27#ifndef _ODEDITORIMPL_H_INCLUDED_
28#define _ODEDITORIMPL_H_INCLUDED_
44#define FX_SAFE_CALL_REACTOR_EVENT_IMPL(reactor, method, params, index) \
46 reactor->method params; \
47} catch (const OdError& err ) { \
48 fxReportReactorExceptionImpl( index, reactor, #method, err ); \
51#define FX_SAFE_CALL_REACTOR_EVENT_IMPL(reactor, method, params, index) { reactor->method params; }
54#include"FxDbCoreExtension.h"
57#define FX_BEGIN_MAIN_THREAD()
58#define FX_END_MAIN_THREAD()
60#define FX_BEGIN_MAIN_THREAD() \
61 CFxDbCoreExtension::StaticExecuteInMainThread( [&]() {
62#define FX_END_MAIN_THREAD() \
70 for (
auto& pReactor : apReactors )
71 apRawReactors.
append( pReactor.get() );
80 if ( iHeuristicIndex < apReactors.
length() && apReactors[ iHeuristicIndex ].get() == pRawReactor )
83 return apReactors.
end() != std::find_if( apReactors.
begin(),
87 return pReactor.get() == pRawReactor;
91#define RXEVENT_FIRE(method, inparams, params) \
92inline void fire_##method inparams \
94 FX_BEGIN_MAIN_THREAD(); \
95 TD_AUTOLOCK( m_mutex ); \
99 const auto reactors = fxCopyRawReactorPointers( m_reactors ); \
100 for (unsigned i = 0; i < reactors.size(); ++i) \
102 if ( fxIsValidReactor( reactors[i], m_reactors, i ) )\
103 FX_SAFE_CALL_REACTOR_EVENT_IMPL( reactors[i], method, params, i ) \
111 if (!(--m_EventCounter))\
112 while( m_reactors.remove(OdRxEventReactorPtr()) );\
113 FX_END_MAIN_THREAD(); \
116#define EDEVENT_FIRE(method, inparams, params) \
117inline void fire_##method inparams \
119 FX_BEGIN_MAIN_THREAD(); \
120 TD_AUTOLOCK( m_mutex ); \
124 const auto reactors = fxCopyRawReactorPointers( m_reactors ); \
125 for (unsigned i = 0; i < reactors.size(); ++i) \
127 if ( fxIsValidReactor( reactors[i], m_reactors, i ) )\
129 OdEditorReactorPtr edReactor = OdEditorReactor::cast(reactors[i]); \
130 if (edReactor.get()) edReactor->method params; \
139 if (!(--m_EventCounter))\
140 while( m_reactors.remove(OdRxEventReactorPtr()) );\
141 FX_END_MAIN_THREAD(); \
144#define DCEVENT_FIRE(method, inparams, params, IdMappingToDatabase) \
145inline void fire_##method inparams \
147 FX_BEGIN_MAIN_THREAD(); \
148 TD_AUTOLOCK( m_mutex ); \
151 const auto reactors = fxCopyRawReactorPointers( m_reactors ); \
152 for (unsigned i = 0; i < reactors.size(); ++i) \
154 if ( fxIsValidReactor( reactors[i], m_reactors, i ) )\
155 reactors[i]->method params; \
163 if (!(--m_EventCounter))\
164 while( m_reactors.remove(OdRxEventReactorPtr()) );\
165 FX_END_MAIN_THREAD(); \
168#define RXEVENT_FIRE_ABORT(method, inparams, params, abortmethod, abortparams) \
169inline void fire_##method inparams \
171 FX_BEGIN_MAIN_THREAD(); \
172 TD_AUTOLOCK( m_mutex ); \
173 const auto reactors = fxCopyRawReactorPointers( m_reactors ); \
174 OdArray<OdRxEventReactorPtr> firedReactors(reactors.length()); \
175 for (unsigned i = 0; i < reactors.size(); ++i) \
177 if ( fxIsValidReactor( reactors[i], m_reactors, i ) ) \
181 firedReactors.append(reactors[i]); \
182 reactors[i]->method params; \
186 for (unsigned j = 0; j < firedReactors.size(); ++j) \
188 if (m_reactors.contains(firedReactors[j])) \
189 firedReactors[j]->abortmethod abortparams; \
195 FX_END_MAIN_THREAD(); \
198#define EDEVENT_FIRE_ABORT(method, inparams, params, abortmethod, abortparams) \
199inline void fire_##method inparams \
201 FX_BEGIN_MAIN_THREAD(); \
202 TD_AUTOLOCK( m_mutex ); \
203 const auto reactors = fxCopyRawReactorPointers( m_reactors ); \
204 OdArray<OdEditorReactorPtr> firedReactors(reactors.length()); \
205 for (unsigned i = 0; i < reactors.size(); ++i) \
207 if ( fxIsValidReactor( reactors[i], m_reactors, i ) ) \
211 OdEditorReactorPtr pReactor = OdEditorReactor::cast(reactors[i]); \
212 if (pReactor.get()) \
214 firedReactors.append(pReactor); \
215 pReactor->method params; \
220 for (unsigned j = 0; j < firedReactors.size(); ++j) \
222 if (m_reactors.contains(firedReactors[j])) \
223 firedReactors[j]->abortmethod abortparams; \
229 FX_END_MAIN_THREAD(); \
298 (pHostDb, subCmd, btrIds, btrNames, paths, vetoOp), xrefSubCommandAborted, (pHostDb, subCmd, btrIds, btrNames, paths))
301 (pHostDb, subCmd, btrIds, btrNames, paths), xrefSubCommandAborted, (pHostDb, subCmd, btrIds, btrNames, paths))
304 (pHostDb, subCmd, btrIds, btrNames, paths), xrefSubCommandAborted, (pHostDb, subCmd, btrIds, btrNames, paths))
326 (pHostDb, subCmd, btrIds, btrNames, paths), xrefSubCommandAborted, (pHostDb, subCmd, btrIds, btrNames, paths))
336 EDEVENT_FIRE(undoSubcommandAuto, (
int activity,
bool state), (activity, state))
337 EDEVENT_FIRE(undoSubcommandControl,(
int activity,
int option), (activity, option))
342 EDEVENT_FIRE(undoSubcommandNumber, (
int activity,
int num), (activity, num))
359 EDEVENT_FIRE(toolbarBitmapSizeWillChange, (
bool largeBitmaps), (largeBitmaps))
360 EDEVENT_FIRE(toolbarBitmapSizeChanged, (
bool largeBitmaps), (largeBitmaps))
OdSmartPtr< OdEditorImpl > OdEditorImplPtr
#define RXEVENT_FIRE(method, inparams, params)
#define RXEVENT_FIRE_ABORT(method, inparams, params, abortmethod, abortparams)
bool fxIsValidReactor(OdRxEventReactor *pRawReactor, const OdArray< OdRxEventReactorPtr > &apReactors, unsigned iHeuristicIndex)
#define DCEVENT_FIRE(method, inparams, params, IdMappingToDatabase)
#define EDEVENT_FIRE_ABORT(method, inparams, params, abortmethod, abortparams)
#define EDEVENT_FIRE(method, inparams, params)
OdArray< OdRxEventReactor * > fxCopyRawReactorPointers(OdArray< OdRxEventReactorPtr > &apReactors)
void reserve(size_type reserveLength)
size_type append(const T &value)
ODRX_DECLARE_MEMBERS(OdEditorImpl)
OdArray< OdRxEventReactorPtr > m_reactors
void addReactor(OdRxEventReactor *pReactor)
RXEVENT_FIRE(dwgFileOpened,(OdDbDatabase *db, const OdString &filename),(db, filename)) RXEVENT_FIRE(initialDwgFileOpenComplete
ODRX_DECLARE_MEMBERS(OdRxEventImpl)
OdRefCounter m_EventCounter
void removeReactor(OdRxEventReactor *pReactor)