added a more flexible way of managing ProcEvents
modifying the global ProcEvent enum and refreshmap array is not needed anymore. You can now register new events dynamically, using a ProcEventMapper instance. See rtgui/localcontrast.cc for an example. Hopefully this solves the problem of recurring merge conflicts when different devs add different proc events
This commit is contained in:
@@ -519,11 +519,48 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
|
||||
HDR, // EvTMFattalAmount
|
||||
ALLNORAW, // EvWBEnabled
|
||||
RGBCURVE, // EvRGBEnabled
|
||||
LUMINANCECURVE, // EvLEnabled
|
||||
RGBCURVE, // EvLocalContastEnabled
|
||||
RGBCURVE, // EvLocalContrastRadius
|
||||
RGBCURVE, // EvLocalContrastAmount
|
||||
RGBCURVE, // EvLocalContrastDarkness
|
||||
RGBCURVE // EvLocalContrastLightness
|
||||
LUMINANCECURVE // EvLEnabled
|
||||
};
|
||||
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
RefreshMapper::RefreshMapper():
|
||||
next_event_(rtengine::NUMOFEVENTS)
|
||||
{
|
||||
for (int event = 0; event < rtengine::NUMOFEVENTS; ++event) {
|
||||
actions_[event] = refreshmap[event];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ProcEvent RefreshMapper::newEvent()
|
||||
{
|
||||
return ProcEvent(++next_event_);
|
||||
}
|
||||
|
||||
|
||||
void RefreshMapper::mapEvent(ProcEvent event, int action)
|
||||
{
|
||||
actions_[event] = action;
|
||||
}
|
||||
|
||||
|
||||
int RefreshMapper::getAction(ProcEvent event) const
|
||||
{
|
||||
auto it = actions_.find(event);
|
||||
if (it == actions_.end()) {
|
||||
return 0;
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RefreshMapper *RefreshMapper::getInstance()
|
||||
{
|
||||
static RefreshMapper instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
} // namespace rtengine
|
||||
|
Reference in New Issue
Block a user