|
楼主 |
发表于 2009-5-6 14:55:51
|
显示全部楼层
回复: TK 102618 Add a Collapse All option for both Summary and Command mode G
// TSK# 102618 MDG
void CEditorTreeView::CollapseGroups(bool collapse)
{
CPCDcommand *pFirstGroupStart = NULL;
CPCDcommand *pLastGroupEnd = NULL;
int item_state = collapse ? TVE_COLLAPSE : TVE_EXPAND;
CString strShowParams = collapse ? _T("0") : _T("1");
CPCDcommand *pCmd = m_pPartProgram->GetStartCommand();
CTreeCtrl& TreeControl = GetTreeCtrl();
while(pCmd)
{
if(pCmd->type() == EW_GROUP_START)
{
CPCDcommand *pGroupCmd = pCmd;
CPCDcommand *pGroupEnd = ((CPCDgroup_start*)pGroupCmd)->MatchingPair();
if(!pFirstGroupStart)
pFirstGroupStart = pGroupCmd;
TreeControl.Expand(pGroupCmd->GetTreeItem(), item_state);
// Update Command Mode
pGroupCmd->read_text(strShowParams, D_TYPES::SHOW_DETAILS, 0);
}
pCmd = pCmd->next;
} // end while
}
// TSK# 102618 MDG
void CEditorTreeView::CollapseCommand(CPCDcommand *pCmd, bool collapse)
{
CTreeCtrl& TreeControl = GetTreeCtrl();
TreeControl.Expand(pCmd->GetTreeItem(), (collapse ? TVE_COLLAPSE : TVE_EXPAND));
}
// TSK# 102618 MDG
void CEditorTreeView::OnCollapseGroups()
{
CollapseGroups(true);
} |
|