-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathacrxEntryPoint.cpp
180 lines (140 loc) · 6.76 KB
/
acrxEntryPoint.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
// (C) Copyright 2002-2012 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
//-----------------------------------------------------------------------------
//----- acrxEntryPoint.cpp
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "resource.h"
#include "GEOUIAppl.h"
#include "gs_ui_wrksession.h"
//-----------------------------------------------------------------------------
#define szRDS _RXST("")
//-----------------------------------------------------------------------------
//----- ObjectARX EntryPoint
class Cgeo_uiApp : public AcRxArxApp {
public:
Cgeo_uiApp () : AcRxArxApp () {}
virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
// TODO: Load dependencies here
// You *must* call On_kInitAppMsg here
AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
if (pkt != NULL)
acrxDynamicLinker->unlockApplication(pkt);
if (GEOUIAppl::init() == GS_BAD) gsc_print_error();
return (retCode) ;
}
virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
// TODO: Add your code here
// You *must* call On_kUnloadAppMsg here
AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
// Questa funzione termina GEOUI.
if (GEOUIAppl::terminate() == GS_BAD) gsc_print_error();
return (retCode) ;
}
virtual void RegisterServerComponents () {
}
virtual AcRx::AppRetCode On_kLoadDwgMsg (void *pkt)
{
AcRx::AppRetCode retCode =AcRxArxApp::On_kLoadDwgMsg (pkt) ;
GEOUIAppl::GEOUICMD_LIST.funcLoad();
if (pDockPaneWrkSession)
{ delete pDockPaneWrkSession; pDockPaneWrkSession = NULL; }
return retCode;
}
virtual AcRx::AppRetCode On_kUnloadDwgMsg (void *pkt)
{
AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadDwgMsg (pkt) ;
GEOUIAppl::GEOUICMD_LIST.funcUnload();
if (pDockPaneWrkSession)
{ delete pDockPaneWrkSession; pDockPaneWrkSession = NULL; }
return retCode;
}
virtual AcRx::AppRetCode On_kInvkSubrMsg (void *pkt)
{
GEOUIAppl::GEOUICMD_LIST.dofun();
return AcRx::kRetOK;
}
// The ACED_ARXCOMMAND_ENTRY_AUTO macro can be applied to any static member
// function of the Cgeo_uiApp class.
// The function should take no arguments and return nothing.
//
// NOTE: ACED_ARXCOMMAND_ENTRY_AUTO has overloads where you can provide resourceid and
// have arguments to define context and command mechanism.
// ACED_ARXCOMMAND_ENTRY_AUTO(classname, group, globCmd, locCmd, cmdFlags, UIContext)
// ACED_ARXCOMMAND_ENTRYBYID_AUTO(classname, group, globCmd, locCmdId, cmdFlags, UIContext)
// only differs that it creates a localized name using a string in the resource file
// locCmdId - resource ID for localized command
// Modal Command with localized name
// ACED_ARXCOMMAND_ENTRY_AUTO(Cgeo_uiApp, MyGroup, MyCommand, MyCommandLocal, ACRX_CMD_MODAL)
static void MyGroupMyCommand () {
// Put your command code here
}
// Modal Command with pickfirst selection
// ACED_ARXCOMMAND_ENTRY_AUTO(Cgeo_uiApp, MyGroup, MyPickFirst, MyPickFirstLocal, ACRX_CMD_MODAL | ACRX_CMD_USEPICKSET)
static void MyGroupMyPickFirst () {
ads_name result ;
int iRet =acedSSGet (ACRX_T("_I"), NULL, NULL, NULL, result) ;
if ( iRet == RTNORM )
{
// There are selected entities
// Put your command using pickfirst set code here
}
else
{
// There are no selected entities
// Put your command code here
}
}
// Application Session Command with localized name
// ACED_ARXCOMMAND_ENTRY_AUTO(Cgeo_uiApp, MyGroup, MySessionCmd, MySessionCmdLocal, ACRX_CMD_MODAL | ACRX_CMD_SESSION)
static void MyGroupMySessionCmd () {
// Put your command code here
}
// The ACED_ADSFUNCTION_ENTRY_AUTO / ACED_ADSCOMMAND_ENTRY_AUTO macros can be applied to any static member
// function of the Cgeo_uiApp class.
// The function may or may not take arguments and have to return RTNORM, RTERROR, RTCAN, RTFAIL, RTREJ to AutoCAD, but use
// acedRetNil, acedRetT, acedRetVoid, acedRetInt, acedRetReal, acedRetStr, acedRetPoint, acedRetName, acedRetList, acedRetVal to return
// a value to the Lisp interpreter.
//
// NOTE: ACED_ADSFUNCTION_ENTRY_AUTO / ACED_ADSCOMMAND_ENTRY_AUTO has overloads where you can provide resourceid.
//- ACED_ADSFUNCTION_ENTRY_AUTO(classname, name, regFunc) - this example
//- ACED_ADSSYMBOL_ENTRYBYID_AUTO(classname, name, nameId, regFunc) - only differs that it creates a localized name using a string in the resource file
//- ACED_ADSCOMMAND_ENTRY_AUTO(classname, name, regFunc) - a Lisp command (prefix C:)
//- ACED_ADSCOMMAND_ENTRYBYID_AUTO(classname, name, nameId, regFunc) - only differs that it creates a localized name using a string in the resource file
// Lisp Function is similar to ARX Command but it creates a lisp
// callable function. Many return types are supported not just string
// or integer.
// ACED_ADSFUNCTION_ENTRY_AUTO(Cgeo_uiApp, MyLispFunction, false)
static int ads_MyLispFunction () {
//struct resbuf *args =acedGetArgs () ;
// Put your command code here
//acutRelRb (args) ;
// Return a value to the AutoCAD Lisp Interpreter
// acedRetNil, acedRetT, acedRetVoid, acedRetInt, acedRetReal, acedRetStr, acedRetPoint, acedRetName, acedRetList, acedRetVal
return (RTNORM) ;
}
} ;
//-----------------------------------------------------------------------------
IMPLEMENT_ARX_ENTRYPOINT(Cgeo_uiApp)
ACED_ARXCOMMAND_ENTRY_AUTO(Cgeo_uiApp, MyGroup, MyCommand, MyCommandLocal, ACRX_CMD_MODAL, NULL)
ACED_ARXCOMMAND_ENTRY_AUTO(Cgeo_uiApp, MyGroup, MyPickFirst, MyPickFirstLocal, ACRX_CMD_MODAL | ACRX_CMD_USEPICKSET, NULL)
ACED_ARXCOMMAND_ENTRY_AUTO(Cgeo_uiApp, MyGroup, MySessionCmd, MySessionCmdLocal, ACRX_CMD_MODAL | ACRX_CMD_SESSION, NULL)
ACED_ADSSYMBOL_ENTRY_AUTO(Cgeo_uiApp, MyLispFunction, false)