/********************************************************************* Fetch page in mem and return all records **********************************************************************/ void TDataAppend::GetPage(int pageNum, int &numRecs, RecId &startRid, void **&recs, Boolean isPrefetch){ if (pageNum < 1 || pageNum > NumPages()){ fprintf(stderr, "TDataAppend::GetPage: invalid page number %d\n", pageNum); Exit::DoExit(1); } BufPage *bpage = _pfile->GetPage(pageNum, isPrefetch); RecId firstRid = MakeRecId(pageNum, 0); numRecs = MIN(RecordsPerPage(), (int)(_header.numRecs - firstRid)); RecId lastRid = firstRid+numRecs-1; /* set return params */ startRid = firstRid; int i; char *ptr = (char *)bpage->PageData(); for (i=0; i < numRecs; i++){ _returnRecs[i] = ptr; ptr += _header.recSize; } recs = _returnRecs; _lastGetPageNum = pageNum; _lastGetPageBuf = bpage; }
//+++-S-cf------------------------------------------------------------------- // NAME: IncPage() // DESC: Increment page number // PARAMETERS: None // RETURN: None //----------------------------------------------------------------------E-+++ void wxLegend::IncPage() { int iDatas = GetCount(); int iPages = NumPages(); if ( iPages * ROWS_PAGE != iDatas ) iPages += 1; if ( m_Page + 1 < iPages ) m_Page += 1; }
//+++-S-cf------------------------------------------------------------------- // NAME: Draw() // DESC: Draw legend // PARAMETERS: CHART_HPAINT hp, // CHART_HRECT hr // RETURN: None //----------------------------------------------------------------------E-+++ void wxLegend::Draw( CHART_HPAINT hp, CHART_HRECT hr ) { int iPages = NumPages(); int iLines = iPages > 0 ? ROWS_PAGE : GetCount(); wxCoord h; //h = (ROWS_PAGE * ROW_SIZE < hr->h) ? ROWS_PAGE * ROW_SIZE : hr->h; h = (iLines * ROW_SIZE < hr->h) ? iLines * ROW_SIZE : hr->h; wxCoord x, y; x = (wxCoord)( 5 + hr->x ); y = (wxCoord)( 5 + hr->y ); //----------------------------------------------------------------------- // draw arrows //----------------------------------------------------------------------- if ( iPages > 0 ) { hp->SetBrush( *wxGREY_BRUSH ); hp->SetPen( *wxBLACK_PEN ); DrawArrow( hp, x+hr->w/2, y, 8, ARROW_UP, false ); hp->DrawLine( x+15, y+10, x+hr->w-15, y+10); DrawArrow( hp, x+hr->w/2, y + 20, 8, ARROW_DOWN, false ); } //----------------------------------------------------------------------- // draw shadow //----------------------------------------------------------------------- y += 30; hp->SetBrush( *wxGREY_BRUSH ); hp->SetPen( *wxTRANSPARENT_PEN ); hp->DrawRectangle( x +5, y +5, hr->w - 10, h ); //----------------------------------------------------------------------- // draw legend window //----------------------------------------------------------------------- hp->SetBrush( *wxWHITE_BRUSH ); hp->SetPen( *wxBLACK_PEN ); hp->DrawRectangle( x, y, hr->w - 10, h ); //----------------------------------------------------------------------- // write labels //----------------------------------------------------------------------- WriteLabel( hp, x+3, y+3, m_Page ); }
const TSharedPtr< FTokenizedMessage > FMessageLogListingModel::GetMessageFromData( const FTokenizedMiscData& MessageData ) const { // Go through all the messages looking for a data match for(uint32 PageIndex = 0; PageIndex < NumPages(); PageIndex++) { for( MessageContainer::TConstIterator It( GetMessageIterator(PageIndex) ); It; ++It ) { const TSharedPtr< FTokenizedMessage > Message = *It; if( Message->GetMessageData() == &MessageData ) { return Message; } } } return NULL; }
/****************************************************************** Return page number of last page *******************************************************************/ int TDataAppend::LastPage() { return NumPages(); };