void CSelectGroup::InitLayout(TRect aRect) { iRect=aRect; iStartPoint=aRect.iTl; iLineWidth = aRect.Width(); iLineHeight=iMainEngine.ScreenLayout().FontHeight(); iLineHeight+=iLineHeight>>1; iItemSize.iHeight=iLineHeight; iItemSize.iWidth=iLineWidth; iMaxLinePerPage = iMainEngine.ScreenLayout().GetClientRect().Height()/iLineHeight-1; }
void TCacheResource::addRef2(const TRect &rect) { //DIAGNOSTICS_NUMBEREDSTRSET(prefix + QString::number((UINT) this) + " | Stack | ", //"crStack", "addRef", ::traduce(rect)); //Add a reference to all cells intersecting the passed one TPoint initialPos(getCellPos(rect.getP00())); TPoint pos; for (pos.x = initialPos.x; pos.x <= rect.x1; pos.x += latticeStep) for (pos.y = initialPos.y; pos.y <= rect.y1; pos.y += latticeStep) { PointLess cellIndex(getCellIndex(pos)); CellData &cellData = m_cellDatas[cellIndex]; cellData.m_referenced = true; cellData.m_refsCount++; } }
/** @SYMTestCaseID GRAPHICS-UI-BENCH-0151 @SYMPREQ PREQ39 @SYMREQ REQ9236 @SYMREQ REQ9237 @SYMTestCaseDesc Measures the performance of DrawBitmap() for the current screen mode, for various bitmap pixel formats. The bitmap is drawn without scaling. @SYMTestActions Create a copy of the bitmap, and scale to the required size, prior to running the test. For each required source pixel format, use DrawBitmap() to tile a bitmap across the target, avoiding any clipping or overlap. @SYMTestExpectedResults The performance to be logged as a pixel rate, per bitmap. */ void CTBitBltPerfDirectGdi::SimpleDrawBitmapL() { INFO_PRINTF1(_L("CTBitBltPerfDirectGdi::SimpleDrawBitmap")); _LIT(KTestName, "DirectGdiDrawBitmap"); for (TInt source = 0; source < iBitmapImage.Count(); ++source) { // Use a bitmap that needs no scaling. CFbsBitmap* bitmapBitBltImage = CopyIntoNewBitmapL(iBitmapImage[source], iBitmapImage[source]->DisplayMode()); CleanupStack::PushL(bitmapBitBltImage); bitmapBitBltImage->Resize(KCropTo.Size()); BitBltBitmapTestL(EDrawBitmap, bitmapBitBltImage, NULL, bitmapBitBltImage->SizeInPixels(), KTestName, iContext); CleanupStack::PopAndDestroy(1, bitmapBitBltImage); } }
/** If the display mode of iBitmapInfo is not expected, return EFalse * or render to the back buffer and returns ETrue */ TBool CCommonInterfaces::DrawColor(const TRect& aRect,const TRgb& aColour) { TRect local = TRect(aRect.iTl-iRect.iTl, aRect.Size()); TUint16* pBuffer16; TUint32* pBuffer32; if (iBitmapInfo.iDisplayMode != iDispMode) { return EFalse; } for (TInt y = local.iTl.iY; y < local.iBr.iY; y++) { for (TInt x = local.iTl.iX; x < local.iBr.iX; x++) { switch (iDispMode) { case EColor64K: pBuffer16 = (TUint16*)iBitmapInfo.iAddress; pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color64K(); break; case EColor16M: pBuffer16 = (TUint16*)iBitmapInfo.iAddress; pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color64K(); break; case EColor16MU: pBuffer32 = (TUint32*)iBitmapInfo.iAddress; pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MU(); break; case EColor16MA: pBuffer32 = (TUint32*)iBitmapInfo.iAddress; pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MA(); break; case EColor4K: pBuffer16 = (TUint16*)iBitmapInfo.iAddress; pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color4K(); break; case EColor16MAP: pBuffer32 = (TUint32*)iBitmapInfo.iAddress; pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MAP(); break; default: break; } } } return ETrue; }
void CTcContainer::CreateLabelsL( const TRect& aRect ) { // Create labels CEikLabel* label; TInt primaryFontTotalHeight( FontTotalHeightInPixels( EAknLogicalFontPrimaryFont ) ); TInt secondaryFontTotalHeight( FontTotalHeightInPixels( EAknLogicalFontSecondaryFont ) ); TInt labelBase = KLabelTlY + primaryFontTotalHeight; AknLayoutUtils::SAknLayoutTextMultiline labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontPrimaryFont ); TRect rect( KLabelTlX, KLabelTlY, aRect.Width() - KLabelTlX, KLabelTlY + primaryFontTotalHeight ); label = CreateLabelL( rect, KTestCase ); AknLayoutUtils::LayoutLabel( label, rect, labelLayout ); rect.Move( 0, secondaryFontTotalHeight ); labelBase += secondaryFontTotalHeight; labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontSecondaryFont ); label = CreateLabelL( rect, KNone ); AknLayoutUtils::LayoutLabel( label, rect, labelLayout ); rect.Move( 0, primaryFontTotalHeight ); labelBase += primaryFontTotalHeight; labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontPrimaryFont ); label = CreateLabelL( rect, KRequest ); AknLayoutUtils::LayoutLabel( label, rect, labelLayout ); rect.Move( 0, secondaryFontTotalHeight ); labelBase += secondaryFontTotalHeight; labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontSecondaryFont ); label = CreateLabelL( rect, KNone ); AknLayoutUtils::LayoutLabel( label, rect, labelLayout ); rect.Move( 0, primaryFontTotalHeight ); labelBase += primaryFontTotalHeight; labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontPrimaryFont ); label = CreateLabelL( rect, KStatus ); AknLayoutUtils::LayoutLabel( label, rect, labelLayout ); rect.Move( 0, secondaryFontTotalHeight ); labelBase += secondaryFontTotalHeight; labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontSecondaryFont ); label = CreateLabelL( rect, KNone ); AknLayoutUtils::LayoutLabel( label, rect, labelLayout ); }
/// Move and resize the window so that the window is the same size as the hyperlink /// text. This stops the hyperlink cursor being active when it is not directly over /// the text. If the text is left justified then the window is merely shrunk, but if /// it is centred or right justified then the window will have to be moved as well. // // Suggested by Pål K. Tønder void TUrlLink::PositionWindow() { // Get the current window position TRect rect; GetWindowRect(rect); TWindow* pParent = GetParentO(); if(pParent){ pParent->ScreenToClient(rect.TopLeft()); pParent->ScreenToClient(rect.BottomRight()); } // Get the size of the window text TTmpBuffer<tchar> buffer(MAX_PATH); GetText(buffer, MAX_PATH); TSize size = LinkFont->GetTextExtent(&buffer[0]); // Get the text justification via the window style uint32 style = GetStyle(); //TWindow // Recalc the window size and position based on the text justification if (style & SS_CENTERIMAGE) rect.Inflate(0, -(rect.Height() - size.cy)/2); else rect.bottom = rect.top + size.cy; if (style & SS_CENTER) rect.Inflate( -(rect.Width() - size.cx)/2, 0); else if (style & SS_RIGHT) rect.left = rect.right - size.cx; else // SS_LEFT = 0, so we can't test for it explicitly rect.right = rect.left + size.cx; // Move the window SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); }
void CHuiVg10CanvasGc::DoClearRenderBuffer( CHuiCanvasRenderBuffer& aImage, const TRect & aRect ) { HUIFX_VG_INVARIANT(); const CHuiVg10CanvasRenderBuffer* vg10RenderBuffer = (const CHuiVg10CanvasRenderBuffer*) &aImage; const TInt COLOR_COMPONENTS = 4; VGfloat savedColor[COLOR_COMPONENTS]; vgGetfv(VG_CLEAR_COLOR, COLOR_COMPONENTS, savedColor); VGfloat color[COLOR_COMPONENTS] = { 0.0f, 0.0f, 0.0f, 0.0f }; vgSetfv(VG_CLEAR_COLOR, COLOR_COMPONENTS, color); vgClearImage(vg10RenderBuffer->Image(), aRect.iTl.iX, aRect.iTl.iY, aRect.Size().iWidth, aRect.Size().iHeight); vgSetfv(VG_CLEAR_COLOR, COLOR_COMPONENTS, savedColor); HUIFX_VG_INVARIANT(); }
TInt CEikCapCArray::YPosToLine(const TRect &aRect, TInt aTop, TInt aMiddle, TInt aBottom, TInt aYCoord) { TInt top = aTop; TInt middle = aMiddle; TInt bottom = aBottom; CalcItemIndexes(top, middle, bottom, aRect.Size()); for(int i = top ; i < top+middle; i++) { CEikCaptionedControl *fst = (*this)[i]; if (aYCoord < fst->Rect().iTl.iY) { if (i > 0) return i-1; else return KErrNotFound; } } if (Count() == 0) return -1; TInt ii = top+middle-1; CEikCaptionedControl *last = (*this)[ii]; if ( aYCoord < last->Rect().iBr.iY ) { return ii; } else { if ( ii+1 < Count() ) { return ii+1; } else if ( aYCoord > last->Rect().iBr.iY ) { return KErrNotFound; } else { return ii; } } }
//----------------------------------------------------------------------------- // questa funzione viene chiamata dopo il fill rect delle aree, e colora gli // inchiostri di tipo "autoink" // che confinano con le aree appena fillate con il rect. rbefore e' il rect del // raster prima del rectfill. void fillautoInks(TRasterCM32P &rin, TRect &rect, const TRasterCM32P &rbefore, TPalette *plt) { assert(plt); TRasterCM32P r = rin->extract(rect); assert(r->getSize() == rbefore->getSize()); int i, j; for (i = 0; i < r->getLy(); i++) { TPixelCM32 *pix = r->pixels(i); TPixelCM32 *pixb = rbefore->pixels(i); for (j = 0; j < r->getLx(); j++, pix++, pixb++) { int paint = pix->getPaint(); int tone = pix->getTone(); int ink = pix->getInk(); if (paint != pixb->getPaint() && tone > 0 && tone < 255 && ink != paint && plt->getStyle(ink)->getFlags() != 0) inkFill(rin, TPoint(j, i) + rect.getP00(), paint, 0, NULL, &rect); } } }
void CFontSizeTestControl::Draw(const TRect& aRect) const { CWindowGc& gc = SystemGc(); gc.SetBrushColor(iBackgroundColor); // get the nearest font matching the desired height CFont* font = NULL; TFontSpec fontSpec; fontSpec.iTypeface.iName = KNokiaSeries60Font; fontSpec.iHeight = iFontSize; CWsScreenDevice* screen = CCoeEnv::Static()->ScreenDevice(); ASSERT(screen->GetNearestFontToDesignHeightInPixels(font, fontSpec) == KErrNone); iBidiText->WrapText(aRect.Width() - ESideBearingsAllowance, *font, NULL, EMaximumTextLines); // it's recommended to create the text drawer in the actual draw function XCoeTextDrawer textDrawer(TextDrawer()); textDrawer->SetMargins(iMargin); textDrawer->SetAlignment(TGulAlignment(EHCenterVCenter)); textDrawer->SetTextColor(KRgbBlack); textDrawer->SetLineGapInPixels(EGapBetweenTextLines); textDrawer.SetClipRect(aRect); textDrawer.DrawText(gc, *iBidiText, aRect, *font); // Release font, otherwise there are problems deleting iScreen (still holds references) screen->ReleaseFont(font); // Draw font 1 pixel larger or smaller next time. if (iIncreaseFontSize) { ++iFontSize; } else { if (iFontSize > 1) { --iFontSize; } } }
/** * Draws the left adornment to the graphics context aGc, in the rectangle aRect. The menu pane * flags determines the type of adornment to be drawn. */ EXPORT_C void LafMenuPane::DrawLeftAdornment(const MLafEnv& aLafEnv, const CCoeControl& /*aMenuPane*/, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& aItemAttributes) { // Brush the background of the rect. aGc.SetPenStyle(CGraphicsContext::ENullPen); aGc.DrawRect(aRect); aGc.SetPenStyle(CGraphicsContext::ESolidPen); const TInt itemFlags = aItemAttributes.iFlags; if (itemFlags&EEikMenuItemSymbolOn) { if (itemFlags&EEikMenuItemCheckBox) { TRect rect = aRect; rect.iTl.iY += aItemAttributes.iBaseLine; TBuf<1> buf; buf.Append(TChar(ESymFontTick)); aGc.UseFont(SymbolFont(aLafEnv)); aGc.SetPenStyle(CGraphicsContext::ESolidPen); // as the tick is big, ignore KPreLeftAdornment and steal 1 pixels from left. aGc.DrawText(buf,TPoint(rect.iTl.iX-1, rect.iTl.iY)); aGc.UseFont(NormalFont(aLafEnv)); } else if (itemFlags&KLafMenuItemRadio) { TUid bmpUid(TUid::Uid(KLafUidEikonOptiVal)); const CFbsBitmap* bitmap = aLafEnv.Bitmap(bmpUid); TSize bitsize = bitmap->SizeInPixels(); TRect butRect(TPoint(0,0), TPoint(bitsize.iWidth,bitsize.iHeight)); TInt yoffset = (aRect.Size().iHeight - bitsize.iHeight) / 2; TInt xoffset = KLafPreLeftAdornmentSpace; TPoint offset(xoffset,yoffset); if (aItemAttributes.iHighlightType == SLafMenuPane::EDrawHighlight) { bmpUid=TUid::Uid(KLafUidEikonOptihVal); bitmap = aLafEnv.Bitmap(bmpUid); } bmpUid=TUid::Uid(KLafUidEikonOptimVal); const CFbsBitmap* mask = aLafEnv.Bitmap(bmpUid); aGc.BitBltMasked((aRect.iTl+offset), bitmap, butRect, mask,ETrue); } } }
EXPORT_C void DrawUtils::DrawText(CGraphicsContext& aGc,const TDesC& aString,const TRect& aBox,TInt aBaseLineOffset, CGraphicsContext::TTextAlign aHoriz,TInt aMargin,const CFont* aFont) /** Draws text inside a rectangle. @param aGc The graphics context. @param aString The text string to draw. @param aBox The rectangle to draw the text in. @param aBaseLineOffset An offset from the top of the box to the text baseline. @param aHoriz The horizontal text alignment. @param aMargin The margin around the text. @param aFont The font to use. */ { // static if (aHoriz!=CGraphicsContext::ELeft) { const TInt extraWidth=aBox.Width()-aFont->TextWidthInPixels(aString)-aMargin; if (aHoriz==CGraphicsContext::ECenter) aMargin+=extraWidth/2; else aMargin=extraWidth; } aGc.DrawText(aString,aBox,aBaseLineOffset,CGraphicsContext::ELeft,aMargin); }
// --------------------------------------------------------------------------- // CFepUiLayoutRootCtrl::IsValidDestination // Test whether the rect conflicts with other controls // (other items were commented in a header). // --------------------------------------------------------------------------- // TBool CFepUiLayoutRootCtrl::IsValidDestination(const TRect& aRect, CDragBar* aDragBar, TBool& aVInfo, TBool& aHInfo) { aVInfo = EFalse; aHInfo = EFalse; if(!Rect().Contains(aRect.iTl) || !Rect().Contains(aRect.iBr)) //outside of the ui layout return EFalse; CFepUiBaseCtrl* ctrl; for(TInt i = iCtrlList.Count()-1; i >= 0;i--) { ctrl = iCtrlList[i]; TBool bIsDragingComponent = EFalse; if(aDragBar) { if(aDragBar->IsDraggingComponent(ctrl)) bIsDragingComponent = ETrue; } if(!bIsDragingComponent && aRect.Intersects(ctrl->Rect())) //conflicts with others { //is the control one of the dragbar component. if(!ctrl->AllowOverlap()) { //if the control not allow overlapping, then it's invalid pos return EFalse; } } } return ETrue; }
void TChain::get_image(cv::Mat& mat, const TRect& grid, unsigned int dim1, unsigned int dim2, bool norm, double sigma1, double sigma2, double nsigma) const { assert((dim1 >= 0) && (dim1 < N) && (dim2 >= 0) && (dim2 < N) && (dim1 != dim2)); mat = cv::Mat::zeros(grid.N_bins[0], grid.N_bins[1], CV_64F); //std::cout << grid.N_bins[0] << " " << grid.N_bins[1] << std::endl; unsigned int i1, i2; for(size_t i=0; i<length; i++) { if(grid.get_index(x[N*i+dim1], x[N*i+dim2], i1, i2)) { mat.at<double>(i1, i2) += w[i]; //std::cerr << mat.at<double>(i1, i2) << std::endl; } } if(norm) { mat /= total_weight; } if((sigma1 >= 0.) && (sigma2 >= 0.)) { double s1 = sigma1 / grid.dx[0]; double s2 = sigma2 / grid.dx[1]; //std::cout << std::endl; //std::cout << dim1 << " " << dim2 << std::endl; //std::cout << "dx = " << sigma1 << " / " << grid.dx[0] << " = " << s1 << std::endl; //std::cout << "dy = " << sigma2 << " / " << grid.dx[1] << " = " << s2 << std::endl; //std::cout << std::endl; int w1 = 2 * ceil(nsigma*s1) + 1; int w2 = 2 * ceil(nsigma*s2) + 1; cv::GaussianBlur(mat, mat, cv::Size(w2,w1), s2, s1, cv::BORDER_REPLICATE); } // Convert to float mat.convertTo(mat, CV_32F); }
// ----------------------------------------------------------------------------- // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CPixelMetricsMapperViewContainer::ConstructL( const TRect& aRect ) { CreateWindowL(); SetCanDrawOutsideRect(); iTexts = new( ELeave ) CDesCArrayFlat( 10 ); iTexts->AppendL( _L( "\tStarted." ) ); iListbox = new( ELeave ) CAknSingleStyleListBox; iListbox->SetContainerWindowL( *this ); iListbox->ConstructL( this, EAknListBoxViewerFlags ); iListbox->Model()->SetItemTextArray( iTexts ); iListbox->SetRect( TRect( aRect.Size() ) ); iListbox->CreateScrollBarFrameL( ETrue ); iListbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOn, CEikScrollBarFrame::EOn ); SetRect( aRect ); iListbox->ActivateL(); ActivateL(); }
// --------------------------------------------------------------------------- // CAppMngr2ListContainer::ConstructL() // --------------------------------------------------------------------------- // void CAppMngr2ListContainer::ConstructL( const TRect& aRect ) { CreateWindowL(); SetRect( aRect ); iListBox = new (ELeave) CAknDoubleLargeStyleListBox; iListBox->SetContainerWindowL( *this ); iListBox->ConstructL( this, EAknListBoxSelectionList ); iListBox->SetListBoxObserver( this ); // Dont display default "(no data)" empty text iListBox->View()->SetListEmptyTextL( KNullDesC ); LoadIconsL(); CreateItemArrayL(); PopulateItemArrayL(); iListBox->CreateScrollBarFrameL(); iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); iListBox->SetRect( aRect.Size() ); // Enable marquee effect iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); }
TBool CDataWrapperBase::GetRectFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRect& aResult) { TBuf<KMaxTestExecuteCommandLength> tempStore; TInt top; tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectTop); TBool ret=GetIntFromConfig(aSectName, tempStore, top); TInt left; tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectLeft); if ( !GetIntFromConfig(aSectName, tempStore, left) ) { ret=EFalse; } TInt bottom; tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectBottom); if ( !GetIntFromConfig(aSectName, tempStore, bottom) ) { ret=EFalse; } TInt right; tempStore.Format(KFormatEntryField, &aKeyName, &KTagRectRight); if ( !GetIntFromConfig(aSectName, tempStore, right) ) { ret=EFalse; } if ( ret ) { aResult.SetRect(left, top, right, bottom); } return ret; }
/** * Sets a clipping rectangle for hiding the whole or a part of edwin's text. * * The reason for using this function is the multiline edwins. The text inside * an edwin can be broken to two or more lines, which must be hidden or shown * independently from each other. That is why it is not enough just to move * the whole edwin out of the screen. * * @param aClipRect The clipping rect for edwin's text. An empty rect disables * hiding. * * @return How many subcontrols were hidden */ static TInt HideLines_Edwin(CEikEdwin *aEdwin, TRect aClipRect) { aEdwin->SetTextLinesRect(aClipRect); // Create rects of the first and last edwin lines TPoint edwinTl( aEdwin->Rect().iTl ); TPoint edwinBr( aEdwin->Rect().iBr ); TRect textFirstLine; aEdwin->TextLayout()->GetLineRect(edwinTl.iY, textFirstLine); textFirstLine.Move( edwinTl.iX, edwinTl.iY + aEdwin->Margins().iTop ); TRect textLastLine; aEdwin->TextLayout()->GetLineRect(edwinBr.iY, textLastLine); textLastLine.Move( edwinBr.iX, edwinBr.iY - aEdwin->Margins().iTop - textLastLine.Height() ); // Check if at least one line fits to the clipping rect if( aClipRect.Contains(textFirstLine.iTl) && aClipRect.iBr.iY >= textFirstLine.iBr.iY ) // The first line fits return 0; if( aClipRect.Contains(textLastLine.iTl) && aClipRect.iBr.iY >= textLastLine.iBr.iY ) // The last line fits return 0; return 1; }
// --------------------------------------------------------------------------- // From class CAknTreeItem. // Draws the simple data row to the appointed graphics context. // --------------------------------------------------------------------------- // void CAknSingleColumnStyleSimpleDataRow::Draw( CWindowGc& aGc, const TRect& aItemRect, const TRect& /*aRect*/, TBool aFocused ) const { CAknTree* root = Root(); __ASSERT_DEBUG( root, User::Invariant() ); // Icon. TInt iconVariety = IsMarked() ? 1 : 0; TRect iconRect = RectFromLayout( aItemRect, AknLayoutScalable_Avkon:: list_single_2heading_msg_pane_g1( iconVariety ) ); TInt iconId = IconId( aFocused ); if ( iIcon != AknTreeListIconID::KNone ) { root->DrawIcon( iconId, iconRect.Size(), aGc, iconRect.iTl, iconRect.Size() ); } // Optional icon ID. TInt optIconId = OptionalIconId( aFocused ); // Text. TAknLayoutText layoutText; TInt textVariety = ( optIconId == KNone ) ? 0 : 1; layoutText.LayoutText( aItemRect, AknLayoutScalable_Avkon:: list_single_2heading_msg_pane_t1( textVariety ).LayoutLine() ); root->DrawText( aGc, aItemRect, AknLayoutScalable_Avkon:: list_single_2heading_msg_pane_t1( textVariety ), *iText, NULL, this, aFocused, ETrue ); // Optional indication icon. TInt optIconVariety = 0; // Marked folder. TRect optIconRect = RectFromLayout( aItemRect, AknLayoutScalable_Avkon:: list_single_2heading_msg_pane_g2( optIconVariety ) ); if ( optIconId != KNone ) { root->DrawIcon( optIconId, optIconRect.Size(), aGc, optIconRect.iTl, optIconRect.Size() ); } }
void MainL() { RWsSession ws; ws.Connect(); CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws); scr->Construct(); CWindowGc* gc = new(ELeave) CWindowGc(scr); gc->Construct(); RWindowGroup grp(ws); grp.Construct(0xc0decafe, ETrue); RWindow win(ws); win.Construct(grp, 0xbeefcafe); win.SetExtent(TPoint(20,160), TSize(320,240)); win.Activate(); win.Invalidate(); win.BeginRedraw(); gc->Activate(win); gc->SetPenStyle(CGraphicsContext::ENullPen); gc->SetBrushStyle(CGraphicsContext::ESolidBrush); TBool color = EFalse; if (Profiler::Start() == KErrNotFound) { _LIT(KProfiler,"profiler"); _LIT(KStart,"start -noui -drive=S"); RProcess p; if (p.Create(KProfiler,KStart) == KErrNone) { p.Resume(); p.Close(); } } for (TInt col=0; col<KCol; ++col) { color = !color; for (TInt row=0; row<KRow; ++row) { TRect rect; rect.iTl.iX = col * KSize.iWidth; rect.iTl.iY = row * KSize.iHeight; rect.SetSize(KSize); color = !color; gc->SetBrushColor(color? KRgbBlue : KRgbBlack); gc->DrawRect(rect); } } gc->Deactivate(); win.EndRedraw(); ws.Flush(); User::After(3000000); win.Close(); grp.Close(); delete gc; delete scr; ws.Close(); Profiler::Stop(); Profiler::Close(); Profiler::Unload(); }
void TFieldDlg::setupDialog() { TObjDlg::setupDialog(); TRect rlCopy; TRect rcCopy; TRect rl( 2, 5, 12, 6 ); TRect rc = rl; rc.move( 10, 0 ); rc.b.x = rc.a.x + 6; rc.a.x++; insert( length = new TNNumericInputLine( rc, 3 ) ); insert( lengthLabel = new TLabel( rl, "L„nge", length ) ); rc.a.x--; rc.move( 0, 1 ); rl.move( 0, 1 ); insert( offset = new TNNumericInputLine( rc, 4 ) ); insert( offsetLabel = new TLabel( rl, "Offset", offset ) ); rcCopy = rc; rlCopy = rl; rc.move( 10, -1 ); rc.b.x = rc.a.x + 15; insert( dumpable = new TNCheckBoxes( rc, new TSItem( "Unbenutzt", 0 ) ) ); rl.move( 0, 2 ); rl.b.x = rl.a.x + 20; rc = rl; rc.move( 1, 1 ); rc.b.x = rc.a.x + 18; rc.b.y++; insert( posSel = new TNRadioButtons( rc, new TSItem( "Automatisch", new TSItem( "Benutzerwahl", 0 )) ) ); insert( posSelLabel = new TLabel( rl, "Positionsauswahl", posSel ) ); rcCopy.move( 22, 3 ); rlCopy.move( 22, 3 ); insert( track = new TNNumericInputLine( rcCopy, 4 ) ); insert( trackLabel = new TLabel( rlCopy, "Spur", track ) ); rcCopy.move( 0, 1 ); rlCopy.move( 0, 1 ); insert( pos = new TNNumericInputLine( rcCopy, 4 ) ); insert( posLabel = new TLabel( rlCopy, "Position", pos ) ); rc.move( 0, 4 ); rc.b.y++; rc.b.x = rc.a.x + 25; rl.move( 0, 4 ); insert( restr = new TNRadioButtons( rc, new TSItem( "keine", new TSItem( "Magnetspuren", new TSItem( "Anzeige-/Magnetspur", 0 ))) ) ); insert( restrLabel = new TLabel( rl, "Einschr„nkung", restr ) ); }
//////////////////////////////////////////////////////////// // TBitmap256Control // ----------------- // Adjust window size occording to zoom factor, bitmap size // and bitmap offset void TBitmap256Control::AdjustWindowSize () { // Removed 'static' for the 4 vars. below, because Win95 allow // the user to change system metrics when he wants... int SBWidth = 0 ; int SBHeight = 0 ; int CXBorder = 0; int CYBorder = 0; int BitmapZoomXSize, BitmapZoomYSize; BOOL HasVScroll, HasHScroll; int BorderWidth, BorderHeight; int wWidth, wHeight; int xRange, yRange; // Get width of vertical and height of horizontal scroll bars if ( SBWidth == 0 ) { SBWidth = GetSystemMetrics (SM_CXVSCROLL); SBHeight = GetSystemMetrics (SM_CYHSCROLL); CXBorder = GetSystemMetrics (SM_CXBORDER); CYBorder = GetSystemMetrics (SM_CYBORDER); } // If no bitmap if ( pDIBInfo == NULL ) { // Reset Window size to maximum orignal size Scroller->SetRange(0, 0); SetWindowPos (NULL, 0, 0, MaxWidth + 2 * CXBorder, MaxHeight + 2 * CYBorder, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); return ; } // Calc. the maximum bitmap size BitmapZoomXSize = BitmapXSize * ZoomFactor; BitmapZoomYSize = BitmapYSize * ZoomFactor; // The window will have Scroll bars ? if ( BitmapZoomXSize > MaxWidth ) HasHScroll = TRUE; else HasHScroll = FALSE; if ( BitmapZoomYSize > MaxHeight ) HasVScroll = TRUE; else HasVScroll = FALSE; // Calc. window width and height BorderWidth = HasVScroll ? SBWidth + CXBorder : CXBorder * 2; BorderHeight = HasHScroll ? SBHeight + CYBorder : CYBorder * 2; // Calc. client area width wWidth = BitmapZoomXSize + BorderWidth > MaxWidth ? ((MaxWidth - BorderWidth) / ZoomFactor) * ZoomFactor: BitmapZoomXSize; xRange = max ((BitmapZoomXSize - wWidth) / ZoomFactor, 0); // Calc. client area height wHeight = BitmapZoomYSize + BorderHeight > MaxHeight ? ((MaxHeight - BorderHeight) / ZoomFactor) * ZoomFactor: BitmapZoomYSize; yRange = max ((BitmapZoomYSize - wHeight) / ZoomFactor, 0); // Set window size TRect cRect = GetWindowRect(); if ( cRect.Width() != wWidth || cRect.Height() != wHeight ) { SetWindowPos (NULL, 0, 0, wWidth + BorderWidth, wHeight + BorderHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } // // Adjust scroller position and range // // Set scroller units Scroller->SetUnits (ZoomFactor, ZoomFactor); // Calc. scroller position Scroller->XPos = min (Scroller->XPos, xRange); Scroller->YPos = min (Scroller->YPos, yRange); Scroller->SetRange (xRange, yRange); }
//////////////////////////////////////////////////////////// // TBitmap256Control // ----------------- // Display bitmap in DC void TBitmap256Control::DisplayBitmap (TDC& dc, TRect &rect) { // Display a cross if no bitmap if ( pDIBInfo == 0 ) { dc.SelectObject(TPen(TColor::LtGray)); dc.MoveTo (0, 0); dc.LineTo (MaxWidth, MaxHeight); dc.MoveTo (0, MaxHeight); dc.LineTo (MaxWidth, 0); dc.SetTextAlign(TA_CENTER); dc.SetTextColor(TColor::White); dc.SetBkColor(TColor::Black); char tmp[40]; if ( BitmapName[0] != '\0' && BitmapName[0] != '-' ) wsprintf (tmp, "No picture (%s)", BitmapName); else wsprintf (tmp, "No picture"); dc.TextOut (MaxWidth / 2, MaxHeight / 2 - 6, tmp); return; } assert (pBitmapPalette != NULL); // pBitmapPalette->UnrealizeObject(); dc.SelectObject (*pBitmapPalette); dc.RealizePalette(); dc.SetStretchBltMode (COLORONCOLOR); #if 1 TRect ZoomRect; ZoomRect.left = rect.left; ZoomRect.top = rect.top; ZoomRect.right = rect.right; ZoomRect.bottom = rect.bottom; // Convert the rect. size to a rect in the sprite rect.left /= ZoomFactor; rect.top /= ZoomFactor; rect.right /= ZoomFactor; rect.bottom /= ZoomFactor; TRect DIBRect; DIBRect.left = rect.left; DIBRect.top = BitmapYSize - rect.bottom; // DIBs are Y inversed DIBRect.right = DIBRect.left + rect.Width(); DIBRect.bottom = DIBRect.top + rect.Height(); dc.StretchDIBits (ZoomRect, DIBRect, pDIBits, *pDIBInfo, DIB_PAL_COLORS, SRCCOPY); #else // Create memory DC and display bitmap TMemoryDC mdc (dc); mdc.SelectObject (*pBitmapPalette); mdc.SelectObject (*pBitmap); dc.StretchBlt(0, 0, ZoomXSize, ZoomYSize, mdc, 0, 0, BitmapXSize, BitmapYSize, SRCCOPY); // Restore GDI objects mdc.RestoreBitmap(); mdc.RestorePalette(); #endif dc.RestorePalette(); }
void AreaFiller::rectFill(const TRect &rect, int color, bool onlyUnfilled, bool fillPaints, bool fillInks) { // Viene trattato il caso fillInks /*- FillInkのみの場合 -*/ if (!fillPaints) { assert(fillInks); assert(m_ras->getBounds().contains(rect)); for (int y = rect.y0; y <= rect.y1; y++) { TPixelCM32 *pix = m_ras->pixels(y) + rect.x0; for (int x = rect.x0; x <= rect.x1; x++, pix++) pix->setInk(color); } return; } TRect r = m_bounds * rect; int dx = r.x1 - r.x0; int dy = (r.y1 - r.y0) * m_wrap; if (dx < 2 || dy < 2) // rect degenere(area contenuta nulla), skippo. return; std::vector<int> frameSeed(2 * (r.getLx() + r.getLy() - 2)); int x, y, count1, count2; /*- ptrをRect範囲のスタート地点に移動 -*/ Pixel *ptr = m_pixels + r.y0 * m_wrap + r.x0; count1 = 0; count2 = r.y1 - r.y0 + 1; // Se il rettangolo non contiene il bordo del raster e se tutti i pixels // contenuti nel rettangolo sono pure paint non deve fare nulla! if (!rect.contains(m_bounds) && areRectPixelsPurePaint(m_pixels, r, m_wrap)) return; // Viene riempito frameSeed con tutti i paint delle varie aree del rettangolo // di contorno. // Viene verificato se i pixels del rettangolo sono tutti pure paint. /*- 輪郭のPaintのIDをframeseed内に格納 -*/ for (y = r.y0; y <= r.y1; y++, ptr += m_wrap, count1++, count2++) { if (r.x0 > 0) frameSeed[count1] = ptr->getPaint(); if (r.x1 < m_ras->getLx() - 1) frameSeed[count2] = (ptr + dx)->getPaint(); } ptr = m_pixels + r.y0 * m_wrap + r.x0 + 1; count1 = count2; count2 = count1 + r.x1 - r.x0 - 1; for (x = r.x0 + 1; x < r.x1; x++, ptr++, count1++, count2++) { if (r.y0 > 0) frameSeed[count1] = ptr->getPaint(); if (r.y1 < m_ras->getLy() - 1) frameSeed[count2] = (ptr + dy)->getPaint(); } assert(count2 == 2 * (r.getLx() + r.getLy() - 2)); // Viene fillato l'interno e il bordo del rettangolo rect con color Pixel *pix = m_pixels + r.y0 * m_wrap + r.x0; if (onlyUnfilled) for (y = r.y0; y <= r.y1; y++, pix += m_wrap - dx - 1) { for (x = r.x0; x <= r.x1; x++, pix++) { if (pix->getPaint() == 0) // BackgroundStyle pix->setPaint(color); if (fillInks) pix->setInk(color); } } else for (y = r.y0; y <= r.y1; y++, pix += m_wrap - dx - 1) { for (x = r.x0; x <= r.x1; x++, pix++) { pix->setPaint(color); if (fillInks) pix->setInk(color); } } // Vengono fillati i pixel del rettangolo con i paint (mantenuti in frameSeed) // che // c'erano prima di fillare l'intero rettangolo, in questo modo si riportano // al colore originale le aree che non sono chiuse e non dovevano essere // fillate. count1 = 0; FillParameters params; // in order to make the paint to protlude behind the line params.m_prevailing = false; if (r.x0 > 0) for (y = r.y0; y <= r.y1; y++) { params.m_p = TPoint(r.x0, y); params.m_styleId = frameSeed[count1++]; fill(m_ras, params); } else count1 += r.y1 - r.y0 + 1; if (r.x1 < m_ras->getLx() - 1) for (y = r.y0; y <= r.y1; y++) { params.m_p = TPoint(r.x1, y); params.m_styleId = frameSeed[count1++]; fill(m_ras, params); } else count1 += r.y1 - r.y0 + 1; if (r.y0 > 0) for (x = r.x0 + 1; x < r.x1; x++) { params.m_p = TPoint(x, r.y0); params.m_styleId = frameSeed[count1++]; fill(m_ras, params); } else count1 += r.x1 - r.x0 - 1; if (r.y1 < m_ras->getLy() - 1) for (x = r.x0 + 1; x < r.x1; x++) { params.m_p = TPoint(x, r.y1); params.m_styleId = frameSeed[count1++]; fill(m_ras, params); } }
// /// Paint Text // void TButtonTextGadget::PaintText(TDC& dc, TRect& rect, const tstring& text) { dc.SelectObject(GetFont()); TColor textColor = TColor::SysBtnText; if(!GetEnabled()) textColor = TColor::Sys3dHilight; else if((GetGadgetWindow()->GetFlatStyle()&TGadgetWindow::FlatHotText) && IsHaveMouse()) textColor = TColor::LtBlue; TColor oldTxColor = dc.SetTextColor(textColor); uint format = DT_SINGLELINE|DT_NOCLIP|DT_END_ELLIPSIS; switch(Align){ case aLeft: format |= DT_LEFT; break; case aRight: format |= DT_RIGHT; break; case aCenter: format |= DT_CENTER; break; } switch(LayoutStyle){ case lTextLeft: case lTextRight: format |= DT_VCENTER; break; case lTextTop: format |= DT_VCENTER;//DT_BOTTOM; break; case lTextBottom: format |= DT_VCENTER;//DT_TOP; break; } // Create a UI Face object for this button & let it paint the button face // TPoint dstPt(rect.TopLeft()); if (GetButtonState() == Down && GetEnabled() && GetGadgetWindow()->GetFlatStyle()&TGadgetWindow::FlatStandard) { if(IsHaveMouse()) { if(IsPressed()) { const int dx = (format & DT_CENTER) ? 2 : 1; const int dy = (format & DT_VCENTER) ? 2 : 1; rect.Offset(dx, dy); } TUIFace(rect, text, TColor::Sys3dFace,format).Paint(dc, dstPt, TUIFace::Normal, true, true); } else { TUIFace face(rect, text, TColor::Sys3dFace,format); if(GetGadgetWindow()->GadgetGetCaptured()==this) face.Paint(dc, dstPt, TUIFace::Normal, true); else face.Paint(dc, dstPt, TUIFace::Down, IsPressed(), false); } } else { TUIFace face(rect, text, TColor::Sys3dFace,format); if (!GetEnabled()) face.Paint(dc, dstPt, TUIFace::Disabled, false, false); else if (GetButtonState() == Indeterminate) face.Paint(dc, dstPt, TUIFace::Indeterm, IsPressed(), false); else if (GetButtonState() == Down) // Down and not flat face.Paint(dc, dstPt, TUIFace::Down, IsPressed(), false); else face.Paint(dc, dstPt, TUIFace::Normal, IsPressed(), false); } dc.SetTextColor(oldTxColor); dc.RestoreFont(); }
// /// This routine is invoked to request the printout object to print a page. // void TRichEditPrintout::PrintPage (int page, TRect& bandRect, uint) { PRECONDITION(page > 0); PRECONDITION(page <= PageCount); // Check control's handle is !0 // PRECONDITION(HWND(RichEdit)); // These should have been set via a prior call to 'SetPrintParams' // PRECONDITION(FmtRange.hdcTarget !=0); PRECONDITION(FmtRange.hdc != 0); // Check whether we're in 'real' printing mode or just print preview. // In print preview mode the target does not match the render DC..... // if (FmtRange.hdc != FmtRange.hdcTarget) { int saveId = SaveDC(FmtRange.hdc); if (FmtRange.hdc) { TDC dc(FmtRange.hdc); // Make window DC match target's logical size // dc.SetMapMode(MM_ANISOTROPIC); dc.SetWindowExt(TSize(MulDiv(SizePhysPage.cx, dc.GetDeviceCaps(LOGPIXELSX), SizePhysInch.cx), MulDiv(SizePhysPage.cy, dc.GetDeviceCaps(LOGPIXELSY), SizePhysInch.cy))); dc.SetViewportExt(TSize(bandRect.Width(), bandRect.Height())); // Update character range for specified page // FmtRange.SetRange(PageIndices[page-1], PageIndices[page]); // Have Edit control draw into window // RichEdit.FormatRange(FmtRange); // Flag that we need to reset control // FlushCache = true; } // Restore the DC // RestoreDC(FmtRange.hdc, saveId); } else { // We're really printing! Update character range for specified page // FmtRange.SetRange(PageIndices[page-1], PageIndices[page]); // Have Edit control format data // RichEdit.FormatRange(FmtRange, false); // Flag that we need to reset control // FlushCache = true; // Have Edit control display to render rectangle of device // RichEdit.DisplayBand(*((TRect*)&FmtRange.rc)); } }
/* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ void CMailBoxContainer::ConstructL(const TRect& aRect) { CreateWindowL(); iUtils.GetFileUtils().GetCurrentPath(iCurrPath); iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,TRect(0,0,aRect.Width(),aRect.Height()), ETrue); iBgContext->SetParentPos(aRect.iTl); SetRect(aRect); ActivateL(); SetMenuL(); CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane(); if(sp) { if(sp->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL)//R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE) { sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); } } iSession = CMsvSession::OpenSyncL(*this); iCurrentFolder = 0; GetFoldersL(); MakeNavipanelL(); if(iFolderArray.Count() <= iCurrentFolder) { iCurrentFolder = 0; } if(iCurrentFolder < iFolderArray.Count()) { if(iFolderArray[iCurrentFolder]) { ReadMailFolderL(iFolderArray[iCurrentFolder]->iMscId); } } }
void CRecognizerContainer::ShowCodes(const TRect& aDrawRect, const TSize& aBmpSize) const { CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("ShowCodes")); RPointerArray<CCodeInfo>* Codes=0; TInt CurrentCode; bool draw_rect=true; if (!iVCS || iVCS->GetCodes() == NULL || iVCS->GetCodes()->Count()==0 || iInvalid) { if (!iCurrentCodeInfo) return; iCurrentCodeArray->Reset(); User::LeaveIfError(iCurrentCodeArray->Append(iCurrentCodeInfo)); Codes=iCurrentCodeArray; CurrentCode=0; if (iVCS || iInvalid) draw_rect=false; } else { Codes=iVCS->GetCodes(); CurrentCode=iCurrentCode; } TInt xd = aDrawRect.iTl.iX; TInt yd = aDrawRect.iTl.iY; TInt hd = aDrawRect.Height(); TInt wd = aDrawRect.Width(); TInt hi = aBmpSize.iHeight; TInt wi = aBmpSize.iWidth; CWindowGc& gc = SystemGc(); gc.SetPenStyle(CGraphicsContext::ESolidPen); TInt n = Codes->Count(); // draw frames around the codes if (draw_rect) { for (TInt i = 0; i < n; i++) { CCodeInfo* ci = (*Codes)[i]; gc.SetPenColor(ci->IsCodeValid() ? KRgbYellow : KRgbRed); gc.SetPenSize(i != CurrentCode ? TSize(1,1) : TSize(2,2)); TPoint rb = ci->GetImageCoordinates(TPoint(10,10)); gc.DrawLine(TPoint(xd + rb.iX*wd/wi, yd + rb.iY*hd/hi), TPoint(xd + ci->x2*wd/wi, yd + ci->y2*hd/hi)); gc.DrawLine(TPoint(xd + rb.iX*wd/wi, yd + rb.iY*hd/hi), TPoint(xd + ci->x4*wd/wi, yd + ci->y4*hd/hi)); gc.DrawLine(TPoint(xd + ci->x1*wd/wi, yd + ci->y1*hd/hi), TPoint(xd + ci->x2*wd/wi, yd + ci->y2*hd/hi)); gc.DrawLine(TPoint(xd + ci->x4*wd/wi, yd + ci->y4*hd/hi), TPoint(xd + ci->x1*wd/wi, yd + ci->y1*hd/hi)); } } gc.SetPenSize(TSize(1,1)); // display value of current code if (CurrentCode >= 0 && CurrentCode < Codes->Count()) { CCodeInfo* ci = (*Codes)[CurrentCode]; TBuf<64> info; // code value ci->code->AppendToString(info); gc.SetPenColor(KRgbYellow); gc.SetBrushStyle(CGraphicsContext::ENullBrush); const CFont* fontUsed = iEikonEnv->DenseFont(); gc.UseFont(fontUsed); TInt baseline = aDrawRect.Height() - 2 * fontUsed->AscentInPixels(); info.Copy(*iScreenMsgBuf); gc.DrawText(info, aDrawRect, baseline, CGraphicsContext::ECenter); } }
void CFiletransferContainer::UpdateDimensions(const TRect& aRect) { iRect=aRect; iWidth=aRect.Width(); iMargin=iWidth/KMarginRatio; iVerticalDistance=aRect.Height()/7; if(iVerticalDistance>50) iVerticalDistance=50; iRound=iVerticalDistance/5; //was 3 before iHorizontalDistance=iWidth-iMargin-iMargin; iVD4=iVerticalDistance*4; iVD5=iVerticalDistance*5; iFill.Create(TSize(1,iVerticalDistance),EColor16MU); TBitmapUtil bu(&iFill); bu.Begin(TPoint(0,0)); TInt i; for(i=0;i<iVerticalDistance;i++) { bu.SetPixel(0x00FF00-0x500*i); bu.IncYPos(); }; //rectangles TInt totHrz=iMargin; TReal hrz=0; TRect *rect; iRects.ResetAndDestroy(); //we will append new elements //compute the distance between rectangles TInt averageRectangleLength=iHorizontalDistance/iFiletransferView->iTotalFilesNo; if(averageRectangleLength<5) { //we should have a single rectangle, and not one rectangle for each file //iRects.Count() will be one, but iDistanceBetweenRectangles is negative iDistanceBetweenRectangles=-1; // rect=new(ELeave) TRect(totHrz,iVD4,totHrz+iHorizontalDistance,iVD5); iRects.Append(rect); } else { iDistanceBetweenRectangles=2; //this is what we will use if there are not so many rectangles if(averageRectangleLength<20)iDistanceBetweenRectangles=1; if(averageRectangleLength<10)iDistanceBetweenRectangles=0; TInt remainingBytes=iFiletransferView->iTotalBytes2Transfer; TInt remainingHorizontalDistance=iHorizontalDistance; for(i=0;i<iFiletransferView->iTotalFilesNo;i++) { totHrz+=(TInt)hrz;//hrz was computed in the last cycle //hrz=iFiletransferView->iFileSizes[i]/(TReal)iFiletransferView->iTotalBytes2Transfer*iHorizontalDistance; hrz=iFiletransferView->iFileSizes[i]/(TReal)remainingBytes*remainingHorizontalDistance; remainingBytes-=iFiletransferView->iFileSizes[i]; remainingHorizontalDistance-=(TInt)hrz; rect=new(ELeave) TRect(totHrz,iVD4,totHrz+(TInt)hrz-iDistanceBetweenRectangles,iVD5); iRects.Append(rect); }; } }
TInt CFiletransferContainer::MoveLabel(TAny *aInstance ) { CFiletransferContainer *self = (CFiletransferContainer*)aInstance; TRect rect = self->Rect(); TInt screenSize=rect.Width(); //self->iFiletransferView->UpdateData(10000); // for debug only if( self->iFileDetailsLabels.Count() < 2) return 1; //if we are here, we make the label move.... TSize labelSize = self->iFileDetailsLabels[1]->MinimumSize(); if(labelSize.iWidth >= screenSize) { //if we are here, we have to move the label TChar first=self->iLabelTextFilename[0]; self->iLabelTextFilename.Delete(0,1); self->iLabelTextFilename.Append(first); self->iFileDetailsLabels[1]->SetTextL(self->iLabelTextFilename); }; self->iTick++; if(self->iTick>=4) { self->iTick=0; self->iFiletransferView->UpdateAllData(); self->UpdateLabelsL(); self->SizeChanged(); if(self->iBytesLastTime==self->iFiletransferView->iTotalBytesTransfered) self->iTimesSame++; else self->iTimesSame=0; if(self->iTimesSame==5) { //we have a problem. Seems the sending/receiving is blocked //CCommSender::GetInstance()->iSocket->CancelAll(); LOG0("FileTransfer::MoveLabel: No bytes transfered since last time (%d)",self->iBytesLastTime); if(self->iFiletransferView->iDirection==CFiletransferView::EDirectionSending) { //sender CCommSender::GetInstanceL()->CancelTransferTimeout(); } else { //receiver CCommReceiver::GetInstanceL()->CancelTransferTimeout(); }; }; self->iBytesLastTime=self->iFiletransferView->iTotalBytesTransfered; LOG(ELogBT,0,"BytesLastTime updated (%d)",self->iBytesLastTime); }; self->DrawNow(); return 1; }