13
0

Merge branch 'cairocanvas' of git.ardour.org:ardour/ardour into cairocanvas

This commit is contained in:
Paul Davis 2013-04-06 16:12:27 -04:00
commit 81506ea41c
9 changed files with 45 additions and 38 deletions

View File

@ -151,20 +151,13 @@ Editor::initialize_canvas ()
marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height));
cd_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0));
#ifdef WITH_VIDEOTIMELINE
videotl_group = new ArdourCanvas::Group (_time_markers_group, 0.0, 0.0);
videotl_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple(0.0, 0.0));
#endif
#ifdef WITH_VIDEOTIMELINE
videotl_bar_group = new ArdourCanvas::Group (track_canvas->root ());
if (Profile->get_sae()) {
videotl_bar = new ArdourCanvas::Rectangle (videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height - 1));
videotl_bar->property_outline_pixels() = 1;
} else {
videotl_bar = new ArdourCanvas::Rectangle (videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height));
videotl_bar->property_outline_pixels() = 0;
}
videotl_bar->property_outline_what() = (0x1 | 0x8);
videotl_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
videotl_bar = new ArdourCanvas::Rectangle (videotl_bar_group, ArdourCanvas::Rect (0.0, 0.0, 100,(timebar_height * videotl_bar_height)));
ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_bar_group, (timebar_height * videotl_bar_height));
#endif

View File

@ -791,13 +791,13 @@ Editor::update_ruler_visibility ()
#ifdef WITH_VIDEOTIMELINE
if (ruler_video_action->get_active()) {
old_unit_pos = videotl_group->property_y();
old_unit_pos = videotl_group->position().y;
if (tbpos != old_unit_pos) {
videotl_group->move ( 0.0, tbpos - old_unit_pos);
videotl_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
old_unit_pos = videotl_bar_group->property_y();
old_unit_pos = videotl_bar_group->position().y;
if (tbgpos != old_unit_pos) {
videotl_bar_group->move ( 0.0, tbgpos - old_unit_pos);
videotl_bar_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
}
videotl_bar_group->show();
videotl_group->show();

View File

@ -28,8 +28,7 @@
#include "ardour_ui.h"
#include "editor.h"
#include "simplerect.h"
#include "canvas_impl.h"
#include "canvas/rectangle.h"
#include "editing.h"
#include "audio_time_axis.h"
#include "video_image_frame.h"
@ -49,7 +48,7 @@ Editor::set_video_timeline_height (const int h)
videotl_bar_height = h;
const double nh = (videotl_bar_height * timebar_height - ((ARDOUR::Profile->get_sae())?1.0:0.0));
videotl_label.set_size_request (-1, (int)timebar_height * videotl_bar_height);
videotl_bar->property_y2().set_value(nh);
videotl_bar->set_y1(nh);
ARDOUR_UI::instance()->video_timeline->set_height(videotl_bar_height * timebar_height);
update_ruler_visibility();
}

View File

@ -26,8 +26,7 @@
#include "video_image_frame.h"
#include "public_editor.h"
#include "utils.h"
#include "canvas_impl.h"
#include "simpleline.h"
#include "canvas/group.h"
#include "rgb_macros.h"
#include "utils_videotl.h"
@ -60,20 +59,20 @@ VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Group& parent,
#endif
unit_position = editor.frame_to_unit (frame_position);
group = new Group (parent, unit_position, 1.0);
img_pixbuf = new ArdourCanvas::Pixbuf(*group);
group = new ArdourCanvas::Group (_parent, ArdourCanvas::Duple(unit_position, 1.0));
img_pixbuf = new ArdourCanvas::Pixbuf(group);
Glib::RefPtr<Gdk::Pixbuf> img;
img = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, clip_width, clip_height);
img->fill(RGBA_TO_UINT(0,0,0,255));
img_pixbuf->property_pixbuf() = img;
img_pixbuf->set(img);
draw_line();
video_draw_cross(img_pixbuf->property_pixbuf());
video_draw_cross(img_pixbuf->pixbuf());
img_pixbuf->set(img_pixbuf->pixbuf());
group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
//img_pixbuf->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
}
VideoImageFrame::~VideoImageFrame ()
@ -89,7 +88,7 @@ void
VideoImageFrame::set_position (framepos_t frame)
{
double new_unit_position = editor.frame_to_unit (frame);
group->move (new_unit_position - unit_position, 0.0);
group->move (ArdourCanvas::Duple (new_unit_position - unit_position, 0.0));
frame_position = frame;
unit_position = new_unit_position;
}
@ -119,16 +118,17 @@ VideoImageFrame::set_videoframe (framepos_t videoframenumber, int re)
#if 0 /* dummy mode: print framenumber */
gchar buf[16];
snprintf (buf, sizeof(buf), "%li", (long int) videoframenumber);
img_pixbuf->property_pixbuf() = pixbuf_from_ustring(g_strdup (buf), get_font_for_style (N_("MarkerText")), 80, 60, Gdk::Color ("#C0C0C0"));
img_pixbuf->pixbuf() = pixbuf_from_ustring(g_strdup (buf), get_font_for_style (N_("MarkerText")), 80, 60, Gdk::Color ("#C0C0C0"));
return;
#endif
#if 1 /* draw "empty frame" while we request the data */
Glib::RefPtr<Gdk::Pixbuf> img;
img = img_pixbuf->property_pixbuf();
img = img_pixbuf->pixbuf();
img->fill(RGBA_TO_UINT(0,0,0,255));
video_draw_cross(img_pixbuf->property_pixbuf());
video_draw_cross(img_pixbuf->pixbuf());
draw_line();
cut_rightend();
img_pixbuf->set(img);
exposeimg();
#endif
/* request video-frame from decoder in background thread */
@ -139,7 +139,7 @@ void
VideoImageFrame::draw_line ()
{
Glib::RefPtr<Gdk::Pixbuf> img;
img = img_pixbuf->property_pixbuf();
img = img_pixbuf->pixbuf();
int rowstride = img->get_rowstride();
int clip_height = img->get_height();
@ -160,7 +160,7 @@ VideoImageFrame::cut_rightend ()
{
if (rightend < 0 ) { return; }
Glib::RefPtr<Gdk::Pixbuf> img;
img = img_pixbuf->property_pixbuf();
img = img_pixbuf->pixbuf();
int rowstride = img->get_rowstride();
int clip_height = img->get_height();
@ -222,12 +222,13 @@ VideoImageFrame::http_download_done (char *data){
if (!data) {
/* Image request failed (HTTP error or timeout) */
Glib::RefPtr<Gdk::Pixbuf> img;
img = img_pixbuf->property_pixbuf();
img = img_pixbuf->pixbuf();
img->fill(RGBA_TO_UINT(128,0,0,255));
video_draw_cross(img_pixbuf->property_pixbuf());
video_draw_cross(img_pixbuf->pixbuf());
cut_rightend();
draw_line();
cut_rightend();
img_pixbuf->set(img);
/* TODO: mark as invalid:
* video_frame_number = -1;
* TODO: but prevent live-loops when calling update again
@ -239,11 +240,12 @@ VideoImageFrame::http_download_done (char *data){
#else // RGB
tmp = Gdk::Pixbuf::create_from_data ((guint8*) data, Gdk::COLORSPACE_RGB, false, 8, clip_width, clip_height, clip_width*3);
#endif
img = img_pixbuf->property_pixbuf();
img = img_pixbuf->pixbuf();
tmp->copy_area (0, 0, clip_width, clip_height, img, 0, 0);
free(data);
draw_line();
cut_rightend();
img_pixbuf->set(img);
}
exposeimg();

View File

@ -34,7 +34,8 @@
#include "ardour/ardour.h"
#include "pbd/signals.h"
#include "canvas.h"
#include "canvas/group.h"
#include "canvas/pixbuf.h"
namespace ARDOUR {
class TempoSection;

View File

@ -30,8 +30,6 @@
#include "public_editor.h"
#include "gui_thread.h"
#include "utils.h"
#include "canvas_impl.h"
#include "simpleline.h"
#include "utils_videotl.h"
#include "rgb_macros.h"
#include "video_timeline.h"

View File

@ -31,7 +31,7 @@
#include "video_image_frame.h"
#include "video_monitor.h"
#include "pbd/signals.h"
#include "canvas.h"
#include "canvas/group.h"
namespace ARDOUR {
class Session;

View File

@ -1,3 +1,6 @@
#ifndef __CANVAS_PIXBUF__
#define __CANVAS_PIXBUF__
#include <glibmm/refptr.h>
#include "canvas/item.h"
@ -20,8 +23,14 @@ public:
void set (Glib::RefPtr<Gdk::Pixbuf>);
/* returns the reference to the internal private pixbuf
* after changing data in the pixbuf a call to set()
* is mandatory to update the data on screen */
Glib::RefPtr<Gdk::Pixbuf> pixbuf();
private:
Glib::RefPtr<Gdk::Pixbuf> _pixbuf;
};
}
#endif

View File

@ -44,6 +44,11 @@ Pixbuf::set (Glib::RefPtr<Gdk::Pixbuf> pixbuf)
end_change ();
}
Glib::RefPtr<Gdk::Pixbuf>
Pixbuf::pixbuf() {
return _pixbuf;
}
XMLNode *
Pixbuf::get_state () const
{