From 3fc126b891fa2bd06fefd4497598d81653a6ccb2 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 4 Nov 2023 09:29:53 -0600 Subject: [PATCH] launchpads: add namespacing to make 1-source-2-surfaces work for X and Mini --- libs/surfaces/launchpad_x/gui.cc | 7 +++++++ libs/surfaces/launchpad_x/gui.h | 4 ++-- libs/surfaces/launchpad_x/launchpad_mini_interface.cc | 7 +++++++ libs/surfaces/launchpad_x/launchpad_x_interface.cc | 8 +++++++- libs/surfaces/launchpad_x/lpx.cc | 7 +++++++ libs/surfaces/launchpad_x/lpx.h | 10 ++++++++-- 6 files changed, 38 insertions(+), 5 deletions(-) diff --git a/libs/surfaces/launchpad_x/gui.cc b/libs/surfaces/launchpad_x/gui.cc index 5eff45d6d0..2939944b11 100644 --- a/libs/surfaces/launchpad_x/gui.cc +++ b/libs/surfaces/launchpad_x/gui.cc @@ -37,9 +37,16 @@ #include "pbd/i18n.h" +#ifdef LAUNCHPAD_MINI +#define LAUNCHPAD_NAMESPACE LP_MINI +#else +#define LAUNCHPAD_NAMESPACE LP_X +#endif + using namespace PBD; using namespace ARDOUR; using namespace ArdourSurface; +using namespace ArdourSurface::LAUNCHPAD_NAMESPACE; using namespace Gtk; using namespace Gtkmm2ext; diff --git a/libs/surfaces/launchpad_x/gui.h b/libs/surfaces/launchpad_x/gui.h index ffd69a4a99..2c425a53d6 100644 --- a/libs/surfaces/launchpad_x/gui.h +++ b/libs/surfaces/launchpad_x/gui.h @@ -39,7 +39,7 @@ namespace Gtk { #include "lpx.h" -namespace ArdourSurface { +namespace ArdourSurface { namespace LAUNCHPAD_NAMESPACE { class LPX_GUI : public Gtk::VBox { @@ -96,6 +96,6 @@ private: #endif }; -} +} } /* namespaces */ #endif /* __ardour_lpx_gui_h__ */ diff --git a/libs/surfaces/launchpad_x/launchpad_mini_interface.cc b/libs/surfaces/launchpad_x/launchpad_mini_interface.cc index 24b36d645f..066e4426fd 100644 --- a/libs/surfaces/launchpad_x/launchpad_mini_interface.cc +++ b/libs/surfaces/launchpad_x/launchpad_mini_interface.cc @@ -25,9 +25,16 @@ o * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include "control_protocol/control_protocol.h" #include "lpx.h" +#ifdef LAUNCHPAD_MINI +#define LAUNCHPAD_NAMESPACE LP_MINI +#else +#define LAUNCHPAD_NAMESPACE LP_X +#endif + using namespace ARDOUR; using namespace PBD; using namespace ArdourSurface; +using namespace ArdourSurface::LAUNCHPAD_NAMESPACE; static ControlProtocol* new_lpmini (Session* s) diff --git a/libs/surfaces/launchpad_x/launchpad_x_interface.cc b/libs/surfaces/launchpad_x/launchpad_x_interface.cc index 77ac6ebcb2..70281436e5 100644 --- a/libs/surfaces/launchpad_x/launchpad_x_interface.cc +++ b/libs/surfaces/launchpad_x/launchpad_x_interface.cc @@ -25,9 +25,15 @@ #include "control_protocol/control_protocol.h" #include "lpx.h" +#ifdef LAUNCHPAD_MINI +#define LAUNCHPAD_NAMESPACE LP_MINI +#else +#define LAUNCHPAD_NAMESPACE LP_X +#endif + using namespace ARDOUR; using namespace PBD; -using namespace ArdourSurface; +using namespace ArdourSurface::LAUNCHPAD_NAMESPACE; static ControlProtocol* new_lpx (Session* s) diff --git a/libs/surfaces/launchpad_x/lpx.cc b/libs/surfaces/launchpad_x/lpx.cc index ee70e159bf..f1d0ac7328 100644 --- a/libs/surfaces/launchpad_x/lpx.cc +++ b/libs/surfaces/launchpad_x/lpx.cc @@ -67,10 +67,17 @@ #define random() rand() #endif +#ifdef LAUNCHPAD_MINI +#define LAUNCHPAD_NAMESPACE LP_MINI +#else +#define LAUNCHPAD_NAMESPACE LP_X +#endif + using namespace ARDOUR; using namespace PBD; using namespace Glib; using namespace ArdourSurface; +using namespace ArdourSurface::LAUNCHPAD_NAMESPACE; using namespace Gtkmm2ext; #include "pbd/abstract_ui.cc" // instantiate template diff --git a/libs/surfaces/launchpad_x/lpx.h b/libs/surfaces/launchpad_x/lpx.h index efb4ec58a6..0b21affe61 100644 --- a/libs/surfaces/launchpad_x/lpx.h +++ b/libs/surfaces/launchpad_x/lpx.h @@ -56,7 +56,13 @@ namespace ARDOUR { class Trigger; } -namespace ArdourSurface { +#ifdef LAUNCHPAD_MINI +#define LAUNCHPAD_NAMESPACE LP_MINI +#else +#define LAUNCHPAD_NAMESPACE LP_X +#endif + +namespace ArdourSurface { namespace LAUNCHPAD_NAMESPACE { class LPX_GUI; @@ -373,6 +379,6 @@ class LaunchPadX : public MIDISurface }; -} /* namespace */ +} } /* namespaces */ #endif /* __ardour_lpx_h__ */