From 2f77f2bc690fce27449be2ddc83ee68cbf3ddb8f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 26 Jun 2014 15:04:59 -0400 Subject: [PATCH] removed no-longer-used Editor::track_canvas_motion() Conflicts: gtk2_ardour/editor.h --- gtk2_ardour/editor.h | 6 ++---- gtk2_ardour/editor_canvas_events.cc | 11 +---------- gtk2_ardour/editor_drag.cc | 16 +++++----------- gtk2_ardour/editor_mouse.cc | 10 +--------- gtk2_ardour/session_dialog.cc | 1 + gtk2_ardour/session_dialog.logic.h | 2 +- gtk2_ardour/tracks_control_panel.logic.cc | 20 ++++++++++---------- gtk2_ardour/verbose_cursor.cc | 7 +++---- gtk2_ardour/verbose_cursor.h | 2 +- gtk2_ardour/waves_button.cc | 2 +- gtk2_ardour/waves_dialog.cc | 1 + gtk2_ardour/waves_ui.cc | 1 + libs/ardour/utils.cc | 22 ++++++++++++---------- 13 files changed, 40 insertions(+), 61 deletions(-) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 8a98ddb1c6..a5e4a2ba22 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -731,10 +731,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void parameter_changed (std::string); void ui_parameter_changed (std::string); - bool track_canvas_motion (GdkEvent*); - - Gtk::EventBox& time_bars_event_box; - Gtk::VBox& time_bars_vbox; + Gtk::EventBox& time_bars_event_box; + Gtk::VBox& time_bars_vbox; ArdourCanvas::Pixbuf *logo_item; #if 0 diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index f13a6357fd..2702dd722d 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -30,6 +30,7 @@ #include "canvas/canvas.h" #include "canvas/text.h" +#include "canvas/scroll_group.h" #include "editor.h" #include "keyboard.h" @@ -199,16 +200,6 @@ Editor::track_canvas_motion_notify_event (GdkEventMotion */*event*/) return false; } -bool -Editor::track_canvas_motion (GdkEvent *ev) -{ - if (_verbose_cursor->visible ()) { - _verbose_cursor->set_position (ev->motion.x + 10, ev->motion.y + 10); - } - - return false; -} - bool Editor::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type) { diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 48456d4c1d..51ddae1448 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -453,11 +453,7 @@ Drag::show_verbose_cursor_text (string const & text) setting. */ - _editor->verbose_cursor()->set ( - text, - _drags->current_pointer_x() + 10, - _drags->current_pointer_y() + 10 - ); + _editor->verbose_cursor()->set (text); } boost::shared_ptr @@ -2029,7 +2025,7 @@ VideoTimeLineDrag::start_grab (GdkEvent* event, Gdk::Cursor*) Timecode::Time timecode; _editor->session()->sample_to_timecode(abs(_startdrag_video_offset), timecode, true /* use_offset */, false /* use_subframes */ ); snprintf (buf, sizeof (buf), "Video Start:\n%c%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, (_startdrag_video_offset<0?'-':' '), timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); - _editor->verbose_cursor()->set(buf, event->button.x + 10, event->button.y + 10); + _editor->verbose_cursor()->set(buf); _editor->verbose_cursor()->show (); } @@ -2079,7 +2075,7 @@ VideoTimeLineDrag::motion (GdkEvent* event, bool first_move) , _("Diff:"), (dt<0?'-':' '), timediff.hours, timediff.minutes, timediff.seconds, timediff.frames ); - _editor->verbose_cursor()->set(buf, event->button.x + 10, event->button.y + 10); + _editor->verbose_cursor()->set(buf); _editor->verbose_cursor()->show (); } @@ -3519,8 +3515,7 @@ ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/) _point->line().start_drag_single (_point, _fixed_grab_x, fraction); - _editor->verbose_cursor()->set (_point->line().get_verbose_cursor_string (fraction), - event->button.x + 10, event->button.y + 10); + _editor->verbose_cursor()->set (_point->line().get_verbose_cursor_string (fraction)); _editor->verbose_cursor()->show (); @@ -3668,8 +3663,7 @@ LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/) _line->start_drag_line (before, after, fraction); - _editor->verbose_cursor()->set (_line->get_verbose_cursor_string (fraction), - event->button.x + 10, event->button.y + 10); + _editor->verbose_cursor()->set (_line->get_verbose_cursor_string (fraction)); _editor->verbose_cursor()->show (); } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index fae965b798..7f8e601757 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1738,16 +1738,9 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ cp = static_cast(item->get_data ("control_point")); cp->show (); - double at_x, at_y; - at_x = cp->get_x(); - at_y = cp->get_y (); - cp->i2w (at_x, at_y); - at_x += 10.0; - at_y += 10.0; - fraction = 1.0 - (cp->get_y() / cp->line().height()); - _verbose_cursor->set (cp->line().get_verbose_cursor_string (fraction), at_x, at_y); + _verbose_cursor->set (cp->line().get_verbose_cursor_string (fraction)); _verbose_cursor->show (); } break; @@ -2036,7 +2029,6 @@ Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from return false; } - track_canvas_motion (event); return true; } diff --git a/gtk2_ardour/session_dialog.cc b/gtk2_ardour/session_dialog.cc index 9089b1d0be..eff74d875a 100644 --- a/gtk2_ardour/session_dialog.cc +++ b/gtk2_ardour/session_dialog.cc @@ -22,6 +22,7 @@ #endif #include "session_dialog.h" +#include "utils.h" #include "i18n.h" using namespace std; diff --git a/gtk2_ardour/session_dialog.logic.h b/gtk2_ardour/session_dialog.logic.h index 14b32795a5..d9666e18d8 100644 --- a/gtk2_ardour/session_dialog.logic.h +++ b/gtk2_ardour/session_dialog.logic.h @@ -55,7 +55,7 @@ struct RecentSessionsSorter { bool operator() (std::pair a, std::pair b) const { - return cmp_nocase(a.first, b.first) == -1; + return ARDOUR::cmp_nocase(a.first, b.first) == -1; } }; diff --git a/gtk2_ardour/tracks_control_panel.logic.cc b/gtk2_ardour/tracks_control_panel.logic.cc index 074dcdac73..17b9ac5c6a 100644 --- a/gtk2_ardour/tracks_control_panel.logic.cc +++ b/gtk2_ardour/tracks_control_panel.logic.cc @@ -163,7 +163,7 @@ DeviceConnectionControl& TracksControlPanel::add_device_capture_control(std::str { std::string device_capture_name(""); std::string pattern(audio_capture_name_prefix); - remove_pattern_from_string(port_name, pattern, device_capture_name); + ARDOUR::remove_pattern_from_string(port_name, pattern, device_capture_name); DeviceConnectionControl &capture_control = *manage (new DeviceConnectionControl(device_capture_name, active, capture_number, track_name)); @@ -180,7 +180,7 @@ DeviceConnectionControl& TracksControlPanel::add_device_playback_control(std::st { std::string device_playback_name(""); std::string pattern(audio_playback_name_prefix); - remove_pattern_from_string(port_name, pattern, device_playback_name); + ARDOUR::remove_pattern_from_string(port_name, pattern, device_playback_name); DeviceConnectionControl &playback_control = *manage (new DeviceConnectionControl(device_playback_name, active, playback_number)); @@ -726,7 +726,7 @@ TracksControlPanel::populate_sample_rate_combo() std::vector s; for (std::vector::const_iterator x = sample_rates.begin(); x != sample_rates.end(); ++x) { - s.push_back (rate_as_string (*x)); + s.push_back (ARDOUR_UI_UTILS::rate_as_string (*x)); } { @@ -736,7 +736,7 @@ TracksControlPanel::populate_sample_rate_combo() _sample_rate_combo.set_sensitive (s.size() > 1); if (!s.empty() ) { - std::string active_sr = rate_as_string(EngineStateController::instance()->get_current_sample_rate() ); + std::string active_sr = ARDOUR_UI_UTILS::rate_as_string(EngineStateController::instance()->get_current_sample_rate() ); _sample_rate_combo.set_active_text(active_sr); } } @@ -798,7 +798,7 @@ TracksControlPanel::populate_input_channels() std::string port_name(""); std::string pattern(audio_capture_name_prefix); - remove_pattern_from_string(input_iter->name, pattern, port_name); + ARDOUR::remove_pattern_from_string(input_iter->name, pattern, port_name); number = number_count++; @@ -862,8 +862,8 @@ TracksControlPanel::populate_midi_ports() for (state_iter = midi_input_states.begin(); state_iter != midi_input_states.end(); ++state_iter) { // strip the device name from input port name std::string device_name(""); - remove_pattern_from_string(state_iter->name, midi_port_name_prefix, device_name); - remove_pattern_from_string(device_name, midi_capture_suffix, device_name); + ARDOUR::remove_pattern_from_string(state_iter->name, midi_port_name_prefix, device_name); + ARDOUR::remove_pattern_from_string(device_name, midi_capture_suffix, device_name); MidiDeviceDescriptor device_descriptor(device_name); device_descriptor.capture_name = state_iter->name; @@ -875,8 +875,8 @@ TracksControlPanel::populate_midi_ports() for (state_iter = midi_output_states.begin(); state_iter != midi_output_states.end(); ++state_iter){ // strip the device name from input port name std::string device_name(""); - remove_pattern_from_string(state_iter->name, midi_port_name_prefix, device_name); - remove_pattern_from_string(device_name, midi_playback_suffix, device_name); + ARDOUR::remove_pattern_from_string(state_iter->name, midi_port_name_prefix, device_name); + ARDOUR::remove_pattern_from_string(device_name, midi_playback_suffix, device_name); // check if we already have descriptor for this device MidiDeviceDescriptor device_descriptor(device_name); @@ -1186,7 +1186,7 @@ TracksControlPanel::sample_rate_changed() // set _ignore_changes flag to ignore changes in combo-box callbacks PBD::Unwinder protect_ignore_changes (_ignore_changes, _ignore_changes + 1); // restore previous buffer size value in combo box - std::string sample_rate_str = rate_as_string (EngineStateController::instance()->get_current_sample_rate() ); + std::string sample_rate_str = ARDOUR_UI_UTILS::rate_as_string (EngineStateController::instance()->get_current_sample_rate() ); _sample_rate_combo.set_active_text(sample_rate_str); } diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc index 299b509c68..39ea9df67d 100644 --- a/gtk2_ardour/verbose_cursor.cc +++ b/gtk2_ardour/verbose_cursor.cc @@ -58,10 +58,9 @@ VerboseCursor::canvas_item () const /** Set the contents and position of the cursor. Coordinates are in window space */ void -VerboseCursor::set (string const & text, double x, double y) +VerboseCursor::set (string const & text) { set_text (text); - set_position (x, y); } void @@ -159,7 +158,7 @@ VerboseCursor::set_time (framepos_t frame, double x, double y) break; } - set (buf, x, y); + set (buf); } void @@ -245,7 +244,7 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end, double x, double break; } - set (buf, x, y); + set (buf); } void diff --git a/gtk2_ardour/verbose_cursor.h b/gtk2_ardour/verbose_cursor.h index 8db45608cd..da09b81ee2 100644 --- a/gtk2_ardour/verbose_cursor.h +++ b/gtk2_ardour/verbose_cursor.h @@ -33,7 +33,7 @@ public: void set_color (uint32_t); - void set (std::string const &, double, double); + void set (std::string const &); void set_text (std::string const &); void set_position (double, double); void set_time (framepos_t, double, double); diff --git a/gtk2_ardour/waves_button.cc b/gtk2_ardour/waves_button.cc index d5b36e29ea..81b56bdc79 100644 --- a/gtk2_ardour/waves_button.cc +++ b/gtk2_ardour/waves_button.cc @@ -53,7 +53,7 @@ WavesButton::WavesButton () , _right_border_width (0) , _bottom_border_width (0) { - ColorsChanged.connect (sigc::mem_fun (*this, &WavesButton::color_handler)); + ARDOUR_UI_UTILS::ColorsChanged.connect (sigc::mem_fun (*this, &WavesButton::color_handler)); } WavesButton::WavesButton (const std::string& str) diff --git a/gtk2_ardour/waves_dialog.cc b/gtk2_ardour/waves_dialog.cc index 242643c6b0..b7d8e04ac0 100644 --- a/gtk2_ardour/waves_dialog.cc +++ b/gtk2_ardour/waves_dialog.cc @@ -40,6 +40,7 @@ using namespace Gtkmm2ext; using namespace PBD; using namespace ARDOUR; +using namespace ARDOUR_UI_UTILS; WavesDialog::WavesDialog (std::string layout_script_file, bool modal, bool use_seperator) : Gtk::Dialog ("", modal, use_seperator) diff --git a/gtk2_ardour/waves_ui.cc b/gtk2_ardour/waves_ui.cc index 246751c44e..c210fc6d64 100644 --- a/gtk2_ardour/waves_ui.cc +++ b/gtk2_ardour/waves_ui.cc @@ -28,6 +28,7 @@ using namespace PBD; using namespace ARDOUR; +using namespace ARDOUR_UI_UTILS; std::map WavesUI::__xml_tree_cache; diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 5667ab9ed3..de4f4b30c5 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -763,17 +763,19 @@ ARDOUR::slider_position_to_gain_with_max (double g, double max_gain) return slider_position_to_gain (g * max_gain/2.0); } -bool remove_pattern_from_string(const std::string& in_str, const std::string& pattern, std::string& out_str) { +bool +ARDOUR::remove_pattern_from_string(const std::string& in_str, const std::string& pattern, std::string& out_str) +{ - out_str.assign(in_str); - - size_t pos = in_str.find(pattern); - if ( pos != std::string::npos ) { - out_str.erase(pos, pattern.length() ); - return true; - } else { - return false; - } + out_str.assign(in_str); + + size_t pos = in_str.find(pattern); + if ( pos != std::string::npos ) { + out_str.erase(pos, pattern.length() ); + return true; + } else { + return false; + } } extern "C" {