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