Cleanup various design patterns.
* do not use implicit bool-to-int-cast * avoid C++11 member initialization in header * always use set and access methods, remove public variable
This commit is contained in:
parent
c46cd91d0e
commit
3136b20847
|
@ -528,13 +528,13 @@ LaunchControlXL::button_track_mode(TrackMode state)
|
||||||
void
|
void
|
||||||
LaunchControlXL::button_select_left()
|
LaunchControlXL::button_select_left()
|
||||||
{
|
{
|
||||||
switch_bank (max (0, bank_start - (7 + (LaunchControlXL::use_fader8master))));
|
switch_bank (max (0, bank_start - (7 + (fader8master() ? 1 : 0))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LaunchControlXL::button_select_right()
|
LaunchControlXL::button_select_right()
|
||||||
{
|
{
|
||||||
switch_bank (max (0, bank_start + 7 + (LaunchControlXL::use_fader8master)));
|
switch_bank (max (0, bank_start + 7 + (fader8master() ? 1 : 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -134,7 +134,7 @@ LCXLGUI::LCXLGUI (LaunchControlXL& p)
|
||||||
align->set (0.0, 0.5);
|
align->set (0.0, 0.5);
|
||||||
align->add (fader8master_button);
|
align->add (fader8master_button);
|
||||||
table.attach (*align, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0),0,0);
|
table.attach (*align, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0),0,0);
|
||||||
fader8master_button.set_active(lcxl.use_fader8master);
|
fader8master_button.set_active (lcxl.fader8master());
|
||||||
fader8master_button.signal_toggled().connect (sigc::mem_fun (*this, &LCXLGUI::toggle_fader8master));
|
fader8master_button.signal_toggled().connect (sigc::mem_fun (*this, &LCXLGUI::toggle_fader8master));
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
|
@ -285,8 +285,7 @@ LCXLGUI::active_port_changed (Gtk::ComboBox* combo, bool for_input)
|
||||||
void
|
void
|
||||||
LCXLGUI::toggle_fader8master ()
|
LCXLGUI::toggle_fader8master ()
|
||||||
{
|
{
|
||||||
DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("use_fader8master WAS: %1\n", lcxl.use_fader8master));
|
DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("use_fader8master WAS: %1\n", lcxl.fader8master()));
|
||||||
lcxl.use_fader8master = !(lcxl.use_fader8master);
|
lcxl.set_fader8master (!lcxl.fader8master());
|
||||||
DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("use_fader8master IS: %1\n", lcxl.use_fader8master));
|
DEBUG_TRACE(DEBUG::LaunchControlXL, string_compose("use_fader8master IS: %1\n", lcxl.fader8master()));
|
||||||
lcxl.set_fader8master(lcxl.use_fader8master);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ LaunchControlXL::LaunchControlXL (ARDOUR::Session& s)
|
||||||
, in_use (false)
|
, in_use (false)
|
||||||
, _track_mode(TrackMute)
|
, _track_mode(TrackMute)
|
||||||
, _template_number(8) // default template (factory 1)
|
, _template_number(8) // default template (factory 1)
|
||||||
|
, _fader8master (false)
|
||||||
, bank_start (0)
|
, bank_start (0)
|
||||||
, connection_state (ConnectionState (0))
|
, connection_state (ConnectionState (0))
|
||||||
, gui (0)
|
, gui (0)
|
||||||
|
@ -148,8 +149,8 @@ LaunchControlXL::begin_using_device ()
|
||||||
|
|
||||||
in_use = true;
|
in_use = true;
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("use_fader8master inital value '%1'\n", use_fader8master));
|
DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("fader8master inital value '%1'\n", fader8master()));
|
||||||
set_fader8master(use_fader8master);
|
set_fader8master (fader8master());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -656,7 +657,7 @@ LaunchControlXL::get_state()
|
||||||
node.add_child_nocopy (*child);
|
node.add_child_nocopy (*child);
|
||||||
|
|
||||||
child = new XMLNode (X_("Configuration"));
|
child = new XMLNode (X_("Configuration"));
|
||||||
child->set_property ("fader8master", LaunchControlXL::use_fader8master);
|
child->set_property ("fader8master", fader8master());
|
||||||
node.add_child_nocopy (*child);
|
node.add_child_nocopy (*child);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
@ -691,7 +692,7 @@ LaunchControlXL::set_state (const XMLNode & node, int version)
|
||||||
|
|
||||||
if ((child = node.child (X_("Configuration"))) !=0) {
|
if ((child = node.child (X_("Configuration"))) !=0) {
|
||||||
/* this should propably become a for-loop at some point */
|
/* this should propably become a for-loop at some point */
|
||||||
child->get_property ("fader8master", use_fader8master);
|
child->get_property ("fader8master", _fader8master);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -854,7 +855,7 @@ LaunchControlXL::switch_bank (uint32_t base)
|
||||||
uint32_t different = 0;
|
uint32_t different = 0;
|
||||||
uint8_t stripable_counter;
|
uint8_t stripable_counter;
|
||||||
|
|
||||||
if (LaunchControlXL::use_fader8master) {
|
if (fader8master ()) {
|
||||||
stripable_counter = 7;
|
stripable_counter = 7;
|
||||||
} else {
|
} else {
|
||||||
stripable_counter = 8;
|
stripable_counter = 8;
|
||||||
|
@ -938,8 +939,9 @@ void LaunchControlXL::set_track_mode (TrackMode mode) {
|
||||||
void
|
void
|
||||||
LaunchControlXL::set_fader8master (bool yn)
|
LaunchControlXL::set_fader8master (bool yn)
|
||||||
{
|
{
|
||||||
if (yn) {
|
_fader8master = yn;
|
||||||
|
if (_fader8master) {
|
||||||
stripable[7] = master;
|
stripable[7] = master;
|
||||||
}
|
}
|
||||||
switch_bank(bank_start);
|
switch_bank (bank_start);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,8 @@ class LCXLGUI;
|
||||||
class LaunchControlMenu;
|
class LaunchControlMenu;
|
||||||
|
|
||||||
class LaunchControlXL : public ARDOUR::ControlProtocol,
|
class LaunchControlXL : public ARDOUR::ControlProtocol,
|
||||||
public AbstractUI<LaunchControlRequest> {
|
public AbstractUI<LaunchControlRequest>
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
enum TrackMode {
|
enum TrackMode {
|
||||||
TrackMute,
|
TrackMute,
|
||||||
|
@ -335,8 +336,6 @@ public:
|
||||||
void *get_gui() const;
|
void *get_gui() const;
|
||||||
void tear_down_gui();
|
void tear_down_gui();
|
||||||
|
|
||||||
bool use_fader8master = false;
|
|
||||||
|
|
||||||
int set_active(bool yn);
|
int set_active(bool yn);
|
||||||
XMLNode &get_state();
|
XMLNode &get_state();
|
||||||
int set_state(const XMLNode &node, int version);
|
int set_state(const XMLNode &node, int version);
|
||||||
|
@ -354,7 +353,9 @@ public:
|
||||||
|
|
||||||
void write(const MidiByteArray &);
|
void write(const MidiByteArray &);
|
||||||
void reset(uint8_t chan);
|
void reset(uint8_t chan);
|
||||||
|
|
||||||
void set_fader8master (bool yn);
|
void set_fader8master (bool yn);
|
||||||
|
bool fader8master () const { return _fader8master; }
|
||||||
|
|
||||||
TrackMode track_mode() const { return _track_mode; }
|
TrackMode track_mode() const { return _track_mode; }
|
||||||
void set_track_mode(TrackMode mode);
|
void set_track_mode(TrackMode mode);
|
||||||
|
@ -366,6 +367,8 @@ private:
|
||||||
TrackMode _track_mode;
|
TrackMode _track_mode;
|
||||||
uint8_t _template_number;
|
uint8_t _template_number;
|
||||||
|
|
||||||
|
bool _fader8master;
|
||||||
|
|
||||||
void do_request(LaunchControlRequest *);
|
void do_request(LaunchControlRequest *);
|
||||||
|
|
||||||
int begin_using_device();
|
int begin_using_device();
|
||||||
|
@ -538,7 +541,7 @@ private:
|
||||||
void stripable_selection_changed();
|
void stripable_selection_changed();
|
||||||
|
|
||||||
bool in_range_select;
|
bool in_range_select;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace ArdourSurface
|
} // namespace ArdourSurface
|
||||||
|
|
Loading…
Reference in New Issue
Block a user