/* delete this line from the data structure */ void scTextline::Delete( scXRect& lineDamage ) { // patch the line pointers if ( GetPrev() ) GetPrev()->SetNext( GetNext() ); else GetColumn()->SetFirstline( GetNext() ); if ( GetNext() ) GetNext()->SetPrev( GetPrev() ); // patch the paragraph pointer if ( fPara && this == fPara->GetFirstline() ) { scTextline* nexttxl = GetNext(); if ( !nexttxl ) nexttxl = GetNextLogical(); if ( nexttxl && nexttxl->GetPara() == fPara ) fPara->SetFirstline( nexttxl ); else fPara->SetFirstline( 0 ); } // compute the damage area scXRect xrect( fInkExtents ); if ( xrect.Valid() ) { QueryExtents( xrect, 1 ); lineDamage.Union( xrect ); } delete this; }
/** * Return previous visible item */ CBibItem * CBibList::GetPrevItem(CBibItem *item) const { POSITION p = CObList::Find((CObject*)item); GetPrev(p); while (p) { CBibItem *bi = (CBibItem*)GetPrev(p); if (bi->IsVisible() && bi->IsRegularItem()) return bi; } return NULL; }
scTextline* scContUnit::LocateFirstLine( scCOLRefData& cData, TypeSpec curSpec, scColumn*& col, MicroPoint& baseline, scLEADRefData& lead, PrevParaData& prevParaData ) { scTextline* lastTxl; if ( GetPrev() ) { /* there are prior paragraphs in the stream */ lastTxl = GetPrev()->GetLastline(); if ( lastTxl ) { lastTxl->ParaLead( lead, col->GetFlowdir() ); if ( lastTxl->GetColumn() != cData.GetActive() ) { cData.COLFini( false ); col = lastTxl->GetColumn(); cData.COLInit( col, this ); } baseline = lastTxl->GetBaseline(); if ( col->GetFlowdir().IsHorizontal() ) cData.fPrevEnd.Set( col->Width(), lastTxl->GetOrigin().y ); else cData.fPrevEnd.Set( lastTxl->GetOrigin().x, col->Depth() ); cData.fSavedPrevEnd = cData.fPrevEnd; // we have to fool the baseline into thinking that it is // in a vertically oriented column if ( col->GetFlowdir().IsVertical() ) baseline = col->Width() - baseline; } else { // overflow stuff, in COLGetStrip TypeSpec ts = SpecAtStart( ); lead.Set( scCachedStyle::GetCachedStyle( ts ).GetComputedLead(), col->GetFlowdir() ); baseline = LONG_MIN; } } else { // this is the first paragraph in the stream TypeSpec ts = SpecAtStart( ); lead.Set( scCachedStyle::GetCachedStyle( ts ).GetComputedLead(), col->GetFlowdir() ); lastTxl = NULL; baseline = FIRST_LINE_POSITION; } return lastTxl; }
void GSRasterizerList::Draw(const GSRasterizerData* data) { *m_sync = 0; m_stats.Reset(); __int64 start = __rdtsc(); POSITION pos = GetTailPosition(); while(pos) { GetPrev(pos)->Draw(data); } while(*m_sync) { _mm_pause(); } m_stats.ticks = __rdtsc() - start; pos = GetHeadPosition(); while(pos) { GSRasterizerStats s; GetNext(pos)->GetStats(s); m_stats.pixels += s.pixels; m_stats.prims = max(m_stats.prims, s.prims); } }
// [R] void CompileSession::RecordErrorInfo(const ErrorInfo& templ) { DEBUG_FORMAT("%s", templ); static bool fContinue = false; if (!fContinue && ::IsDebuggerPresent()) { __debugbreak(); fContinue = true; } if (error_set_.Contains(&templ)) { return; } auto& error_info = templ.Clone(); error_set_.Add(&error_info); auto ref = errors_.GetLast(); while (ref) { if (error_info.source_info() > ref->source_info()) { break; } ref = ref->GetPrev(); } if (ref) { errors_.InsertAfter(&error_info, ref); } else { errors_.Prepend(&error_info); } }
void scContUnit::Unlink( ) { scContUnit* lastPara; scContUnit* nextPara; // mark all the lines of the paragraph as being invalid Deformat( ); lastPara = GetPrev(); nextPara = GetNext(); if ( lastPara ) lastPara->SetNext( nextPara ); else { // this is the first paragraph in the stream and we must let // the columns know that the head of the stream has changed // GetStream()->ResetStream( (scStream*)nextPara ); } if ( nextPara ) nextPara->SetPrev( lastPara ); SetPrev( NULL ); SetNext( NULL ); }
ListItem* OverrideList::InsertBefore(OverrideListItem* pliInsertPoint, OverrideListItem* pliToInsert) { ERROR2IF(pliToInsert==NULL, NULL, "OverrideList::InsertBefore - NULL parameter"); //This variable will tell us whether to insert pliToInsert //into the list BOOL fInsert=TRUE; //First compare pliToInsert with everything below pliInsertPoint in the list fInsert=CompareWithItemsBelow(pliInsertPoint, pliToInsert); //Now get the list item above pliInsertPoint OverrideListItem* pliTest=(OverrideListItem*) GetPrev(pliInsertPoint); //If there is anything above pliInsertPoint if (fInsert && pliTest!=NULL) { //Then test everything above pliInsertPoint fInsert=CompareWithItemsAbove(pliInsertPoint, pliToInsert); } //So, should we insert pliToInsert? if (fInsert) //Yes. So do it. return List::InsertBefore(pliInsertPoint, pliToInsert); else //No. So return an error value. return NULL; }
void MarkedStack::Release(void) { // Find the mark to stop at ListItemPtrItem* MarkRec = (ListItemPtrItem*)MarkStack.Pop(); ListItem* Mark; if (MarkRec == NULL) // There are no marks to find { Mark = NULL; } else { Mark = MarkRec->pListItem; } ListItem* TopOfStack = GetTail(); ListItem* AsGoodAsDead; while (TopOfStack != Mark) // Loop until we find Mark { ENSURE(TopOfStack != NULL, "A Mark could not be found in the Marked stack"); TopOfStack = GetPrev(TopOfStack); AsGoodAsDead = RemoveTail(); delete AsGoodAsDead; } if (MarkRec != NULL) { delete (MarkRec); // Restored State to that pointed to by Mark, so delete it } }
CPlaylistItem& CPlaylist::GetPrevWrap(POSITION& pos) { GetPrev(pos); if (!pos) { pos = GetTailPosition(); } return GetAt(pos); }
RUIUseBuffer* RUIUseBufferList::_FindLastUseBuffer(RUIUseBuffer* pRUIUseBufferBefore, BOOL bUse) { RUIUseBuffer* pRUIUseBuffer; if (pRUIUseBufferBefore != NULL) pRUIUseBuffer = (RUIUseBuffer*) GetPrev(pRUIUseBufferBefore); else pRUIUseBuffer = (RUIUseBuffer*) GetLast(); while (pRUIUseBuffer != NULL) { if (pRUIUseBuffer->GetUse() == bUse) return pRUIUseBuffer; pRUIUseBuffer = (RUIUseBuffer*) GetPrev(pRUIUseBuffer); } return NULL; }
/** * Deletes all pages and clears the list. */ void CPrintPages::Clear() { POSITION p = GetTailPosition(); while (p) { CPrintPage *page = (CPrintPage*)GetPrev(p); delete page; } RemoveAll(); }
CWnd* CWnd::_GetPrevActiveWindow() { CWnd *pWnd = GetPrev(); while ( pWnd && ( !(pWnd->m_dwFlags & WsVisible) || (pWnd->m_dwFlags & WsNoActivate)) ) pWnd = pWnd->GetPrev(); if (!pWnd && m_pParent && !(m_pParent->m_dwFlags & WsModal)) pWnd = m_pParent->_GetPrevActiveWindow(); return pWnd; }
/** * Return the last visible item */ CBibItem * CBibList::GetLast() const { POSITION h = GetTailPosition(); while (h) { CBibItem* bi = (CBibItem*)GetPrev(h); ASSERT(bi); if (bi->IsVisible() && bi->IsRegularItem()) return bi; } return NULL; }
//------------------------------------------------------------------------------ // // Function Name: CMLListCtrlElements::Last() // // Parameters: None // // Return Value: A pointer to the last object in the list // // Description: This function will retrieve the last object in the list. // //------------------------------------------------------------------------------ CMLListCtrlElement* CMLListCtrlElements::Last() { // Get the last position m_PrevPos = GetTailPosition(); m_NextPos = NULL; if(m_PrevPos == NULL) return NULL; else return (CMLListCtrlElement*)GetPrev(m_PrevPos); }
//------------------------------------------------------------------------------ // // Function Name: CMLListCtrlElements::Prev() // // Parameters: None // // Return Value: A pointer to the previous object in the list // // Description: This function will previous the first object in the list. // //------------------------------------------------------------------------------ CMLListCtrlElement* CMLListCtrlElements::Prev() { if(m_PrevPos == NULL) return NULL; else { m_NextPos = m_PrevPos; GetNext(m_NextPos); return (CMLListCtrlElement*)GetPrev(m_PrevPos); } }
bool TrackList::MoveUp(Track * t) { if (t) { Track *p = GetPrev(t, true); if (p) { SwapNodes(p->GetNode(), t->GetNode()); return true; } } return false; }
void clRowEntry::GetPrevItems(int count, clRowEntry::Vec_t& items, bool selfIncluded) { if(count <= 0) { return; } items.reserve(count); if(!this->IsHidden() && selfIncluded) { items.insert(items.begin(), this); } clRowEntry* prev = GetPrev(); while(prev) { if(prev->IsVisible() && !prev->IsHidden()) { items.insert(items.begin(), prev); } if((int)items.size() == count) { return; } prev = prev->GetPrev(); } }
std::pair<Track *, Track *> TrackList::FindSyncLockGroup(Track *pMember) const { if (!pMember) return { nullptr, nullptr }; // A non-trivial sync-locked group is a maximal sub-sequence of the tracks // consisting of any positive number of audio tracks followed by zero or // more label tracks. // Step back through any label tracks. auto member = pMember; while (member && ( nullptr != track_cast<const LabelTrack*>(member) )) { member = GetPrev(member); } // Step back through the wave and note tracks before the label tracks. Track *first = nullptr; while (member && IsSyncLockableNonLabelTrack(member)) { first = member; member = GetPrev(member); } if (!first) // Can't meet the criteria described above. In that case, // consider the track to be the sole member of a group. return { pMember, pMember }; Track *last = first; bool inLabels = false; while (const auto next = GetNext(last)) { if ( ! IsGoodNextSyncLockTrack(next, inLabels) ) break; last = next; inLabels = (nullptr != track_cast<const LabelTrack*>(last) ); } return { first, last }; }
/* ==================================================================== */ scTextline* scTextline::GetPrevLogical( void ) const { if ( fPrev ) return GetPrev(); scColumn* col = fColumn; do { col = col->GetPrev(); } while ( col && !col->GetFirstline() ); return col ? col->GetLastline( ) : 0; }
CPlaylistItem& CPlaylist::GetPrevWrap(POSITION& pos) { if (m_bShuffle) { ReshuffleIfNeeded(); pos = GetAt(pos).m_posPrevShuffle; } else { GetPrev(pos); } if (!pos) { pos = GetShuffleAwareTailPosition(); } return GetAt(pos); }
node<ItemType>* BstClass<ItemType>::GetPrev(/* in */KeyType key, //key to find parant node of /* in */node<ItemType>* & trav) //location in tree { //given whether the key is greater than or less than current node //check left or right for = key if(key < trav -> data.key) { if(trav -> left -> data.key == key) return trav; else GetPrev(key, trav -> left); }//end if else if(key > trav -> data.key) { if(trav -> right -> data.key == key) return trav; else GetPrev(key, trav -> right); }//end else if else return nullptr;//key being searched is at root }//end GetPrev
/***************************************************************************** * CList::InsertBefore() ***************************************************************************** * Inserts a given list item before a second list item (which is presumed to * be a list member). Inserts the given list item at the head if there is * no preceding list item. */ void CList::InsertBefore(CListItem *pItem,CListItem *pInsert) { CListItem *prev = GetPrev(pItem); ASSERT(pInsert != pItem); pInsert->SetNext(pItem); if (prev) { ASSERT(pInsert != prev); prev->SetNext(pInsert); } else { m_pHead = pInsert; } }
int StreamBuffer::GetBack() const noexcept { if(x_uSize == 0){ return -1; } auto pNode = x_lstBuffers.GetLast(); for(;;){ ASSERT(pNode); const auto &vBuffer = pNode->Get(); if(vBuffer.m_uRead < vBuffer.m_uWrite){ return vBuffer.m_abyData[vBuffer.m_uWrite - 1]; } pNode = pNode->GetPrev(); } }
void CXFA_FFField::SetEditScrollOffset() { XFA_Element eType = m_pDataAcc->GetUIType(); if (eType == XFA_Element::TextEdit || eType == XFA_Element::NumericEdit || eType == XFA_Element::PasswordEdit) { FX_FLOAT fScrollOffset = 0; CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev()); if (pPrev) { CFX_RectF rtMargin; m_pDataAcc->GetUIMargin(rtMargin); fScrollOffset = -rtMargin.top; } while (pPrev) { fScrollOffset += pPrev->m_rtUI.height; pPrev = static_cast<CXFA_FFField*>(pPrev->GetPrev()); } ((CFWL_Edit*)m_pNormalWidget)->SetScrollOffset(fScrollOffset); } }
void CWnd::Destroy() { // najprv znic childy CWnd *pChild = m_pFirst; while (pChild) { pChild->Destroy(); pChild = pChild->m_pNext; } // odstran zo zoznamu if (m_pParent->m_pFirst == this) m_pParent->m_pFirst = this->m_pNext; else GetPrev()->m_pNext = this->m_pNext; // a teraz mozes seba m_pParent = NULL; m_dwFlags = WsHidden; }
WORD CUndLst::Un_UndEvt (LPOFSTRUCT_V pofDstFil, FIOPOLPRC fpCBkPrc, DWORD ulCBkArg) { ///////////////////////////////////////////////////////////////////////// // Undo inhibited? ///////////////////////////////////////////////////////////////////////// if (NULL == m_vpUndPos) return (0); ///////////////////////////////////////////////////////////////////////// // Get current event ///////////////////////////////////////////////////////////////////////// CUndEvt * pUndEvt = GetAt(m_vpUndPos); if (NULL == pUndEvt) return (-1); ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// if (pUndEvt->Undo(pofDstFil, fpCBkPrc, ulCBkArg)) return (-1); ///////////////////////////////////////////////////////////////////////// GetPrev(m_vpUndPos); return (0); }
// Free -- Free Memory ---------------------------------------------CHeapBlock- // // When a block is freed it is merged with previous and next block // if they are free. If merged with next block then next block is // removed from list. If not merged with either block then this // block is added to free list. // // NULL pointers and invalid block pointers are ignored. // // NOTE: Must be re-entrant // U32 CHeapBlock::Free(void *pData) { BLKHEAD *pBlk,*pPrevBlk,*pNextBlk; U32 cbRet=0; if (pData != NULL) { pBlk = GetBlk(pData); // Check if allocated block if (pBlk->tThis == TYPEALLOC) { Critical section; cbRet=pBlk->sThis; FREE(cbRet, pBlk->raAlloc); // Merge with next block if it is free pNextBlk = GetNext(pBlk); if (pNextBlk->tThis == TYPEFREE) { _Unlink(pNextBlk); pBlk->sThis += pNextBlk->sThis + sizeof(BLKHEAD); GetNext(pBlk)->sPrev = pBlk->sThis; } // Merge with previous block if it is free pPrevBlk = GetPrev(pBlk); if (pPrevBlk->tThis != TYPEFREE) { pBlk->tThis = TYPEFREE; _Link(pBlk); } else { pPrevBlk->sThis += pBlk->sThis + sizeof(BLKHEAD); GetNext(pPrevBlk)->sPrev = pPrevBlk->sThis; } } } return cbRet; }
BOOL OverrideList::CompareWithItemsAbove(OverrideListItem* pliStartPos, OverrideListItem* pliToInsert) { //This pointer will show the item we are looking at OverrideListItem* pliLook=pliStartPos; //While we are still looking at a valid item while (pliLook!=NULL) { //This will be the next item we look at //It's important to do this now - because we may delete pliLook in a moment OverrideListItem* pliNext=(OverrideListItem*) GetPrev(pliLook); //Does the item we are looking at override the item //we are about to insert? if (pliLook->OverrideFromAbove(pliToInsert)) { //Yes. So return to say that we're not going to insert the //item return FALSE; } //Does the item we are about to insert override the item //we are looking at? if (pliToInsert->OverrideFromBelow(pliLook)) { //Yes. So delete the item we are looking at. RemoveItem(pliLook); delete pliLook; } //And move on to the next item pliLook=pliNext; } //ANd return to say that pliToInsert has not been overridden return TRUE; }
scContUnit* scContUnit::Merge( long& offset ) { scStream* stream = (scStream*)FirstInChain(); scContUnit* prev = GetPrev(); if ( prev ) { scColumn* col = scColumn::FindFlowset( stream ); offset = prev->GetContentSize(); Unlink( ); prev->Renumber(); long tmp = offset; prev->PasteText( this, tmp ); Free( col ? col->FlowsetGetSelection() : 0 ); return prev; } return this; }
TrackPanelResizeHandle::TrackPanelResizeHandle ( const std::shared_ptr<Track> &track, int y, const AudacityProject *pProject ) : mpTrack{ track } , mMouseClickY( y ) { auto tracks = pProject->GetTracks(); Track *prev = tracks->GetPrev(track.get()); Track *next = tracks->GetNext(track.get()); //STM: Determine whether we should rescale one or two tracks if (prev && prev->GetLink() == track.get()) { // mpTrack is the lower track mInitialTrackHeight = track->GetHeight(); mInitialActualHeight = track->GetActualHeight(); mInitialMinimized = track->GetMinimized(); mInitialUpperTrackHeight = prev->GetHeight(); mInitialUpperActualHeight = prev->GetActualHeight(); mMode = IsResizingBelowLinkedTracks; } else if (next && track->GetLink() == next) { // mpTrack is the upper track mInitialTrackHeight = next->GetHeight(); mInitialActualHeight = next->GetActualHeight(); mInitialMinimized = next->GetMinimized(); mInitialUpperTrackHeight = track->GetHeight(); mInitialUpperActualHeight = track->GetActualHeight(); mMode = IsResizingBetweenLinkedTracks; } else { // DM: Save the initial mouse location and the initial height mInitialTrackHeight = track->GetHeight(); mInitialActualHeight = track->GetActualHeight(); mInitialMinimized = track->GetMinimized(); mMode = IsResizing; } }