Push2: Drop "using namespace std"

No functional changes, just makes some more context explicit like the previous
commit.
This commit is contained in:
David Robillard 2021-06-18 20:31:35 -04:00 committed by Paul Davis
parent 61088a1a01
commit c4632da2e7
10 changed files with 65 additions and 72 deletions

View file

@ -40,7 +40,6 @@
using namespace PBD;
using namespace ARDOUR;
using namespace ArdourSurface;
using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
@ -92,7 +91,7 @@ P2GUI::P2GUI (Push2& p)
_table.set_homogeneous (false);
std::string data_file_path;
string name = "push2-small.png";
std::string name = "push2-small.png";
Searchpath spath(ARDOUR::ardour_data_search_path());
spath.add_subdirectory_to_paths ("icons");
find_file (spath, name, data_file_path);
@ -170,8 +169,8 @@ P2GUI::connection_handler ()
void
P2GUI::update_port_combos ()
{
vector<string> midi_inputs;
vector<string> midi_outputs;
std::vector<std::string> midi_inputs;
std::vector<std::string> midi_outputs;
ARDOUR::AudioEngine::instance()->get_ports ("", ARDOUR::DataType::MIDI, ARDOUR::PortFlags (ARDOUR::IsOutput|ARDOUR::IsTerminal), midi_inputs);
ARDOUR::AudioEngine::instance()->get_ports ("", ARDOUR::DataType::MIDI, ARDOUR::PortFlags (ARDOUR::IsInput|ARDOUR::IsTerminal), midi_outputs);
@ -192,7 +191,7 @@ P2GUI::update_port_combos ()
for (n = 1; i != children.end(); ++i, ++n) {
string port_name = (*i)[_midi_port_columns.full_name];
std::string port_name = (*i)[_midi_port_columns.full_name];
if (_p2.input_port()->connected_to (port_name)) {
_input_combo.set_active (n);
input_found = true;
@ -209,7 +208,7 @@ P2GUI::update_port_combos ()
++i; /* skip "Disconnected" */
for (n = 1; i != children.end(); ++i, ++n) {
string port_name = (*i)[_midi_port_columns.full_name];
std::string port_name = (*i)[_midi_port_columns.full_name];
if (_p2.output_port()->connected_to (port_name)) {
_output_combo.set_active (n);
output_found = true;
@ -223,16 +222,16 @@ P2GUI::update_port_combos ()
}
Glib::RefPtr<Gtk::ListStore>
P2GUI::build_midi_port_list (vector<string> const & ports, bool for_input)
P2GUI::build_midi_port_list (std::vector<std::string> const & ports, bool for_input)
{
Glib::RefPtr<Gtk::ListStore> store = ListStore::create (_midi_port_columns);
TreeModel::Row row;
row = *store->append ();
row[_midi_port_columns.full_name] = string();
row[_midi_port_columns.full_name] = std::string();
row[_midi_port_columns.short_name] = _("Disconnected");
for (vector<string>::const_iterator p = ports.begin(); p != ports.end(); ++p) {
for (std::vector<std::string>::const_iterator p = ports.begin(); p != ports.end(); ++p) {
row = *store->append ();
row[_midi_port_columns.full_name] = *p;
std::string pn = ARDOUR::AudioEngine::instance()->get_pretty_name_by_name (*p);
@ -253,7 +252,7 @@ P2GUI::active_port_changed (Gtk::ComboBox* combo, bool for_input)
}
TreeModel::iterator active = combo->get_active ();
string new_port = (*active)[_midi_port_columns.full_name];
std::string new_port = (*active)[_midi_port_columns.full_name];
if (new_port.empty()) {
if (for_input) {
@ -312,6 +311,6 @@ P2GUI::reprogram_pressure_mode ()
pm = Push2::AfterTouch;
}
cerr << "Reprogram pm to " << pm << endl;
std::cerr << "Reprogram pm to " << pm << std::endl;
_p2.set_pressure_mode (pm);
}

View file

@ -27,7 +27,6 @@
using namespace ARDOUR;
using namespace PBD;
using namespace std;
using namespace ArdourSurface;
static ControlProtocol*
@ -39,7 +38,7 @@ new_push2 (ControlProtocolDescriptor*, Session* s)
p2 = new Push2 (*s);
/* do not set active here - wait for set_state() */
}
catch (exception & e) {
catch (std::exception & e) {
error << "Error instantiating Push2 support: " << e.what() << endmsg;
delete p2;
p2 = 0;
@ -55,9 +54,9 @@ delete_push2 (ControlProtocolDescriptor*, ControlProtocol* cp)
{
delete cp;
}
catch ( exception & e )
catch ( std::exception & e )
{
cout << "Exception caught trying to finalize Push2 support: " << e.what() << endl;
std::cout << "Exception caught trying to finalize Push2 support: " << e.what() << std::endl;
}
}

View file

@ -38,7 +38,6 @@
using namespace ARDOUR;
using namespace PBD;
using namespace Gtkmm2ext;
using namespace std;
using namespace ArdourSurface;
using namespace ArdourCanvas;
@ -72,7 +71,7 @@ LevelMeter::~LevelMeter ()
_configuration_connection.disconnect();
_meter_type_connection.disconnect();
_parameter_connection.disconnect();
for (vector<MeterInfo>::iterator i = _meters.begin(); i != _meters.end(); i++) {
for (std::vector<MeterInfo>::iterator i = _meters.begin(); i != _meters.end(); ++i) {
delete (*i).meter;
}
_meters.clear();
@ -136,7 +135,7 @@ static float vu_standard() {
float
LevelMeter::update_meters ()
{
vector<MeterInfo>::iterator i;
std::vector<MeterInfo>::iterator i;
uint32_t n;
if (!_meter) {
@ -191,10 +190,10 @@ LevelMeter::update_meters ()
}
void
LevelMeter::parameter_changed (string p)
LevelMeter::parameter_changed (std::string p)
{
if (p == "meter-hold") {
vector<MeterInfo>::iterator i;
std::vector<MeterInfo>::iterator i;
uint32_t n;
for (n = 0, i = _meters.begin(); i != _meters.end(); ++i, ++n) {
@ -209,7 +208,7 @@ LevelMeter::parameter_changed (string p)
setup_meters (_meter_length, _regular_meter_width, _thin_meter_width);
}
else if (p == "meter-peak") {
vector<MeterInfo>::iterator i;
std::vector<MeterInfo>::iterator i;
uint32_t n;
for (n = 0, i = _meters.begin(); i != _meters.end(); ++i, ++n) {
@ -233,7 +232,7 @@ LevelMeter::meter_type_changed (MeterType t)
void
LevelMeter::hide_all_meters ()
{
for (vector<MeterInfo>::iterator i = _meters.begin(); i != _meters.end(); ++i) {
for (std::vector<MeterInfo>::iterator i = _meters.begin(); i != _meters.end(); ++i) {
if ((*i).packed) {
_meter_packer->remove ((*i).meter);
(*i).packed = false;
@ -486,7 +485,7 @@ LevelMeter::setup_meters (int len, int initial_width, int thin_width)
void LevelMeter::clear_meters (bool reset_highlight)
{
for (vector<MeterInfo>::iterator i = _meters.begin(); i < _meters.end(); i++) {
for (std::vector<MeterInfo>::iterator i = _meters.begin(); i < _meters.end(); ++i) {
(*i).meter->clear();
(*i).max_peak = minus_infinity();
if (reset_highlight)

View file

@ -40,13 +40,12 @@
#endif
using namespace ARDOUR;
using namespace std;
using namespace PBD;
using namespace Glib;
using namespace ArdourSurface;
using namespace ArdourCanvas;
Push2Menu::Push2Menu (Item* parent, vector<string> s)
Push2Menu::Push2Menu (Item* parent, std::vector<std::string> s)
: Container (parent)
, _baseline (-1)
, _ncols (0)
@ -70,7 +69,7 @@ Push2Menu::Push2Menu (Item* parent, vector<string> s)
_active_bg = new ArdourCanvas::Rectangle (this);
for (vector<string>::iterator si = s.begin(); si != s.end(); ++si) {
for (std::vector<std::string>::iterator si = s.begin(); si != s.end(); ++si) {
Text* t = new Text (this);
t->set_font_description (fd);
t->set (*si);
@ -96,7 +95,7 @@ Push2Menu::rearrange (uint32_t initial_display)
return;
}
vector<Text*>::iterator i = _displays.begin();
std::vector<Text*>::iterator i = _displays.begin();
/* move to first */
@ -182,7 +181,7 @@ Push2Menu::scroll (Direction dir, bool page)
case DirectionLeft:
if (page) {
set_active (max (0, (int) (_first - (_nrows * _ncols))));
set_active (std::max (0, (int) (_first - (_nrows * _ncols))));
} else {
if (_active / _nrows == 0) {
/* in the first column, go to last column, same row */
@ -198,7 +197,7 @@ Push2Menu::scroll (Direction dir, bool page)
case DirectionRight:
if (page) {
set_active (min ((uint32_t) _displays.size(), _first + (_nrows * _ncols)));
set_active (std::min ((uint32_t) _displays.size(), _first + (_nrows * _ncols)));
} else {
if (_active / _nrows == _ncols) {
/* in the last column, go to same row in first column */
@ -270,7 +269,7 @@ Push2Menu::set_text_color (Gtkmm2ext::Color c)
{
_text_color = c;
for (vector<Text*>::iterator t = _displays.begin(); t != _displays.end(); ++t) {
for (std::vector<Text*>::iterator t = _displays.begin(); t != _displays.end(); ++t) {
(*t)->set_color (c);
}
@ -295,7 +294,7 @@ Push2Menu::set_font_description (Pango::FontDescription fd)
{
_font_description = fd;
for (vector<Text*>::iterator t = _displays.begin(); t != _displays.end(); ++t) {
for (std::vector<Text*>::iterator t = _displays.begin(); t != _displays.end(); ++t) {
(*t)->set_font_description (fd);
}
}

View file

@ -26,8 +26,6 @@
#include <iomanip>
#include <stdexcept>
using namespace std;
MidiByteArray::MidiByteArray (size_t size, MIDI::byte array[])
: std::vector<MIDI::byte>()
{
@ -67,21 +65,21 @@ MidiByteArray & operator << (MidiByteArray & mba, const MIDI::byte & b)
MidiByteArray & operator << (MidiByteArray & mba, const MidiByteArray & barr)
{
back_insert_iterator<MidiByteArray> bit (mba);
std::back_insert_iterator<MidiByteArray> bit (mba);
copy (barr.begin(), barr.end(), bit);
return mba;
}
ostream & operator << (ostream & os, const MidiByteArray & mba)
std::ostream & operator << (std::ostream & os, const MidiByteArray & mba)
{
os << "[";
char fill = os.fill('0');
for (MidiByteArray::const_iterator it = mba.begin(); it != mba.end(); ++it) {
if (it != mba.begin()) os << " ";
os << hex << setw(2) << (int)*it;
os << std::hex << std::setw(2) << (int)*it;
}
os.fill (fill);
os << dec;
os << std::dec;
os << "]";
return os;
}

View file

@ -67,7 +67,6 @@
#endif
using namespace ARDOUR;
using namespace std;
using namespace PBD;
using namespace Glib;
using namespace ArdourSurface;
@ -113,7 +112,7 @@ MixLayout::MixLayout (Push2& p, Session & s, std::string const & name)
t->set_color (_p2.get_color (Push2::ParameterName));
t->set_position (Duple (10 + (n*Push2Canvas::inter_button_spacing()), 5));
string txt;
std::string txt;
switch (n) {
case 0:
txt = _("Volumes");
@ -424,9 +423,13 @@ MixLayout::strip_vpot (int n, int delta)
boost::shared_ptr<Controllable> ac = gain_meter[n]->knob->controllable();
if (ac) {
ac->set_value (ac->interface_to_internal (
min (ac->upper(), max (ac->lower(), ac->internal_to_interface (ac->get_value()) + (delta/256.0)))),
PBD::Controllable::UseGroup);
ac->set_value (
ac->interface_to_internal (
std::min (ac->upper (),
std::max (ac->lower (),
ac->internal_to_interface (ac->get_value ()) +
(delta / 256.0)))),
PBD::Controllable::UseGroup);
}
}
@ -512,8 +515,8 @@ MixLayout::mute_changed (uint32_t n)
void
MixLayout::solo_mute_changed (uint32_t n)
{
string shortname = short_version (_stripable[n]->name(), 10);
string text;
std::string shortname = short_version (_stripable[n]->name(), 10);
std::string text;
boost::shared_ptr<AutomationControl> ac;
ac = _stripable[n]->solo_control();
if (ac && ac->get_value()) {
@ -648,13 +651,13 @@ MixLayout::switch_bank (uint32_t base)
void
MixLayout::button_right ()
{
switch_bank (max (0, _bank_start + 8));
switch_bank (std::max (0, _bank_start + 8));
}
void
MixLayout::button_left ()
{
switch_bank (max (0, _bank_start - 8));
switch_bank (std::max (0, _bank_start - 8));
}

View file

@ -66,7 +66,6 @@
#endif
using namespace ARDOUR;
using namespace std;
using namespace PBD;
using namespace Glib;
using namespace ArdourSurface;
@ -78,7 +77,7 @@ using namespace Gtkmm2ext;
#define PUSH2 0x1967
Push2::Push2 (ARDOUR::Session& s)
: ControlProtocol (s, string (X_("Ableton Push 2")))
: ControlProtocol (s, std::string (X_("Ableton Push 2")))
, AbstractUI<Push2Request> (name())
, _handle (0)
, _in_use (false)
@ -628,7 +627,7 @@ Push2::handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes* ev)
if (ev->value) {
/* any press cancels any pending long press timeouts */
for (set<ButtonID>::iterator x = _buttons_down.begin(); x != _buttons_down.end(); ++x) {
for (std::set<ButtonID>::iterator x = _buttons_down.begin(); x != _buttons_down.end(); ++x) {
boost::shared_ptr<Button> bb = _id_button_map[*x];
bb->timeout_connection.disconnect ();
}
@ -647,7 +646,7 @@ Push2::handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes* ev)
}
set<ButtonID>::iterator c = _consumed.find (button->id);
std::set<ButtonID>::iterator c = _consumed.find (button->id);
if (c == _consumed.end()) {
if (ev->value == 0) {
@ -1177,14 +1176,14 @@ Push2::port_registration_handler ()
/* the origin of the numeric magic identifiers is known only to Ableton
and may change in time. This is part of how CoreMIDI works.
*/
string input_port_name = X_("system:midi_capture_1319078870");
string output_port_name = X_("system:midi_playback_3409210341");
std::string input_port_name = X_("system:midi_capture_1319078870");
std::string output_port_name = X_("system:midi_playback_3409210341");
#else
string input_port_name = X_("Ableton Push 2 MIDI 1 in");
string output_port_name = X_("Ableton Push 2 MIDI 1 out");
std::string input_port_name = X_("Ableton Push 2 MIDI 1 in");
std::string output_port_name = X_("Ableton Push 2 MIDI 1 out");
#endif
vector<string> in;
vector<string> out;
std::vector<std::string> in;
std::vector<std::string> out;
AudioEngine::instance()->get_ports (string_compose (".*%1", input_port_name), DataType::MIDI, PortFlags (IsPhysical|IsOutput), in);
AudioEngine::instance()->get_ports (string_compose (".*%1", output_port_name), DataType::MIDI, PortFlags (IsPhysical|IsInput), out);
@ -1209,8 +1208,8 @@ Push2::connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boo
return false;
}
string ni = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (boost::shared_ptr<ARDOUR::Port>(_async_in)->name());
string no = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (boost::shared_ptr<ARDOUR::Port>(_async_out)->name());
std::string ni = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (boost::shared_ptr<ARDOUR::Port>(_async_in)->name());
std::string no = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (boost::shared_ptr<ARDOUR::Port>(_async_out)->name());
if (ni == name1 || ni == name2) {
if (yn) {
@ -1312,7 +1311,7 @@ void
Push2::set_pad_scale (int root, int octave, MusicalMode::Type mode, bool inkey)
{
MusicalMode m (mode);
vector<float>::iterator interval;
std::vector<float>::iterator interval;
int note;
const int original_root = root;
@ -1322,8 +1321,8 @@ Push2::set_pad_scale (int root, int octave, MusicalMode::Type mode, bool inkey)
const int root_start = root;
set<int> mode_map; /* contains only notes in mode, O(logN) lookup */
vector<int> mode_vector; /* sorted in note order */
std::set<int> mode_map; /* contains only notes in mode, O(logN) lookup */
std::vector<int> mode_vector; /* sorted in note order */
mode_map.insert (note);
mode_vector.push_back (note);
@ -1356,7 +1355,7 @@ Push2::set_pad_scale (int root, int octave, MusicalMode::Type mode, bool inkey)
if (inkey) {
vector<int>::iterator notei;
std::vector<int>::iterator notei;
int row_offset = 0;
for (int row = 0; row < 8; ++row) {

View file

@ -34,7 +34,6 @@
#endif
using namespace ARDOUR;
using namespace std;
using namespace PBD;
using namespace Glib;
using namespace ArdourSurface;
@ -376,7 +375,7 @@ ScaleLayout::strip_vpot (int n, int delta)
void
ScaleLayout::build_scale_menu ()
{
vector<string> v;
std::vector<std::string> v;
/* must match in which enums are declared in push2.h
*/
@ -460,8 +459,8 @@ ScaleLayout::show_root_state ()
Pango::FontDescription fd ("Sans 10");
uint32_t highlight_text = 0;
vector<Text*>* none_text_array = 0;
vector<Text*>* one_text_array = 0;
std::vector<Text*>* none_text_array = 0;
std::vector<Text*>* one_text_array = 0;
Push2::ButtonID bid = Push2::Upper2; /* keep compilers quiet */
switch (_p2.scale_root()) {
@ -595,14 +594,14 @@ ScaleLayout::menu_rearranged ()
_left_scroll_text->set ("<");
_close_text->hide ();
} else {
_left_scroll_text->set (string());
_left_scroll_text->set (std::string());
_close_text->show ();
}
if (_scale_menu->can_scroll_right()) {
_right_scroll_text->set (">");
} else {
_right_scroll_text->set (string());
_right_scroll_text->set (std::string());
}
}

View file

@ -36,7 +36,6 @@
using namespace ARDOUR;
using namespace PBD;
using namespace std;
using namespace ArdourSurface;
using namespace ArdourCanvas;
@ -49,7 +48,7 @@ SplashLayout::SplashLayout (Push2& p, Session& s, std::string const & name)
rc.add_subdirectory_to_paths ("resources");
if (!find_file (rc, PROGRAM_NAME "-splash.png", splash_file)) {
cerr << "Cannot find splash screen image file\n";
std::cerr << "Cannot find splash screen image file\n";
throw failed_constructor();
}
@ -70,7 +69,7 @@ SplashLayout::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) c
double x_ratio = (double) _img->get_width() / (cols - 20);
double y_ratio = (double) _img->get_height() / (rows - 20);
double scale = min (x_ratio, y_ratio);
double scale = std::min (x_ratio, y_ratio);
/* background */

View file

@ -73,7 +73,6 @@
#endif
using namespace ARDOUR;
using namespace std;
using namespace PBD;
using namespace Glib;
using namespace ArdourSurface;