triggerbox: use translatable marker name function in GUI

This commit is contained in:
Paul Davis 2022-02-11 11:33:43 -07:00
parent 98f1b4364d
commit 17e5667216
11 changed files with 16 additions and 17 deletions

View File

@ -180,7 +180,7 @@ CueEntry::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context>
//draw cue letter
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (context);
layout->set_font_description (UIConfiguration::instance ().get_NormalFont ());
layout->set_text (string_compose (_("%1"), (char) ('A' + _cue_idx)));
layout->set_text (cue_marker_name (_cue_idx));
int tw, th;
layout->get_pixel_size (tw, th);
context->translate (self.x0, self.y0 - 0.5); //canvas widget offset (sigh)
@ -276,7 +276,7 @@ CueBoxUI::context_menu (uint64_t idx)
for (int i = 0; i < default_triggers_per_box; i++) {
FollowAction jump_fa = (FollowAction::JumpTrigger);
jump_fa.targets.set(i);
jitems.push_back (MenuElem (string_compose ("%1", (char)('A' + i)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), jump_fa, idx)));
jitems.push_back (MenuElem (cue_marker_name (i), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), jump_fa, idx)));
}
fitems.push_back (MenuElem (_("Jump..."), *jump_menu));

View File

@ -740,7 +740,7 @@ Editor::mouse_add_new_marker (timepos_t where, Location::Flags extra_flags, int3
if (flags & Location::IsCueMarker) {
/* XXX i18n needed for cue letter names */
markername = string_compose (_("cue %1"), (char) ('A' + cue_id));
markername = string_compose (_("cue %1"), cue_marker_name (cue_id));
} else {
namebase = _("mark");
_session->locations()->next_available_name (markername, namebase);
@ -1045,7 +1045,7 @@ Editor::build_marker_menu (Location* loc)
MenuList& cue_items (cues_menu->items());
for (int32_t n = 0; n < default_triggers_per_box; ++n) {
/* XXX the "letter" names of the cues need to be subject to i18n somehow */
cue_items.push_back (MenuElem (string_compose (_("%1"), (char) ('A' + n)), sigc::bind (sigc::mem_fun(*this, &Editor::marker_menu_change_cue), n)));
cue_items.push_back (MenuElem (cue_marker_name (n), sigc::bind (sigc::mem_fun(*this, &Editor::marker_menu_change_cue), n)));
}
items.push_back (Menu_Helpers::MenuElem ("Set Cue:", *cues_menu));
/* TODO: tweak marker_menu_range_to_next to make a range between 2 Cues? */

View File

@ -4197,8 +4197,7 @@ Editor::bounce_range_selection (BounceTarget target, bool enable_processing)
tslot = manage (new ArdourDropdown ());
for (int c = 0; c < default_triggers_per_box; ++c) {
// XXX ('A' + x) is not translatable, TODO abstract using nth_letter()
std::string lbl = string_compose ("%1", (char)('A' + c));
std::string lbl = cue_marker_name (c);
tslot->AddMenuElem (Menu_Helpers::MenuElem (lbl, sigc::bind ([] (uint32_t* t, uint32_t v, ArdourDropdown* s, std::string l) {*t = v; s->set_text (l);}, &trigger_slot, c, tslot, lbl)));
}
tslot->set_active ("A");

View File

@ -253,7 +253,7 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t)
cme->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_cue_behavior));
for (int32_t n = 0; n < default_triggers_per_box; ++n) {
/* XXX the "letter" names of the cues need to be subject to i18n somehow */
ruler_items.push_back (MenuElem (string_compose (_("Cue %1"), (char) ('A' + n)), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, n)));
ruler_items.push_back (MenuElem (string_compose (_("Cue %1"), cue_marker_name (n)), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, n)));
}
break;

View File

@ -527,7 +527,7 @@ ArdourMarker::setup_name_display ()
_name_item->clamp_width (name_width);
if (_type == Cue) {
_name_item->set (string_compose ("%1", (char)('A' + _cue_index))); // XXX not translatable
_name_item->set (cue_marker_name (_cue_index));
} else {
_name_item->set (_name);
}

View File

@ -434,7 +434,7 @@ MiniTimeline::draw_cue (cairo_t* cr, int marker_loc, int &leftmost_cue_pos, int
//TODO: (*) we may need 'stop' marker(s) on the timeline as well, they will overwrite the bar with black
//draw cue letter
_layout->set_text (string_compose (_("%1"), (char) ('A' + cue_index)));
_layout->set_text (cue_marker_name (cue_index));
cairo_set_source_rgb (cr, 0, 0, 0); //black
cairo_move_to (cr, marker_loc, y_center); //move to center of circle
int tw, th;

View File

@ -148,7 +148,7 @@ SlotPropertyTable::SlotPropertyTable ()
for (int i = 0; i < default_triggers_per_box; i++) {
FollowAction jump_fa = (FollowAction::JumpTrigger);
jump_fa.targets.set(i);
jitems.push_back (MenuElem (string_compose ("%1", (char)('A' + i)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), jump_fa, 0)));
jitems.push_back (MenuElem (cue_marker_name (i), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), jump_fa, 0)));
}
_follow_left.AddMenuElem (MenuElem (_("Jump"), *jump_menu));
_follow_left.set_sizing_text (longest_follow);
@ -165,7 +165,7 @@ SlotPropertyTable::SlotPropertyTable ()
for (int i = 0; i < default_triggers_per_box; i++) {
FollowAction jump_fa = (FollowAction::JumpTrigger);
jump_fa.targets.set(i);
jitems_1.push_back (MenuElem (string_compose ("%1", (char)('A' + i)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), jump_fa, 1)));
jitems_1.push_back (MenuElem (cue_marker_name (i), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), jump_fa, 1)));
}
_follow_right.AddMenuElem (MenuElem (_("Jump"), *jump_menu_1));
_follow_right.set_sizing_text (longest_follow);

View File

@ -64,7 +64,7 @@ TriggerJumpDialog::on_trigger_set ()
b->signal_clicked.connect(sigc::bind(sigc::mem_fun(*this, &TriggerJumpDialog::button_clicked), i));
Gtk::Label* l = manage(new Gtk::Label(string_compose ("%1:", (char)('A' + i)), ALIGN_RIGHT));
Gtk::Label* l = manage(new Gtk::Label (cue_marker_name(i), ALIGN_RIGHT));
_table.attach (*l, 0, 1, r,r+1, Gtk::FILL, Gtk::SHRINK);
_table.attach (*b, 1, 2, r,r+1, Gtk::FILL, Gtk::SHRINK);

View File

@ -452,7 +452,7 @@ TriggerMaster::prop_change (PropertyChange const& what_changed)
_loopster->hide ();
} else {
play_text = (string_compose ("%1", (char)('A' + trigger->index ()))); // XXX not translatable
play_text = cue_marker_name (trigger->index ());
int fc = trigger->follow_count ();
int lc = trigger->loop_count ();

View File

@ -159,7 +159,7 @@ TriggerUI::register_actions ()
for (int32_t n = 0; n < default_triggers_per_box; ++n) {
const std::string action_name = string_compose ("trigger-cue-%1", n);
const std::string display_name = string_compose (_("Trigger Cue %1"), (char) ('A' + n));
const std::string display_name = string_compose (_("Trigger Cue %1"), cue_marker_name (n));
ActionManager::register_action (trigger_actions, action_name.c_str (), display_name.c_str (), sigc::bind (sigc::ptr_fun (TriggerUI::trigger_cue), n));
}
@ -597,7 +597,7 @@ TriggerUI::follow_context_menu ()
for (int i = 0; i < default_triggers_per_box; i++) {
FollowAction jump_fa = (FollowAction::JumpTrigger);
jump_fa.targets.set(i);
jitems.push_back (MenuElem (string_compose ("%1", (char)('A' + i)), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), jump_fa)));
jitems.push_back (MenuElem (cue_marker_name (i), sigc::bind (sigc::mem_fun (*this, &TriggerUI::set_follow_action), jump_fa)));
}
items.push_back (MenuElem (_("Jump"), *jump_menu));
@ -780,7 +780,7 @@ TriggerUI::follow_action_to_string (FollowAction const & fa, bool with_targets)
if ( fa.targets.count() == 1 ) { //jump to a specific row
for (int i = 0; i < default_triggers_per_box; i++) {
if (fa.targets.test(i)) {
return string_compose (_("Jump to: %1"), (char)('A' + i));
return string_compose (_("Jump to: %1"), cue_marker_name (i));
}
}
} else {

View File

@ -235,7 +235,7 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, FollowAct
}
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (context);
layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
layout->set_text (string_compose ("%1", (char)('A' + cue_idx))); //XXX translate?
layout->set_text (cue_marker_name (cue_idx));
int tw, th;
layout->get_pixel_size (tw, th);
context->move_to (size / 2, size / 2);