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:
@@ -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
|
||||
|
Reference in New Issue
Block a user