reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 0e519f9f81916b3f379174f59d53b1a326b892dc
parent ce8d52a1496fe9b210b664cdd144e8056d58d2dd
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Mon, 23 Nov 2015 14:01:54 -0500

do some early refactoring

Diffstat:
MTupfile | 1+
Dsrc/global.hpp | 11-----------
Msrc/main.cpp | 13++++++-------
Asrc/reapack.cpp | 6++++++
Asrc/reapack.hpp | 16++++++++++++++++
5 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/Tupfile b/Tupfile @@ -4,6 +4,7 @@ CXXFLAGS := -Wall -Wextra -Werror -Wno-unused-parameter -pipe -fPIC CXXFLAGS += -fdiagnostics-color CXXFLAGS += -O2 -std=c++14 CXXFLAGS += -Ivendor/ -Ivendor/WDL/ -Ivendor/WDL/WDL/ +CXXFLAGS += -DWDL_NO_DEFINE_MINMAX LDFLAGS := -dynamiclib diff --git a/src/global.hpp b/src/global.hpp @@ -1,11 +0,0 @@ -#ifndef REAPACK_GLOBAL_HPP -#define REAPACK_GLOBAL_HPP - -#include "reaper_plugin.h" - -struct Global { - REAPER_PLUGIN_HINSTANCE instance = 0; - gaccel_register_t action; -}; - -#endif diff --git a/src/main.cpp b/src/main.cpp @@ -1,13 +1,13 @@ -#include "global.hpp" +#include "reapack.hpp" #define REAPERAPI_IMPLEMENT #include "reaper_plugin_functions.h" -static Global global; +static ReaPack reapack; bool commandHook(const int command, const int flag) { - if(command != global.action.accel.cmd) + if(command != reapack.actionId()) return false; ShowMessageBox("Hello World!", "Test", 0); @@ -17,8 +17,7 @@ bool commandHook(const int command, const int flag) extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT( REAPER_PLUGIN_HINSTANCE instance, reaper_plugin_info_t *rec) { - global.instance = instance; - global.action.desc = "ReaPack: Package Manager"; + reapack.instance = instance; if(!rec || rec->caller_version != REAPER_PLUGIN_VERSION || !rec->GetFunc) return 0; @@ -28,8 +27,8 @@ extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT( rec->Register("hookcommand", (void *)commandHook); - global.action.accel.cmd = rec->Register("command_id", (void *)"REAPACKMGR"); - rec->Register("gaccel", &global.action); + reapack.setActionId(rec->Register("command_id", (void *)"REAPACKMGR")); + rec->Register("gaccel", &reapack.action); return 1; } diff --git a/src/reapack.cpp b/src/reapack.cpp @@ -0,0 +1,6 @@ +#include "reapack.hpp" + +ReaPack::ReaPack() +{ + action.desc = "ReaPack: Package Manager"; +} diff --git a/src/reapack.hpp b/src/reapack.hpp @@ -0,0 +1,16 @@ +#ifndef REAPACK_REAPACK_HPP +#define REAPACK_REAPACK_HPP + +#include "reaper_plugin.h" + +struct ReaPack { + ReaPack(); + + int actionId() const { return action.accel.cmd; } + void setActionId(const int id) { action.accel.cmd = id; } + + REAPER_PLUGIN_HINSTANCE instance = 0; + gaccel_register_t action; +}; + +#endif