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:
Alberto Griggio
2017-12-19 13:46:19 +01:00
parent a2bd8acac9
commit c166e0a7ed
12 changed files with 215 additions and 23 deletions

View File

@@ -19,6 +19,9 @@
#ifndef __REFRESHMAP__
#define __REFRESHMAP__
#include <unordered_map>
#include "procevents.h"
// Use M_VOID if you wish to update the proc params without updating the preview at all !
#define M_VOID (1<<17)
// Use M_MINUPDATE if you wish to update the preview without modifying the image (think about it like a "refreshPreview")
@@ -74,4 +77,23 @@
#define OUTPUTPROFILE M_MONITOR
extern int refreshmap[];
namespace rtengine {
class RefreshMapper {
public:
static RefreshMapper *getInstance();
ProcEvent newEvent();
void mapEvent(ProcEvent event, int action);
int getAction(ProcEvent event) const;
private:
RefreshMapper();
int next_event_;
std::unordered_map<int, int> actions_;
};
} // namespace rtengine
#endif