-
Notifications
You must be signed in to change notification settings - Fork 1
/
DlgNewImportDescr.cpp
158 lines (121 loc) · 3.55 KB
/
DlgNewImportDescr.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*//////////////////////////////////////////////////////////////////////////////
// Name: dlgwewimportdescr.cpp
// Purpose: Implementation of CDlgNewImportDescr
// Author: Ruediger Herrmann
// Copyright: (c) Ruediger Herrmann
//////////////////////////////////////////////////////////////////////////////*/
#include "stdafx.h"
#include "ECTImportX.h"
#include "easycashdoc.h"
#include "DlgNewImportDescr.h"
#include "ImportParams.h"
#include "module.h"
#include "helpcontextmap.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CDlgNewImportDescr::CDlgNewImportDescr ( CWnd* pParent )
: CDialog ( CDlgNewImportDescr::IDD, pParent ) {
//{{AFX_DATA_INIT(CDlgNewImportDescr)
m_Name = _T("");
m_CopyExisting = FALSE;
//}}AFX_DATA_INIT
m_ImportDescrList = NULL;
m_CurrentImportParams = NULL;
}
void CDlgNewImportDescr::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgNewImportDescr)
DDX_Control(pDX, IDC_COPYEXISTING, m_CopyExistingCheckBox);
DDX_Text(pDX, IDC_NAME, m_Name);
DDX_Check(pDX, IDC_COPYEXISTING, m_CopyExisting);
//}}AFX_DATA_MAP
// validation
if ( pDX->m_bSaveAndValidate ) {
// name must not be empty
if ( m_Name.IsEmpty() ) {
AfxMessageBox ( IDS_NAMEISEMPTY, MB_OK | MB_ICONSTOP, 0 );
pDX->Fail();
}
// test if there is already an entry with same name
if ( m_ImportDescrList != NULL && m_ImportDescrList->FindByName ( m_Name ) != -1 ) {
AfxMessageBox ( IDS_NAMEALREADYEXISTS, MB_OK | MB_ICONSTOP, 0 );
pDX->Fail();
}
}
else
{
if ( m_CopyExistingCheckBox.m_hWnd )
m_CopyExistingCheckBox.EnableWindow ( m_CurrentImportParams != NULL );
}
}
BEGIN_MESSAGE_MAP(CDlgNewImportDescr, CDialog)
//{{AFX_MSG_MAP(CDlgNewImportDescr)
ON_WM_HELPINFO()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CDlgNewImportDescr::OnHelpInfo(HELPINFO* pHelpInfo)
{
char exefilename[MAX_PATH];
char *cp;
if (::GetModuleFileName(theApp.m_hInstance, exefilename, MAX_PATH) && (cp = strrchr(exefilename, '\\')))
{
strcpy(cp, "\\ECTEImport.htm");
::ShellExecute(NULL, "open", exefilename, NULL, NULL, SW_SHOWNORMAL);
}
return CDialog::OnHelpInfo(pHelpInfo);
}
void CDlgNewImportDescr::BuildDefaultName() {
if ( !m_ImportDescrList )
return;
int Counter = 1;
CString DefaultName;
DefaultName.Format ( IDS_DEFAULTNAME, Counter );
BOOL Found;
int i;
while ( TRUE ) {
Found = FALSE;
for ( i = 0; i <= m_ImportDescrList->GetSize() - 1; i++ )
if ( m_ImportDescrList->FindByName ( DefaultName ) != -1 ) {
Found = TRUE;
break;
}
if ( !Found )
break;
Counter++;
DefaultName.Format ( IDS_DEFAULTNAME, Counter );
}
m_Name = DefaultName;
}
BOOL CDlgNewImportDescr::OnInitDialog()
{
BuildDefaultName();
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
}
/*
// DlgNewImportDescr.cpp : implementation file
//
#include "stdafx.h"
#include "ECTImportX.h"
#include "DlgNewImportDescr.h"
// CDlgNewImportDescr dialog
IMPLEMENT_DYNAMIC(CDlgNewImportDescr, CDialog)
CDlgNewImportDescr::CDlgNewImportDescr(CWnd* pParent **=NULL**)
: CDialog(CDlgNewImportDescr::IDD, pParent)
{
}
CDlgNewImportDescr::~CDlgNewImportDescr()
{
}
void CDlgNewImportDescr::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CDlgNewImportDescr, CDialog)
END_MESSAGE_MAP()
// CDlgNewImportDescr message handlers
*/