几何尺寸与公差论坛

 找回密码
 注册
查看: 114|回复: 2

TK 102618 Add a Collapse All option for both Summary and Command mode Groups

[复制链接]
发表于 2009-5-6 14:49:30 | 显示全部楼层 |阅读模式
Add a Collapse All option for both Summary and Command mode Groups
<< David Petrizze  --  05/30/06  07:01:36>>
Add a Collapse All option for both Summary and Command mode Groups
<<END>>

<< Jerry Naylor  --  10/20/06  14:19:12>>
Reviewed by Matt. This document is complete.
<<END>>
<< Jared Hess  --  09/11/06  11:28:29>>
This is documented in the "Summary Mode Command Shortcut Menu" topic and in the "Command Mode Shortcut Menu" topic. I added this information on the "Collapse Groups" menu item into those topics:
"This option collapses all expanded user-defined groups. Other expanded items remain
expanded."
Let me know if anything else should be added for this.
<<END>>
<< Tim Wernicke  --  08/08/06  11:50:14>>
Added to V42 Test Plan.
Also, why do we have a Group/Collapse right-click option in the Command Mode but only a Collapse option for the Summary Mode?
<<END>>
<< Matt Gotch  --  06/14/06  18:55:35>>
- Added Collapse Groups menu item.
- Added code to keep summary mode and command mode groups in sync.
Files inserted to server
------------------------
V42\EDITORS\EDITORTREEVIEW.CPP
V42\EDITORS\EDITWIN.CPP
V42\EDITORS\GROUPSTART.CPP
V42\INCLUDE\EDITORTREEVIEW.H
V42\INCLUDE\EDITWIN.H
V42\INCLUDE\resource.h
V42\MENU\RESOURCEENUM.CPP
V42\RESOURCE\LANGS\ENGLISH\Resource.RC
<<END>>
<< Changes made by Matt Gotch -- 06/14/06  18:55:40>>
Action:  Matt Gotch to David Petrizze, Status:  DESIGN to REVIEW
<<END>>
<< David Petrizze  --  05/30/06  07:02:50>>
Also link the Expand/Collapse state of the Tree view with the Toggle parameter in the Command mode.
<<END>>
 楼主| 发表于 2009-5-6 14:54:35 | 显示全部楼层

回复: TK 102618 Add a Collapse All option for both Summary and Command mode G

// TSK# 102618 MDG
void CEditorTreeView::OnItemExpanded(NMHDR* pNMHDR, LRESULT* pResult)
{
  NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
  TV_ITEM Item = pNMTreeView->itemNew;
  HTREEITEM hItem = Item.hItem;

  CTreeCtrl& TheControl = GetTreeCtrl();
  CTreeItemObject *pObject = (CTreeItemObject*)TheControl.GetItemData(hItem);
  if(pObject && pObject->m_eType == CTreeItemObject::CommandPointer)
  {
    if(pObject->m_pCmd)
    {
      if(pObject->m_pCmd->type() == EW_GROUP_START)
      {
        if(pNMTreeView->action == TVE_EXPAND)
          ((CPCDgroup_start*)pObject->m_pCmd)->read_text(_T("1"), D_TYPES::SHOW_DETAILS, 0);
        else
          ((CPCDgroup_start*)pObject->m_pCmd)->read_text(_T("0"), D_TYPES::SHOW_DETAILS, 0);
      }// end if EW_GROUP_START
    }// end if m_pCmd
  }// end if CommandPointer
}
 楼主| 发表于 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);
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2025-1-3 09:49 , Processed in 0.039839 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表