#include "time_axis_view.h"
#include "editor_drag.h"
#include "editor_cursors.h"
+#include "ui_config.h"
#include "i18n.h"
{
ruler_grabbed_widget = 0;
- Pango::FontDescription font (ARDOUR_UI::config()->get_SmallerFont());
+ Pango::FontDescription font (UIConfiguration::instance().get_SmallerFont());
_timecode_metric = new TimecodeMetric (this);
_bbt_metric = new BBTMetric (this);
_minsec_metric = new MinsecMetric (this);
_samples_metric = new SamplesMetric (this);
-
+
timecode_ruler = new ArdourCanvas::Ruler (_time_markers_group, *_timecode_metric,
ArdourCanvas::Rect (0, 0, ArdourCanvas::COORD_MAX, timebar_height));
timecode_ruler->set_font_description (font);
minsec_ruler->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_event), minsec_ruler, MinsecRulerItem));
bbt_ruler->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_event), bbt_ruler, BBTRulerItem));
samples_ruler->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_event), samples_ruler, SamplesRulerItem));
-
+
visible_timebars = 0; /*this will be changed below */
}
switch (t) {
case MarkerBarItem:
- ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false, false)));
+ ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false)));
ruler_items.push_back (MenuElem (_("Clear all locations"), sigc::mem_fun(*this, &Editor::clear_markers)));
ruler_items.push_back (MenuElem (_("Unhide locations"), sigc::mem_fun(*this, &Editor::unhide_markers)));
- ruler_items.push_back (SeparatorElem ());
break;
+
case RangeMarkerBarItem:
ruler_items.push_back (MenuElem (_("New range"), sigc::bind (sigc::mem_fun (*this, &Editor::mouse_add_new_range), where)));
ruler_items.push_back (MenuElem (_("Clear all ranges"), sigc::mem_fun(*this, &Editor::clear_ranges)));
ruler_items.push_back (MenuElem (_("Unhide ranges"), sigc::mem_fun(*this, &Editor::unhide_ranges)));
- ruler_items.push_back (SeparatorElem ());
-
break;
- case TransportMarkerBarItem:
+ case TransportMarkerBarItem:
+ ruler_items.push_back (MenuElem (_("New Loop range"), sigc::bind (sigc::mem_fun (*this, &Editor::mouse_add_new_loop), where)));
+ ruler_items.push_back (MenuElem (_("New Punch range"), sigc::bind (sigc::mem_fun (*this, &Editor::mouse_add_new_punch), where)));
break;
case CdMarkerBarItem:
// TODO
- ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true, false)));
+ ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true)));
break;
-
case TempoBarItem:
ruler_items.push_back (MenuElem (_("New Tempo"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_tempo_event), where)));
break;
tempo_label.hide();
}
- if (!Profile->get_sae() && ruler_range_action->get_active()) {
+ if (ruler_range_action->get_active()) {
old_unit_pos = range_marker_group->position().y;
if (tbpos != old_unit_pos) {
range_marker_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
return;
}
- fr = _session->frame_rate();
+ fr = _session->frame_rate();
if (lower > (spacer = (framepos_t) (128 * Editor::get_current_zoom ()))) {
lower = lower - spacer;
} else if (range <= 8 * 60 * 60 * fr) { /* 4 - 8 hrs*/
timecode_ruler_scale = timecode_show_hours;
timecode_mark_modulo = 1;
- timecode_nmarks = 2 + 8;
+ timecode_nmarks = 2 + 8;
} else if (range <= 16 * 60 * 60 * fr) { /* 16-24 hrs*/
timecode_ruler_scale = timecode_show_hours;
timecode_mark_modulo = 1;
But in this case, where the range defined by lower and uppper can vary
substantially (basically anything from 24hrs+ to several billion years)
- trying to decide which tick marks to show does require us to know
+ trying to decide which tick marks to show does require us to know
about the available width.
*/
mark.position = pos;
marks.push_back (mark);
++n;
- }
+ }
/* can't use Timecode::increment_hours() here because we may be traversing thousands of hours
and doing it 1 hour at a time is just stupid (and slow).
*/
} else {
bbt_ruler_scale = bbt_show_ticks_detail;
}
-
+
if ((bbt_ruler_scale == bbt_show_ticks_detail) && (lower_beat.beats == upper_beat.beats) && (upper_beat.ticks - lower_beat.ticks <= Timecode::BBT_Time::ticks_per_beat / 4)) {
bbt_ruler_scale = bbt_show_ticks_super_detail;
}
}
-static void
+static void
edit_last_mark_label (std::vector<ArdourCanvas::Ruler::Mark>& marks, const std::string& newlabel)
{
ArdourCanvas::Ruler::Mark copy = marks.back();
copy.label = newlabel;
marks.pop_back ();
marks.push_back (copy);
-}
+}
void
Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble lower, gdouble upper, gint /*maxchars*/)
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
-
+
// could do marks.assign() here to preallocate
mark.label = "";
But in this case, where the range defined by lower and uppper can vary
substantially (anything from 24hrs+ to several billion years)
- trying to decide which tick marks to show does require us to know
+ trying to decide which tick marks to show does require us to know
about the available width.
*/
marks.push_back (mark);
}
break;
-
+
case minsec_show_seconds:
for (n = 0; n < minsec_nmarks; pos += minsec_mark_interval, ++n) {
sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);
marks.push_back (mark);
}
break;
-
+
case minsec_show_many_hours:
for (n = 0; n < minsec_nmarks; ) {
sample_to_clock_parts (pos, _session->frame_rate(), &hrs, &mins, &secs, &millisecs);