void CCrystalTextBuffer::
AddView (CCrystalTextView * pView)
{
- m_lpViews.AddTail (pView);
+ m_lpViews.push_back (pView);
}
void CCrystalTextBuffer::
RemoveView (CCrystalTextView * pView)
{
- POSITION pos = m_lpViews.GetHeadPosition ();
- while (pos != nullptr)
- {
- POSITION thispos = pos;
- CCrystalTextView *pvw = m_lpViews.GetNext (pos);
- if (pvw == pView)
- {
- m_lpViews.RemoveAt (thispos);
- return;
- }
- }
- ASSERT (false);
+ auto it = std::find(m_lpViews.begin(), m_lpViews.end(), pView);
+ if (it != m_lpViews.end())
+ m_lpViews.erase(it);
}
CrystalLineParser::TextDefinition *CCrystalTextBuffer::
RetypeViews (const tchar_t* lpszFileName)
{
- POSITION pos = m_lpViews.GetHeadPosition ();
CString sNew = GetExt (lpszFileName);
CrystalLineParser::TextDefinition *def = CrystalLineParser::GetTextType (sNew);
- while (pos != nullptr)
- {
- CCrystalTextView *pView = m_lpViews.GetNext (pos);
- pView->SetTextType (def);
- }
+ for (auto* pView : m_lpViews)
+ pView->SetTextType (def);
return def;
}
void CCrystalTextBuffer::
UpdateViews (CCrystalTextView * pSource, CUpdateContext * pContext, DWORD dwUpdateFlags, int nLineIndex /*= -1*/ )
{
- POSITION pos = m_lpViews.GetHeadPosition ();
- while (pos != nullptr)
- {
- CCrystalTextView *pView = m_lpViews.GetNext (pos);
- pView->UpdateView (pSource, pContext, dwUpdateFlags, nLineIndex);
- }
+ for (auto* pView : m_lpViews)
+ pView->UpdateView (pSource, pContext, dwUpdateFlags, nLineIndex);
}
/**
{
for (auto& buf : m_pSharedTableProps->m_textBufferList)
{
- POSITION pos = buf->m_lpViews.GetHeadPosition ();
- while (pos != nullptr)
+ for (auto* pView : buf->m_lpViews)
{
- CCrystalTextView* pView = buf->m_lpViews.GetNext (pos);
pView->InvalidateScreenRect ();
pView->UpdateView (nullptr, nullptr, UPDATE_HORZRANGE | UPDATE_VERTRANGE, -1);
}
m_fShrinkHeight=0;
m_bPropertyPage=false;
m_bPropertySheet=false;
- m_ConstraintList.RemoveAll();
+ m_ConstraintList.clear();
m_bPersistent=false;
m_bConstrainNonChildren = false;
}
m_nDelayed++;
}
- ConstraintList & constraintList = m_ConstraintList;
- constraintList.AddTail(constraint);
+ m_ConstraintList.push_back(constraint);
return true;
}
{
if (m_nDelayed == 0)
return;
- ConstraintList & constraintList = m_ConstraintList;
- for (POSITION pos=constraintList.GetHeadPosition(); pos != nullptr; constraintList.GetNext(pos))
+ for (auto& constraint : m_ConstraintList)
{
- Constraint & constraint = constraintList.GetAt(pos);
if (constraint.m_hwndChild != nullptr)
continue;
ASSERT(constraint.m_pWnd != nullptr);
int nDeltaWidth = (rectParentCurrent.right - m_rectDlgOriginal.right);
int nDeltaHeight = (rectParentCurrent.bottom - m_rectDlgOriginal.bottom);
- ConstraintList & constraintList = m_ConstraintList;
- for (POSITION pos=constraintList.GetHeadPosition(); pos != nullptr; constraintList.GetNext(pos))
+ for (auto& constraint : m_ConstraintList)
{
- Constraint & constraint = constraintList.GetAt(pos);
if (constraint.m_hwndChild == nullptr)
continue;