canvas markers now use ArdourCanvas::Text, not ArdourCanvas::Pixbuf, since the latter will be optimized to use Pixbuf too
This commit is contained in:
parent
6b5846ab95
commit
fc787fad50
@ -23,7 +23,7 @@
|
|||||||
#include "canvas/group.h"
|
#include "canvas/group.h"
|
||||||
#include "canvas/line.h"
|
#include "canvas/line.h"
|
||||||
#include "canvas/polygon.h"
|
#include "canvas/polygon.h"
|
||||||
#include "canvas/pixbuf.h"
|
#include "canvas/text.h"
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
/*
|
/*
|
||||||
@ -269,11 +269,14 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
|
|||||||
layout->set_font_description (name_font);
|
layout->set_font_description (name_font);
|
||||||
Gtkmm2ext::get_ink_pixel_size (layout, width, name_height);
|
Gtkmm2ext::get_ink_pixel_size (layout, width, name_height);
|
||||||
|
|
||||||
name_pixbuf = new ArdourCanvas::Pixbuf (group);
|
_name_item = new ArdourCanvas::Text (group);
|
||||||
|
_name_item->set_font_description (name_font);
|
||||||
|
_name_item->set_color (0);
|
||||||
|
|
||||||
#ifdef CANVAS_DEBUG
|
#ifdef CANVAS_DEBUG
|
||||||
name_pixbuf->name = string_compose ("Marker::name_pixbuf for %1", annotation);
|
_name_item->name = string_compose ("Marker::_name_item for %1", annotation);
|
||||||
#endif
|
#endif
|
||||||
name_pixbuf->set_position (ArdourCanvas::Duple (_label_offset, 13 / 2 - name_height / 2));
|
_name_item->set_position (ArdourCanvas::Duple (_label_offset, 13 / 2 - name_height / 2));
|
||||||
|
|
||||||
set_name (annotation.c_str());
|
set_name (annotation.c_str());
|
||||||
|
|
||||||
@ -393,22 +396,26 @@ Marker::setup_name_display ()
|
|||||||
|
|
||||||
/* Work out how wide the name can be */
|
/* Work out how wide the name can be */
|
||||||
int name_width = min ((double) pixel_width (_name, name_font) + 2, limit);
|
int name_width = min ((double) pixel_width (_name, name_font) + 2, limit);
|
||||||
|
|
||||||
if (name_width == 0) {
|
if (name_width == 0) {
|
||||||
name_width = 1;
|
name_width = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (label_on_left ()) {
|
if (label_on_left ()) {
|
||||||
name_pixbuf->set_x_position (-name_width);
|
_name_item->set_x_position (-name_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
name_pixbuf->set (pixbuf_from_string (_name, name_font, name_width, name_height, Gdk::Color ("#000000")));
|
_name_item->set (_name);
|
||||||
|
|
||||||
|
// CAIROCANVAS
|
||||||
|
// need to "clip" name to name_width and name_height
|
||||||
|
|
||||||
if (label_on_left ()) {
|
if (label_on_left ()) {
|
||||||
_name_background->set_x0 (name_pixbuf->position().x - 2);
|
_name_background->set_x0 (_name_item->position().x - 2);
|
||||||
_name_background->set_x1 (name_pixbuf->position().x + name_width + _shift);
|
_name_background->set_x1 (_name_item->position().x + name_width + _shift);
|
||||||
} else {
|
} else {
|
||||||
_name_background->set_x0 (name_pixbuf->position().x - _label_offset + 2);
|
_name_background->set_x0 (_name_item->position().x - _label_offset + 2);
|
||||||
_name_background->set_x1 (name_pixbuf->position().x + name_width);
|
_name_background->set_x1 (_name_item->position().x + name_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
_name_background->set_y0 (0);
|
_name_background->set_y0 (0);
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include "ardour/ardour.h"
|
#include "ardour/ardour.h"
|
||||||
#include "pbd/signals.h"
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
|
#include "canvas/fwd.h"
|
||||||
#include "canvas/types.h"
|
#include "canvas/types.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
@ -34,15 +36,6 @@ namespace ARDOUR {
|
|||||||
class MeterSection;
|
class MeterSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
|
||||||
class Polygon;
|
|
||||||
class Line;
|
|
||||||
class Rectangle;
|
|
||||||
class Group;
|
|
||||||
class Pixbuf;
|
|
||||||
class Item;
|
|
||||||
}
|
|
||||||
|
|
||||||
class PublicEditor;
|
class PublicEditor;
|
||||||
|
|
||||||
class Marker : public sigc::trackable
|
class Marker : public sigc::trackable
|
||||||
@ -108,7 +101,7 @@ class Marker : public sigc::trackable
|
|||||||
ArdourCanvas::Group* _parent;
|
ArdourCanvas::Group* _parent;
|
||||||
ArdourCanvas::Group *group;
|
ArdourCanvas::Group *group;
|
||||||
ArdourCanvas::Polygon *mark;
|
ArdourCanvas::Polygon *mark;
|
||||||
ArdourCanvas::Pixbuf *name_pixbuf;
|
ArdourCanvas::Text *_name_item;
|
||||||
ArdourCanvas::Points *points;
|
ArdourCanvas::Points *points;
|
||||||
ArdourCanvas::Line* _line;
|
ArdourCanvas::Line* _line;
|
||||||
ArdourCanvas::Points *line_points;
|
ArdourCanvas::Points *line_points;
|
||||||
|
Loading…
Reference in New Issue
Block a user