#include <gtkmm2ext/utils.h>
+#include "ardour_ui.h"
+/*
+ * ardour_ui.h was moved up in the include list
+ * due to a conflicting definition of 'Rect' between
+ * Apple's MacTypes.h file and GTK
+ */
+
#include "public_editor.h"
#include "time_axis_view_item.h"
#include "time_axis_view.h"
#include "utils.h"
#include "canvas_impl.h"
#include "rgb_macros.h"
-#include "ardour_ui.h"
#include "i18n.h"
double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH;
-inline guint8
-convert_color_channel (guint8 src,
- guint8 alpha)
-{
- return alpha ? ((guint (src) << 8) - src) / alpha : 0;
-}
-
-void
-convert_bgra_to_rgba (guint8 const* src,
- guint8* dst,
- int width,
- int height)
-{
- guint8 const* src_pixel = src;
- guint8* dst_pixel = dst;
-
- for (int y = 0; y < height; y++)
- for (int x = 0; x < width; x++)
- {
- dst_pixel[0] = convert_color_channel (src_pixel[2],
- src_pixel[3]);
- dst_pixel[1] = convert_color_channel (src_pixel[1],
- src_pixel[3]);
- dst_pixel[2] = convert_color_channel (src_pixel[0],
- src_pixel[3]);
- dst_pixel[3] = src_pixel[3];
-
- dst_pixel += 4;
- src_pixel += 4;
- }
-}
-
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
* @param start the start point of this item
* @param duration the duration of this item
*/
-TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color& base_color,
+TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color,
nframes_t start, nframes_t duration, bool recording,
Visibility vis)
: trackview (tv), _recregion(recording)
win.add (foo);
Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
- int width;
- int height;
+ int width = 0;
+ int height = 0;
layout->set_font_description (*NAME_FONT);
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
- NAME_Y_OFFSET = height + 5;
- NAME_HIGHLIGHT_SIZE = height + 6;
- NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 2;
+ NAME_Y_OFFSET = height + 3;
+ NAME_HIGHLIGHT_SIZE = height + 2;
+ NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
have_name_font = true;
}
}
void
-TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_color, nframes_t start, nframes_t duration, Visibility vis)
+TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color const & base_color, nframes_t start, nframes_t duration, Visibility vis)
{
item_name = it_name ;
samples_per_unit = spu ;
show_vestigial = true;
visibility = vis;
_sensitive = true;
- name_pixbuf = 0;
if (duration == 0) {
warning << "Time Axis Item Duration == 0" << endl ;
name_pixbuf->property_x() = NAME_X_OFFSET;
name_pixbuf->property_y() = trackview.current_height() - 1.0 - NAME_Y_OFFSET;
+ } else {
+ name_pixbuf = 0;
}
- /* create our grab handles used for trimming/duration etc */
+ /* 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;
- if (visibility & ShowHandles) {
-
- frame_handle_start = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 1.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH+1);
- frame_handle_start->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
-
- frame_handle_end = new ArdourCanvas::SimpleRect (*group, trackview.editor().frame_to_pixel(get_duration()) - TimeAxisViewItem::GRAB_HANDLE_LENGTH, trackview.editor().frame_to_pixel(get_duration()), 1.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH + 1);
- frame_handle_end->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
-
- } else {
- frame_handle_start = 0;
- frame_handle_end = 0;
- }
+ 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;
set_color (base_color) ;
* @param src the identity of the object that initiated the change
*/
void
-TimeAxisViewItem::set_max_duration_active(bool active, void* src)
+TimeAxisViewItem::set_max_duration_active (bool active, void* /*src*/)
{
- max_duration_active = active ;
+ max_duration_active = active;
}
/**
* @param src the identity of the object that initiated the change
*/
void
-TimeAxisViewItem::set_min_duration_active(bool active, void* src)
+TimeAxisViewItem::set_min_duration_active (bool active, void* /*src*/)
{
min_duration_active = active ;
}
uint32_t pb_width, it_width;
double font_size;
- if (!name_pixbuf) return;
-
font_size = NAME_FONT->get_size() / Pango::SCALE;
it_width = trackview.editor().frame_to_pixel(item_duration);
pb_width = new_name.length() * font_size;
}
if (pb_width <= 0 || it_width < NAME_X_OFFSET) {
- name_pixbuf->hide();
+ if (name_pixbuf) {
+ name_pixbuf->hide();
+ }
return;
} else {
name_pixbuf->show();
cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, pb_width, NAME_HIGHLIGHT_SIZE );
cairo_t *cr = cairo_create (surface);
cairo_text_extents_t te;
- cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
+ cairo_set_source_rgba (cr, 0.2, 0.2, 0.2, 1.0);
cairo_select_font_face (cr, NAME_FONT->get_family().c_str(),
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10);
}
if (height > NAME_HIGHLIGHT_SIZE) {
- name_highlight->property_y1() = (double) height+1 - NAME_HIGHLIGHT_SIZE;
- name_highlight->property_y2() = (double) height;
+ name_highlight->property_y1() = (double) height - 1 - NAME_HIGHLIGHT_SIZE;
+ name_highlight->property_y2() = (double) height - 2;
}
else {
/* it gets hidden now anyway */
}
if (visibility & ShowNameText) {
- name_pixbuf->property_y() = height+1 - NAME_Y_OFFSET;
+ name_pixbuf->property_y() = height - 1 - NAME_Y_OFFSET;
}
if (frame) {
- frame->property_y2() = height+1;
+ frame->property_y2() = height - 1;
+ frame_handle_start->property_y2() = height - 1;
+ frame_handle_end->property_y2() = height - 1;
}
- vestigial_frame->property_y2() = height+1;
+ vestigial_frame->property_y2() = height - 1;
}
/**
*
*/
void
-TimeAxisViewItem::set_color(Gdk::Color& base_color)
+TimeAxisViewItem::set_color (Gdk::Color const & base_color)
{
compute_colors (base_color);
set_colors ();
* @param color the base color of the item
*/
void
-TimeAxisViewItem::compute_colors(Gdk::Color& base_color)
+TimeAxisViewItem::compute_colors (Gdk::Color const & base_color)
{
unsigned char radius ;
char minor_shift ;
if (frame_handle_start) {
if (position_locked) {
frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
- frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
+ frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
} else {
- frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandle.get();
- frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandle.get();
+ frame_handle_start->property_fill_color_rgba() = RGBA_TO_UINT(1, 1, 1, 0); //ARDOUR_UI::config()->canvasvar_TrimHandle.get();
+ frame_handle_end->property_fill_color_rgba() = RGBA_TO_UINT(1, 1, 1, 0); //ARDOUR_UI::config()->canvasvar_TrimHandle.get();
}
}
}
}
void
-TimeAxisViewItem::reset_name_width (double pixel_width)
+TimeAxisViewItem::reset_name_width (double /*pixel_width*/)
{
set_name_text (item_name);
}