Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action_impl_pre.hpp

    re4afb4 rb4fa106  
    4242#include <boost/preprocessor/seq/transform.hpp>
    4343
    44 // some derived names: if CATEGORY is not given, we don't prefix with it
    45 #ifdef CATEGORY
     44// some derived names
    4645#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
    4746#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
    4847#define STATE BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, State))
    4948#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))
    5749
    5850// check if no lists given
     
    6961
    7062// check user has given name and category
     63#ifndef CATEGORY
     64ERROR: No "CATEGORY" defined in: __FILE__
     65#endif
     66
    7167#ifndef ACTIONNAME
    7268ERROR: No "ACTIONNAME" defined in: __FILE__
     
    114110  >(\
    115111  BOOST_PP_SEQ_ELEM(n, paramtokens)\
    116   , Traits.getDescription()\
    117   );
     112  , ValueStorage::getInstance().getDescription(\
     113  BOOST_PP_SEQ_ELEM(n, paramtokens)\
     114  ));
    118115
    119116// prints set/queryCurrentValue (command) for paramreferences and paramtokens
     
    128125#include "Actions/ActionRegistry.hpp"
    129126#include "UIElements/Dialog.hpp"
    130 
    131 #ifdef paramtokens
    132 #define statenecessary 1
    133 #endif
    134 #ifndef statetokens
    135 #define statenecessary 1
    136 #endif
     127#include "Actions/ValueStorage.hpp"
     128
    137129
    138130// =========== memento to remember the state when undoing ===========
    139 #ifdef statenecessary
    140131class STATE : public ActionState {
    141132public:
     
    163154  ACTION::PARAMS params;
    164155};
    165 #endif /* statenecessary */
    166 
    167 // (const) prototype to be placed into the ActionRegistry (must be deleted by registry itself)
    168 const ACTION INSTANCE;
     156
     157// =========== name of action ===========
     158const char ACTION::NAME[] = TOKEN;
    169159
    170160// =========== constructor ===========
    171161ACTION::ACTION () :
    172   Action(ActionTrait<ACTION>())
     162  Action(NAME)
    173163{}
    174164
    175165// =========== destructor ===========
    176166ACTION::~ACTION ()
    177 {
    178   //std::cout << "Action ACTION is being destroyed." << std::endl;
    179 }
     167{}
    180168
    181169// =========== fill a dialog ===========
     
    183171        ASSERT(dialog,"No Dialog given when filling actionname's dialog");
    184172#if BOOST_PP_EQUAL(MAXPARAMTYPES,0)
    185         dialog->queryEmpty(TOKEN, Traits.getDescription());
     173        dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
    186174#else
    187175#define BOOST_PP_LOCAL_MACRO(n) dialog_print(~, n, ~)
     
    204192{
    205193  ACTION::PARAMS params;
    206   Action *ToCall = ActionRegistry::getInstance().getActionByName( TOKEN ); //->clone(params);
     194  Action *ToCall = ActionRegistry::getInstance().getActionByName( ACTION::NAME ); //->clone(params);
    207195#if BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
    208196#define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, setCurrentValue, )
     
    235223#undef PARAMS
    236224#undef STATE
    237 #undef INSTANCE
    238225
    239226#undef ACTIONNAME
Note: See TracChangeset for help on using the changeset viewer.