Skip to content

Commit

Permalink
Fixed Swell
Browse files Browse the repository at this point in the history
  • Loading branch information
Levitanus committed Apr 11, 2024
1 parent 98a374f commit 012149e
Show file tree
Hide file tree
Showing 5 changed files with 11,405 additions and 34 deletions.
5 changes: 5 additions & 0 deletions low/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ mod codegen {
.allowlist_var("reaper_functions::.*")
.allowlist_var("swell_functions::.*")
.allowlist_var("SWELL_.*")
.allowlist_var("GWL_ID")
.allowlist_var("GW_CHILD")
.allowlist_var("CSURF_EXT_.*")
.allowlist_var("PCM_SINK_EXT_.*")
.allowlist_var("PCM_SOURCE_EXT_.*")
Expand Down Expand Up @@ -415,6 +417,9 @@ mod codegen {
fn generate_swell(file: &syn::File) {
let fn_ptrs = parse_fn_ptrs(file, "swell_functions");
let result = generate_swell_token_stream(&fn_ptrs);
let syntax_tree =
syn::parse_file(result.to_string().as_str()).unwrap();
let result = prettyplease::unparse(&syntax_tree);
std::fs::write("src/swell.rs", result.to_string())
.expect("Unable to write file");
}
Expand Down
2 changes: 2 additions & 0 deletions low/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub mod root {
pub const IDIGNORE: u32 = 5;
pub const IDYES: u32 = 6;
pub const IDNO: u32 = 7;
pub const GW_CHILD: u32 = 5;
pub const GWL_ID: i32 = -12;
pub const WM_CTLCOLORMSGBOX: u32 = 306;
pub const WM_CTLCOLOREDIT: u32 = 307;
pub const WM_CTLCOLORLISTBOX: u32 = 308;
Expand Down
65 changes: 33 additions & 32 deletions low/src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ pub use super::bindings::root::{
/// Windows (= `u32` on Windows) and `c_uint` on Linux (= `u32` on Linux).
pub use super::bindings::root::{
midi_quantize_mode_t, ACCEL, BM_GETCHECK, BM_GETIMAGE, BM_SETCHECK,
BM_SETIMAGE, BST_CHECKED, BST_INDETERMINATE, BST_UNCHECKED, CBN_CLOSEUP,
CBN_DROPDOWN, CBN_EDITCHANGE, CBN_SELCHANGE, CB_ADDSTRING,
BM_SETIMAGE, BOOL, BST_CHECKED, BST_INDETERMINATE, BST_UNCHECKED,
CBN_CLOSEUP, CBN_DROPDOWN, CBN_EDITCHANGE, CBN_SELCHANGE, CB_ADDSTRING,
CB_DELETESTRING, CB_FINDSTRING, CB_FINDSTRINGEXACT, CB_GETCOUNT,
CB_GETCURSEL, CB_GETITEMDATA, CB_GETLBTEXT, CB_GETLBTEXTLEN,
CB_INITSTORAGE, CB_INSERTSTRING, CB_RESETCONTENT, CB_SETCURSEL,
Expand All @@ -55,36 +55,37 @@ pub use super::bindings::root::{
DT_LEFT, DT_NOCLIP, DT_NOPREFIX, DT_RIGHT, DT_SINGLELINE, DT_TOP,
DT_VCENTER, DT_WORDBREAK, EN_CHANGE, EN_KILLFOCUS, EN_SETFOCUS,
GMEM_DDESHARE, GMEM_DISCARDABLE, GMEM_FIXED, GMEM_LOWER, GMEM_MOVEABLE,
GMEM_SHARE, GMEM_ZEROINIT, GUID, HANDLE, HBRUSH, HDC, HDC__, HINSTANCE,
HMENU, HMENU__, HWND, HWND__, IDABORT, IDCANCEL, IDIGNORE, IDNO, IDOK,
IDRETRY, IDYES, INT_PTR, LPARAM, LPSTR, LRESULT, MB_ICONERROR,
MB_ICONINFORMATION, MB_ICONSTOP, MB_OK, MB_OKCANCEL, MB_RETRYCANCEL,
MB_YESNO, MB_YESNOCANCEL, MENUITEMINFO, MF_BITMAP, MF_BYCOMMAND,
MF_BYPOSITION, MF_CHECKED, MF_DISABLED, MF_ENABLED, MF_GRAYED, MF_POPUP,
MF_SEPARATOR, MF_STRING, MF_UNCHECKED, MIIM_BITMAP, MSG, OPAQUE,
PAINTSTRUCT, PCM_SINK_EXT_CREATESOURCE, PCM_SOURCE_EXT_ADDMIDIEVENTS,
PCM_SOURCE_EXT_NOTIFYPREVIEWPLAYPOS, PCM_SOURCE_EXT_REMOVEFROMMIDIPOOL,
POINT, RECT, SB_BOTH, SB_BOTTOM, SB_CTL, SB_ENDSCROLL, SB_HORZ, SB_LEFT,
SB_LINEDOWN, SB_LINELEFT, SB_LINERIGHT, SB_LINEUP, SB_PAGEDOWN,
SB_PAGELEFT, SB_PAGERIGHT, SB_PAGEUP, SB_RIGHT, SB_THUMBPOSITION,
SB_THUMBTRACK, SB_TOP, SB_VERT, SCROLLINFO, SIF_ALL, SIF_DISABLENOSCROLL,
SIF_PAGE, SIF_POS, SIF_RANGE, SIF_TRACKPOS, SM_CXHSCROLL, SM_CXSCREEN,
SM_CXVSCROLL, SM_CYHSCROLL, SM_CYMENU, SM_CYSCREEN, SM_CYVSCROLL, SRCCOPY,
SRCCOPY_USEALPHACHAN, TPM_BOTTOMALIGN, TPM_CENTERALIGN, TPM_HORIZONTAL,
TPM_LEFTALIGN, TPM_LEFTBUTTON, TPM_NONOTIFY, TPM_RETURNCMD,
TPM_RIGHTALIGN, TPM_RIGHTBUTTON, TPM_TOPALIGN, TPM_VCENTERALIGN,
TPM_VERTICAL, TRANSPARENT, UINT, ULONG_PTR, VK_ADD, VK_BACK, VK_CAPITAL,
VK_CLEAR, VK_CONTROL, VK_DECIMAL, VK_DELETE, VK_DIVIDE, VK_DOWN, VK_END,
VK_ESCAPE, VK_F1, VK_F10, VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16,
VK_F17, VK_F18, VK_F19, VK_F2, VK_F20, VK_F21, VK_F22, VK_F23, VK_F24,
VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_HELP, VK_HOME,
VK_INSERT, VK_LBUTTON, VK_LEFT, VK_LWIN, VK_MBUTTON, VK_MENU, VK_MULTIPLY,
VK_NEXT, VK_NUMLOCK, VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3,
VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9,
VK_PAUSE, VK_PRINT, VK_PRIOR, VK_RBUTTON, VK_RETURN, VK_RIGHT, VK_SCROLL,
VK_SELECT, VK_SEPARATOR, VK_SHIFT, VK_SNAPSHOT, VK_SPACE, VK_SUBTRACT,
VK_TAB, VK_UP, WDL_INT64, WM_ACTIVATE, WM_ACTIVATEAPP, WM_CAPTURECHANGED,
WM_CHAR, WM_CLOSE, WM_COMMAND, WM_CONTEXTMENU, WM_COPYDATA, WM_CREATE,
GMEM_SHARE, GMEM_ZEROINIT, GUID, GWL_ID, GW_CHILD, HANDLE, HBRUSH, HDC,
HDC__, HINSTANCE, HMENU, HMENU__, HWND, HWND__, IDABORT, IDCANCEL,
IDIGNORE, IDNO, IDOK, IDRETRY, IDYES, INT_PTR, LPARAM, LPSTR, LRESULT,
MB_ICONERROR, MB_ICONINFORMATION, MB_ICONSTOP, MB_OK, MB_OKCANCEL,
MB_RETRYCANCEL, MB_YESNO, MB_YESNOCANCEL, MENUITEMINFO, MF_BITMAP,
MF_BYCOMMAND, MF_BYPOSITION, MF_CHECKED, MF_DISABLED, MF_ENABLED,
MF_GRAYED, MF_POPUP, MF_SEPARATOR, MF_STRING, MF_UNCHECKED, MIIM_BITMAP,
MSG, OPAQUE, PAINTSTRUCT, PCM_SINK_EXT_CREATESOURCE,
PCM_SOURCE_EXT_ADDMIDIEVENTS, PCM_SOURCE_EXT_NOTIFYPREVIEWPLAYPOS,
PCM_SOURCE_EXT_REMOVEFROMMIDIPOOL, POINT, RECT, SB_BOTH, SB_BOTTOM,
SB_CTL, SB_ENDSCROLL, SB_HORZ, SB_LEFT, SB_LINEDOWN, SB_LINELEFT,
SB_LINERIGHT, SB_LINEUP, SB_PAGEDOWN, SB_PAGELEFT, SB_PAGERIGHT,
SB_PAGEUP, SB_RIGHT, SB_THUMBPOSITION, SB_THUMBTRACK, SB_TOP, SB_VERT,
SCROLLINFO, SIF_ALL, SIF_DISABLENOSCROLL, SIF_PAGE, SIF_POS, SIF_RANGE,
SIF_TRACKPOS, SM_CXHSCROLL, SM_CXSCREEN, SM_CXVSCROLL, SM_CYHSCROLL,
SM_CYMENU, SM_CYSCREEN, SM_CYVSCROLL, SRCCOPY, SRCCOPY_USEALPHACHAN,
TPM_BOTTOMALIGN, TPM_CENTERALIGN, TPM_HORIZONTAL, TPM_LEFTALIGN,
TPM_LEFTBUTTON, TPM_NONOTIFY, TPM_RETURNCMD, TPM_RIGHTALIGN,
TPM_RIGHTBUTTON, TPM_TOPALIGN, TPM_VCENTERALIGN, TPM_VERTICAL,
TRANSPARENT, UINT, ULONG_PTR, VK_ADD, VK_BACK, VK_CAPITAL, VK_CLEAR,
VK_CONTROL, VK_DECIMAL, VK_DELETE, VK_DIVIDE, VK_DOWN, VK_END, VK_ESCAPE,
VK_F1, VK_F10, VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16, VK_F17,
VK_F18, VK_F19, VK_F2, VK_F20, VK_F21, VK_F22, VK_F23, VK_F24, VK_F3,
VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_HELP, VK_HOME, VK_INSERT,
VK_LBUTTON, VK_LEFT, VK_LWIN, VK_MBUTTON, VK_MENU, VK_MULTIPLY, VK_NEXT,
VK_NUMLOCK, VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4,
VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_PAUSE,
VK_PRINT, VK_PRIOR, VK_RBUTTON, VK_RETURN, VK_RIGHT, VK_SCROLL, VK_SELECT,
VK_SEPARATOR, VK_SHIFT, VK_SNAPSHOT, VK_SPACE, VK_SUBTRACT, VK_TAB, VK_UP,
WDL_INT64, WM_ACTIVATE, WM_ACTIVATEAPP, WM_CAPTURECHANGED, WM_CHAR,
WM_CLOSE, WM_COMMAND, WM_CONTEXTMENU, WM_COPYDATA, WM_CREATE,
WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX,
WM_CTLCOLORMSGBOX, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC, WM_DEADCHAR,
WM_DESTROY, WM_DISPLAYCHANGE, WM_DRAWITEM, WM_DROPFILES, WM_ERASEBKGND,
Expand Down
11,360 changes: 11,359 additions & 1 deletion low/src/swell.rs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion rea-rs/src/reaper.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rea_rs_low::{
raw::{self, gaccel_register_t},
register_plugin_destroy_hook, PluginContext,
register_plugin_destroy_hook, PluginContext, Swell,
};

use crate::{errors::ReaperStaticResult, keys::KeyBinding};
Expand Down Expand Up @@ -81,6 +81,7 @@ extern "C" fn timer_f() {

pub struct Reaper {
low: rea_rs_low::Reaper,
swell: Swell,
actions: Vec<Action>,
hook: extern "C" fn(i32, i32) -> bool,
accels: Vec<Gaccel>,
Expand All @@ -99,6 +100,7 @@ impl Reaper {
}
Self {
low,
swell: Swell::load(context),
actions,
hook,
accels: Vec::new(),
Expand All @@ -124,6 +126,9 @@ impl Reaper {
pub fn low(&self) -> &rea_rs_low::Reaper {
&self.low
}
pub fn swell(&self) -> &rea_rs_low::Swell {
&self.swell
}
pub fn plugin_context(&self) -> PluginContext {
self.low.plugin_context().clone()
}
Expand Down

0 comments on commit 012149e

Please sign in to comment.