예제 #1
0
/* 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;
}
예제 #2
0
파일: BibList.cpp 프로젝트: stievie/bibedt
/**
 * 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;
}
예제 #3
0
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;
}
예제 #4
0
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);
	}
}
예제 #5
0
// [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);
  }
}
예제 #6
0
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 );
}
예제 #7
0
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;
	
}
예제 #8
0
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 
	}
} 
예제 #9
0
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;
}
예제 #11
0
/**
 * Deletes all pages and clears the list.
 */
void CPrintPages::Clear()
{
	POSITION p = GetTailPosition();
	while (p) {
		CPrintPage *page = (CPrintPage*)GetPrev(p);
		delete page;
	}
	RemoveAll();
}
예제 #12
0
파일: Wnd.cpp 프로젝트: cycologist/DS203
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;
}
예제 #13
0
파일: BibList.cpp 프로젝트: stievie/bibedt
/**
 * 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;
}
예제 #14
0
//------------------------------------------------------------------------------
//
// 	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);
}
예제 #15
0
//------------------------------------------------------------------------------
//
// 	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);
	}
}
예제 #16
0
bool TrackList::MoveUp(Track * t)
{
   if (t) {
      Track *p = GetPrev(t, true);
      if (p) {
         SwapNodes(p->GetNode(), t->GetNode());
         return true;
      }
   }

   return false;
}
예제 #17
0
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();
    }
}
예제 #18
0
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 };
}
예제 #19
0
/* ==================================================================== */
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;
}
예제 #20
0
파일: Playlist.cpp 프로젝트: 1ldk/mpc-hc
CPlaylistItem& CPlaylist::GetPrevWrap(POSITION& pos)
{
    if (m_bShuffle) {
        ReshuffleIfNeeded();
        pos = GetAt(pos).m_posPrevShuffle;
    } else {
        GetPrev(pos);
    }
    if (!pos) {
        pos = GetShuffleAwareTailPosition();
    }
    return GetAt(pos);
}
예제 #21
0
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
예제 #22
0
파일: clist.cpp 프로젝트: 340211173/Driver
/*****************************************************************************
 * 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;
    }
}
예제 #23
0
파일: StreamBuffer.cpp 프로젝트: shuyy/MCF
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();
	}
}
예제 #24
0
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);
  }
}
예제 #25
0
파일: Wnd.cpp 프로젝트: cycologist/DS203
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;
}
예제 #26
0
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);
}
예제 #27
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;
}
예제 #28
0
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;
}
예제 #29
0
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;
}
예제 #30
0
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;
   }
}