X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fimageframe_view.cc;h=e8ff8784865927f09a33c105a5ab804b90ca60c5;hb=cd87dceb0fda44d7c8fcc2b7844f65def25edb23;hp=7e7f673c9d0b1c6ab15cb868678864af00e8cf85;hpb=e493b2b7c4fbbbfc457f02babf9546289b430177;p=ardour.git diff --git a/gtk2_ardour/imageframe_view.cc b/gtk2_ardour/imageframe_view.cc index 7e7f673c9d..e8ff878486 100644 --- a/gtk2_ardour/imageframe_view.cc +++ b/gtk2_ardour/imageframe_view.cc @@ -28,15 +28,16 @@ #include "imageframe_time_axis_group.h" #include "marker_time_axis.h" #include "marker_time_axis_view.h" -#include "canvas-simplerect.h" #include "public_editor.h" #include "utils.h" #include "imageframe_view.h" -#include "canvas-imageframe.h" +#include "imageframe.h" +#include "canvas_impl.h" #include "gui_thread.h" using namespace sigc ; using namespace ARDOUR ; +using namespace Gtk; sigc::signal ImageFrameView::GoingAway; @@ -55,19 +56,19 @@ sigc::signal ImageFrameView::GoingAway; * @param height the width of the origianl rgb_data image data * @param num_channels the number of color channels within rgb_data */ -ImageFrameView::ImageFrameView(std::string item_id, - GtkCanvasGroup *parent, +ImageFrameView::ImageFrameView(const string & item_id, + ArdourCanvas::Group *parent, ImageFrameTimeAxis* tv, ImageFrameTimeAxisGroup* item_group, double spu, - GdkColor& basic_color, + Gdk::Color& basic_color, jack_nframes_t start, jack_nframes_t duration, unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels) - : TimeAxisViewItem(item_id, parent, *tv, spu, basic_color, start, duration, + : TimeAxisViewItem(item_id, *parent, *tv, spu, basic_color, start, duration, TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText| TimeAxisViewItem::ShowNameHighlight| TimeAxisViewItem::ShowFrame| @@ -91,34 +92,16 @@ ImageFrameView::ImageFrameView(std::string item_id, //calculate our image width based on the track height double im_ratio = (double)width/(double)height ; - int im_width = (int)((double)(trackview.height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE) * im_ratio) ; + double im_width = ((double)(trackview.height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE) * im_ratio) ; - imageframe = gtk_canvas_item_new(GTK_CANVAS_GROUP(group), - gtk_canvas_imageframe_get_type(), - "pixbuf", pbuf, - "x", (gdouble) 1.0, - "y", (gdouble) 1.0, - "anchor", GTK_ANCHOR_NW, - "width", (gdouble) im_width, - "height", (gdouble) (trackview.height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE), - NULL) ; - - - gtk_signal_connect (GTK_OBJECT(frame_handle_start), "event", - (GtkSignalFunc) PublicEditor::canvas_imageframe_start_handle_event, - this); - - gtk_signal_connect (GTK_OBJECT(frame_handle_end), "event", - (GtkSignalFunc) PublicEditor::canvas_imageframe_end_handle_event, - this); - - gtk_signal_connect (GTK_OBJECT(group), "event", - (GtkSignalFunc) PublicEditor::canvas_imageframe_item_view_event, this); - - /* handle any specific details required by the initial start end duration values */ - - gtk_canvas_item_raise_to_top(frame_handle_start) ; - gtk_canvas_item_raise_to_top(frame_handle_end) ; + imageframe = new ImageFrame (*group, pbuf, 1.0, 1.0, ANCHOR_NW, im_width, (trackview.height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE)); + + frame_handle_start->signal_event().connect (bind (mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_start_handle_event), frame_handle_start, this)); + frame_handle_end->signal_event().connect (bind (mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_end_handle_event), frame_handle_end, this)); + group->signal_event().connect (bind (mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_item_view_event), imageframe, this)); + + frame_handle_start->raise_to_top(); + frame_handle_end->raise_to_top(); set_position(start, this) ; set_duration(duration, this) ; @@ -172,7 +155,7 @@ ImageFrameView::~ImageFrameView() if(imageframe) { - gtk_object_destroy(GTK_OBJECT(imageframe)) ; +delete imageframe; imageframe = 0 ; } } @@ -230,7 +213,7 @@ ImageFrameView::set_duration(jack_nframes_t dur, void* src) if(ret) { /* handle setting the sizes of our canvas itesm based on the new duration */ - gtk_canvas_item_set(imageframe, "drawwidth", (gdouble) trackview.editor.frame_to_pixel(get_duration()), NULL) ; + imageframe->property_drawwidth() = trackview.editor.frame_to_pixel(get_duration()); } return(ret) ; @@ -277,22 +260,22 @@ ImageFrameView::set_height (gdouble h) // set the image size // @todo might have to re-get the image data, for a large height...hmmm. double im_ratio = (double)image_data_width/(double)image_data_height ; - int im_width = (int)((double)(h - TimeAxisViewItem::NAME_Y_OFFSET) * im_ratio) ; - gtk_canvas_item_set(imageframe, "width", (gdouble)im_width, NULL) ; - gtk_canvas_item_set(imageframe, "height",(gdouble) (h - TimeAxisViewItem::NAME_Y_OFFSET), NULL) ; - - gtk_canvas_item_raise_to_top(frame) ; - gtk_canvas_item_raise_to_top(imageframe) ; - gtk_canvas_item_raise_to_top(name_highlight) ; - gtk_canvas_item_raise_to_top(name_text) ; - gtk_canvas_item_raise_to_top(frame_handle_start) ; - gtk_canvas_item_raise_to_top(frame_handle_end) ; + imageframe->property_width() = (h - TimeAxisViewItem::NAME_Y_OFFSET) * im_ratio; + imageframe->property_height() = h - TimeAxisViewItem::NAME_Y_OFFSET; + + frame->raise_to_top(); + imageframe->raise_to_top(); + name_highlight->raise_to_top(); + name_text->raise_to_top(); + frame_handle_start->raise_to_top(); + frame_handle_end->raise_to_top(); - gtk_canvas_item_set (name_text, "y", h - TimeAxisViewItem::NAME_Y_OFFSET, NULL); - gtk_canvas_item_set (frame, "y2", h, NULL); + name_text->property_y() = h - TimeAxisViewItem::NAME_Y_OFFSET; + frame->property_y2() = h; - gtk_canvas_item_set (name_highlight, "y1", (gdouble) h - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, "y2", (gdouble) h - 1.0, NULL); + name_highlight->property_y1() = (gdouble) h - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE; + name_highlight->property_y2() = (gdouble) h - 1.0; } @@ -310,7 +293,7 @@ ImageFrameView::add_marker_view_item(MarkerView* item, void* src) { marker_view_list.push_back(item) ; - item->GoingAway.connect(bind(slot(*this, &ImageFrameView::remove_marker_view_item), (void*)this)); + item->GoingAway.connect(bind(mem_fun(*this, &ImageFrameView::remove_marker_view_item), (void*)this)); MarkerViewAdded(item, src) ; /* EMIT_SIGNAL */ } @@ -324,7 +307,7 @@ ImageFrameView::add_marker_view_item(MarkerView* item, void* src) * @return the removed marker item */ MarkerView* -ImageFrameView::remove_named_marker_view_item(std::string markerId, void* src) +ImageFrameView::remove_named_marker_view_item(const string & markerId, void* src) { MarkerView* mv = 0 ; MarkerViewList::iterator i = marker_view_list.begin() ; @@ -360,7 +343,7 @@ ImageFrameView::remove_named_marker_view_item(std::string markerId, void* src) void ImageFrameView::remove_marker_view_item(MarkerView* mv, void* src) { - ENSURE_GUI_THREAD(bind (slot (*this, &ImageFrameView::remove_marker_view_item), mv, src)); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameView::remove_marker_view_item), mv, src)); MarkerViewList::iterator i ; @@ -376,11 +359,11 @@ ImageFrameView::remove_marker_view_item(MarkerView* mv, void* src) * @param markId the id/name of the item to search for */ bool -ImageFrameView::has_marker_view_item(std::string mname) +ImageFrameView::has_marker_view_item(const string & mname) { bool result = false ; - for (MarkerViewList::iterator ci = marker_view_list.begin(); ci != marker_view_list.end(); ++ci) + for (MarkerViewList::const_iterator ci = marker_view_list.begin(); ci != marker_view_list.end(); ++ci) { if (((MarkerView*)*ci)->get_item_name() == mname) {