From ccf8ef0a0fc50968b62d4d67b980c45d8a355db3 Mon Sep 17 00:00:00 2001 From: woodybury Date: Tue, 7 Jan 2025 19:24:59 +0000 Subject: [PATCH 1/3] get models and irs buttons with dymanic clear button --- NeuralAmpModeler/NeuralAmpModeler.cpp | 45 +++++++-- NeuralAmpModeler/NeuralAmpModelerControls.h | 96 +++++++++++++++---- NeuralAmpModeler/config.h | 1 + .../project.pbxproj | 30 +++--- NeuralAmpModeler/resources/img/Globe.svg | 5 + NeuralAmpModeler/resources/main.rc_mac_menu | 34 +++---- 6 files changed, 156 insertions(+), 55 deletions(-) create mode 100644 NeuralAmpModeler/resources/img/Globe.svg diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp index 490951cbc..5687c88fa 100644 --- a/NeuralAmpModeler/NeuralAmpModeler.cpp +++ b/NeuralAmpModeler/NeuralAmpModeler.cpp @@ -119,6 +119,7 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info) const auto gearSVG = pGraphics->LoadSVG(GEAR_FN); const auto fileSVG = pGraphics->LoadSVG(FILE_FN); + const auto globeSVG = pGraphics->LoadSVG(GLOBE_ICON_FN); const auto crossSVG = pGraphics->LoadSVG(CLOSE_BUTTON_FN); const auto rightArrowSVG = pGraphics->LoadSVG(RIGHT_ARROW_FN); const auto leftArrowSVG = pGraphics->LoadSVG(LEFT_ARROW_FN); @@ -224,15 +225,45 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info) const std::string defaultNamFileString = "Select model..."; const std::string defaultIRString = "Select IR..."; #endif - pGraphics->AttachControl(new NAMFileBrowserControl(modelArea, kMsgTagClearModel, defaultNamFileString.c_str(), - "nam", loadModelCompletionHandler, style, fileSVG, crossSVG, - leftArrowSVG, rightArrowSVG, fileBackgroundBitmap), - kCtrlTagModelFileBrowser); + pGraphics->AttachControl( + new NAMFileBrowserControl( + modelArea, + kMsgTagClearModel, + defaultNamFileString.c_str(), + "nam", + loadModelCompletionHandler, + style, + fileSVG, + crossSVG, + leftArrowSVG, + rightArrowSVG, + fileBackgroundBitmap, + globeSVG, + "Get NAM Models", + "https://tonehunt.org/popular?tags%5B0%5D=nam" + ), + kCtrlTagModelFileBrowser + ); pGraphics->AttachControl(new ISVGSwitchControl(irSwitchArea, {irIconOffSVG, irIconOnSVG}, kIRToggle)); pGraphics->AttachControl( - new NAMFileBrowserControl(irArea, kMsgTagClearIR, defaultIRString.c_str(), "wav", loadIRCompletionHandler, style, - fileSVG, crossSVG, leftArrowSVG, rightArrowSVG, fileBackgroundBitmap), - kCtrlTagIRFileBrowser); + new NAMFileBrowserControl( + irArea, + kMsgTagClearIR, + defaultIRString.c_str(), + "wav", + loadIRCompletionHandler, + style, + fileSVG, + crossSVG, + leftArrowSVG, + rightArrowSVG, + fileBackgroundBitmap, + globeSVG, + "Get IRs", + "https://tonehunt.org/popular?filter=ir" + ), + kCtrlTagIRFileBrowser + ); pGraphics->AttachControl( new NAMSwitchControl(ngToggleArea, kNoiseGateActive, "Noise Gate", style, switchHandleBitmap)); pGraphics->AttachControl(new NAMSwitchControl(eqToggleArea, kEQActive, "EQ", style, switchHandleBitmap)); diff --git a/NeuralAmpModeler/NeuralAmpModelerControls.h b/NeuralAmpModeler/NeuralAmpModelerControls.h index 26462c315..a02b030a2 100644 --- a/NeuralAmpModeler/NeuralAmpModelerControls.h +++ b/NeuralAmpModeler/NeuralAmpModelerControls.h @@ -12,6 +12,11 @@ using namespace iplug; using namespace igraphics; +enum class NAMBrowserState { + Empty, // when no file loaded, show "Get" button + Loaded // when ile loaded, show "Clear" button +}; + // Where the corner button on the plugin (settings, close settings) goes // :param rect: Rect for the whole plugin's UI IRECT CornerButtonArea(const IRECT& rect) @@ -209,12 +214,27 @@ class NAMFileNameControl : public IVButtonControl } }; +// URL control for the "Get" models/irs links +class NAMGetButtonControl : public NAMSquareButtonControl +{ +public: + NAMGetButtonControl(const IRECT& bounds, const char* label, const char* url, const ISVG& globeSVG) + : NAMSquareButtonControl(bounds, [url](IControl* pCaller) { + WDL_String fullURL(url); + pCaller->GetUI()->OpenURL(fullURL.Get()); + }, globeSVG) + { + SetTooltip(label); + } +}; + class NAMFileBrowserControl : public IDirBrowseControlBase { public: NAMFileBrowserControl(const IRECT& bounds, int clearMsgTag, const char* labelStr, const char* fileExtension, IFileDialogCompletionHandlerFunc ch, const IVStyle& style, const ISVG& loadSVG, - const ISVG& clearSVG, const ISVG& leftSVG, const ISVG& rightSVG, const IBitmap& bitmap) + const ISVG& clearSVG, const ISVG& leftSVG, const ISVG& rightSVG, const IBitmap& bitmap, + const ISVG& globeSVG, const char* getButtonLabel, const char* getButtonURL) : IDirBrowseControlBase(bounds, fileExtension, false, false) , mClearMsgTag(clearMsgTag) , mDefaultLabelStr(labelStr) @@ -225,6 +245,10 @@ class NAMFileBrowserControl : public IDirBrowseControlBase , mClearSVG(clearSVG) , mLeftSVG(leftSVG) , mRightSVG(rightSVG) + , mGlobeSVG(globeSVG) + , mGetButtonLabel(getButtonLabel) + , mGetButtonURL(getButtonURL) + , mBrowserState(NAMBrowserState::Empty) { mIgnoreMouse = true; } @@ -304,6 +328,7 @@ class NAMFileBrowserControl : public IDirBrowseControlBase auto clearFileFunc = [&](IControl* pCaller) { pCaller->GetDelegate()->SendArbitraryMsgFromUI(mClearMsgTag); mFileNameControl->SetLabelAndTooltip(mDefaultLabelStr.Get()); + SetBrowserState(NAMBrowserState::Empty); // FIXME disabling output mode... // pCaller->GetUI()->GetControlWithTag(kCtrlTagOutputMode)->SetDisabled(false); }; @@ -328,7 +353,7 @@ class NAMFileBrowserControl : public IDirBrowseControlBase IRECT padded = mRECT.GetPadded(-6.f).GetHPadded(-2.f); const auto buttonWidth = padded.H(); const auto loadFileButtonBounds = padded.ReduceFromLeft(buttonWidth); - const auto clearButtonBounds = padded.ReduceFromRight(buttonWidth); + const auto clearAndGetButtonBounds = padded.ReduceFromRight(buttonWidth); const auto leftButtonBounds = padded.ReduceFromLeft(buttonWidth); const auto rightButtonBounds = padded.ReduceFromLeft(buttonWidth); const auto fileNameButtonBounds = padded; @@ -341,10 +366,17 @@ class NAMFileBrowserControl : public IDirBrowseControlBase ->SetAnimationEndActionFunction(nextFileFunc); AddChildControl(mFileNameControl = new NAMFileNameControl(fileNameButtonBounds, mDefaultLabelStr.Get(), mStyle)) ->SetAnimationEndActionFunction(chooseFileFunc); - AddChildControl(new NAMSquareButtonControl(clearButtonBounds, DefaultClickActionFunc, mClearSVG)) - ->SetAnimationEndActionFunction(clearFileFunc); - mFileNameControl->SetLabelAndTooltip(mDefaultLabelStr.Get()); + // creates both right-side controls but only show one based on state + mClearButton = new NAMSquareButtonControl(clearAndGetButtonBounds, DefaultClickActionFunc, mClearSVG); + mClearButton->SetAnimationEndActionFunction(clearFileFunc); + AddChildControl(mClearButton); + + mGetButton = new NAMGetButtonControl(clearAndGetButtonBounds, mGetButtonLabel, mGetButtonURL, mGlobeSVG); + AddChildControl(mGetButton); + + // initialize control visibility + SetBrowserState(NAMBrowserState::Empty); } void LoadFileAtCurrentIndex() @@ -367,24 +399,27 @@ class NAMFileBrowserControl : public IDirBrowseControlBase { std::string label(std::string("(FAILED) ") + std::string(mFileNameControl->GetLabelStr())); mFileNameControl->SetLabelAndTooltip(label.c_str()); + SetBrowserState(NAMBrowserState::Empty); } break; case kMsgTagLoadedModel: case kMsgTagLoadedIR: - { - WDL_String fileName, directory; - fileName.Set(reinterpret_cast(pData)); - directory.Set(reinterpret_cast(pData)); - directory.remove_filepart(true); - - ClearPathList(); - AddPath(directory.Get(), ""); - SetupMenu(); - SetSelectedFile(fileName.Get()); - mFileNameControl->SetLabelAndTooltipEllipsizing(fileName); + { + WDL_String fileName, directory; + fileName.Set(reinterpret_cast(pData)); + directory.Set(reinterpret_cast(pData)); + directory.remove_filepart(true); + + ClearPathList(); + AddPath(directory.Get(), ""); + SetupMenu(); + SetSelectedFile(fileName.Get()); + mFileNameControl->SetLabelAndTooltipEllipsizing(fileName); + SetBrowserState(NAMBrowserState::Loaded); + } + break; + default: break; - } - default: break; } } @@ -398,13 +433,36 @@ class NAMFileBrowserControl : public IDirBrowseControlBase return; } + // set the state of the browser and the visibility of the "Get" vs. "Clear" buttons + void SetBrowserState(NAMBrowserState newState) { + mBrowserState = newState; + + switch (mBrowserState) { + case NAMBrowserState::Empty: + mClearButton->Hide(true); + mGetButton->Hide(false); + break; + case NAMBrowserState::Loaded: + mClearButton->Hide(false); + mGetButton->Hide(true); + break; + } + } + WDL_String mDefaultLabelStr; IFileDialogCompletionHandlerFunc mCompletionHandlerFunc; NAMFileNameControl* mFileNameControl = nullptr; IVStyle mStyle; IBitmap mBitmap; - ISVG mLoadSVG, mClearSVG, mLeftSVG, mRightSVG; + ISVG mLoadSVG, mClearSVG, mLeftSVG, mRightSVG, mGlobeSVG; int mClearMsgTag; + + // new members for the "Get" button + const char* mGetButtonLabel; + const char* mGetButtonURL; + NAMBrowserState mBrowserState; + NAMSquareButtonControl* mClearButton = nullptr; + NAMGetButtonControl* mGetButton = nullptr; }; class NAMMeterControl : public IVPeakAvgMeterControl<>, public IBitmapBase diff --git a/NeuralAmpModeler/config.h b/NeuralAmpModeler/config.h index e78db336c..b6be2a21d 100644 --- a/NeuralAmpModeler/config.h +++ b/NeuralAmpModeler/config.h @@ -67,6 +67,7 @@ #define MODEL_ICON_FN "ModelIcon.svg" #define IR_ICON_ON_FN "IRIconOn.svg" #define IR_ICON_OFF_FN "IRIconOff.svg" +#define GLOBE_ICON_FN "Globe.svg" #define BACKGROUND_FN "Background.jpg" #define BACKGROUND2X_FN "Background@2x.jpg" diff --git a/NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj/project.pbxproj b/NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj/project.pbxproj index 759cacc84..c662ca098 100644 --- a/NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj/project.pbxproj +++ b/NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj/project.pbxproj @@ -3509,10 +3509,11 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 0.5.7; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 686EDA2T8T; + DEVELOPMENT_TEAM = ""; DSTROOT = "$(AU_PATH)"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(EXTRA_PLUGIN_DEFS)", @@ -3543,10 +3544,11 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 0.5.7; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 77BKRC84G3; + DEVELOPMENT_TEAM = ""; DSTROOT = "$(AU_PATH)"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(EXTRA_PLUGIN_DEFS)", @@ -3577,10 +3579,11 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 0.5.7; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 686EDA2T8T; + DEVELOPMENT_TEAM = ""; DSTROOT = "$(AU_PATH)"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(EXTRA_PLUGIN_DEFS)", @@ -4329,9 +4332,10 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = "NeuralAmpModeler-macOS.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 77BKRC84G3; + DEVELOPMENT_TEAM = ""; DSTROOT = "$(APP_PATH)"; ENABLE_HARDENED_RUNTIME = YES; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -4364,9 +4368,10 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = "NeuralAmpModeler-macOS.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 77BKRC84G3; + DEVELOPMENT_TEAM = ""; DSTROOT = "$(APP_PATH)"; ENABLE_HARDENED_RUNTIME = YES; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -4399,9 +4404,10 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = "NeuralAmpModeler-macOS.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 77BKRC84G3; + DEVELOPMENT_TEAM = ""; DSTROOT = "$(APP_PATH)"; ENABLE_HARDENED_RUNTIME = YES; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/NeuralAmpModeler/resources/img/Globe.svg b/NeuralAmpModeler/resources/img/Globe.svg new file mode 100644 index 000000000..357f7efdf --- /dev/null +++ b/NeuralAmpModeler/resources/img/Globe.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/NeuralAmpModeler/resources/main.rc_mac_menu b/NeuralAmpModeler/resources/main.rc_mac_menu index b12ff708a..d49c6e1b8 100644 --- a/NeuralAmpModeler/resources/main.rc_mac_menu +++ b/NeuralAmpModeler/resources/main.rc_mac_menu @@ -1,21 +1,21 @@ SWELL_DEFINE_MENU_RESOURCE_BEGIN(IDR_MENU1) - POPUP "&File" - BEGIN - MENUITEM "&Preferences...\tCtrl+,", ID_PREFERENCES - MENUITEM "&Quit", ID_QUIT - END - POPUP "&Debug" - BEGIN - MENUITEM "&Live Edit Mode\tCtrl+E", ID_LIVE_EDIT - MENUITEM "&Show Control Bounds\tCtrl+B", ID_SHOW_BOUNDS - MENUITEM "&Show Drawn Area\tCtrl+D", ID_SHOW_DRAWN - MENUITEM "&Show FPS\tCtrl+F", ID_SHOW_FPS - END - POPUP "&Help" - BEGIN - MENUITEM "&About", ID_ABOUT - MENUITEM "&Read Manual", ID_HELP - END + POPUP "&File" + BEGIN + MENUITEM "&Preferences...\tCtrl+,", ID_PREFERENCES + MENUITEM "&Quit", ID_QUIT + END + POPUP "&Debug" + BEGIN + MENUITEM "&Live Edit Mode\tCtrl+E", ID_LIVE_EDIT + MENUITEM "&Show Control Bounds\tCtrl+B", ID_SHOW_BOUNDS + MENUITEM "&Show Drawn Area\tCtrl+D", ID_SHOW_DRAWN + MENUITEM "&Show FPS\tCtrl+F", ID_SHOW_FPS + END + POPUP "&Help" + BEGIN + MENUITEM "&About", ID_ABOUT + MENUITEM "&Read Manual", ID_HELP + END SWELL_DEFINE_MENU_RESOURCE_END(IDR_MENU1) From a34425f8c143ef906543c3e596273e7a5ed9f6cd Mon Sep 17 00:00:00 2001 From: woodybury Date: Tue, 7 Jan 2025 19:32:13 +0000 Subject: [PATCH 2/3] revert local development files that were accidentally committed --- .../project.pbxproj | 30 +++++++--------- NeuralAmpModeler/resources/main.rc_mac_menu | 34 +++++++++---------- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj/project.pbxproj b/NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj/project.pbxproj index c662ca098..759cacc84 100644 --- a/NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj/project.pbxproj +++ b/NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj/project.pbxproj @@ -3509,11 +3509,10 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 0.5.7; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 686EDA2T8T; DSTROOT = "$(AU_PATH)"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(EXTRA_PLUGIN_DEFS)", @@ -3544,11 +3543,10 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 0.5.7; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 77BKRC84G3; DSTROOT = "$(AU_PATH)"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(EXTRA_PLUGIN_DEFS)", @@ -3579,11 +3577,10 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 0.5.7; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 686EDA2T8T; DSTROOT = "$(AU_PATH)"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(EXTRA_PLUGIN_DEFS)", @@ -4332,10 +4329,9 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = "NeuralAmpModeler-macOS.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 77BKRC84G3; DSTROOT = "$(APP_PATH)"; ENABLE_HARDENED_RUNTIME = YES; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -4368,10 +4364,9 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = "NeuralAmpModeler-macOS.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 77BKRC84G3; DSTROOT = "$(APP_PATH)"; ENABLE_HARDENED_RUNTIME = YES; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -4404,10 +4399,9 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CODE_SIGN_ENTITLEMENTS = "NeuralAmpModeler-macOS.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 77BKRC84G3; DSTROOT = "$(APP_PATH)"; ENABLE_HARDENED_RUNTIME = YES; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/NeuralAmpModeler/resources/main.rc_mac_menu b/NeuralAmpModeler/resources/main.rc_mac_menu index d49c6e1b8..b12ff708a 100644 --- a/NeuralAmpModeler/resources/main.rc_mac_menu +++ b/NeuralAmpModeler/resources/main.rc_mac_menu @@ -1,21 +1,21 @@ SWELL_DEFINE_MENU_RESOURCE_BEGIN(IDR_MENU1) - POPUP "&File" - BEGIN - MENUITEM "&Preferences...\tCtrl+,", ID_PREFERENCES - MENUITEM "&Quit", ID_QUIT - END - POPUP "&Debug" - BEGIN - MENUITEM "&Live Edit Mode\tCtrl+E", ID_LIVE_EDIT - MENUITEM "&Show Control Bounds\tCtrl+B", ID_SHOW_BOUNDS - MENUITEM "&Show Drawn Area\tCtrl+D", ID_SHOW_DRAWN - MENUITEM "&Show FPS\tCtrl+F", ID_SHOW_FPS - END - POPUP "&Help" - BEGIN - MENUITEM "&About", ID_ABOUT - MENUITEM "&Read Manual", ID_HELP - END + POPUP "&File" + BEGIN + MENUITEM "&Preferences...\tCtrl+,", ID_PREFERENCES + MENUITEM "&Quit", ID_QUIT + END + POPUP "&Debug" + BEGIN + MENUITEM "&Live Edit Mode\tCtrl+E", ID_LIVE_EDIT + MENUITEM "&Show Control Bounds\tCtrl+B", ID_SHOW_BOUNDS + MENUITEM "&Show Drawn Area\tCtrl+D", ID_SHOW_DRAWN + MENUITEM "&Show FPS\tCtrl+F", ID_SHOW_FPS + END + POPUP "&Help" + BEGIN + MENUITEM "&About", ID_ABOUT + MENUITEM "&Read Manual", ID_HELP + END SWELL_DEFINE_MENU_RESOURCE_END(IDR_MENU1) From 03f13bc5ba134470b416023d5e774ca72aaab955 Mon Sep 17 00:00:00 2001 From: woodybury Date: Tue, 7 Jan 2025 19:39:18 +0000 Subject: [PATCH 3/3] format.bash --- NeuralAmpModeler/NeuralAmpModeler.cpp | 45 ++++------------ NeuralAmpModeler/NeuralAmpModelerControls.h | 59 +++++++++++---------- 2 files changed, 41 insertions(+), 63 deletions(-) diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp index 5687c88fa..7656974d9 100644 --- a/NeuralAmpModeler/NeuralAmpModeler.cpp +++ b/NeuralAmpModeler/NeuralAmpModeler.cpp @@ -226,44 +226,17 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info) const std::string defaultIRString = "Select IR..."; #endif pGraphics->AttachControl( - new NAMFileBrowserControl( - modelArea, - kMsgTagClearModel, - defaultNamFileString.c_str(), - "nam", - loadModelCompletionHandler, - style, - fileSVG, - crossSVG, - leftArrowSVG, - rightArrowSVG, - fileBackgroundBitmap, - globeSVG, - "Get NAM Models", - "https://tonehunt.org/popular?tags%5B0%5D=nam" - ), - kCtrlTagModelFileBrowser - ); + new NAMFileBrowserControl(modelArea, kMsgTagClearModel, defaultNamFileString.c_str(), "nam", + loadModelCompletionHandler, style, fileSVG, crossSVG, leftArrowSVG, rightArrowSVG, + fileBackgroundBitmap, globeSVG, "Get NAM Models", + "https://tonehunt.org/popular?tags%5B0%5D=nam"), + kCtrlTagModelFileBrowser); pGraphics->AttachControl(new ISVGSwitchControl(irSwitchArea, {irIconOffSVG, irIconOnSVG}, kIRToggle)); pGraphics->AttachControl( - new NAMFileBrowserControl( - irArea, - kMsgTagClearIR, - defaultIRString.c_str(), - "wav", - loadIRCompletionHandler, - style, - fileSVG, - crossSVG, - leftArrowSVG, - rightArrowSVG, - fileBackgroundBitmap, - globeSVG, - "Get IRs", - "https://tonehunt.org/popular?filter=ir" - ), - kCtrlTagIRFileBrowser - ); + new NAMFileBrowserControl(irArea, kMsgTagClearIR, defaultIRString.c_str(), "wav", loadIRCompletionHandler, style, + fileSVG, crossSVG, leftArrowSVG, rightArrowSVG, fileBackgroundBitmap, globeSVG, + "Get IRs", "https://tonehunt.org/popular?filter=ir"), + kCtrlTagIRFileBrowser); pGraphics->AttachControl( new NAMSwitchControl(ngToggleArea, kNoiseGateActive, "Noise Gate", style, switchHandleBitmap)); pGraphics->AttachControl(new NAMSwitchControl(eqToggleArea, kEQActive, "EQ", style, switchHandleBitmap)); diff --git a/NeuralAmpModeler/NeuralAmpModelerControls.h b/NeuralAmpModeler/NeuralAmpModelerControls.h index a02b030a2..5285153a3 100644 --- a/NeuralAmpModeler/NeuralAmpModelerControls.h +++ b/NeuralAmpModeler/NeuralAmpModelerControls.h @@ -12,9 +12,10 @@ using namespace iplug; using namespace igraphics; -enum class NAMBrowserState { - Empty, // when no file loaded, show "Get" button - Loaded // when ile loaded, show "Clear" button +enum class NAMBrowserState +{ + Empty, // when no file loaded, show "Get" button + Loaded // when ile loaded, show "Clear" button }; // Where the corner button on the plugin (settings, close settings) goes @@ -215,14 +216,17 @@ class NAMFileNameControl : public IVButtonControl }; // URL control for the "Get" models/irs links -class NAMGetButtonControl : public NAMSquareButtonControl +class NAMGetButtonControl : public NAMSquareButtonControl { public: NAMGetButtonControl(const IRECT& bounds, const char* label, const char* url, const ISVG& globeSVG) - : NAMSquareButtonControl(bounds, [url](IControl* pCaller) { - WDL_String fullURL(url); - pCaller->GetUI()->OpenURL(fullURL.Get()); - }, globeSVG) + : NAMSquareButtonControl( + bounds, + [url](IControl* pCaller) { + WDL_String fullURL(url); + pCaller->GetUI()->OpenURL(fullURL.Get()); + }, + globeSVG) { SetTooltip(label); } @@ -404,22 +408,21 @@ class NAMFileBrowserControl : public IDirBrowseControlBase break; case kMsgTagLoadedModel: case kMsgTagLoadedIR: - { - WDL_String fileName, directory; - fileName.Set(reinterpret_cast(pData)); - directory.Set(reinterpret_cast(pData)); - directory.remove_filepart(true); - - ClearPathList(); - AddPath(directory.Get(), ""); - SetupMenu(); - SetSelectedFile(fileName.Get()); - mFileNameControl->SetLabelAndTooltipEllipsizing(fileName); - SetBrowserState(NAMBrowserState::Loaded); - } - break; - default: - break; + { + WDL_String fileName, directory; + fileName.Set(reinterpret_cast(pData)); + directory.Set(reinterpret_cast(pData)); + directory.remove_filepart(true); + + ClearPathList(); + AddPath(directory.Get(), ""); + SetupMenu(); + SetSelectedFile(fileName.Get()); + mFileNameControl->SetLabelAndTooltipEllipsizing(fileName); + SetBrowserState(NAMBrowserState::Loaded); + } + break; + default: break; } } @@ -434,10 +437,12 @@ class NAMFileBrowserControl : public IDirBrowseControlBase } // set the state of the browser and the visibility of the "Get" vs. "Clear" buttons - void SetBrowserState(NAMBrowserState newState) { + void SetBrowserState(NAMBrowserState newState) + { mBrowserState = newState; - - switch (mBrowserState) { + + switch (mBrowserState) + { case NAMBrowserState::Empty: mClearButton->Hide(true); mGetButton->Hide(false);