From 17e56672166170ea470533e43b01984ad11eda6c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 11 Feb 2022 11:33:43 -0700 Subject: [PATCH] triggerbox: use translatable marker name function in GUI --- gtk2_ardour/cuebox_ui.cc | 4 ++-- gtk2_ardour/editor_markers.cc | 4 ++-- gtk2_ardour/editor_ops.cc | 3 +-- gtk2_ardour/editor_rulers.cc | 2 +- gtk2_ardour/marker.cc | 2 +- gtk2_ardour/mini_timeline.cc | 2 +- gtk2_ardour/slot_properties_box.cc | 4 ++-- gtk2_ardour/trigger_jump_dialog.cc | 2 +- gtk2_ardour/trigger_master.cc | 2 +- gtk2_ardour/trigger_ui.cc | 6 +++--- gtk2_ardour/triggerbox_ui.cc | 2 +- 11 files changed, 16 insertions(+), 17 deletions(-) diff --git a/gtk2_ardour/cuebox_ui.cc b/gtk2_ardour/cuebox_ui.cc index 8a1b33883a..70ba7b6766 100644 --- a/gtk2_ardour/cuebox_ui.cc +++ b/gtk2_ardour/cuebox_ui.cc @@ -180,7 +180,7 @@ CueEntry::render (ArdourCanvas::Rect const& area, Cairo::RefPtr //draw cue letter Glib::RefPtr 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)); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 10bfa299c6..f7c8762952 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -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? */ diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index ce97d87a03..3bae41a846 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -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"); diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 4f4f5be71a..ade03a3b38 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -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; diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 19ded76d5d..0a16a3d23a 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -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); } diff --git a/gtk2_ardour/mini_timeline.cc b/gtk2_ardour/mini_timeline.cc index 2e81d8b0b9..107773ffe1 100644 --- a/gtk2_ardour/mini_timeline.cc +++ b/gtk2_ardour/mini_timeline.cc @@ -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; diff --git a/gtk2_ardour/slot_properties_box.cc b/gtk2_ardour/slot_properties_box.cc index 10dace9914..8393aef03b 100644 --- a/gtk2_ardour/slot_properties_box.cc +++ b/gtk2_ardour/slot_properties_box.cc @@ -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); diff --git a/gtk2_ardour/trigger_jump_dialog.cc b/gtk2_ardour/trigger_jump_dialog.cc index bcbd29a0eb..2cb6b9efc8 100644 --- a/gtk2_ardour/trigger_jump_dialog.cc +++ b/gtk2_ardour/trigger_jump_dialog.cc @@ -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); diff --git a/gtk2_ardour/trigger_master.cc b/gtk2_ardour/trigger_master.cc index 24bebe2994..072b40ed7f 100644 --- a/gtk2_ardour/trigger_master.cc +++ b/gtk2_ardour/trigger_master.cc @@ -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 (); diff --git a/gtk2_ardour/trigger_ui.cc b/gtk2_ardour/trigger_ui.cc index 1bb2c03f34..82ade283a1 100644 --- a/gtk2_ardour/trigger_ui.cc +++ b/gtk2_ardour/trigger_ui.cc @@ -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 { diff --git a/gtk2_ardour/triggerbox_ui.cc b/gtk2_ardour/triggerbox_ui.cc index f2481b9912..06568b8bb2 100644 --- a/gtk2_ardour/triggerbox_ui.cc +++ b/gtk2_ardour/triggerbox_ui.cc @@ -235,7 +235,7 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr context, FollowAct } Glib::RefPtr 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);