diff --git a/Builds/MacOSX/Ctrlr.xcodeproj/project.pbxproj b/Builds/MacOSX/Ctrlr.xcodeproj/project.pbxproj
index 7cfedc7e5..3d10b8278 100644
--- a/Builds/MacOSX/Ctrlr.xcodeproj/project.pbxproj
+++ b/Builds/MacOSX/Ctrlr.xcodeproj/project.pbxproj
@@ -2859,6 +2859,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -2874,7 +2875,7 @@
LIBRARY_STYLE = Bundle;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-bundle -lCtrlr";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr;
@@ -2928,6 +2929,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -2943,7 +2945,7 @@
LIBRARY_STYLE = Bundle;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-bundle -lCtrlr";
OTHER_REZFLAGS = "-d ppc_$ppc -d i386_$i386 -d ppc64_$ppc64 -d x86_64_$x86_64 -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -I \"$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase\" -I \"$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AudioUnit.framework/Headers\"";
@@ -2996,6 +2998,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3009,7 +3012,7 @@
INFOPLIST_PREPROCESS = NO;
LIBRARY_STYLE = Bundle;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-bundle -lCtrlr";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr;
@@ -3061,6 +3064,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3074,7 +3078,7 @@
INFOPLIST_PREPROCESS = NO;
LIBRARY_STYLE = Bundle;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-bundle -lCtrlr";
OTHER_REZFLAGS = "-d ppc_$ppc -d i386_$i386 -d ppc64_$ppc64 -d x86_64_$x86_64 -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -I \"$(DEVELOPER_DIR)/Extras/CoreAudio/AudioUnits/AUPublic/AUBase\" -I \"$(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AudioUnit.framework/Headers\"";
@@ -3126,6 +3130,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3139,7 +3144,7 @@
INFOPLIST_PREPROCESS = NO;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-lCtrlr";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr;
@@ -3192,6 +3197,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3207,7 +3213,7 @@
LIBRARY_STYLE = Bundle;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-bundle -lCtrlr";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr;
@@ -3260,6 +3266,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3273,7 +3280,7 @@
INFOPLIST_PREPROCESS = NO;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-lCtrlr";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr.CtrlrAUv3;
@@ -3323,6 +3330,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3335,7 +3343,7 @@
INFOPLIST_FILE = Info-Standalone_Plugin.plist;
INFOPLIST_PREPROCESS = NO;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-lCtrlr";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr;
@@ -3436,6 +3444,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3448,7 +3457,7 @@
INFOPLIST_FILE = Info-AUv3_AppExtension.plist;
INFOPLIST_PREPROCESS = NO;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-lCtrlr";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr.CtrlrAUv3;
@@ -3499,6 +3508,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3511,7 +3521,7 @@
INSTALL_PATH = "@executable_path/../Frameworks";
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr;
PRODUCT_NAME = "Ctrlr";
@@ -3562,6 +3572,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3573,7 +3584,7 @@
);
INSTALL_PATH = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr;
PRODUCT_NAME = "Ctrlr";
@@ -3688,6 +3699,7 @@
"$(SRCROOT)/../../Source/Misc/luabind",
"$(SRCROOT)/../../Source/Misc/libusb/include",
"$(SRCROOT)/../../Source/Misc/boost",
+ "$(SRCROOT)/../../Source/Misc/vst2sdk",
"$(SRCROOT)/../../Source/MIDI",
"$(SRCROOT)/../../Source/Core",
"$(SRCROOT)/../../Source/Native",
@@ -3701,7 +3713,7 @@
INFOPLIST_PREPROCESS = NO;
LIBRARY_STYLE = Bundle;
MACOSX_DEPLOYMENT_TARGET = 10.11;
- MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
+ MTL_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK $(SRCROOT)/../../JuceLibraryCode $(SRCROOT)/../../JUCE/modules $(SRCROOT)/../../Source $(SRCROOT)/../../Source/Misc $(SRCROOT)/../../Source/Misc/include $(SRCROOT)/../../Source/Misc/lua/include $(SRCROOT)/../../Source/Misc/luabind $(SRCROOT)/../../Source/Misc/libusb/include $(SRCROOT)/../../Source/Misc/boost $(SRCROOT)/../../Source/Misc/vst2sdk $(SRCROOT)/../../Source/MIDI $(SRCROOT)/../../Source/Core $(SRCROOT)/../../Source/Native $(SRCROOT)/../../Source/Plugin $(SRCROOT)/../../Source/UIComponents $(SRCROOT)/../../Source/Lua $(SRCROOT)/../../JUCE/modules/juce_audio_plugin_client";
OTHER_CPLUSPLUSFLAGS = "-w";
OTHER_LDFLAGS = "-bundle -lCtrlr";
PRODUCT_BUNDLE_IDENTIFIER = com.instigator.Ctrlr;
diff --git a/Builds/MacOSX/Info-AU.plist b/Builds/MacOSX/Info-AU.plist
index 316d97615..5ae69a0f7 100644
--- a/Builds/MacOSX/Info-AU.plist
+++ b/Builds/MacOSX/Info-AU.plist
@@ -37,7 +37,7 @@
manufacturer
inSt
type
- CtrlrAU
+ aumi
subtype
cTrl
version
diff --git a/Builds/MacOSX/Info-AUv3_AppExtension.plist b/Builds/MacOSX/Info-AUv3_AppExtension.plist
index 7be04defe..14c58867f 100644
--- a/Builds/MacOSX/Info-AUv3_AppExtension.plist
+++ b/Builds/MacOSX/Info-AUv3_AppExtension.plist
@@ -45,7 +45,7 @@
manufacturer
inSt
type
- CtrlrAU
+ aumi
subtype
cTrl
version
diff --git a/Ctrlr.jucer b/Ctrlr.jucer
index 3fa104bb3..351dcce9e 100644
--- a/Ctrlr.jucer
+++ b/Ctrlr.jucer
@@ -10,7 +10,7 @@
pluginIsSynth="1" pluginWantsMidiIn="1" pluginProducesMidiOut="1"
pluginIsMidiEffectPlugin="1" pluginEditorRequiresKeys="1" pluginAUExportPrefix="CtrlrAU"
pluginRTASCategory="" aaxIdentifier="com.instigator.Ctrlr" pluginAAXCategory="2"
- companyName="Instigator" pluginAUMainType="CtrlrAU" pluginFormats="buildVST,buildVST3,buildAU,buildAUv3,buildStandalone"
+ companyName="Instigator" pluginFormats="buildVST,buildVST3,buildAU,buildAUv3,buildStandalone"
pluginCharacteristicsValue="pluginIsSynth,pluginWantsMidiIn,pluginProducesMidiOut,pluginIsMidiEffectPlugin,pluginEditorRequiresKeys"
jucerFormatVersion="1">
@@ -1060,9 +1060,9 @@
enableGNUExtensions="0" extraCompilerFlags="-w">
+ headerPath="../../Source
../../Source/Misc
../../Source/Misc/include
../../Source/Misc/lua/include
../../Source/Misc/luabind
../../Source/Misc/libusb/include
../../Source/Misc/boost
../../Source/Misc/vst2sdk
../../Source/MIDI
../../Source/Core
../../Source/Native
../../Source/Plugin
../../Source/UIComponents
../../Source/Lua"/>
diff --git a/JUCE/modules/juce_audio_plugin_client/AU/CoreAudioUtilityClasses/AUCarbonViewBase.cpp b/JUCE/modules/juce_audio_plugin_client/AU/CoreAudioUtilityClasses/AUCarbonViewBase.cpp
index 4b9525b1b..7de90afec 100644
--- a/JUCE/modules/juce_audio_plugin_client/AU/CoreAudioUtilityClasses/AUCarbonViewBase.cpp
+++ b/JUCE/modules/juce_audio_plugin_client/AU/CoreAudioUtilityClasses/AUCarbonViewBase.cpp
@@ -285,7 +285,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
// [4/4]
/* <-- kEventParamOrigin (out, typeHIPoint)
- * On exit, contains the scrollable viewÕs current origin (the
+ * On exit, contains the scrollable view's current origin (the
* view-relative coordinate that is drawn at the top left
* corner of its frame). These coordinates should always be
* greater than or equal to zero. They should be less than or
diff --git a/JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp b/JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp
index 21042d0b2..580d62319 100644
--- a/JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp
+++ b/JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp
@@ -1246,7 +1246,7 @@ void LookAndFeel_V4::drawPropertyPanelSectionHeader (Graphics& g, const String&
g.setColour (findColour (PropertyComponent::labelTextColourId));
g.setFont ({ (float) height * 0.7f, Font::bold });
- g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true);
+ g.drawText (name, textX, 0, std::max(width - textX - 4,1), height, Justification::centredLeft, true);
}
void LookAndFeel_V4::drawPropertyComponentBackground (Graphics& g, int width, int height, PropertyComponent& component)
diff --git a/JuceLibraryCode/BinaryData.cpp b/JuceLibraryCode/BinaryData.cpp
index e9be2126d..278154268 100644
--- a/JuceLibraryCode/BinaryData.cpp
+++ b/JuceLibraryCode/BinaryData.cpp
@@ -18778,8 +18778,8 @@ static const unsigned char temp_binary_data_81[] =
"end\r\n"
" \r\n"
"\r\n"
-" \r\n"
-" \r\n"
+" \r\n"
+" \r\n"
" \r\n"
" \r\n"
"\r\n";
diff --git a/JuceLibraryCode/JucePluginDefines.h b/JuceLibraryCode/JucePluginDefines.h
index 80dea9e83..c891730d6 100644
--- a/JuceLibraryCode/JucePluginDefines.h
+++ b/JuceLibraryCode/JucePluginDefines.h
@@ -92,7 +92,7 @@
#define JucePlugin_Vst3Category "Instrument|Synth"
#endif
#ifndef JucePlugin_AUMainType
- #define JucePlugin_AUMainType CtrlrAU
+ #define JucePlugin_AUMainType 'aumi'
#endif
#ifndef JucePlugin_AUSubType
#define JucePlugin_AUSubType JucePlugin_PluginCode
diff --git a/README.md b/README.md
index 572cab356..c15710a51 100644
--- a/README.md
+++ b/README.md
@@ -6,10 +6,10 @@ Control any MIDI enabled hardware: synthesizers, drum machines, samplers, effect
Cross Platform
==============
-Works on Windows (XP and up, both 64 and 32bit binaries are available), MAC OSX (10.5 and up), Linux (any modern distro should run it).
+Works on Windows (XP and up, both 64 and 32bit binaries are available), macOS (10.5 and up), Linux (any modern distro should run it).
Host in your DAW
-Each platform has a VST build of Ctrlr so you can host your panels as normal VST plugins, for the OSX a special AU build is available.
+Each platform has a VST build of Ctrlr so you can host your panels as normal VST plugins, for macOS a special AU build is available.
Customize
=========
@@ -71,15 +71,17 @@ The post-commit script takes an argument "clean" if you wish to clean all the in
files before building. If you want to ignore any package errors that it reports (i assume you
know your system better then my script) then just add -f as an option when building.
-OSX
-===
-You need the CoreAudio developer files for the build to work.
+macOS
+=====
+Unzip boost or link your own boost library e.g. from [Homebrew](https://brew.sh):
-First you need to build the AU_wrapper library that simplifies the build a lot, it's located in
-Builds/Generated/Mac/AU_Wrapper, it will create a .a library and try to put it in /usr/local/lib
-if it fails, do that manualy (permission problems)
+```
+# use packaged boost library
+cd Source/Misc/boost && unzip boost.zip
+# alternatively, link your own
+ln -s /opt/homebrew/Cellar/boost/BOOST_VERSION/include/boost Source/Misc/boost/boost
+```
-Open the corresponding Xcode project in Builds/Generated/Mac, after that just build it, in case of
-errors you are on your own, the amount of changes between Xcode versions and OSX versions is impossible
-for me to track, you can post an issue and i'll try to solve it.
+Open the Xcode project `Builds/MacOSX/Ctrlr.xcodeproj` and build it.
+In case of errors it might help to refresh the project files using Projuicer.
diff --git a/Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp b/Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp
index 2caaf3f69..e4c909960 100644
--- a/Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp
+++ b/Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp
@@ -49,7 +49,7 @@ void CtrlrModulatorProcessor::handleAsyncUpdate()
if (valueChangedCbk.get() && !owner.getRestoreState())
{
CtrlrPanel &ownerPanel = owner.getOwnerPanel();
- if (!ownerPanel.getRestoreState() && !ownerPanel.getBootstrapState() && valueChangedCbk->isValid())
+ if (!ownerPanel.getRestoreState() && !ownerPanel.getBootstrapState() && valueChangedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (valueChangedCbk,
&owner,
@@ -324,7 +324,7 @@ int CtrlrModulatorProcessor::getValueFromMidiMessage(const CtrlrMIDIDeviceType s
if (getValueFromMidiCbk)
{
- if (!getValueFromMidiCbk.wasObjectDeleted() && getValueForMidiCbk->isValid())
+ if (!getValueFromMidiCbk.wasObjectDeleted() && getValueForMidiCbk->isCallable())
{
evaluationResult = owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().callWithRet (getValueFromMidiCbk, &owner, getMidiMessage(source), evaluationResult);
}
@@ -477,7 +477,7 @@ int CtrlrModulatorProcessor::getValueForMidiMessage(const int value)
if (getValueForMidiCbk)
{
- if (!getValueForMidiCbk.wasObjectDeleted() && getValueForMidiCbk->isValid())
+ if (!getValueForMidiCbk.wasObjectDeleted() && getValueForMidiCbk->isCallable())
{
evaluationResult = owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().callWithRet (getValueForMidiCbk, &owner, evaluationResult);
}
diff --git a/Source/Core/CtrlrPanel/CtrlrPanel.cpp b/Source/Core/CtrlrPanel/CtrlrPanel.cpp
index 5548f5b17..dc1fc9edd 100644
--- a/Source/Core/CtrlrPanel/CtrlrPanel.cpp
+++ b/Source/Core/CtrlrPanel/CtrlrPanel.cpp
@@ -230,6 +230,7 @@ Result CtrlrPanel::restoreState (const ValueTree &savedState)
File panelFile = userDocsDir.getNonexistentChildFile("CtrlrPanel", ".panel");
filePath = panelFile.getFullPathName();
}
+ _DBG(filePath);
panelTree.setProperty(Ids::panelFilePath, filePath, nullptr);
ctrlrLuaManager->restoreState(savedState.getChildWithName(Ids::luaManager));
@@ -278,7 +279,7 @@ Result CtrlrPanel::restoreState (const ValueTree &savedState)
if (luaPanelBeforeLoadCbk && !luaPanelBeforeLoadCbk.wasObjectDeleted())
{
- if (luaPanelBeforeLoadCbk->isValid())
+ if (luaPanelBeforeLoadCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelBeforeLoadCbk);
}
@@ -342,7 +343,7 @@ void CtrlrPanel::bootstrapPanel(const bool setInitialProgram)
if (luaPanelLoadedCbk.get())
{
- if (luaPanelLoadedCbk->isValid())
+ if (luaPanelLoadedCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelLoadedCbk, (uint8)owner.getInstanceMode());
}
@@ -829,7 +830,7 @@ ValueTree CtrlrPanel::getCustomData()
if (luaPanelSaveStateCbk && !luaPanelSaveStateCbk.wasObjectDeleted())
{
- if (luaPanelSaveStateCbk->isValid())
+ if (luaPanelSaveStateCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelSaveStateCbk, customData);
}
@@ -852,7 +853,7 @@ void CtrlrPanel::setCustomData (const ValueTree &customData)
{
if (luaPanelRestoreStateCbk && !luaPanelRestoreStateCbk.wasObjectDeleted())
{
- if (luaPanelRestoreStateCbk->isValid())
+ if (luaPanelRestoreStateCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelRestoreStateCbk, customData);
}
@@ -912,7 +913,7 @@ void CtrlrPanel::setProgram(ValueTree programTree, const bool sendSnapshotNow)
if (luaPanelProgramChangedCbk && !luaPanelProgramChangedCbk.wasObjectDeleted())
{
- if (luaPanelProgramChangedCbk->isValid())
+ if (luaPanelProgramChangedCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelProgramChangedCbk);
}
@@ -1088,7 +1089,7 @@ void CtrlrPanel::handleAsyncUpdate()
bool luaValid = false;
if (luaPanelMidiReceivedCbk)
- luaValid = luaPanelMidiReceivedCbk->isValid();
+ luaValid = luaPanelMidiReceivedCbk->isCallable();
while (i.getNextEvent(m,time))
{
@@ -1181,7 +1182,7 @@ void CtrlrPanel::setMidiChannel(const CtrlrPanelMidiChannel optionToSet, const u
if (luaPanelMidiChannelChangedCbk && !luaPanelMidiChannelChangedCbk.wasObjectDeleted())
{
- if (luaPanelMidiChannelChangedCbk->isValid())
+ if (luaPanelMidiChannelChangedCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelMidiChannelChangedCbk, (int)optionToSet, (int)value);
}
@@ -1275,7 +1276,7 @@ void CtrlrPanel::modulatorValueChanged(CtrlrModulator *m)
if (luaPanelModulatorValueChangedCbk && !luaPanelModulatorValueChangedCbk.wasObjectDeleted())
{
- if (luaPanelModulatorValueChangedCbk->isValid())
+ if (luaPanelModulatorValueChangedCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelModulatorValueChangedCbk, m, m->getValueNonMapped());
}
@@ -1461,7 +1462,7 @@ void CtrlrPanel::luaSavePanel(const CtrlrPanelFileType fileType, const File &fil
{
if (luaPanelSavedCbk && !luaPanelSavedCbk.wasObjectDeleted())
{
- if (luaPanelSavedCbk->isValid())
+ if (luaPanelSavedCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelSavedCbk, (int)fileType, file);
}
@@ -1497,7 +1498,7 @@ void CtrlrPanel::sendMidiProgramChange()
if (luaPanelProgramChangedCbk && !luaPanelProgramChangedCbk.wasObjectDeleted())
{
- if (luaPanelProgramChangedCbk->isValid())
+ if (luaPanelProgramChangedCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelProgramChangedCbk, program, bankLsb, bankMsb);
}
@@ -1665,7 +1666,7 @@ void CtrlrPanel::notify (const String ¬ification, CtrlrNotificationCallback *
{
if (luaPanelMessageHandlerCbk && !luaPanelMessageHandlerCbk.wasObjectDeleted())
{
- if (luaPanelMessageHandlerCbk->isValid())
+ if (luaPanelMessageHandlerCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelMessageHandlerCbk, notification, ctrlrNotificationType);
}
@@ -1765,7 +1766,7 @@ void CtrlrPanel::resourceImportFinished()
if (luaPanelResourcesLoadedCbk && !luaPanelResourcesLoadedCbk.wasObjectDeleted())
{
- if (luaPanelResourcesLoadedCbk->isValid())
+ if (luaPanelResourcesLoadedCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelResourcesLoadedCbk);
}
diff --git a/Source/Core/CtrlrPanel/CtrlrPanel.h b/Source/Core/CtrlrPanel/CtrlrPanel.h
index a544ae4c3..2e122bd69 100644
--- a/Source/Core/CtrlrPanel/CtrlrPanel.h
+++ b/Source/Core/CtrlrPanel/CtrlrPanel.h
@@ -145,6 +145,7 @@ class CtrlrPanel: public ValueTree::Listener,
File getPanelContentDir();
File getPanelLuaDir();
File getPanelResourcesDir();
+ Result convertLuaMethodToFile(ValueTree & item);
Result convertLuaMethodsToFiles(const String dirPath);
File getLuaMethodGroupDir(const ValueTree &methodGroup);
@@ -183,7 +184,8 @@ class CtrlrPanel: public ValueTree::Listener,
static void writePanelXml(OutputStream &outputStream, CtrlrPanel *panel, const bool compressPanel);
Result writeLuaMethod(const File &parentDir, ValueTree *method);
Result writeLuaMethodGroup(const File &parentDir, ValueTree *methodGroup);
- Result writeLuaChildren(const File &parentDir, ValueTree *parentElement);
+ Result writeLuaChild(const File &parentDir, ValueTree *child);
+ Result writeLuaChildren(const File &parentDir, ValueTree *parentElement);
File getLuaMethodSourceFile(const ValueTree *method);
static void convertLuaMethodsToPropeties(const File &panelLuaDir, ValueTree &panelTree);
static void convertLuaMethodToProperty(const File &panelLuaDir, ValueTree *method);
diff --git a/Source/Core/CtrlrPanel/CtrlrPanelFileOperations.cpp b/Source/Core/CtrlrPanel/CtrlrPanelFileOperations.cpp
index 90bc3bf0a..5bec2524b 100644
--- a/Source/Core/CtrlrPanel/CtrlrPanelFileOperations.cpp
+++ b/Source/Core/CtrlrPanel/CtrlrPanelFileOperations.cpp
@@ -92,6 +92,36 @@ File CtrlrPanel::getLuaMethodGroupDir(const ValueTree &methodGroup)
return result;
}
+Result CtrlrPanel::convertLuaMethodToFile(ValueTree & item)
+{
+ Result res = Result::ok();
+ if (!item.isValid() || !item.hasType(Ids::luaMethod))
+ {
+ res = Result::fail("Internal error: Ony Lua methods can be converted to files.");
+ }
+ File methodLuaDirectory(getLuaMethodGroupDir(item.getParent()));
+ if (methodLuaDirectory.existsAsFile())
+ { // A directory with that name already exists
+ res = Result::fail("Convert to file can't create directory (a file with that name already exists): " + methodLuaDirectory.getFullPathName());
+ }
+ else if (!methodLuaDirectory.exists())
+ {
+ res = methodLuaDirectory.createDirectory();
+ }
+ if (res.ok())
+ {
+ if (methodLuaDirectory.hasWriteAccess())
+ { // Save lua code
+ res = writeLuaChild(methodLuaDirectory, &item);
+ }
+ else
+ {
+ res = Result::fail("Convert to XML can't write in panel directory: " + methodLuaDirectory.getFullPathName());
+ }
+ }
+ return res;
+}
+
Result CtrlrPanel::convertLuaMethodsToFiles(const String dirPath)
{
Result res = Result::ok();
@@ -680,35 +710,46 @@ Result CtrlrPanel::writeLuaMethodGroup(const File &parentDir, ValueTree *methodG
return res;
}
-Result CtrlrPanel::writeLuaChildren(const File &parentDir, ValueTree *parentElement)
+Result CtrlrPanel::writeLuaChild(const File &parentDir, ValueTree *child)
{
- if (parentElement == nullptr)
- return Result::fail("Parent element is missing");
+ if (child == nullptr)
+ return Result::fail("Child element is missing");
Result res = Result::ok();
- for (int i = 0; igetNumChildren(); i++)
+ if (child->hasType(Ids::luaMethod))
{
- ValueTree child = parentElement->getChild(i);
- if (child.hasType(Ids::luaMethod))
- {
- if ((int)child.getProperty(Ids::luaMethodSource) != CtrlrLuaMethod::codeInFile)
- { // Only process methods that are not already saved in files
- res = CtrlrPanel::writeLuaMethod(parentDir, &child);
- if (res.failed())
- { // Break on first error
- return res;
- }
- }
- }
- else if (child.hasType(Ids::luaMethodGroup))
+ if ((int)child->getProperty(Ids::luaMethodSource) != CtrlrLuaMethod::codeInFile)
{
- res = CtrlrPanel::writeLuaMethodGroup(parentDir, &child);
+ // Only process methods that are not already saved in files
+ res = CtrlrPanel::writeLuaMethod(parentDir, child);
if (res.failed())
{ // Break on first error
return res;
}
}
}
+ else if (child->hasType(Ids::luaMethodGroup))
+ {
+ res = CtrlrPanel::writeLuaMethodGroup(parentDir, child);
+ if (res.failed())
+ { // Break on first error
+ return res;
+ }
+ }
+ return res;
+}
+
+Result CtrlrPanel::writeLuaChildren(const File &parentDir, ValueTree *parentElement)
+{
+ if (parentElement == nullptr)
+ return Result::fail("Parent element is missing");
+
+ Result res = Result::ok();
+ for (int i = 0; igetNumChildren(); i++)
+ {
+ ValueTree child = parentElement->getChild(i);
+ writeLuaChild(parentDir, &child);
+ }
return res;
}
@@ -978,7 +1019,8 @@ void CtrlrPanel::updatePanelWindowTitle()
{
editor->setName(newName);
// Trigger editor window title update
- owner.getEditor()->activeCtrlrChanged();
+ auto editor = owner.getEditor();
+ if (editor) editor->activeCtrlrChanged();
}
}
}
@@ -1038,4 +1080,4 @@ bool CtrlrPanel::canClose(const bool closePanel)
}
}
return result;
-}
+}
diff --git a/Source/Core/CtrlrPanel/CtrlrPanelMIDISnapshot.cpp b/Source/Core/CtrlrPanel/CtrlrPanelMIDISnapshot.cpp
index d7353f90e..31e263ea1 100644
--- a/Source/Core/CtrlrPanel/CtrlrPanelMIDISnapshot.cpp
+++ b/Source/Core/CtrlrPanel/CtrlrPanelMIDISnapshot.cpp
@@ -3,26 +3,26 @@
#include "CtrlrLog.h"
#include "CtrlrPanel/CtrlrPanel.h"
#include "CtrlrPanelMIDISnapshot.h"
-#include "CtrlrLuaManager.h"
+#include "CtrlrLuaManager.h"
CtrlrPanelMIDISnapshot::CtrlrPanelMIDISnapshot(CtrlrPanel &_owner)
: owner(_owner),
Thread("MIDI Snapshot"),
- snapshotDelay(50),
- showDialog(false),
- alertWindow(nullptr),
- wasCancelledByUser(false),
- luaPanelMidiSnapshotPreCbk(nullptr),
+ snapshotDelay(50),
+ showDialog(false),
+ alertWindow(nullptr),
+ wasCancelledByUser(false),
+ luaPanelMidiSnapshotPreCbk(nullptr),
luaPanelMidiSnapshotPostCbk(nullptr)
{
buffer.ensureSize(8192);
}
CtrlrPanelMIDISnapshot::~CtrlrPanelMIDISnapshot()
-{
- if (alertWindow)
- deleteAndZero (alertWindow);
-
+{
+ if (alertWindow)
+ deleteAndZero (alertWindow);
+
stopThread (500);
}
@@ -34,13 +34,13 @@ void CtrlrPanelMIDISnapshot::sendSnapshot()
void CtrlrPanelMIDISnapshot::handleAsyncUpdate()
{
gatherSnapshotData();
- startThread();
-
+ startThread();
+
startTimer (100);
- if (alertWindow)
+ if (alertWindow)
{
const ScopedLock sl (messageLock);
- alertWindow->setMessage (message);
+ alertWindow->setMessage (message);
alertWindow->enterModalState();
}
}
@@ -69,100 +69,102 @@ void CtrlrPanelMIDISnapshot::gatherSnapshotData()
}
}
}
- }
-
- showDialog = owner.getProperty(Ids::panelMidiSnapshotShowProgress);
-
- if (showDialog)
- {
- if (alertWindow == nullptr)
- {
+ }
+
+ showDialog = owner.getProperty(Ids::panelMidiSnapshotShowProgress);
+
+ if (showDialog)
+ {
+ if (alertWindow == nullptr)
+ {
alertWindow = LookAndFeel::getDefaultLookAndFeel().createAlertWindow ("MIDI Snapshot", String(), "Stop", String(), String(), AlertWindow::NoIcon, 1, nullptr);
alertWindow->setEscapeKeyCancels (false);
- alertWindow->addProgressBarComponent (progress);
- }
- }
- else
- {
- alertWindow = nullptr;
- }
-
+ alertWindow->addProgressBarComponent (progress);
+ }
+ }
+ else
+ {
+ alertWindow = nullptr;
+ }
+
if (luaPanelMidiSnapshotPreCbk && !luaPanelMidiSnapshotPreCbk.wasObjectDeleted())
{
- if (luaPanelMidiSnapshotPreCbk->isValid())
+ if (luaPanelMidiSnapshotPreCbk->isCallable())
{
owner.getCtrlrLuaManager().getMethodManager().call (luaPanelMidiSnapshotPreCbk, &buffer);
}
}
-}
-
+}
+
void CtrlrPanelMIDISnapshot::setStatusMessage (const String& newStatusMessage)
{
const ScopedLock sl (messageLock);
message = newStatusMessage;
-}
+}
void CtrlrPanelMIDISnapshot::run()
{
MidiBuffer::Iterator i(buffer);
MidiMessage m; int t; int k=0;
- while (i.getNextEvent(m,t))
- {
+ while (!threadShouldExit() && i.getNextEvent(m,t))
+ {
progress = k / (double) buffer.getNumEvents();
owner.sendMidi(m);
k++;
wait(snapshotDelay);
}
+ while (!threadShouldExit()) {
+ wait(-1);
+ }
}
void CtrlrPanelMIDISnapshot::setDelay(const int _snapshotDelay)
{
snapshotDelay = _snapshotDelay;
-}
-
-void CtrlrPanelMIDISnapshot::timerCallback()
-{
+}
+
+void CtrlrPanelMIDISnapshot::timerCallback()
+{
bool threadStillRunning = isThreadRunning();
if (! threadStillRunning)
{
stopTimer();
- stopThread (500);
-
- if (alertWindow)
- {
+
+ if (alertWindow)
+ {
if (alertWindow->isCurrentlyModal())
- alertWindow->exitModalState (1);
+ alertWindow->exitModalState (1);
- alertWindow->setVisible (false);
+ alertWindow->setVisible (false);
}
- wasCancelledByUser = threadStillRunning;
-
+ wasCancelledByUser = threadStillRunning;
+
if (luaPanelMidiSnapshotPostCbk && !luaPanelMidiSnapshotPostCbk.wasObjectDeleted())
{
- if (luaPanelMidiSnapshotPostCbk->isValid())
+ if (luaPanelMidiSnapshotPostCbk->isCallable())
{
owner.getCtrlrLuaManager().getMethodManager().call (luaPanelMidiSnapshotPostCbk, &buffer);
}
- }
+ }
return; // (this may be deleted now)
}
-
- if (alertWindow)
+
+ if (alertWindow)
{
const ScopedLock sl (messageLock);
- alertWindow->setMessage (message);
- }
-}
-
-void CtrlrPanelMIDISnapshot::setPreLuaCallback(CtrlrLuaMethod *method)
-{
- luaPanelMidiSnapshotPreCbk = method;
-}
-
-void CtrlrPanelMIDISnapshot::setPostLuaCallback(CtrlrLuaMethod *method)
-{
- luaPanelMidiSnapshotPostCbk = method;
-}
+ alertWindow->setMessage (message);
+ }
+}
+
+void CtrlrPanelMIDISnapshot::setPreLuaCallback(CtrlrLuaMethod *method)
+{
+ luaPanelMidiSnapshotPreCbk = method;
+}
+
+void CtrlrPanelMIDISnapshot::setPostLuaCallback(CtrlrLuaMethod *method)
+{
+ luaPanelMidiSnapshotPostCbk = method;
+}
diff --git a/Source/Core/CtrlrPanel/CtrlrPanelProcessor.cpp b/Source/Core/CtrlrPanel/CtrlrPanelProcessor.cpp
index 19285734e..40388030f 100644
--- a/Source/Core/CtrlrPanel/CtrlrPanelProcessor.cpp
+++ b/Source/Core/CtrlrPanel/CtrlrPanelProcessor.cpp
@@ -91,7 +91,7 @@ CtrlrPanel &CtrlrPanelProcessor::getOwner()
void CtrlrPanelProcessor::processLua(MidiBuffer &midiMessages, const AudioPlayHead::CurrentPositionInfo &info)
{
- if (luaAudioProcessBlockCbk && luaAudioProcessBlockCbk->isValid())
+ if (luaAudioProcessBlockCbk && luaAudioProcessBlockCbk->isCallable())
{
owner.getCtrlrLuaManager().getMethodManager().callAudio(luaAudioProcessBlockCbk, midiMessages, info);
}
diff --git a/Source/Core/stdafx_luabind.h b/Source/Core/stdafx_luabind.h
index 77599826a..5d88b75d0 100644
--- a/Source/Core/stdafx_luabind.h
+++ b/Source/Core/stdafx_luabind.h
@@ -159,7 +159,7 @@ namespace luabind
String* wp = object_cast(obj);
return String(*wp);
}
- return String(lua_tostring(L, index));
+ return String(CharPointer_UTF8 (lua_tostring(L, index)));
}
void to(lua_State* L, String const &value)
diff --git a/Source/Lua/CtrlrLuaManager.cpp b/Source/Lua/CtrlrLuaManager.cpp
index b8dfda592..a97ca8f18 100644
--- a/Source/Lua/CtrlrLuaManager.cpp
+++ b/Source/Lua/CtrlrLuaManager.cpp
@@ -203,6 +203,7 @@ void CtrlrLuaManager::wrapCore (lua_State* L)
void CtrlrLuaManager::wrapCtrlrClasses(lua_State* L)
{
+ _DBG("CtrlrLuaManager::wrapCtrlrClasses");
CtrlrValueMap::wrapForLua (L);
CtrlrModulator::wrapForLua (L);
CtrlrPanel::wrapForLua (L);
@@ -276,11 +277,47 @@ int func_panic(lua_State *L)
lua_getglobal(L, "ERROR");
return(0);
}
+/*
+ * dump_stack(ls);
+ */
+static void dump_stack(lua_State *L)
+{
+ int i;
+ int top = lua_gettop(L);
+ printf("\n#### BOS ####\n");
+ for(i = top; i >= 1; i--)
+ {
+ int t = lua_type(L, i);
+ switch(t)
+ {
+ case LUA_TSTRING:
+ printf("%i (%i) = `%s'", i, i - (top + 1), lua_tostring(L, i));
+ break;
-bool CtrlrLuaManager::runCode (const String &code, const String name)
+ case LUA_TBOOLEAN:
+ printf("%i (%i) = %s", i, i - (top + 1), lua_toboolean(L, i) ? "true" : "false");
+ break;
+
+ case LUA_TNUMBER:
+ printf("%i (%i) = %g", i, i - (top + 1), lua_tonumber(L, i));
+ break;
+
+ default:
+ printf("%i (%i) = %s", i, i - (top + 1), lua_typename(L, t));
+ break;
+ }
+ printf("\n");
+ }
+ printf("#### EOS ####\n");
+ printf("\n");
+}
+
+CtrlrLuaMethod::Type CtrlrLuaManager::runCode (const String &code, const String name)
{
if (luaState && !isLuaDisabled())
{
+ //std::clog << "Executing Lua code " << (const char *) name.toUTF8() << std::endl;
+
if (luaL_loadbuffer(luaState, code.toUTF8(), std::strlen(code.toUTF8()), name.isEmpty() ? "_runtime" : name.toUTF8())
|| lua_pcall(luaState, 0, 0, 0))
{
@@ -288,14 +325,43 @@ bool CtrlrLuaManager::runCode (const String &code, const String name)
_LERR("ERROR: " + String(a));
lastError = "ERROR: " + String(a);
lua_pop(luaState, 1);
- return (false);
+ return (CtrlrLuaMethod::ERROR);
+ } else if (!name.isEmpty()) {
+ //std::clog << code << std::endl;
+ lua_getglobal(luaState,name.toUTF8());
+ //dump_stack(luaState);
+ int type = lua_type(luaState,1);
+ lua_pop(luaState,1);
+ switch (type) {
+ case CtrlrLuaMethod::NONE:
+ case CtrlrLuaMethod::NIL:
+ {
+ String errstring = "ERROR: The code for function or variable " + name
+ + " does not define " + name + ".";
+ _LERR(errstring);
+ lastError = std::move(errstring);
+ break;
+ }
+ case CtrlrLuaMethod::BOOLEAN:
+ case CtrlrLuaMethod::LIGHTUSERDATA:
+ case CtrlrLuaMethod::NUMBER:
+ case CtrlrLuaMethod::STRING:
+ case CtrlrLuaMethod::TABLE:
+ case CtrlrLuaMethod::USERDATA:
+ case CtrlrLuaMethod::THREAD:
+ case CtrlrLuaMethod::FUNCTION:
+ break;
+ default:
+ type = CtrlrLuaMethod::UNKNOWN;
+ }
+ return ((CtrlrLuaMethod::Type)type);
}
- return (true);
+ return (CtrlrLuaMethod::SCRIPT);
}
else
{
- return (false);
+ return (CtrlrLuaMethod::DISABLED);
}
}
@@ -388,7 +454,7 @@ void CtrlrPanel::setGlobalVariable(const int index, const int value)
if (luaPanelGlobalChangedCbk && !luaPanelGlobalChangedCbk.wasObjectDeleted())
{
- if (luaPanelGlobalChangedCbk->isValid())
+ if (luaPanelGlobalChangedCbk->isCallable())
{
getCtrlrLuaManager().getMethodManager().call (luaPanelGlobalChangedCbk, index, value);
}
diff --git a/Source/Lua/CtrlrLuaManager.h b/Source/Lua/CtrlrLuaManager.h
index b1dffa545..3f5df4eec 100644
--- a/Source/Lua/CtrlrLuaManager.h
+++ b/Source/Lua/CtrlrLuaManager.h
@@ -28,7 +28,7 @@ class CtrlrLuaManager : public ValueTree::Listener
void wrapJuceCoreClasses(lua_State *L);
void wrapConverters(lua_State* L);
void wrapUtilities(lua_State* L);
- bool runCode (const String &code, const String name="");
+ CtrlrLuaMethod::Type runCode (const String &code, const String name="");
void setProperty (const Identifier& name, const var &newValue, const bool isUndoable=false);
const var &getProperty (const Identifier& name) const { return luaManagerTree.getProperty (name); }
diff --git a/Source/Lua/JuceClasses/LComponents.cpp b/Source/Lua/JuceClasses/LComponents.cpp
index 7be9927c6..077d1daf2 100644
--- a/Source/Lua/JuceClasses/LComponents.cpp
+++ b/Source/Lua/JuceClasses/LComponents.cpp
@@ -1596,9 +1596,16 @@ void LSlider::wrapForLua (lua_State *L)
module(L)
[
- class_("NotificationType")
- ,
- class_ >("Slider")
+ class_("NotificationType")
+ .enum_("NotificationType")
+ [
+ value("dontSendNotification",dontSendNotification),
+ value("sendNotification",sendNotification),
+ value("sendNotificationSync",sendNotificationSync),
+ value("sendNotificationAsync",sendNotificationAsync)
+ ]
+ ,
+ class_ >("Slider")
.def("setSliderStyle", &Slider::setSliderStyle)
.def("getSliderStyle", &Slider::getSliderStyle)
.def("setRotaryParameters", (void(Slider::*)(float, float, bool))&Slider::setRotaryParameters)
diff --git a/Source/Lua/Methods/CtrlrLuaMethod.cpp b/Source/Lua/Methods/CtrlrLuaMethod.cpp
index caa03b047..4f1fd3df4 100644
--- a/Source/Lua/Methods/CtrlrLuaMethod.cpp
+++ b/Source/Lua/Methods/CtrlrLuaMethod.cpp
@@ -10,7 +10,7 @@
#include "CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.h"
CtrlrLuaMethod::CtrlrLuaMethod(CtrlrLuaMethodManager &_owner)
- : methodIsValid(false),
+ : type(UNKNOWN),
methodTree(Ids::luaMethod),
owner(_owner),
methodCodeEditor(nullptr),
@@ -24,7 +24,7 @@ CtrlrLuaMethod::CtrlrLuaMethod(CtrlrLuaMethodManager &_owner)
}
CtrlrLuaMethod::CtrlrLuaMethod(CtrlrLuaMethodManager &_owner, ValueTree &_methodTree)
- : methodIsValid(false),
+ : type(UNKNOWN),
methodTree(_methodTree),
owner(_owner),
methodCodeEditor(nullptr),
@@ -49,7 +49,7 @@ CtrlrLuaMethod::~CtrlrLuaMethod()
void CtrlrLuaMethod::remove() // this is called by the manager to remove us permanently, cleanup and stuff
{
- setValid (false);
+ setType (DISABLED);
if (luaObject && luaObject->getObject())
{
@@ -93,6 +93,7 @@ Uuid CtrlrLuaMethod::getUuid()
const File CtrlrLuaMethod::getSourceFile()
{
+ // TODO: there should be a better way to get the owning panel
return (owner.getOwner().getOwner().getLuaMethodSourceFile(&methodTree));
}
@@ -105,7 +106,9 @@ void CtrlrLuaMethod::valueTreePropertyChanged (ValueTree &treeWhosePropertyHasCh
{
if (property == Ids::luaMethodValid)
{
- methodIsValid = (bool)treeWhosePropertyHasChanged.getProperty(property);
+ if (!(bool)treeWhosePropertyHasChanged.getProperty(property)) {
+ setType(DISABLED);
+ }
}
else if (property == Ids::luaMethodName)
{
@@ -150,7 +153,7 @@ const String CtrlrLuaMethod::getCode()
}
}
-bool CtrlrLuaMethod::setCodeInternal(const String &newMethodCode)
+CtrlrLuaMethod::Type CtrlrLuaMethod::setCodeInternal(const String &newMethodCode)
{
errorString.clear();
errorString.append ("Compile: "+getName()+" - ", out, Colours::black);
@@ -158,54 +161,56 @@ bool CtrlrLuaMethod::setCodeInternal(const String &newMethodCode)
if (owner.isLuaDisabled())
{
errorString.append("FAILED lua is disabled\n", out.withStyle(Font::bold), Colours::darkred);
- return (false);
+ return (DISABLED);
}
- bool compileRet = owner.getOwner().runCode(newMethodCode, getName());
+ Type compileRet = owner.getOwner().runCode(newMethodCode, getName());
String error;
- if (compileRet && getName() != "")
- {
- try
- {
- setObject ( (luabind::object)luabind::globals (getLuaState()) [(const char *)getName().toUTF8()] );
- }
- catch (const luabind::error &e)
- {
- error = String(e.what());
- }
- }
- else if (compileRet == false)
- {
+ switch (compileRet) {
+ case ERROR:
error = owner.getOwner().getLastError();
- }
-
- if (compileRet)
- {
- errorString.append ("OK\n", out.withStyle(Font::bold), Colours::black);
- }
- else
- {
errorString.append ("FAILED\n", out.withStyle(Font::bold), Colours::darkred);
errorString.append (error + "\n" , out, Colours::darkred);
+ break;
+ default:
+ if (getName() != "")
+ {
+ try
+ {
+ setObject ( (luabind::object)luabind::globals (getLuaState()) [(const char *)getName().toUTF8()] );
+ }
+ catch (const luabind::error &e)
+ {
+ error = String(e.what());
+ }
+ errorString.append ("OK\n", out.withStyle(Font::bold), Colours::black);
+ }
}
-
- setValid(compileRet);
+ setType(compileRet);
return (compileRet);
}
+void CtrlrLuaMethod::setType(Type t) {
+ type = t;
+ methodTree.setProperty (Ids::luaMethodValid,
+ isValid(),
+ nullptr);
+}
+#if 0
void CtrlrLuaMethod::setValid (const bool _methodIsValid)
{
methodIsValid = _methodIsValid;
methodTree.setProperty (Ids::luaMethodValid, methodIsValid, nullptr);
}
-bool CtrlrLuaMethod::isValid () const
+Bool CtrlrLuaMethod::isValid () const
{
return (methodIsValid);
}
+#endif
void CtrlrLuaMethod::setCodeEditor (CtrlrLuaMethodCodeEditor *_methodCodeEditor)
{
diff --git a/Source/Lua/Methods/CtrlrLuaMethod.h b/Source/Lua/Methods/CtrlrLuaMethod.h
index 257193c72..33756e149 100644
--- a/Source/Lua/Methods/CtrlrLuaMethod.h
+++ b/Source/Lua/Methods/CtrlrLuaMethod.h
@@ -33,14 +33,37 @@ class CtrlrLuaMethod : public ValueTree::Listener
codeInFile
};
+ enum Type
+ {
+ NONE = LUA_TNONE,
+ NIL = LUA_TNIL,
+ BOOLEAN = LUA_TBOOLEAN,
+ LIGHTUSERDATA = LUA_TLIGHTUSERDATA,
+ NUMBER = LUA_TNUMBER,
+ STRING = LUA_TSTRING,
+ TABLE = LUA_TTABLE,
+ FUNCTION = LUA_TFUNCTION,
+ USERDATA = LUA_TUSERDATA,
+ THREAD = LUA_TTHREAD,
+ NUMTAGS = LUA_NUMTAGS,
+ SCRIPT = LUA_NUMTAGS,
+ ERROR,
+ UNKNOWN,
+ DISABLED
+ };
+
+
void setCodeEditor (CtrlrLuaMethodCodeEditor *_methodCodeEditor);
CtrlrLuaMethodCodeEditor *getCodeEditor();
void setObject (CtrlrLuaObjectWrapper _luaObject);
const String getName() const;
CtrlrLuaObjectWrapper &getObject();
+ Type getType() const { return type ; }
+ void setType(Type t);
bool isValid() const;
- void setValid (const bool _methodIsValid);
+ // void setValid (const bool _methodIsValid);
+ bool isCallable() const;
void remove();
ValueTree &getMethodTree() { return (methodTree); }
Uuid getUuid();
@@ -64,11 +87,11 @@ class CtrlrLuaMethod : public ValueTree::Listener
private:
Font out;
- bool setCodeInternal (const String &newMethodCode);
+ Type setCodeInternal (const String &newMethodCode);
WeakReference::Master masterReference;
friend class WeakReference;
CtrlrLuaObjectWrapper *luaObject;
- bool methodIsValid;
+ Type type;
ValueTree methodTree;
String methodName;
CtrlrLuaMethodManager &owner;
@@ -77,4 +100,49 @@ class CtrlrLuaMethod : public ValueTree::Listener
bool audioThreadMethod;
};
+inline bool CtrlrLuaMethod::isValid() const {
+ switch (getType()) {
+ case BOOLEAN:
+ case LIGHTUSERDATA:
+ case NUMBER:
+ case STRING:
+ case TABLE:
+ case FUNCTION:
+ case USERDATA:
+ case THREAD:
+ case SCRIPT:
+ return true;
+ case NONE:
+ case NIL:
+ case ERROR:
+ case UNKNOWN:
+ case DISABLED:
+ default:
+ return false;
+ }
+}
+
+inline bool CtrlrLuaMethod::isCallable() const {
+ switch (getType()) {
+ case FUNCTION:
+ return true;
+ case NONE:
+ case NIL:
+ case BOOLEAN:
+ case LIGHTUSERDATA:
+ case USERDATA:
+ case THREAD:
+ case SCRIPT:
+ case NUMBER:
+ case STRING:
+ case TABLE:
+ case ERROR:
+ case UNKNOWN:
+ case DISABLED:
+ default:
+ return false;
+ }
+}
+
+
#endif
diff --git a/Source/Lua/Methods/CtrlrLuaMethodManagerCalls.cpp b/Source/Lua/Methods/CtrlrLuaMethodManagerCalls.cpp
index f2d2e1ce5..9c8623f15 100644
--- a/Source/Lua/Methods/CtrlrLuaMethodManagerCalls.cpp
+++ b/Source/Lua/Methods/CtrlrLuaMethodManagerCalls.cpp
@@ -16,7 +16,7 @@
#define CATCH_METHOD_EXCEPTION \
catch (luabind::error &e)\
{\
- o->setValid(false);\
+ o->setType(CtrlrLuaMethod::ERROR); \
const char* a = lua_tostring(e.state(), -1);\
lastExecutionError = String(a);\
AlertWindow::showMessageBox (AlertWindow::WarningIcon,\
@@ -32,7 +32,7 @@ catch (luabind::error &e)\
#define CATCH_METHOD_EXCEPTION_STR \
catch (luabind::error &e)\
{\
- o->setValid(false);\
+ o->setType(CtrlrLuaMethod::ERROR);\
const char* a = lua_tostring(e.state(), -1);\
lastExecutionError = String(a);\
AlertWindow::showMessageBox (AlertWindow::WarningIcon, "Callback error: " + o->getName(), String(luabind::object_cast (luabind::object(luabind::from_stack(e.state(), -1)))) + "\n\nMethod disabled");\
@@ -45,7 +45,7 @@ catch (luabind::error &e)\
#define CATCH_METHOD_EXCEPTION_DAD \
catch (luabind::error &e)\
{\
- o->setValid(false);\
+ o->setType(CtrlrLuaMethod::ERROR);\
const char* a = lua_tostring(e.state(), -1);\
lastExecutionError = String(a);\
AlertWindow::showMessageBox (AlertWindow::WarningIcon, "Callback error: " + o->getName(), String(luabind::object_cast (luabind::object(luabind::from_stack(e.state(), -1)))) + "\n\nMethod disabled");\
@@ -57,7 +57,7 @@ catch (luabind::error &e)\
#define CATCH_METHOD_EXCEPTION_NO_DIALOG \
catch (luabind::error &e)\
{\
- o->setValid(false);\
+ o->setType(CtrlrLuaMethod::ERROR); \
lastExecutionError = String(luabind::object_cast (luabind::object(luabind::from_stack(e.state(), -1))));\
_LERR("Callback error: [" + o->getName() + "]\n" + lastExecutionError.fromLastOccurrenceOf("Error message:\n",false,false) + ".\nMethod disabled");\
if (currentMethodEditor)\
@@ -78,7 +78,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o)
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject());
}
CATCH_METHOD_EXCEPTION
@@ -97,7 +97,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrModulator *param1
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2);
}
@@ -118,7 +118,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrModulator *param1
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2, param3);
}
@@ -139,7 +139,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrModulator *param1
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2.toUTF8().getAddress());
}
@@ -160,7 +160,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrComponent *param1
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2.toUTF8().getAddress());
}
@@ -182,7 +182,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrComponent *param1
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2);
}
@@ -203,7 +203,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const MidiMessage &par
try
{
- if (o->isValid())
+ if (o->isCallable())
{
CtrlrMidiMessage mm(param1);
const luabind::object &obj = o->getObject().getLuabindObject();
@@ -231,7 +231,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const CtrlrMidiMessage
try
{
- if (o->isValid())
+ if (o->isCallable())
{
const luabind::object &obj = o->getObject().getLuabindObject();
if (obj.is_valid())
@@ -256,7 +256,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1);
}
CATCH_METHOD_EXCEPTION
@@ -275,7 +275,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1, boost::ref(param2));
}
CATCH_METHOD_EXCEPTION_NO_DIALOG
@@ -294,7 +294,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrPanelCanvas *para
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, boost::reference_wrapper(param2));
}
@@ -315,7 +315,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrPanel *param1)
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1);
}
CATCH_METHOD_EXCEPTION_NO_DIALOG
@@ -334,7 +334,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1, boost::ref(param2));
}
CATCH_METHOD_EXCEPTION
@@ -353,7 +353,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1, boost::ref(param2), param3, param4);
}
CATCH_METHOD_EXCEPTION
@@ -372,7 +372,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const int param1, cons
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1, param2, param3);
}
CATCH_METHOD_EXCEPTION
@@ -391,7 +391,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const int param1, cons
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1, param2);
}
CATCH_METHOD_EXCEPTION
@@ -410,7 +410,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const int param1, cons
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1, param2, param3, param4);
}
CATCH_METHOD_EXCEPTION
@@ -429,7 +429,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const int param1, cons
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1, param2);
}
CATCH_METHOD_EXCEPTION
@@ -448,7 +448,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrModulator *param1
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1, param2);
}
CATCH_METHOD_EXCEPTION
@@ -467,7 +467,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrWaveform *param1)
try
{
- if (o->isValid())
+ if (o->isCallable())
luabind::call_function(o->getObject().getObject(), param1);
}
CATCH_METHOD_EXCEPTION
@@ -488,7 +488,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const ValueTree ¶m
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2);
}
@@ -509,7 +509,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const String ¶m1,
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2);
}
@@ -531,7 +531,7 @@ int CtrlrLuaMethodManager::callWithRet(CtrlrLuaMethod *o, CtrlrModulator *param1
try
{
- if (o->isValid())
+ if (o->isCallable())
{
return (luabind::call_function(o->getObject().getObject(), param1, param2));
}
@@ -552,7 +552,7 @@ int CtrlrLuaMethodManager::callWithRet(CtrlrLuaMethod *o, CtrlrModulator *param1
try
{
- if (o->isValid())
+ if (o->isCallable())
{
return (luabind::call_function(o->getObject().getObject(), param1, param2, param3));
}
@@ -573,7 +573,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const StringArray &par
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2, param3);
}
@@ -595,7 +595,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const StringArray &par
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1);
}
@@ -617,7 +617,7 @@ int CtrlrLuaMethodManager::callWithRet(CtrlrLuaMethod *o, ValueTree valueTree1,
try
{
- if (o->isValid())
+ if (o->isCallable())
{
return (luabind::call_function(o->getObject().getObject(), valueTree1, valueTree2));
}
@@ -638,7 +638,7 @@ String CtrlrLuaMethodManager::callWithRetString(CtrlrLuaMethod *o, CtrlrCustomCo
try
{
- if (o->isValid())
+ if (o->isCallable())
{
return (luabind::call_function(o->getObject().getObject(), param1));
}
@@ -659,7 +659,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2, param3);
}
@@ -681,7 +681,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2, param3);
}
@@ -703,7 +703,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2, param3);
}
@@ -725,7 +725,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2);
}
@@ -747,7 +747,7 @@ int CtrlrLuaMethodManager::callWithRet(CtrlrLuaMethod *o, CtrlrCustomComponent *
try
{
- if (o->isValid())
+ if (o->isCallable())
{
return (luabind::call_function(o->getObject().getObject(), param1, param2));
}
@@ -768,7 +768,7 @@ DragAndDropSourceDetails CtrlrLuaMethodManager::callWithRet (CtrlrLuaMethod *o,
try
{
- if (o->isValid())
+ if (o->isCallable())
{
return (luabind::call_function(o->getObject().getObject(), param1, param2));
}
@@ -789,7 +789,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, LMemoryBlock *param1)
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1);
}
@@ -811,7 +811,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, ValueTree ¶m1)
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1);
}
@@ -833,7 +833,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, MidiBuffer *param1)
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1);
}
@@ -855,7 +855,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const ValueTree ¶m
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1);
}
@@ -877,7 +877,7 @@ const bool CtrlrLuaMethodManager::callAudio(CtrlrLuaMethod *o, MidiBuffer ¶m
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2);
}
@@ -899,7 +899,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const String ¶m1,
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1, param2, param3);
}
@@ -921,7 +921,7 @@ const bool CtrlrLuaMethodManager::call(CtrlrLuaMethod *o, const uint8 param1)
try
{
- if (o->isValid())
+ if (o->isCallable())
{
luabind::call_function(o->getObject().getObject(), param1);
}
diff --git a/Source/Native/CtrlrMac.cpp b/Source/Native/CtrlrMac.cpp
index 4f4dfeb0a..1fe229170 100644
--- a/Source/Native/CtrlrMac.cpp
+++ b/Source/Native/CtrlrMac.cpp
@@ -2,6 +2,7 @@
#include "stdafx_luabind.h"
static const int zero=0;
#ifdef __APPLE__
+#include
#include "CtrlrPanel/CtrlrPanel.h"
#include "CtrlrMac.h"
#include "CtrlrMacros.h"
@@ -126,7 +127,7 @@ const Result CtrlrMac::setBundleInfo (CtrlrPanel *sourceInfo, const File &bundle
if (plist.existsAsFile() && plist.hasWriteAccess())
{
- ScopedPointer plistXml (XmlDocument::parse(plist));
+ std::unique_ptr plistXml (XmlDocument::parse(plist));
if (plistXml == nullptr)
{
return (Result::fail("MAC native, can't parse Info.plist as a XML document"));
diff --git a/Source/Resources/XML/CtrlrLuaMethodTemplates.xml b/Source/Resources/XML/CtrlrLuaMethodTemplates.xml
index 86ea8fb67..d655d16eb 100644
--- a/Source/Resources/XML/CtrlrLuaMethodTemplates.xml
+++ b/Source/Resources/XML/CtrlrLuaMethodTemplates.xml
@@ -702,8 +702,8 @@ function how()
end
-
-
+
+
diff --git a/Source/UIComponents/CtrlrComponents/CtrlrComponent.cpp b/Source/UIComponents/CtrlrComponents/CtrlrComponent.cpp
index 47ac0de48..f64395ff2 100644
--- a/Source/UIComponents/CtrlrComponents/CtrlrComponent.cpp
+++ b/Source/UIComponents/CtrlrComponents/CtrlrComponent.cpp
@@ -177,7 +177,7 @@ void CtrlrComponent::mouseDoubleClick(const MouseEvent &e)
{
if (mouseDoubleClickCbk && !mouseDoubleClickCbk.wasObjectDeleted())
{
- if (mouseDoubleClickCbk->isValid())
+ if (mouseDoubleClickCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseDoubleClickCbk, this, e);
}
@@ -188,7 +188,7 @@ void CtrlrComponent::mouseDown(const MouseEvent &e)
{
if (mouseDownCbk && !mouseDownCbk.wasObjectDeleted())
{
- if (mouseDownCbk->isValid())
+ if (mouseDownCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseDownCbk, this, e);
}
@@ -216,7 +216,7 @@ void CtrlrComponent::mouseMove (const MouseEvent &e)
{
if (mouseMoveCbk && !mouseMoveCbk.wasObjectDeleted())
{
- if (mouseMoveCbk->isValid())
+ if (mouseMoveCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseMoveCbk, this, e);
}
@@ -227,7 +227,7 @@ void CtrlrComponent::mouseDrag (const MouseEvent &e)
{
if (mouseDragCbk && !mouseDragCbk.wasObjectDeleted())
{
- if (mouseDragCbk->isValid())
+ if (mouseDragCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseDragCbk, this, e);
}
diff --git a/Source/UIComponents/CtrlrComponents/CtrlrCustomComponent.cpp b/Source/UIComponents/CtrlrComponents/CtrlrCustomComponent.cpp
index 66a47ef45..7efc5c4e9 100644
--- a/Source/UIComponents/CtrlrComponents/CtrlrCustomComponent.cpp
+++ b/Source/UIComponents/CtrlrComponents/CtrlrCustomComponent.cpp
@@ -46,7 +46,7 @@ void CtrlrCustomComponent::paint (Graphics &g)
{
if (paintCbk && !paintCbk.wasObjectDeleted())
{
- if (paintCbk->isValid())
+ if (paintCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (paintCbk, this, g);
}
@@ -57,7 +57,7 @@ bool CtrlrCustomComponent::keyPressed (const KeyPress &key, Component *originati
{
if (keyPressedCbk.get())
{
- if (keyPressedCbk->isValid())
+ if (keyPressedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (keyPressedCbk, this, key, originatingComponent);
}
@@ -69,7 +69,7 @@ bool CtrlrCustomComponent::keyStateChanged (bool isKeyDown, Component *originati
{
if (keyStateChangedCbk && !keyStateChangedCbk.wasObjectDeleted())
{
- if (keyStateChangedCbk->isValid())
+ if (keyStateChangedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (keyStateChangedCbk, this, isKeyDown, originatingComponent);
}
@@ -81,7 +81,7 @@ void CtrlrCustomComponent::paintOverChildren(Graphics &g)
{
if (paintOverChildrenCbk && !paintOverChildrenCbk.wasObjectDeleted())
{
- if (paintOverChildrenCbk->isValid())
+ if (paintOverChildrenCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (paintOverChildrenCbk, this, g);
}
@@ -92,7 +92,7 @@ void CtrlrCustomComponent::resized()
{
if (resizedCbk && !resizedCbk.wasObjectDeleted())
{
- if (resizedCbk->isValid())
+ if (resizedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (resizedCbk, this);
}
@@ -104,7 +104,7 @@ void CtrlrCustomComponent::mouseMove (const MouseEvent &e)
{
if (mouseMoveCbk && !mouseMoveCbk.wasObjectDeleted())
{
- if (mouseMoveCbk->isValid())
+ if (mouseMoveCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseMoveCbk, this, e);
}
@@ -115,7 +115,7 @@ void CtrlrCustomComponent::mouseDown (const MouseEvent &e)
{
if (mouseDownCbk && !mouseDownCbk.wasObjectDeleted())
{
- if (mouseDownCbk->isValid())
+ if (mouseDownCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseDownCbk, this, e);
}
@@ -126,7 +126,7 @@ void CtrlrCustomComponent::mouseUp (const MouseEvent &e)
{
if (mouseUpCbk && !mouseUpCbk.wasObjectDeleted())
{
- if (mouseUpCbk->isValid())
+ if (mouseUpCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseUpCbk, this, e);
}
@@ -140,14 +140,19 @@ void CtrlrCustomComponent::mouseDrag (const MouseEvent &e)
{
if (dadStartCbk && !dadStartCbk.wasObjectDeleted())
{
- if (dadStartCbk->isValid())
+ if (dadStartCbk->isCallable())
{
DragAndDropContainer* const dragContainer = DragAndDropContainer::findParentDragContainerFor (this);
if (dragContainer)
{
DragAndDropSourceDetails details = owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().callWithRet (dadStartCbk, this, e);
Point offset(details.getImageOffsetX(), details.getImageOffsetY());
- dragContainer->startDragging (details.getDescription(), this, details.getDragImage(), true, &offset);
+ dragContainer->startDragging (details.getDescription(),
+ this,
+ details.getDragImage(),
+ true,
+ &offset,
+ &e.source);
}
}
}
@@ -155,7 +160,7 @@ void CtrlrCustomComponent::mouseDrag (const MouseEvent &e)
if (mouseDragCbk && !mouseDragCbk.wasObjectDeleted())
{
- if (mouseDragCbk->isValid())
+ if (mouseDragCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseDragCbk, this, e);
}
@@ -167,7 +172,7 @@ void CtrlrCustomComponent::mouseEnter (const MouseEvent &e)
_DBG("CtrlrCustomComponent::mouseEnter");
if (mouseEnterCbk && !mouseEnterCbk.wasObjectDeleted())
{
- if (mouseEnterCbk->isValid())
+ if (mouseEnterCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseEnterCbk, this, e);
}
@@ -178,7 +183,7 @@ void CtrlrCustomComponent::mouseExit (const MouseEvent &e)
{
if (mouseExitCbk && !mouseExitCbk.wasObjectDeleted())
{
- if (mouseExitCbk->isValid())
+ if (mouseExitCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseExitCbk, this, e);
}
@@ -194,7 +199,7 @@ const String CtrlrCustomComponent::getComponentText()
{
if (getTextCbk && !getTextCbk.wasObjectDeleted())
{
- if (getTextCbk->isValid())
+ if (getTextCbk->isCallable())
{
return (owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().callWithRetString (getTextCbk, this));
}
@@ -207,7 +212,7 @@ void CtrlrCustomComponent::setComponentText (const String &componentText)
{
if (setTextCbk && !setTextCbk.wasObjectDeleted())
{
- if (setTextCbk->isValid())
+ if (setTextCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (setTextCbk, this, componentText);
}
@@ -218,7 +223,7 @@ void CtrlrCustomComponent::setComponentValue (const double newValue, const bool
{
if (setValueCbk && !setValueCbk.wasObjectDeleted())
{
- if (setValueCbk->isValid())
+ if (setValueCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (setValueCbk, this, newValue, sendChangeMessage);
}
@@ -229,7 +234,7 @@ double CtrlrCustomComponent::getComponentValue()
{
if (getValueCbk && !getValueCbk.wasObjectDeleted())
{
- if (getValueCbk->isValid())
+ if (getValueCbk->isCallable())
{
return (owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (getValueCbk, this));
}
@@ -436,7 +441,7 @@ void CtrlrCustomComponent::mouseDoubleClick (const MouseEvent &e)
{
if (mouseDoubleClickCbk && !mouseDoubleClickCbk.wasObjectDeleted())
{
- if (mouseDoubleClickCbk->isValid())
+ if (mouseDoubleClickCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseDoubleClickCbk, this, e);
}
@@ -447,7 +452,7 @@ void CtrlrCustomComponent::mouseWheelMove (const MouseEvent &e, const MouseWheel
{
if (mouseWheelMoveCbk && !mouseWheelMoveCbk.wasObjectDeleted())
{
- if (mouseWheelMoveCbk->isValid())
+ if (mouseWheelMoveCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (mouseWheelMoveCbk, this, e, wheel.deltaX, wheel.deltaY);
}
@@ -458,7 +463,7 @@ bool CtrlrCustomComponent::isInterestedInDragSource (const SourceDetails& dragSo
{
if (dadIsInterestedCbk && !dadIsInterestedCbk.wasObjectDeleted())
{
- if (dadIsInterestedCbk->isValid())
+ if (dadIsInterestedCbk->isCallable())
{
return (owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().callWithRet (dadIsInterestedCbk, this, DragAndDropSourceDetails (dragSourceDetails)) ? true : false);
}
@@ -470,7 +475,7 @@ void CtrlrCustomComponent::itemDragEnter (const SourceDetails &dragSourceDetails
{
if (dadEnterCbk && !dadEnterCbk.wasObjectDeleted())
{
- if (dadEnterCbk->isValid())
+ if (dadEnterCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (dadEnterCbk, this, DragAndDropSourceDetails (dragSourceDetails));
}
@@ -482,7 +487,7 @@ void CtrlrCustomComponent::itemDragMove (const SourceDetails &dragSourceDetails)
_DBG("CtrlrCustomComponent::itemDragMove");
if (dadMoveCbk && !dadMoveCbk.wasObjectDeleted())
{
- if (dadMoveCbk->isValid())
+ if (dadMoveCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (dadMoveCbk, this, DragAndDropSourceDetails (dragSourceDetails));
}
@@ -493,7 +498,7 @@ void CtrlrCustomComponent::itemDragExit (const SourceDetails &dragSourceDetails)
{
if (dadExitCbk && !dadExitCbk.wasObjectDeleted())
{
- if (dadExitCbk->isValid())
+ if (dadExitCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (dadExitCbk, this, DragAndDropSourceDetails (dragSourceDetails));
}
@@ -504,7 +509,7 @@ void CtrlrCustomComponent::itemDropped (const SourceDetails& dragSourceDetails)
{
if (dadDroppedCbk && !dadDroppedCbk.wasObjectDeleted())
{
- if (dadDroppedCbk->isValid())
+ if (dadDroppedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (dadDroppedCbk, this, DragAndDropSourceDetails (dragSourceDetails));
}
diff --git a/Source/UIComponents/CtrlrComponents/Groups/CtrlrTabsComponent.cpp b/Source/UIComponents/CtrlrComponents/Groups/CtrlrTabsComponent.cpp
index efafe0cce..9893e3d62 100644
--- a/Source/UIComponents/CtrlrComponents/Groups/CtrlrTabsComponent.cpp
+++ b/Source/UIComponents/CtrlrComponents/Groups/CtrlrTabsComponent.cpp
@@ -322,7 +322,7 @@ void CtrlrTabsComponent::valueTreePropertyChanged (ValueTree &treeWhosePropertyH
if (tabChangedCbk && !tabChangedCbk.wasObjectDeleted())
{
- if (tabChangedCbk->isValid())
+ if (tabChangedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (tabChangedCbk, &owner, (int)getProperty(property));
}
diff --git a/Source/UIComponents/CtrlrComponents/Labels/CtrlrLCDLabel.cpp b/Source/UIComponents/CtrlrComponents/Labels/CtrlrLCDLabel.cpp
index 87d637c34..045ede912 100644
--- a/Source/UIComponents/CtrlrComponents/Labels/CtrlrLCDLabel.cpp
+++ b/Source/UIComponents/CtrlrComponents/Labels/CtrlrLCDLabel.cpp
@@ -225,7 +225,7 @@ void CtrlrLCDLabel::labelTextChanged (Label* labelThatHasChanged)
if (labelChangedCbk && !labelChangedCbk.wasObjectDeleted())
{
- if (labelChangedCbk->isValid())
+ if (labelChangedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (labelChangedCbk, dynamic_cast(this), labelThatHasChanged->getText());
}
diff --git a/Source/UIComponents/CtrlrComponents/Labels/CtrlrLabel.cpp b/Source/UIComponents/CtrlrComponents/Labels/CtrlrLabel.cpp
index d45d5af81..7438a09d5 100644
--- a/Source/UIComponents/CtrlrComponents/Labels/CtrlrLabel.cpp
+++ b/Source/UIComponents/CtrlrComponents/Labels/CtrlrLabel.cpp
@@ -263,7 +263,7 @@ void CtrlrLabel::labelTextChanged (Label* labelThatHasChanged)
if (labelChangedCbk && !labelChangedCbk.wasObjectDeleted())
{
- if (labelChangedCbk->isValid())
+ if (labelChangedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (labelChangedCbk, dynamic_cast(this), labelThatHasChanged->getText());
}
diff --git a/Source/UIComponents/CtrlrComponents/Sliders/CtrlrImageSlider.cpp b/Source/UIComponents/CtrlrComponents/Sliders/CtrlrImageSlider.cpp
index 50cfd8715..b217e54f5 100644
--- a/Source/UIComponents/CtrlrComponents/Sliders/CtrlrImageSlider.cpp
+++ b/Source/UIComponents/CtrlrComponents/Sliders/CtrlrImageSlider.cpp
@@ -162,7 +162,18 @@ void CtrlrImageSlider::valueTreePropertyChanged (ValueTree &treeWhosePropertyHas
}
else if (property == Ids::uiSliderInterval || property == Ids::uiSliderMax || property == Ids::uiSliderMin)
{
- ctrlrSlider->setRange ( getProperty (Ids::uiSliderMin), getProperty (Ids::uiSliderMax), getProperty (Ids::uiSliderInterval) );
+ double max = getProperty (Ids::uiSliderMax);
+ const double min = getProperty (Ids::uiSliderMin);
+ double interval = getProperty (Ids::uiSliderInterval);
+ if (interval == 0)
+ interval = std::abs(max-min) + 1;
+ // For JUCE MAX must be >= min
+ if (max <= min) {
+ // samething between 0.5 and 1 times the interval
+ // to avoid rounding errors
+ max = min + interval * 0.66;
+ }
+ ctrlrSlider->setRange ( min, max, interval );
owner.setProperty (Ids::modulatorMax, ctrlrSlider->getMaximum());
owner.setProperty (Ids::modulatorMin, ctrlrSlider->getMinimum());
}
diff --git a/Source/UIComponents/CtrlrComponents/Specials/CtrlrFileListBox.cpp b/Source/UIComponents/CtrlrComponents/Specials/CtrlrFileListBox.cpp
index 4f8112694..6cdc706b0 100644
--- a/Source/UIComponents/CtrlrComponents/Specials/CtrlrFileListBox.cpp
+++ b/Source/UIComponents/CtrlrComponents/Specials/CtrlrFileListBox.cpp
@@ -324,7 +324,7 @@ void CtrlrFileListBox::fileClicked (const File &file, const MouseEvent &e)
{
if (fileClickedCbk && !fileClickedCbk.wasObjectDeleted())
{
- if (fileClickedCbk->isValid())
+ if (fileClickedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (fileClickedCbk, &owner, file);
}
@@ -335,7 +335,7 @@ void CtrlrFileListBox::fileDoubleClicked (const File &file)
{
if (fileDoubleClickedCbk && !fileDoubleClickedCbk.wasObjectDeleted())
{
- if (fileDoubleClickedCbk->isValid())
+ if (fileDoubleClickedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (fileDoubleClickedCbk, &owner, file);
}
@@ -347,7 +347,7 @@ void CtrlrFileListBox::deleteKeyPressed (const int value)
{
if (itemDeleteKeyPressedCbk && !itemDeleteKeyPressedCbk.wasObjectDeleted())
{
- if (itemDeleteKeyPressedCbk->isValid())
+ if (itemDeleteKeyPressedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (itemDeleteKeyPressedCbk, &owner, value);
}
@@ -358,7 +358,7 @@ void CtrlrFileListBox::returnKeyPressed (const int value)
{
if (itemReturnKeyPressedCbk && !itemReturnKeyPressedCbk.wasObjectDeleted())
{
- if (itemReturnKeyPressedCbk->isValid())
+ if (itemReturnKeyPressedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (itemReturnKeyPressedCbk, &owner, value);
}
diff --git a/Source/UIComponents/CtrlrComponents/Specials/CtrlrListBox.cpp b/Source/UIComponents/CtrlrComponents/Specials/CtrlrListBox.cpp
index 3b24340c9..78c184a29 100644
--- a/Source/UIComponents/CtrlrComponents/Specials/CtrlrListBox.cpp
+++ b/Source/UIComponents/CtrlrComponents/Specials/CtrlrListBox.cpp
@@ -226,7 +226,7 @@ void CtrlrListBox::listBoxItemClicked (int value, const MouseEvent &e)
{
if (itemClickedCbk && !itemClickedCbk.wasObjectDeleted())
{
- if (itemClickedCbk->isValid())
+ if (itemClickedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (itemClickedCbk, &owner, value);
}
@@ -237,7 +237,7 @@ void CtrlrListBox::listBoxItemDoubleClicked (int value, const MouseEvent &e)
{
if (itemDoubleClickedCbk && !itemDoubleClickedCbk.wasObjectDeleted())
{
- if (itemDoubleClickedCbk->isValid())
+ if (itemDoubleClickedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (itemDoubleClickedCbk, &owner, value);
}
@@ -248,7 +248,7 @@ void CtrlrListBox::deleteKeyPressed (int value)
{
if (itemDeleteKeyPressedCbk && !itemDeleteKeyPressedCbk.wasObjectDeleted())
{
- if (itemDeleteKeyPressedCbk->isValid())
+ if (itemDeleteKeyPressedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (itemDeleteKeyPressedCbk, &owner, value);
}
@@ -259,7 +259,7 @@ void CtrlrListBox::returnKeyPressed (int value)
{
if (itemReturnKeyPressedCbk && !itemReturnKeyPressedCbk.wasObjectDeleted())
{
- if (itemReturnKeyPressedCbk->isValid())
+ if (itemReturnKeyPressedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (itemReturnKeyPressedCbk, &owner, value);
}
diff --git a/Source/UIComponents/CtrlrComponents/Specials/CtrlrWaveform.cpp b/Source/UIComponents/CtrlrComponents/Specials/CtrlrWaveform.cpp
index ef29a0c41..dd48faca6 100644
--- a/Source/UIComponents/CtrlrComponents/Specials/CtrlrWaveform.cpp
+++ b/Source/UIComponents/CtrlrComponents/Specials/CtrlrWaveform.cpp
@@ -247,7 +247,7 @@ void CtrlrWaveform::changeListenerCallback (ChangeBroadcaster* source)
{
if (thumbnailChangedCbk && !thumbnailChangedCbk.wasObjectDeleted())
{
- if (thumbnailChangedCbk->isValid())
+ if (thumbnailChangedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (thumbnailChangedCbk, this);
}
@@ -307,7 +307,7 @@ void CtrlrWaveform::reset (int numChannels, double sampleRate, double totalSampl
if (sourceChangedCbk && !sourceChangedCbk.wasObjectDeleted())
{
- if (sourceChangedCbk->isValid())
+ if (sourceChangedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (sourceChangedCbk, this);
}
@@ -322,7 +322,7 @@ const bool CtrlrWaveform::loadFromFile (const File &fileToLoadFrom)
if (sourceChangedCbk && !sourceChangedCbk.wasObjectDeleted())
{
- if (sourceChangedCbk->isValid())
+ if (sourceChangedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (sourceChangedCbk, this);
}
@@ -431,7 +431,7 @@ void CtrlrWaveform::filesDropped (const StringArray &files, int x, int y)
{
if (fileDroppedCbk && !fileDroppedCbk.wasObjectDeleted())
{
- if (fileDroppedCbk->isValid())
+ if (fileDroppedCbk->isCallable())
{
owner.getOwnerPanel().getCtrlrLuaManager().getMethodManager().call (fileDroppedCbk, files, x, y);
}
diff --git a/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.cpp b/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.cpp
index 6628c58f8..ca70a4f34 100644
--- a/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.cpp
+++ b/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.cpp
@@ -154,7 +154,7 @@ bool CtrlrLuaMethodCodeEditor::keyPressed (const KeyPress &key, Component *origi
if (key.getKeyCode() == KeyPress::F8Key)
{
- owner.saveAndCompilAllMethods();
+ owner.saveAndCompileAllMethods();
return (true);
}
diff --git a/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.h b/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.h
index fa49ff0a1..c8d2e6b45 100644
--- a/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.h
+++ b/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodCodeEditor.h
@@ -9,7 +9,7 @@
class CtrlrLuaMethodEditor;
class GenericCodeEditorComponent;
-class CtrlrLuaDebugger;
+class CtrlrLuaDebugger;
class CtrlrLuaMethodCodeEditor : public Component, public KeyListener, public CodeDocument::Listener, public AsyncUpdater
{
@@ -100,4 +100,4 @@ class GenericCodeEditorComponent : public CodeEditorComponent
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GenericCodeEditorComponent)
};
//==============================================================================
-#endif
+#endif
diff --git a/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodEditor.cpp b/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodEditor.cpp
index 4aec9ea88..a865ec865 100644
--- a/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodEditor.cpp
+++ b/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodEditor.cpp
@@ -503,7 +503,7 @@ bool CtrlrLuaMethodEditor::canCloseWindow()
}
else if (ret == 1)
{ // Save all
- saveAndCompilAllMethods();
+ saveAndCompileAllMethods();
return true;
}
else
@@ -792,72 +792,47 @@ void CtrlrLuaMethodEditor::itemClicked (const MouseEvent &e, ValueTree &item)
{
if (e.mods.isPopupMenu())
{
+ enum popupItems {
+ NOP = 0,
+ ADD_METHOD,
+ ADD_FILES,
+ ADD_GROUP,
+ REMOVE_METHOD,
+ REMOVE_GROUP,
+ RENAME_GROUP,
+ CONVERT_TO_FILES,
+ CONVERT_TO_FILE,
+ LOCATE_FILE,
+ SORT_BY_NAME,
+ SORT_BY_SIZE
+ };
+ int result;
+ bool isMethodGroup = item.hasType(Ids::luaMethodGroup);
if ( item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup) )
{
PopupMenu m;
+
m.addSectionHeader ("Group operations");
- m.addItem (1, "Add method");
- m.addItem (2, "Add files");
- m.addItem (3, "Add group");
+ m.addItem (ADD_METHOD, "Add method");
+ m.addItem (ADD_FILES , "Add files");
+ m.addItem (ADD_GROUP , "Add group");
m.addSeparator();
- bool isMethodGroup = item.hasType(Ids::luaMethodGroup);
if (isMethodGroup)
{
- m.addItem (4, "Remove group");
- m.addItem (5, "Rename group");
+ m.addItem (REMOVE_GROUP, "Remove group");
+ m.addItem (RENAME_GROUP, "Rename group");
}
else
{ // Root element => add a menu to convert method to filesto files
- m.addItem(4, "Convert to files...");
+ m.addItem(CONVERT_TO_FILES, "Convert all to files...");
}
m.addSeparator();
- m.addItem (6, "Sort by name");
- m.addItem (7, "Sort by size");
+ m.addItem (SORT_BY_NAME, "Sort by name");
+ m.addItem (SORT_BY_SIZE, "Sort by size");
- const int ret = m.show();
+ result = m.show();
- if (ret == 1)
- {
- addNewMethod (item);
- }
- else if (ret == 2)
- {
- addMethodFromFile (item);
- }
- else if (ret == 3)
- {
- addNewGroup (item);
- }
- else if (ret == 4)
- {
- if (isMethodGroup)
- { // Case of a method group => remove group
- removeGroup(item);
- }
- else
- { // Case of to root element => export to files
- convertToFiles();
- }
- }
- else if (ret == 5)
- {
- renameGroup (item);
- }
- else if (ret == 6)
- {
- ChildSorter sorter(true,*this);
- getMethodManager().getManagerTree().sort (sorter, nullptr, false);
-
- triggerAsyncUpdate();
- }
- else if (ret == 7)
- {
- ChildSorter sorter(false,*this);
- getMethodManager().getManagerTree().sort (sorter, nullptr, false);
-
- triggerAsyncUpdate();
- }
}
else if (item.hasType(Ids::luaMethod))
{
@@ -867,40 +842,80 @@ void CtrlrLuaMethodEditor::itemClicked (const MouseEvent &e, ValueTree &item)
{
if (!owner.getLuaMethodSourceFile(&item).existsAsFile())
{
- m.addItem (12, "Locate file on disk");
+ m.addItem (LOCATE_FILE, "Locate file on disk");
}
+ } else {
+ m.addItem(CONVERT_TO_FILE , "Convert to file...");
}
m.addSeparator();
- m.addItem (2,"Remove method");
+ m.addItem (REMOVE_METHOD,"Remove method");
- const int ret = m.show();
+ result = m.show();
- if (ret == 11)
- {
- /* convert a in-memory method to a file based one */
- }
- else if (ret == 12)
- {
- /* locate a missing file on disk */
- }
- else if (ret == 10)
- {
- /* convert a method from a file to a in-memory property */
- }
- else if (ret == 2)
- {
- /* remove a method */
- if (SURE("Delete the selected method?", this))
- {
- {
- methodEditArea->closeTabWithMethod (item);
- getMethodManager().removeMethod (item.getProperty(Ids::uuid).toString());
- }
-
- triggerAsyncUpdate();
- }
+ }
+ switch (result) {
+ case ADD_METHOD:
+ jassert(item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup));
+ addNewMethod (item);
+ break;
+ case ADD_FILES:
+ jassert(item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup));
+ addMethodFromFile (item);
+ break;
+ case ADD_GROUP:
+ jassert(item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup));
+ addNewGroup (item);
+ break;
+ case REMOVE_GROUP:
+ jassert(item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup));
+ jassert(isMethodGroup);
+ removeGroup(item);
+ break;
+ case RENAME_GROUP:
+ jassert(item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup));
+ jassert(isMethodGroup);
+ renameGroup (item);
+ break;
+ case CONVERT_TO_FILES:
+ jassert(item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup));
+ jassert(!isMethodGroup);
+ // Case of to root element => export to files
+ convertToFiles();
+ break;
+ case SORT_BY_NAME: {
+ jassert(item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup));
+ ChildSorter sorter(true,*this);
+ getMethodManager().getManagerTree().sort (sorter, nullptr, false);
+ triggerAsyncUpdate();
+ break;
+ }
+ case SORT_BY_SIZE: {
+ jassert(item.hasType (Ids::luaManagerMethods) || item.hasType (Ids::luaMethodGroup));
+ ChildSorter sorter(false,*this);
+ getMethodManager().getManagerTree().sort (sorter, nullptr, false);
+ triggerAsyncUpdate();
+ break;
+ }
+ case LOCATE_FILE: {
+ jassert(item.hasType(Ids::luaMethod));
+ jassert((int)item.getProperty(Ids::luaMethodSource) == CtrlrLuaMethod::codeInFile);
+ /* TODO: implement */
+ break;
+ }
+ case CONVERT_TO_FILE:
+ jassert(item.hasType(Ids::luaMethod));
+ jassert((int)item.getProperty(Ids::luaMethodSource) == CtrlrLuaMethod::codeInFile);
+ convertToFile(item);
+ break;
+ case REMOVE_METHOD: {
+ /* remove a method */
+ if (SURE("Delete the selected method?", this)) {
+ methodEditArea->closeTabWithMethod (item);
+ getMethodManager().removeMethod (item.getProperty(Ids::uuid).toString());
}
+ triggerAsyncUpdate();
+ }
}
}
}
@@ -1030,110 +1045,133 @@ int ChildSorter::compareElements (ValueTree first, ValueTree second)
}
}
+enum MainMenus {
+ MAIN_FILE,
+ MAIN_EDIT
+};
+
+enum SubMenuIds {
+ MENU_SAVE=1,
+ MENU_COMPILE,
+ MENU_COMPILE_ALL,
+
+ MENU_CLOSE,
+ MENU_CLOSE_TAB,
+ MENU_CLOSE_ALL_TABS,
+
+ MENU_CONVERT_TO_FILE,
+ MENU_CONVERT_TO_FILES,
+
+ MENU_FIND_REPLACE,
+ MENU_DEBUGGER,
+ MENU_CONSOLE,
+ MENU_CLEAR_OUTPUT,
+
+ MENU_SETTINGS
+};
+
+static const char* const menuNames[] = { "File", "Edit", nullptr };
+
+
+
StringArray CtrlrLuaMethodEditor::getMenuBarNames()
{
- const char* const names[] = { "File", "Edit", nullptr };
- return StringArray (names);
+ return StringArray (menuNames);
}
PopupMenu CtrlrLuaMethodEditor::getMenuForIndex(int topLevelMenuIndex, const String &menuName)
{
PopupMenu menu;
- if (topLevelMenuIndex == 0)
- {
- menu.addItem (2, "Save");
- menu.addItem (3, "Save and compile");
- menu.addItem (4, "Save and compile all");
+ switch (topLevelMenuIndex) {
+ case MAIN_FILE:
+ menu.addItem (MENU_SAVE , "Save");
+ menu.addItem (MENU_COMPILE , "Save and compile");
+ menu.addItem (MENU_COMPILE_ALL , "Save and compile all");
menu.addSeparator();
- menu.addItem(5, "Close current tab");
- menu.addItem(6, "Close all tabs");
+ menu.addItem (MENU_CLOSE_TAB , "Close current tab");
+ menu.addItem (MENU_CLOSE_ALL_TABS , "Close all tabs");
menu.addSeparator ();
- menu.addItem(7, "Convert to files...");
+ menu.addItem (MENU_CONVERT_TO_FILE , "Convert to file...");
+ menu.addItem (MENU_CONVERT_TO_FILES, "Convert to files...");
menu.addSeparator();
- menu.addItem (1, "Close");
- }
- else if (topLevelMenuIndex == 1)
- {
- menu.addItem (4, "Find and replace");
- menu.addItem (7, "Debugger");
- menu.addItem (8, "Console");
-
- menu.addItem (5, "Clear Output");
+ menu.addItem (MENU_CLOSE , "Close");
+ break;
+ case MAIN_EDIT:
+ menu.addItem (MENU_FIND_REPLACE , "Find and replace");
+ menu.addItem (MENU_DEBUGGER , "Debugger");
+ menu.addItem (MENU_CONSOLE , "Console");
+
+ menu.addItem (MENU_CLEAR_OUTPUT , "Clear Output");
menu.addSeparator();
- menu.addItem (6, "Settings");
+ menu.addItem (MENU_SETTINGS , "Settings");
+ break;
+ default:
+ jassert(topLevelMenuIndex < MAIN_FILE || topLevelMenuIndex > MAIN_EDIT);
}
return (menu);
}
void CtrlrLuaMethodEditor::menuItemSelected(int menuItemID, int topLevelMenuIndex)
{
- if (menuItemID == 1 && topLevelMenuIndex == 0)
- {
+ switch ((SubMenuIds)menuItemID) {
+ case MENU_CLOSE:
if (isCurrentlyModal())
exitModalState(-1);
- if (canCloseWindow())
- {
+ if (canCloseWindow()) {
owner.getWindowManager().toggle(CtrlrPanelWindowManager::LuaMethodEditor, false);
}
- }
- if (menuItemID == 2 && topLevelMenuIndex == 0)
- {
+ break;
+ case MENU_SAVE:
if (getCurrentEditor())
- {
getCurrentEditor()->saveDocument();
- }
- }
- else if (menuItemID == 3 && topLevelMenuIndex == 0)
- {
+ break;
+ case MENU_COMPILE:
if (getCurrentEditor())
- {
getCurrentEditor()->saveAndCompileDocument();
- }
- }
- else if (menuItemID == 4 && topLevelMenuIndex == 0)
- {
- saveAndCompilAllMethods();
- }
- else if (menuItemID == 5 && topLevelMenuIndex == 0)
- {
+ break;
+ case MENU_COMPILE_ALL:
+ saveAndCompileAllMethods();
+ break;
+ case MENU_CLOSE_TAB:
closeCurrentTab();
- }
- else if (menuItemID == 6 && topLevelMenuIndex == 0)
- {
+ break;
+ case MENU_CLOSE_ALL_TABS:
closeAllTabs();
- }
- else if (menuItemID == 7 && topLevelMenuIndex == 0)
- {
+ break;
+ case MENU_CONVERT_TO_FILE:
+ convertToFile(getCurrentEditor());
+ break;
+ case MENU_CONVERT_TO_FILES:
convertToFiles();
- }
- else if (menuItemID == 4 && topLevelMenuIndex == 1)
- {
+ break;
+ case MENU_FIND_REPLACE:
methodEditArea->showFindDialog();
- }
- else if (menuItemID == 5 && topLevelMenuIndex == 1)
- {
+ break;
+ case MENU_DEBUGGER:
+ methodEditArea->showDebuggerTab();
+ break;
+ case MENU_CONSOLE:
+ methodEditArea->showConsoleTab();
+ break;
+ case MENU_CLEAR_OUTPUT:
methodEditArea->clearOutputText();
- }
- else if (menuItemID == 6 && topLevelMenuIndex == 1)
- {
+ break;
+ case MENU_SETTINGS: {
CtrlrLuaMethodCodeEditorSettings s(*this);
CtrlrDialogWindow::showModalDialog ("Code editor settings", &s, false, this);
- componentTree.setProperty (Ids::luaMethodEditorFont, owner.getCtrlrManagerOwner().getFontManager().getStringFromFont (s.getFont()), nullptr);
- componentTree.setProperty (Ids::luaMethodEditorBgColour, COLOUR2STR (s.getColour()), nullptr);
+ componentTree.setProperty (Ids::luaMethodEditorFont,
+ owner.getCtrlrManagerOwner().getFontManager().getStringFromFont (s.getFont()),
+ nullptr);
+ componentTree.setProperty (Ids::luaMethodEditorBgColour,
+ COLOUR2STR (s.getColour()), nullptr);
+ break;
}
- else if (menuItemID == 7 && topLevelMenuIndex == 1)
- {
- methodEditArea->showDebuggerTab();
- }
- else if (menuItemID == 8 && topLevelMenuIndex == 1)
- {
- methodEditArea->showConsoleTab();
}
}
-void CtrlrLuaMethodEditor::saveAndCompilAllMethods()
+void CtrlrLuaMethodEditor::saveAndCompileAllMethods()
{
for (int i=0; igetNumTabs(); i++)
{
@@ -1146,6 +1184,37 @@ void CtrlrLuaMethodEditor::saveAndCompilAllMethods()
}
}
+void CtrlrLuaMethodEditor::convertToFile(WeakReference editor)
+{
+ if (!editor)
+ return;
+ auto method = editor -> getMethod();
+ if (method)
+ convertToFile(method->getMethodTree());
+}
+
+
+void CtrlrLuaMethodEditor::convertToFile(ValueTree &item)
+{
+ /* TODO: implement */
+ // Show confirmation dialog
+ const String base_path = owner.getPanelLuaDirPath();
+ const int confirm = AlertWindow::showOkCancelBox(AlertWindow::QuestionIcon, "Convert to files", "Do you want to convert the Lua method to file (base path=" + base_path + ")?", "Yes", "No");
+ if (confirm == 1)
+ {
+ Result res = owner.convertLuaMethodToFile(item);
+ if (res.wasOk())
+ {
+ owner.luaManagerChanged();
+ triggerAsyncUpdate();
+ }
+ else
+ {
+ AlertWindow::showMessageBox(AlertWindow::WarningIcon, "Convert to file", "Failed to convert Lua method to file.\n" + res.getErrorMessage());
+ }
+ }
+}
+
void CtrlrLuaMethodEditor::convertToFiles()
{
// Show confirmation dialog
diff --git a/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodEditor.h b/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodEditor.h
index 2d655d237..b14cd8510 100644
--- a/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodEditor.h
+++ b/Source/UIComponents/CtrlrLua/MethodEditor/CtrlrLuaMethodEditor.h
@@ -108,7 +108,9 @@ class CtrlrLuaMethodEditor : public CtrlrChildWindowContent,
PopupMenu getMenuForIndex(int topLevelMenuIndex, const String &menuName);
void menuItemSelected(int menuItemID, int topLevelMenuIndex);
void searchResultClicked (const String &methodName, const int lineNumber, const int resultPositionStart, const int resultPositionEnd);
- void saveAndCompilAllMethods();
+ void saveAndCompileAllMethods();
+ void convertToFile(WeakReference codeEditor);
+ void convertToFile(ValueTree &item);
void convertToFiles();
/* Debugger stuff
*/
@@ -123,7 +125,7 @@ class CtrlrLuaMethodEditor : public CtrlrChildWindowContent,
bool caseCansitive, findDialogActive;
String lookInString, searchInString, currentSearchString;
- private:
+private:
WeakReference::Master masterReference;
friend class WeakReference;
File lastBrowsedSourceDir;
diff --git a/Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.cpp b/Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.cpp
index 87cfb83c2..927240450 100644
--- a/Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.cpp
+++ b/Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.cpp
@@ -54,7 +54,7 @@ void CtrlrPanelCanvas::paint (Graphics& g)
{
if (paintCbk && !paintCbk.wasObjectDeleted())
{
- if (paintCbk->isValid())
+ if (paintCbk->isCallable())
{
owner.getOwner().getCtrlrLuaManager().getMethodManager().call (paintCbk, this, g);
@@ -130,7 +130,7 @@ void CtrlrPanelCanvas::resized()
if (resizedCbk && !resizedCbk.wasObjectDeleted())
{
- if (resizedCbk->isValid())
+ if (resizedCbk->isCallable())
{
owner.getOwner().getCtrlrLuaManager().getMethodManager().call (resizedCbk, &owner.getOwner());
}
@@ -217,7 +217,7 @@ void CtrlrPanelCanvas::mouseDown (const MouseEvent& e)
{
getOwner().getSelection()->selectOnly (c);
getOwner().getSelection()->dispatchPendingMessages();
- startDraggingSelection();
+ startDraggingSelection(e.source);
}
}
}
@@ -228,7 +228,7 @@ void CtrlrPanelCanvas::mouseDown (const MouseEvent& e)
}
if (!isLayer(e.eventComponent) && editMode && e.mods.isShiftDown())
{
- startDraggingSelection();
+ startDraggingSelection(e.source);
}
}
@@ -503,6 +503,7 @@ int CtrlrPanelCanvas::snapPosition (int pos, int snapSize, const bool allowSnap)
return pos;
}
+#if 0
void CtrlrPanelCanvas::moveSelectedComps (int dx, int dy, bool snap)
{
if ((bool)owner.getProperty (Ids::uiPanelLock))
@@ -512,6 +513,7 @@ void CtrlrPanelCanvas::moveSelectedComps (int dx, int dy, bool snap)
dragSelectedComps (dx, dy, snap);
endDraggingSelection();
}
+#endif
void CtrlrPanelCanvas::dragSelectedComps (int dx, int dy, const bool allowSnap)
{
@@ -562,7 +564,7 @@ void CtrlrPanelCanvas::endDraggingSelection()
}
}
-void CtrlrPanelCanvas::startDraggingSelection()
+void CtrlrPanelCanvas::startDraggingSelection(const MouseInputSource& inputSource)
{
if (getOwner().getSelection() == nullptr)
return;
@@ -574,7 +576,12 @@ void CtrlrPanelCanvas::startDraggingSelection()
c->getProperties().set ("yDragStart", c->getY());
c->toBack();
}
- startDragging ("__ctrlr_component_selection", this, Image (Image::ARGB,1,1,true));
+ startDragging ("__ctrlr_component_selection",
+ this,
+ Image (Image::ARGB,1,1,true),
+ false,
+ nullptr,
+ &inputSource);
if (getOwner().getSelection()->getNumSelected() > 1)
getPanel().getUndoManager()->beginNewTransaction ("Move multiple");
@@ -1030,7 +1037,7 @@ void CtrlrPanelCanvas::fileDragEnter (const StringArray &files, int x, int y)
{
if (luaPanelFileDragEnterHandlerCbk && !luaPanelFileDragEnterHandlerCbk.wasObjectDeleted())
{
- if (luaPanelFileDragEnterHandlerCbk->isValid())
+ if (luaPanelFileDragEnterHandlerCbk->isCallable())
{
owner.getOwner().getCtrlrLuaManager().getMethodManager().call (luaPanelFileDragEnterHandlerCbk, files, x, y);
@@ -1043,7 +1050,7 @@ void CtrlrPanelCanvas::fileDragExit (const StringArray &files)
{
if (luaPanelFileDragExitHandlerCbk && !luaPanelFileDragExitHandlerCbk.wasObjectDeleted())
{
- if (luaPanelFileDragExitHandlerCbk->isValid())
+ if (luaPanelFileDragExitHandlerCbk->isCallable())
{
owner.getOwner().getCtrlrLuaManager().getMethodManager().call (luaPanelFileDragExitHandlerCbk, files);
@@ -1080,7 +1087,7 @@ void CtrlrPanelCanvas::filesDropped (const StringArray &files, int x, int y)
if (luaPanelFileDragDropHandlerCbk && !luaPanelFileDragDropHandlerCbk.wasObjectDeleted())
{
- if (luaPanelFileDragDropHandlerCbk->isValid())
+ if (luaPanelFileDragDropHandlerCbk->isCallable())
{
owner.getOwner().getCtrlrLuaManager().getMethodManager().call (luaPanelFileDragDropHandlerCbk, files, x, y);
diff --git a/Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.h b/Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.h
index b191bd29d..8e62e1cda 100644
--- a/Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.h
+++ b/Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.h
@@ -119,9 +119,11 @@ class CtrlrPanelCanvas : public CtrlrChildWindowContent,
void copyWithChildren(CtrlrComponent *c);
void deleteWithChildren(CtrlrComponent *c);
int snapPosition (int pos, int snapSize, const bool allowSnap);
+#if 0
void moveSelectedComps (int dx, int dy, bool snap);
+#endif
void dragSelectedComps (int dx, int dy, const bool allowSnap);
- void startDraggingSelection();
+ void startDraggingSelection(const MouseInputSource& inputSource);
void endDraggingSelection();
void restoreState (const ValueTree &savedState);
void canvasStateRestored();
diff --git a/Source/UIComponents/CtrlrPropertyEditors/CtrlrPropertyComponent.cpp b/Source/UIComponents/CtrlrPropertyEditors/CtrlrPropertyComponent.cpp
index 51c7d7f1e..375f6c5d5 100644
--- a/Source/UIComponents/CtrlrPropertyEditors/CtrlrPropertyComponent.cpp
+++ b/Source/UIComponents/CtrlrPropertyEditors/CtrlrPropertyComponent.cpp
@@ -58,7 +58,7 @@ void CtrlrPropertyComponent::paint (Graphics &g)
g.setFont (currentFont);
g.setColour(findColour(PropertyComponent::labelTextColourId));
- g.drawFittedText (visibleText, 3, 0, getLookAndFeel().getPropertyComponentContentPosition (*this).getX()-5, getHeight(), Justification::centredLeft, 2);
+ g.drawFittedText (visibleText, 3, 0, std::max( getLookAndFeel().getPropertyComponentContentPosition (*this).getX()-5,0), getHeight(), Justification::centredLeft, 2);
}
void CtrlrPropertyComponent::resized()