/** the number of characters used to for the size of the image data message */
const int32_t IMAGE_DATA_MESSAGE_SIZE_CHARS = 32 ;
+ /** the number of characters in a return/reply message */
+ const int32_t RETURN_MSG_SIZE = 3 ;
// ------------------------------------------------------------------------- //
// Main Actions
// we join the action chars with items to create the message
void
Editor::handle_new_imageframe_time_axis_view(const string & track_name, void* src)
{
+ route_redisplay_does_not_sync_order_keys = true;
+ no_route_list_redisplay = true;
+
ImageFrameTimeAxis* iftav ;
iftav = new ImageFrameTimeAxis(track_name, *this, *session, *track_canvas) ;
iftav->set_time_axis_name(track_name, this) ;
track_views.push_back(iftav) ;
- TreeModel::Row row = *(route_display_model->append());
+ TreeModel::Row row = *(route_display_model->append());
+#if 1 // fake Route workaround
+ row[route_display_columns.route] =
+ session->new_video_track(iftav->name());
+#endif
row[route_display_columns.text] = iftav->name();
row[route_display_columns.tv] = iftav;
+ row[route_display_columns.visible] = true;
route_list_display.get_selection()->select (row);
iftav->GoingAway.connect(bind(mem_fun(*this, &Editor::remove_route), (TimeAxisView*)iftav)) ;
+ iftav->set_old_order_key (route_display_model->children().size() - 1);
iftav->gui_changed.connect(mem_fun(*this, &Editor::handle_gui_changes)) ;
+
+ no_route_list_redisplay = false;
+ redisplay_route_list ();
+ route_redisplay_does_not_sync_order_keys = false;
}
void
: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
{
item_construct(parentx);
- set("pixbuf", pbuf, "x", x,"y", y,"width", w,"height", h, 0);
+ set("pixbuf", pbuf, "x", x,"y", y,"width", w,"height", h, "anchor", anchor, 0);
}
ImageFrame::ImageFrame(Group& parentx)
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
/**
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
//------------------------
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
/**
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
//---------------------------------
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
/**
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
/**
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
/**
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
/**
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
/**
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
/**
send_message(msgBuffer.str()) ;
// XXX should do something with the return
- std::string retmsg ;
- read_message(retmsg) ;
+ read_result();
}
return(retcode) ;
}
+/**
+ * Reads a reply message ("RT0"/"RT1") from the Socket
+ *
+ * @return true if "RT0" was received,, otherwise false
+ */
+bool
+ImageFrameSocketHandler::read_result()
+{
+ char buf[(ardourvis::RETURN_MSG_SIZE)+1] ;
+ int retcode = ::recv(theArdourToCompositorSocket, buf, ardourvis::RETURN_MSG_SIZE, 0) ;
+ buf[ardourvis::RETURN_MSG_SIZE]='\0';
+ if (retcode > 0) {
+ std::cout << "Received Result [" << buf << "]\n" ;
+ if (retcode == ardourvis::RETURN_MSG_SIZE && buf == ardourvis::RETURN_TRUE) {
+ return (true);
+ }
+ }
+ return(false) ;
+}
/**
* Convenience method to string_compose and send a success messasge back to the Image Compositor
* @return the return value from the socket call
*/
int read_message(std::string& msg) ;
+
+ /**
+ * Reads a return message ("RT0"/"RT1") from the Socket
+ *
+ * @return true if "RT0" was received,, otherwise false
+ */
+ bool read_result();
/**
* Convenience method to compose and send a success messasge back to the Image Compositor
void
ImageFrameTimeAxis::set_height (uint32_t h)
{
+ bool changed = (height == 0) || (h != height);
VisualTimeAxis::set_height(h) ;
// tell out view helper of the change too
view->set_height((double) height) ;
}
+ if (changed) {
// tell those interested that we have had our height changed
- gui_changed("track_height",(void*)0); /* EMIT_SIGNAL */
+ gui_changed("track_height",(void*)0); /* EMIT_SIGNAL */
+ }
}
/**
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, false,
TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText|
TimeAxisViewItem::ShowNameHighlight|
TimeAxisViewItem::ShowFrame|
memcpy(the_rgb_data, rgb_data, (width*height*num_channels)) ;
ArtPixBuf* pbuf ;
- pbuf = art_pixbuf_new_rgba(the_rgb_data, width, height, (num_channels * width));
+ if (num_channels==3)
+ pbuf = art_pixbuf_new_rgb(the_rgb_data, width, height, (num_channels * width));
+ else if (num_channels==4)
+ pbuf = art_pixbuf_new_rgba(the_rgb_data, width, height, (num_channels * width));
+ else {
+ ; // error unsupported image data format
+ art_free(the_rgb_data);
+ std::cerr << "imageframe_view: unsupported image data format" << std::endl;
+ return;
+ }
imageframe = 0 ;
//calculate our image width based on the track height
void
MarkerTimeAxis::set_height (uint32_t h)
{
+ bool changed = (height == 0) || (h != height);
VisualTimeAxis::set_height(h) ;
// tell out view helper of the change too
view->set_height((double) height) ;
}
+ if (changed) {
// tell those interested that we have had our height changed
gui_changed("track_height",(void*)0) ; /* EMIT_SIGNAL */
+ }
}
/**
size_button.set_name("TrackSizeButton") ;
visual_button.set_name("TrackVisualButton") ;
hide_button.set_name("TrackRemoveButton") ;
- hide_button.add(*(Gtk::manage(new Gtk::Image(get_xpm("small_x.xpm")))));
+ hide_button.add (*(manage (new Image (::get_icon("hide")))));
+ hide_button.show_all ();
+
size_button.signal_button_release_event().connect (mem_fun (*this, &VisualTimeAxis::size_click)) ;
visual_button.signal_clicked().connect (mem_fun (*this, &VisualTimeAxis::visual_click)) ;
hide_button.signal_clicked().connect (mem_fun (*this, &VisualTimeAxis::hide_click)) ;
ARDOUR_UI::instance()->tooltips().set_tip(size_button,_("Display Height")) ;
ARDOUR_UI::instance()->tooltips().set_tip(visual_button, _("Visual options")) ;
ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("Hide this track")) ;
-
+
+if (0) {
+ /* old school - when we used to put an extra row of buttons in place */
controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
-
+}
/* remove focus from the buttons */
size_button.unset_flags(Gtk::CAN_FOCUS) ;
hide_button.unset_flags(Gtk::CAN_FOCUS) ;
if (h >= hNormal) {
hide_name_label ();
show_name_entry ();
- other_button_hbox.show_all() ;
+ visual_button.show();
+ size_button.show();
+ hide_button.show();
} else if (h >= hSmaller) {
hide_name_label ();
show_name_entry ();
- other_button_hbox.hide_all() ;
+ visual_button.hide ();
+ size_button.hide ();
+ hide_button.hide();
} else if (h >= hSmall) {
hide_name_entry ();
show_name_label ();
- other_button_hbox.hide_all() ;
+ visual_button.hide ();
+ size_button.hide ();
+ hide_button.hide ();
}
}
std::list<boost::shared_ptr<AudioTrack> > new_audio_track (int input_channels, int output_channels, TrackMode mode = Normal, uint32_t how_many = 1);
RouteList new_audio_route (int input_channels, int output_channels, uint32_t how_many);
RouteList new_route_from_template (uint32_t how_many, const std::string& template_path);
-
+
+ /* this is a hack put in to support work on video tracks by Robin Gareus. Nobody
+ should assume that this works yet (February 2009)
+ */
+
+ boost::shared_ptr<Route> new_video_track (string name);
+
void remove_route (boost::shared_ptr<Route>);
void resort_routes ();
if (set_state (node)) {
throw failed_constructor();
}
+
+ /* we should not need to do this here, since all values were set via XML. however
+ some older sessions may have bugs and this allows us to fix them.
+ */
+
+ update ();
}
Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newin, boost::shared_ptr<AudioRegion> newout)
break;
case EndOfIn:
- _position = _in->last_frame() - _length;
+ _position = _in->last_frame() - _length + 1;
break;
case EndOfOut:
- _position = _out->last_frame() - _length;
+ _position = _out->last_frame() - _length + 1;
}
return true;
string coutname = _name;
coutname += _("[control]");
+ delete _control_outs;
_control_outs = new IO (_session, coutname);
_control_outs->set_state (**(child->children().begin()));
return ret;
}
+boost::shared_ptr<Route>
+Session::new_video_track (string name)
+{
+ uint32_t control_id = ntracks() + nbusses() + 1;
+ shared_ptr<Route> new_route (
+ new Route ( *this, name, -1, -1, -1, -1, Route::Flag(0), ARDOUR::DataType::NIL));
+ new_route->set_remote_control_id (control_id);
+
+ RouteList rl;
+ rl.push_back (new_route);
+ {
+ RCUWriter<RouteList> writer (routes);
+ shared_ptr<RouteList> r = writer.get_copy ();
+ r->insert (r->end(), rl.begin(), rl.end());
+ resort_routes_using (r);
+ }
+ return new_route;
+}
+
void
Session::add_routes (RouteList& new_routes, bool save)
{
set_dirty();
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ if ((*niter)->property ("default-type")->value() == "unknown" ) {
+ std::cout << "ignoring route with type unknown. (video-track)" << std::endl;
+ // Note: this may mess up remote_control IDs or more..
+ continue;
+ }
boost::shared_ptr<Route> route (XMLRouteFactory (**niter));