Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action_impl_pre.hpp

    rb4fa106 re4afb4  
    4242#include <boost/preprocessor/seq/transform.hpp>
    4343
    44 // some derived names
     44// some derived names: if CATEGORY is not given, we don't prefix with it
     45#ifdef CATEGORY
    4546#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
    4647#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
    4748#define STATE BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, State))
    4849#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))
    4957
    5058// check if no lists given
     
    6169
    6270// check user has given name and category
    63 #ifndef CATEGORY
    64 ERROR: No "CATEGORY" defined in: __FILE__
    65 #endif
    66 
    6771#ifndef ACTIONNAME
    6872ERROR: No "ACTIONNAME" defined in: __FILE__
     
    110114  >(\
    111115  BOOST_PP_SEQ_ELEM(n, paramtokens)\
    112   , ValueStorage::getInstance().getDescription(\
    113   BOOST_PP_SEQ_ELEM(n, paramtokens)\
    114   ));
     116  , Traits.getDescription()\
     117  );
    115118
    116119// prints set/queryCurrentValue (command) for paramreferences and paramtokens
     
    125128#include "Actions/ActionRegistry.hpp"
    126129#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
    129137
    130138// =========== memento to remember the state when undoing ===========
     139#ifdef statenecessary
    131140class STATE : public ActionState {
    132141public:
     
    154163  ACTION::PARAMS params;
    155164};
    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)
     168const ACTION INSTANCE;
    159169
    160170// =========== constructor ===========
    161171ACTION::ACTION () :
    162   Action(NAME)
     172  Action(ActionTrait<ACTION>())
    163173{}
    164174
    165175// =========== destructor ===========
    166176ACTION::~ACTION ()
    167 {}
     177{
     178  //std::cout << "Action ACTION is being destroyed." << std::endl;
     179}
    168180
    169181// =========== fill a dialog ===========
     
    171183        ASSERT(dialog,"No Dialog given when filling actionname's dialog");
    172184#if BOOST_PP_EQUAL(MAXPARAMTYPES,0)
    173         dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
     185        dialog->queryEmpty(TOKEN, Traits.getDescription());
    174186#else
    175187#define BOOST_PP_LOCAL_MACRO(n) dialog_print(~, n, ~)
     
    192204{
    193205  ACTION::PARAMS params;
    194   Action *ToCall = ActionRegistry::getInstance().getActionByName( ACTION::NAME ); //->clone(params);
     206  Action *ToCall = ActionRegistry::getInstance().getActionByName( TOKEN ); //->clone(params);
    195207#if BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
    196208#define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, setCurrentValue, )
     
    223235#undef PARAMS
    224236#undef STATE
     237#undef INSTANCE
    225238
    226239#undef ACTIONNAME
Note: See TracChangeset for help on using the changeset viewer.