using namespace ARDOUR;
Pango::FontDescription* TimeAxisViewItem::NAME_FONT = 0;
-bool TimeAxisViewItem::have_name_font = false;
const double TimeAxisViewItem::NAME_X_OFFSET = 15.0;
const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6;
double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH;
+void
+TimeAxisViewItem::set_constant_heights ()
+{
+ NAME_FONT = get_font_for_style (X_("TimeAxisViewItemName"));
+
+ Gtk::Window win;
+ Gtk::Label foo;
+ win.add (foo);
+
+ Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
+ int width = 0;
+ int height = 0;
+
+ layout->set_font_description (*NAME_FONT);
+ Gtkmm2ext::get_ink_pixel_size (layout, width, height);
+
+ NAME_HEIGHT = height;
+ NAME_Y_OFFSET = height + 3;
+ NAME_HIGHLIGHT_SIZE = height + 2;
+ NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
+}
+
/**
* Construct a new TimeAxisViewItem.
*
, _height (1.0)
, _recregion (recording)
{
- if (!have_name_font) {
-
- /* first constructed item sets up font info */
-
- NAME_FONT = get_font_for_style (N_("TimeAxisViewItemName"));
-
- Gtk::Window win;
- Gtk::Label foo;
- win.add (foo);
-
- Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
- int width = 0;
- int height = 0;
-
- layout->set_font_description (*NAME_FONT);
- Gtkmm2ext::get_ink_pixel_size (layout, width, height);
-
- NAME_HEIGHT = height;
- NAME_Y_OFFSET = height + 3;
- NAME_HIGHLIGHT_SIZE = height + 2;
- NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
-
- have_name_font = true;
- }
-
group = new ArdourCanvas::Group (parent);
init (it_name, spu, base_color, start, duration, vis, true, true);
void
TimeAxisViewItem::init (
- const string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis, bool wide, bool high
- )
+ const string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis, bool wide, bool high)
{
item_name = it_name;
samples_per_unit = spu;
if (visibility & ShowFrame) {
frame = new ArdourCanvas::SimpleRect (*group, 0.0, 1.0, trackview.editor().frame_to_pixel(duration), trackview.current_height());
+
frame->property_outline_pixels() = 1;
frame->property_outline_what() = 0xF;
- frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
-
- /* by default draw all 4 edges */
-
- uint32_t outline_what = 0x1|0x2|0x4|0x8;
-
- if (visibility & HideFrameLeft) {
- outline_what &= ~(0x1);
- }
-
- if (visibility & HideFrameRight) {
- outline_what &= ~(0x2);
+
+ if(_recregion){
+ frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
}
-
- if (visibility & HideFrameTB) {
- outline_what &= ~(0x4 | 0x8);
+ else {
+ frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
}
-
- frame->property_outline_what() = outline_what;
+
+ frame->property_outline_what() = 0x1|0x2|0x4|0x8;
} else {
frame = 0;
}
if (visibility & ShowNameHighlight) {
+
if (visibility & FullWidthNameHighlight) {
name_highlight = new ArdourCanvas::SimpleRect (*group, 0.0, trackview.editor().frame_to_pixel(item_duration), trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height() - 1);
} else {
name_highlight = new ArdourCanvas::SimpleRect (*group, 1.0, trackview.editor().frame_to_pixel(item_duration) - 1, trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height() - 1);
}
+
name_highlight->set_data ("timeaxisviewitem", this);
} else {
}
/* create our grab handles used for trimming/duration etc */
- frame_handle_start = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 5.0, trackview.current_height());
- frame_handle_start->property_outline_what() = 0x0;
-
- frame_handle_end = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 5.0, trackview.current_height());
- frame_handle_end->property_outline_what() = 0x0;
+ if (!_recregion) {
+ frame_handle_start = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 5.0, trackview.current_height());
+ frame_handle_start->property_outline_what() = 0x0;
+ frame_handle_end = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 5.0, trackview.current_height());
+ frame_handle_end->property_outline_what() = 0x0;
+ } else {
+ frame_handle_start = frame_handle_end = 0;
+ }
set_color (base_color);
if (frame) {
frame->property_y2() = height - 1;
- frame_handle_start->property_y2() = height - 1;
- frame_handle_end->property_y2() = height - 1;
+ if (frame_handle_start) {
+ frame_handle_start->property_y2() = height - 1;
+ frame_handle_end->property_y2() = height - 1;
+ }
}
vestigial_frame->property_y2() = height - 1;
frame_handle_end->hide();
}
- } if (pixel_width < 2.0) {
+ }
+
+ if (pixel_width < 2.0) {
if (show_vestigial) {
vestigial_frame->show();