ICS (image compositor socket) patches from robin gareus, to keep ICS alive in 2.X; variations on giso's proposed fix for #1731 (x-fade clicking)

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4720 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-03-02 20:59:13 +00:00
parent a453d54508
commit 6eccd043f2
14 changed files with 131 additions and 42 deletions

View file

@ -46,6 +46,8 @@ namespace ardourvis
/** 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

View file

@ -1081,19 +1081,32 @@ Editor::markerview_end_handle_end_trim (ArdourCanvas::Item* item, GdkEvent* even
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

View file

@ -35,7 +35,7 @@ ImageFrame::ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk:
: 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)

View file

@ -316,8 +316,7 @@ ImageFrameSocketHandler::send_imageframe_time_axis_removed(const string & track_
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
/**
@ -357,8 +356,7 @@ ImageFrameSocketHandler::send_imageframe_time_axis_renamed(const string & new_id
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
//------------------------
@ -393,8 +391,7 @@ ImageFrameSocketHandler::send_marker_time_axis_removed(const string & track_id,
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
/**
@ -434,8 +431,7 @@ ImageFrameSocketHandler::send_marker_time_axis_renamed(const string & new_id, co
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
//---------------------------------
@ -476,8 +472,7 @@ ImageFrameSocketHandler::send_imageframe_time_axis_group_removed(const string &
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
/**
@ -521,8 +516,7 @@ ImageFrameSocketHandler::send_imageframe_time_axis_group_renamed(const string &
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
@ -561,8 +555,7 @@ ImageFrameSocketHandler::send_imageframe_view_position_change(nframes_t pos, voi
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
/**
@ -596,8 +589,7 @@ ImageFrameSocketHandler::send_imageframe_view_duration_change(nframes_t dur, voi
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
/**
@ -632,8 +624,7 @@ ImageFrameSocketHandler::send_imageframe_view_renamed(const string & new_id, con
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
/**
@ -669,8 +660,7 @@ ImageFrameSocketHandler::send_imageframe_view_removed(const string & item_id, vo
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
@ -709,8 +699,7 @@ ImageFrameSocketHandler::send_marker_view_position_change(nframes_t pos, void* s
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
/**
@ -742,8 +731,7 @@ ImageFrameSocketHandler::send_marker_view_duration_change(nframes_t dur, void* s
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
@ -780,8 +768,7 @@ ImageFrameSocketHandler::send_marker_view_renamed(const string & new_id, const s
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
/**
@ -815,8 +802,7 @@ ImageFrameSocketHandler::send_marker_view_removed(const string & item_id, void*
send_message(msgBuffer.str()) ;
// XXX should do something with the return
std::string retmsg ;
read_message(retmsg) ;
read_result();
}
@ -2323,6 +2309,25 @@ ImageFrameSocketHandler::read_message(std::string& msg)
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

View file

@ -669,6 +669,13 @@ class ImageFrameSocketHandler : public sigc::trackable
* @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

View file

@ -138,6 +138,7 @@ ImageFrameTimeAxis::~ImageFrameTimeAxis ()
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
@ -146,8 +147,10 @@ ImageFrameTimeAxis::set_height (uint32_t h)
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 */
}
}
/**

View file

@ -67,7 +67,7 @@ ImageFrameView::ImageFrameView(const string & item_id,
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|
@ -86,7 +86,16 @@ ImageFrameView::ImageFrameView(const string & item_id,
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

View file

@ -109,6 +109,7 @@ MarkerTimeAxis::~MarkerTimeAxis()
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
@ -117,8 +118,10 @@ MarkerTimeAxis::set_height (uint32_t h)
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 */
}
}
/**

View file

@ -84,18 +84,22 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se
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) ;
@ -154,15 +158,21 @@ VisualTimeAxis::set_height(uint32_t h)
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 ();
}
}

View file

@ -504,7 +504,13 @@ class Session : public PBD::StatefulDestructible
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 ();

View file

@ -162,6 +162,12 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
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)
@ -468,11 +474,11 @@ Crossfade::update ()
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;

View file

@ -1834,6 +1834,7 @@ Route::_set_state (const XMLNode& node, bool call_base)
string coutname = _name;
coutname += _("[control]");
delete _control_outs;
_control_outs = new IO (_session, coutname);
_control_outs->set_state (**(child->children().begin()));

View file

@ -2115,6 +2115,25 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template
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)
{

View file

@ -1359,6 +1359,11 @@ Session::load_routes (const XMLNode& node)
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));