MoveToGroupDlg.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // MoveToGroupDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "cp_main.h"
  5. #include "MoveToGroupDlg.h"
  6. #include "GroupName.h"
  7. #include "ProcessPaste.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CMoveToGroupDlg dialog
  15. CMoveToGroupDlg::CMoveToGroupDlg(CWnd* pParent /*=NULL*/)
  16. : CDialog(CMoveToGroupDlg::IDD, pParent)
  17. {
  18. //{{AFX_DATA_INIT(CMoveToGroupDlg)
  19. // NOTE: the ClassWizard will add member initialization here
  20. //}}AFX_DATA_INIT
  21. m_nSelectedGroup = -1;
  22. }
  23. void CMoveToGroupDlg::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CDialog::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(CMoveToGroupDlg)
  27. DDX_Control(pDX, IDC_TREE, m_Tree);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(CMoveToGroupDlg, CDialog)
  31. //{{AFX_MSG_MAP(CMoveToGroupDlg)
  32. ON_WM_SIZE()
  33. ON_BN_CLICKED(IDC_BUTTON_NEW_GROUP, OnButtonNewGroup)
  34. //}}AFX_MSG_MAP
  35. ON_MESSAGE(NM_GROUP_TREE_MESSAGE, OnTreeSelect)
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CMoveToGroupDlg message handlers
  39. BOOL CMoveToGroupDlg::OnInitDialog()
  40. {
  41. CDialog::OnInitDialog();
  42. m_Tree.m_lSelectedFolderID = m_nSelectedGroup;
  43. m_Tree.SetNotificationWndEx(m_hWnd);
  44. m_Tree.FillTree();
  45. theApp.m_Language.UpdateMoveToGroups(this);
  46. return TRUE; // return TRUE unless you set the focus to a control
  47. // EXCEPTION: OCX Property Pages should return FALSE
  48. }
  49. LRESULT CMoveToGroupDlg::OnTreeSelect(WPARAM wParam, LPARAM lParam)
  50. {
  51. int nID = (int)wParam;
  52. if(nID >= 0)
  53. {
  54. m_nSelectedGroup = nID;
  55. OnOK();
  56. }
  57. else
  58. {
  59. OnCancel();
  60. }
  61. return TRUE;
  62. }
  63. void CMoveToGroupDlg::OnOK()
  64. {
  65. m_nSelectedGroup = m_Tree.GetSelectedTree();
  66. CDialog::OnOK();
  67. }
  68. void CMoveToGroupDlg::OnSize(UINT nType, int cx, int cy)
  69. {
  70. CDialog::OnSize(nType, cx, cy);
  71. // TODO: Add your message handler code here
  72. }
  73. void CMoveToGroupDlg::OnButtonNewGroup()
  74. {
  75. CGroupName Name;
  76. int nParentID = m_Tree.GetSelectedTree();
  77. if(nParentID < 0)
  78. return;
  79. if(Name.DoModal() != IDOK)
  80. return;
  81. CString csName = Name.m_csName;
  82. long lID = NewGroupID(nParentID, csName);
  83. if(lID >= 0)
  84. {
  85. m_Tree.AddNode(csName, lID);
  86. }
  87. m_Tree.SetFocus();
  88. }