-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBEToolbox.cpp
262 lines (217 loc) · 7.13 KB
/
BEToolbox.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
///////////////////////////////////////////////////////////////////////
// BEToolbox
// Copyright © 1999-2025 Washington State Department of Transportation
// Bridge and Structures Office
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the Alternate Route Open Source License as
// published by the Washington State Department of Transportation,
// Bridge and Structures Office.
//
// This program is distributed in the hope that it will be useful, but
// distribution is AS IS, WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the Alternate Route Open Source License for more details.
//
// You should have received a copy of the Alternate Route Open Source
// License along with this program; if not, write to the Washington
// State Department of Transportation, Bridge and Structures Office,
// P.O. Box 47340, Olympia, WA 98503, USA or e-mail
///////////////////////////////////////////////////////////////////////
// BEToolbox.cpp : Implementation of DLL Exports.
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "BEToolbox_i.h"
#include "dllmain.h"
#include "BEToolboxTool.h"
#include <EAF\EAFAppPlugin.h>
#include <System\ComCatMgr.h>
#include <BridgeLinkCATID.h>
#include "PGSuperCatCom.h"
#include "PGSpliceCatCom.h"
#include <WBFLCore_i.c>
#include <WBFLTools_i.c>
#include <Plugins\PGSuperIEPlugin.h>
#include <Plugins\BeamFamilyCLSID.h>
#include <EAF\EAFDocument.h>
#include <EAF\EAFDisplayUnits.h>
#include <IFace\Intervals.h>
#include <IFace\Bridge.h>
#include <IFace\Project.h>
#include <IFace\GirderHandlingSpecCriteria.h>
#include <IFace\PrestressForce.h>
#include <IFace\AnalysisResults.h>
#include <IFace\DocumentType.h>
#include <IFace\Selection.h>
#include "Tools.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return (AfxDllCanUnloadNow()==S_OK && _AtlModule.GetLockCount()==0) ? S_OK : S_FALSE;
}
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
HRESULT Register(bool bRegister)
{
HRESULT hr = S_OK;
// Register the BEToolbox component infor object with BridgeLink... this gives BridgeLink an object with
// BEToolbox information for the About dialog
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_BEToolboxComponentInfo,CATID_BridgeLinkComponentInfo,bRegister);
if ( FAILED(hr) )
return hr;
// Register BEToolbox as a BridgeLink application (this makes BEToolbox show up in the New Project dialog)
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_BEToolboxPlugin, CATID_BridgeLinkAppPlugin, bRegister);
if ( FAILED(hr) )
return hr;
// Register the PGSuper/PGSplice Data Importers/Exporters this DLL implements
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_CurvelImporter, CATID_PGSuperDataImporter, bRegister);
if ( FAILED(hr) )
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_CurvelImporter, CATID_PGSpliceDataImporter, bRegister);
if ( FAILED(hr) )
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_CurvelExporter, CATID_PGSuperDataExporter, bRegister);
if ( FAILED(hr) )
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_CurvelExporter, CATID_PGSpliceDataExporter, bRegister);
if ( FAILED(hr) )
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_GenCompExporter, CATID_PGSuperDataExporter, bRegister);
if ( FAILED(hr) )
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_GenCompExporter, CATID_PGSpliceDataExporter, bRegister);
if ( FAILED(hr) )
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_PGStableExporter, CATID_PGSuperDataExporter, bRegister);
if ( FAILED(hr) )
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_PGStableExporter, CATID_PGSpliceDataExporter, bRegister);
if ( FAILED(hr) )
{
return hr;
}
// Register the standard BEToolbox Tools so they can be discovered at application startup
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_BoxGdrTool, CATID_BEToolboxTool, bRegister);
if (FAILED(hr))
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_GenCompTool, CATID_BEToolboxTool, bRegister);
if (FAILED(hr))
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_GirCompTool, CATID_BEToolboxTool, bRegister);
if (FAILED(hr))
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_UltColTool, CATID_BEToolboxTool, bRegister);
if (FAILED(hr))
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_CurvelTool, CATID_BEToolboxTool, bRegister);
if (FAILED(hr))
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_PGStableTool, CATID_BEToolboxTool, bRegister);
if (FAILED(hr))
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_SpectraTool, CATID_BEToolboxTool, bRegister);
if (FAILED(hr))
{
return hr;
}
hr = WBFL::System::ComCatMgr::RegWithCategory(CLSID_BearingTool, CATID_BEToolboxTool, bRegister);
if (FAILED(hr))
{
return hr;
}
return S_OK;
}
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
HRESULT hr = _AtlModule.DllRegisterServer();
if ( FAILED(hr) )
return hr;
hr = Register(true);
if ( FAILED(hr) )
return hr;
return S_OK;
}
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
HRESULT hr = Register(false);
if ( FAILED(hr) )
return hr;
hr = _AtlModule.DllUnregisterServer();
return hr;
}
// THIS FUNCTION WAS CAUSING SOME PROBLEMS.
//
// Must compile with UNICODE for this function, but this caused MFC problems
// because the other DLL's aren't compiled with UNICODE. If this function is
// put back into the mix, be sure to go to BEToolbox.def and put it
// back in the function exports as well
//// DllInstall - Adds/Removes entries to the system registry per user
//// per machine.
//STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
//{
// HRESULT hr = E_FAIL;
// static const wchar_t szUserSwitch[] = _T("user");
//
// if (pszCmdLine != nullptr)
// {
// if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
// {
// AtlSetPerUserRegistration(true);
// }
// }
//
// if (bInstall)
// {
// hr = DllRegisterServer();
// if (FAILED(hr))
// {
// DllUnregisterServer();
// }
// }
// else
// {
// hr = DllUnregisterServer();
// }
//
// return hr;
//}