From 43b98524b5088ae36749d1d3dd904242caa024b6 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Tue, 8 Feb 2022 16:54:13 -0600 Subject: [PATCH] Cue page: cues are timeline rulers so color them(?); pixel-pushing --- gtk2_ardour/cuebox_ui.cc | 39 +++++++++++++++++++-------------------- gtk2_ardour/cuebox_ui.h | 1 - 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/gtk2_ardour/cuebox_ui.cc b/gtk2_ardour/cuebox_ui.cc index de3159f7f4..8a1b33883a 100644 --- a/gtk2_ardour/cuebox_ui.cc +++ b/gtk2_ardour/cuebox_ui.cc @@ -16,6 +16,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + #include "pbd/compose.h" #include "pbd/convert.h" @@ -27,10 +29,11 @@ #include "canvas/polygon.h" #include "canvas/text.h" -#include "gtkmm2ext/actions.h" -#include "gtkmm2ext/colors.h" #include #include + +#include "gtkmm2ext/actions.h" +#include "gtkmm2ext/colors.h" #include "gtkmm2ext/utils.h" #include "ardour_ui.h" @@ -71,11 +74,6 @@ CueEntry::CueEntry (Item* item, uint64_t cue_index) name_button->name = ("slot_selector_button"); name_button->show (); - name_text = new Text (name_button); - name_text->set (string_compose ("%1", (char)('A' + _cue_idx))); // XXX not translatable - name_text->set_ignore_events (false); - name_text->show (); - /* watch for cue-recording state */ TriggerBox::CueRecordingChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&CueEntry::rec_state_changed, this), gui_context ()); @@ -130,13 +128,6 @@ CueEntry::_size_allocate (ArdourCanvas::Rect const& alloc) name_button->set_center ( Duple(height/2, height/2) ); name_button->set_radius ( (height/2)- 2*scale ); - - name_text->size_allocate (ArdourCanvas::Rect (0, 0, height, height)); - name_text->set_position (Duple (4. * scale, 2.5 * scale)); - name_text->clamp_width (height); - - /* font scale may have changed. uiconfig 'embeds' the ui-scale in the font */ - name_text->set_font_description (UIConfiguration::instance ().get_SmallBoldMonospaceFont ()); } void @@ -186,6 +177,19 @@ CueEntry::render (ArdourCanvas::Rect const& area, Cairo::RefPtr context->set_line_width (1); } + //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))); + int tw, th; + layout->get_pixel_size (tw, th); + context->translate (self.x0, self.y0 - 0.5); //canvas widget offset (sigh) + context->move_to (width/2,height/2); //move to center + context->rel_move_to (-tw/2, -th/2); //rel move to top-left of text + context->set_source_rgb (0, 0, 0); //black + layout->show_in_cairo_context (context); + context->set_identity_matrix (); + if (false /*_cue_idx == 0*/) { Cairo::RefPtr drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6 * scale); drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7); @@ -205,14 +209,12 @@ CueEntry::set_default_colors () } set_fill_color (bg_col); - color_t fg_col = UIConfiguration::instance ().color ("neutral:midground"); + color_t fg_col = UIConfiguration::instance ().color ("location marker"); if ((_cue_idx / 2) % 2 == 0) { fg_col = HSV (fg_col).darker (0.20).color (); } name_button->set_fill_color (fg_col); - name_text->set_fill_color (UIConfiguration::instance ().color ("neutral:background")); - if (TriggerBox::cue_recording()) { name_button->set_fill_color (UIConfiguration::instance ().color ("alert:ruddy")); } @@ -427,9 +429,6 @@ CueBoxUI::build () _slots.push_back (te); -#if 0 - te->name_text->Event.connect (sigc::bind (sigc::mem_fun (*this, &CueBoxUI::text_event), n)); -#endif te->Event.connect (sigc::bind (sigc::mem_fun (*this, &CueBoxUI::event), n)); } } diff --git a/gtk2_ardour/cuebox_ui.h b/gtk2_ardour/cuebox_ui.h index f7dcb59372..e9c1e3f41d 100644 --- a/gtk2_ardour/cuebox_ui.h +++ b/gtk2_ardour/cuebox_ui.h @@ -48,7 +48,6 @@ public: ~CueEntry (); ArdourCanvas::Circle* name_button; - ArdourCanvas::Text* name_text; void render (ArdourCanvas::Rect const& area, Cairo::RefPtr context) const;