13
0

trigger_ui: pixel pushing for mac

This commit is contained in:
Ben Loftis 2022-02-26 08:47:40 -06:00
parent dd1156e900
commit 3280523e90
2 changed files with 22 additions and 9 deletions

View File

@ -181,11 +181,15 @@ 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 ());
int font_size = 8 * scale;
char font_name[128];
snprintf (font_name, sizeof (font_name), "ArdourMono %d", font_size);
Pango::FontDescription pfd (font_name);
layout->set_font_description (pfd);
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)
context->translate (self.x0 - 0.5*scale, self.y0 - 0.5*scale);
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

View File

@ -89,7 +89,7 @@ Loopster::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context>
}
context->set_identity_matrix ();
context->translate (self.x0, self.y0 - 0.5);
context->translate (self.x0, self.y0);
float size = _rect.height ();
@ -189,34 +189,43 @@ TriggerMaster::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Cont
/* MIDI triggers get a 'note' symbol */
if (_triggerbox && _triggerbox->data_type () == ARDOUR::DataType::MIDI) {
layout->set_font_description (UIConfiguration::instance ().get_BigBoldMonospaceFont ());
int font_size = 14 * scale;
char font_name[128];
snprintf (font_name, sizeof (font_name), "ArdourSans %d", font_size);
Pango::FontDescription pfd (font_name);
layout->set_font_description (pfd);
layout->set_text ("\u266b");
int tw, th;
layout->get_pixel_size (tw, th);
context->move_to (width / 2, height / 2);
context->rel_move_to (-tw / 2, -th / 2);
context->rel_move_to (-tw / 2, -2*scale -th / 2);
Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground"));
layout->show_in_cairo_context (context);
}
int font_size = 8 * scale;
char font_name[128];
snprintf (font_name, sizeof (font_name), "ArdourSans %d", font_size);
Pango::FontDescription pfd (font_name);
if (play_text != "") {
layout->set_font_description (UIConfiguration::instance ().get_NormalFont ());
layout->set_font_description (pfd);
layout->set_text (play_text);
int tw, th;
layout->get_pixel_size (tw, th);
context->move_to ( height + 4*scale, height / 2); //left side, but make room for loopster
context->rel_move_to ( 0, -th / 2); //vertically centered text
context->rel_move_to ( 0, -1*scale -th / 2); //vertically centered text
Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground"));
layout->show_in_cairo_context (context);
}
if (loop_text != "") {
layout->set_font_description (UIConfiguration::instance ().get_NormalFont ());
layout->set_font_description (pfd);
layout->set_text (loop_text);
int tw, th;
layout->get_pixel_size (tw, th);
context->move_to ( width-4*scale, height / 2); //right side
context->rel_move_to ( -tw, -th / 2); //right justified, vertically centered text
context->rel_move_to ( -tw, -1*scale -th / 2); //right justified, vertically centered text
Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground"));
layout->show_in_cairo_context (context);
}