Changes in src/Actions/Action_impl_pre.hpp [b4fa106:e4afb4]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action_impl_pre.hpp
rb4fa106 re4afb4 42 42 #include <boost/preprocessor/seq/transform.hpp> 43 43 44 // some derived names 44 // some derived names: if CATEGORY is not given, we don't prefix with it 45 #ifdef CATEGORY 45 46 #define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action)) 46 47 #define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME) 47 48 #define STATE BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, State)) 48 49 #define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters)) 50 #else 51 #define ACTION BOOST_PP_CAT(ACTIONNAME, Action) 52 #define COMMAND ACTIONNAME 53 #define STATE BOOST_PP_CAT(ACTIONNAME, State) 54 #define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters) 55 #endif 56 #define INSTANCE BOOST_PP_CAT(this_, BOOST_PP_CAT(ACTIONNAME, _instance)) 49 57 50 58 // check if no lists given … … 61 69 62 70 // check user has given name and category 63 #ifndef CATEGORY64 ERROR: No "CATEGORY" defined in: __FILE__65 #endif66 67 71 #ifndef ACTIONNAME 68 72 ERROR: No "ACTIONNAME" defined in: __FILE__ … … 110 114 >(\ 111 115 BOOST_PP_SEQ_ELEM(n, paramtokens)\ 112 , ValueStorage::getInstance().getDescription(\ 113 BOOST_PP_SEQ_ELEM(n, paramtokens)\ 114 )); 116 , Traits.getDescription()\ 117 ); 115 118 116 119 // prints set/queryCurrentValue (command) for paramreferences and paramtokens … … 125 128 #include "Actions/ActionRegistry.hpp" 126 129 #include "UIElements/Dialog.hpp" 127 #include "Actions/ValueStorage.hpp" 128 130 131 #ifdef paramtokens 132 #define statenecessary 1 133 #endif 134 #ifndef statetokens 135 #define statenecessary 1 136 #endif 129 137 130 138 // =========== memento to remember the state when undoing =========== 139 #ifdef statenecessary 131 140 class STATE : public ActionState { 132 141 public: … … 154 163 ACTION::PARAMS params; 155 164 }; 156 157 // =========== name of action =========== 158 const char ACTION::NAME[] = TOKEN; 165 #endif /* statenecessary */ 166 167 // (const) prototype to be placed into the ActionRegistry (must be deleted by registry itself) 168 const ACTION INSTANCE; 159 169 160 170 // =========== constructor =========== 161 171 ACTION::ACTION () : 162 Action( NAME)172 Action(ActionTrait<ACTION>()) 163 173 {} 164 174 165 175 // =========== destructor =========== 166 176 ACTION::~ACTION () 167 {} 177 { 178 //std::cout << "Action ACTION is being destroyed." << std::endl; 179 } 168 180 169 181 // =========== fill a dialog =========== … … 171 183 ASSERT(dialog,"No Dialog given when filling actionname's dialog"); 172 184 #if BOOST_PP_EQUAL(MAXPARAMTYPES,0) 173 dialog->queryEmpty( NAME, ValueStorage::getInstance().getDescription(NAME));185 dialog->queryEmpty(TOKEN, Traits.getDescription()); 174 186 #else 175 187 #define BOOST_PP_LOCAL_MACRO(n) dialog_print(~, n, ~) … … 192 204 { 193 205 ACTION::PARAMS params; 194 Action *ToCall = ActionRegistry::getInstance().getActionByName( ACTION::NAME); //->clone(params);206 Action *ToCall = ActionRegistry::getInstance().getActionByName( TOKEN ); //->clone(params); 195 207 #if BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0) 196 208 #define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, setCurrentValue, ) … … 223 235 #undef PARAMS 224 236 #undef STATE 237 #undef INSTANCE 225 238 226 239 #undef ACTIONNAME
Note:
See TracChangeset
for help on using the changeset viewer.