reapack

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

commit ce8d52a1496fe9b210b664cdd144e8056d58d2dd
parent a9be9bb84ee22b3cf9cc3f468e4035cf91604689
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Sun, 22 Nov 2015 17:36:38 -0500

implement Hello World action

Diffstat:
Asrc/global.hpp | 11+++++++++++
Msrc/main.cpp | 15++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/global.hpp b/src/global.hpp @@ -0,0 +1,11 @@ +#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,8 +1,15 @@ +#include "global.hpp" + #define REAPERAPI_IMPLEMENT #include "reaper_plugin_functions.h" -bool commandHook(int command, int flag) +static Global global; + +bool commandHook(const int command, const int flag) { + if(command != global.action.accel.cmd) + return false; + ShowMessageBox("Hello World!", "Test", 0); return true; } @@ -10,6 +17,9 @@ bool commandHook(int command, 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"; + if(!rec || rec->caller_version != REAPER_PLUGIN_VERSION || !rec->GetFunc) return 0; @@ -18,5 +28,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); + return 1; }