Push2: Mostly fix scale menu text rendering (#8599)

"Mostly" because there are still some issues with horizontal overlap between
entries, but I think that's something that needs to be addressed separately.

Like earlier issues, this was caused by using a screen-derived or default
cairo/pango context.  I also tinkered with some constants to make things look
sensible to me, and hopefully everywhere since it should always look the same
with the context fix.
This commit is contained in:
David Robillard 2021-06-18 20:32:09 -04:00 committed by Paul Davis
parent 2a31e0721d
commit 2af9c2180a
6 changed files with 8 additions and 10 deletions

View File

@ -51,8 +51,6 @@ class Push2Canvas : public ArdourCanvas::Canvas
void queue_resize ();
bool vblank ();
Cairo::RefPtr<Cairo::Context> image_context() { return _context; }
int rows() const { return _rows; }
int cols() const { return _cols; }

View File

@ -59,7 +59,7 @@ Push2Menu::Push2Menu (Item* parent, std::vector<std::string> s)
if (_baseline < 0) {
Push2Canvas* p2c = dynamic_cast<Push2Canvas*> (canvas());
Glib::RefPtr<Pango::Layout> throwaway = Pango::Layout::create (p2c->image_context());
Glib::RefPtr<Pango::Layout> throwaway = Pango::Layout::create (p2c->get_pango_context());
throwaway->set_font_description (fd);
throwaway->set_text (X_("Hg")); /* ascender + descender) */
int h, w;
@ -112,7 +112,7 @@ Push2Menu::rearrange (uint32_t initial_display)
while (i != _displays.end()) {
Coord x = col * Push2Canvas::inter_button_spacing();
Coord y = 2 + (row * _baseline);
Coord y = row * _baseline;
(*i)->set_position (Duple (x, y));

View File

@ -52,7 +52,6 @@
#include "canvas.h"
#include "gui.h"
#include "layout.h"
#include "menu.h"
#include "mix.h"
#include "push2.h"
#include "scale.h"

View File

@ -428,11 +428,11 @@ ScaleLayout::build_scale_menu ()
Pango::FontDescription fd ("Sans Bold 8");
_scale_menu->set_font_description (fd);
/* move menu into position so that its leftmost column is in the
* 2nd-from-left column of the display/button layout.
*/
/* Move menu horizontally so that the leftmost column is in the
2nd-from-left column of the display/button layout. The Y position is
just what appears centered to me. */
_scale_menu->set_position (Duple (10 + Push2Canvas::inter_button_spacing(), 40));
_scale_menu->set_position (Duple (10 + Push2Canvas::inter_button_spacing(), 32));
/* listen for changes */

View File

@ -29,6 +29,8 @@ namespace ArdourCanvas {
namespace ArdourSurface {
class Push2Menu;
class ScaleLayout : public Push2Layout
{
public:

View File

@ -61,7 +61,6 @@
#include "canvas.h"
#include "knob.h"
#include "level_meter.h"
#include "menu.h"
#include "push2.h"
#include "track_mix.h"
#include "utils.h"