X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fverbose_cursor.cc;h=bf11733b6d25e93e7e69b45dfa2870d2edeb89aa;hb=a610157955af2f588f59d00ed585c2d842197c85;hp=b24dfbc8a84780d962f3f53b3d5b2ff4442f84c8;hpb=a2294aa0ff70238a34b4e2656d2742a732a47046;p=ardour.git diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc index b24dfbc8a8..bf11733b6d 100644 --- a/gtk2_ardour/verbose_cursor.cc +++ b/gtk2_ardour/verbose_cursor.cc @@ -26,15 +26,15 @@ #include "canvas/scroll_group.h" #include "canvas/tracking_text.h" -#include "ardour_ui.h" #include "audio_clock.h" #include "editor.h" #include "editor_drag.h" -#include "global_signals.h" #include "main_clock.h" #include "verbose_cursor.h" +#include "ardour_ui.h" +#include "ui_config.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -44,16 +44,16 @@ VerboseCursor::VerboseCursor (Editor* editor) { _canvas_item = new ArdourCanvas::TrackingText (_editor->get_noscroll_group()); CANVAS_DEBUG_NAME (_canvas_item, "verbose canvas cursor"); - _canvas_item->set_font_description (Pango::FontDescription (ARDOUR_UI::config()->get_canvasvar_LargerBoldFont())); + _canvas_item->set_font_description (Pango::FontDescription (UIConfiguration::instance().get_LargerBoldFont())); color_handler (); - ARDOUR_UI_UTILS::ColorsChanged.connect (sigc::mem_fun (*this, &VerboseCursor::color_handler)); + UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &VerboseCursor::color_handler)); } void VerboseCursor::color_handler () { - _canvas_item->set_color (ARDOUR_UI::config()->get_canvasvar_VerboseCanvasCursor()); + _canvas_item->set_color (UIConfiguration::instance().color_mod ("verbose canvas cursor", "verbose canvas cursor")); } ArdourCanvas::Item * @@ -98,9 +98,6 @@ VerboseCursor::set_time (framepos_t frame) char buf[128]; Timecode::Time timecode; Timecode::BBT_Time bbt; - int hours, mins; - framepos_t frame_rate; - float secs; if (_editor->_session == 0) { return; @@ -118,18 +115,11 @@ VerboseCursor::set_time (framepos_t frame) case AudioClock::Timecode: _editor->_session->timecode_time (frame, timecode); - snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); + snprintf (buf, sizeof (buf), "%s", Timecode::timecode_format_time (timecode).c_str()); break; case AudioClock::MinSec: - /* XXX this is copied from show_verbose_duration_cursor() */ - frame_rate = _editor->_session->frame_rate(); - hours = frame / (frame_rate * 3600); - frame = frame % (frame_rate * 3600); - mins = frame / (frame_rate * 60); - frame = frame % (frame_rate * 60); - secs = (float) frame / (float) frame_rate; - snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%07.4f", hours, mins, secs); + AudioClock::print_minsec (frame, buf, sizeof (buf), _editor->_session->frame_rate()); break; default: @@ -147,10 +137,7 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end) Timecode::Time timecode; Timecode::BBT_Time sbbt; Timecode::BBT_Time ebbt; - int hours, mins; - framepos_t distance, frame_rate; - float secs; - Meter meter_at_start (_editor->_session->tempo_map().meter_at(start)); + Meter meter_at_start (_editor->_session->tempo_map().meter_at_frame (start)); if (_editor->_session == 0) { return; @@ -197,19 +184,11 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end) case AudioClock::Timecode: _editor->_session->timecode_duration (end - start, timecode); - snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); + snprintf (buf, sizeof (buf), "%s", Timecode::timecode_format_time (timecode).c_str()); break; case AudioClock::MinSec: - /* XXX this stuff should be elsewhere.. */ - distance = end - start; - frame_rate = _editor->_session->frame_rate(); - hours = distance / (frame_rate * 3600); - distance = distance % (frame_rate * 3600); - mins = distance / (frame_rate * 60); - distance = distance % (frame_rate * 60); - secs = (float) distance / (float) frame_rate; - snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%07.4f", hours, mins, secs); + AudioClock::print_minsec (end - start, buf, sizeof (buf), _editor->_session->frame_rate()); break; default: