Logo Search packages:      
Sourcecode: ardour version File versions  Download package

void ImageFrameSocketHandler::handle_insert_marker_time_axis ( const char *  msg  )  [private]

Handle the insertion of a new MarkerTimeAxis

Parameters:
msg the received message

Definition at line 1173 of file imageframe_socket_handler.cc.

References sigc::bind(), get_message_part(), sigc::mem_fun(), VisualTimeAxis::NameChanged, send_marker_time_axis_removed(), send_marker_time_axis_renamed(), send_return_failure(), thePublicEditor, and VisualTimeAxis::VisualTimeAxisRemoved.

Referenced by handle_insert_message().

{
      int position = 4 ; // message type chars
      
      // get the ImageFrameTrack name size
      int track_name_size = atoi(get_message_part(position, ardourvis::TEXT_SIZE_CHARS, msg).c_str()) ;
      position += ardourvis::TEXT_SIZE_CHARS ;
      
      // get the image frame track name
      std::string track_name = get_message_part(position, track_name_size, msg) ;
      position += track_name_size ;
      
      // get the size of the name of the associated track
      int assoc_track_name_size = atoi(get_message_part(position, ardourvis::TEXT_SIZE_CHARS, msg).c_str()) ;
      position += ardourvis::TEXT_SIZE_CHARS ;
      
      // get the name of the track we associate the marker track with   
      std::string assoc_track_name = get_message_part(position, assoc_track_name_size, msg) ;
      position += assoc_track_name_size ;

      // check that we dont already have a time axis with that name
      TimeAxisView* checkTav = thePublicEditor.get_named_time_axis(track_name) ;
      if(checkTav)
      {
            std::string errmsg("Track already exists: ") ;
            errmsg.append(track_name) ;
            send_return_failure(errmsg) ;
      }
      else
      {
            // check the associated time axis exists
            TimeAxisView* assoc_tav = thePublicEditor.get_named_time_axis(assoc_track_name) ;
            if(assoc_tav)
            {
                  thePublicEditor.add_imageframe_marker_time_axis(track_name, assoc_tav, this) ;
                  TimeAxisView* new_tav = thePublicEditor.get_named_time_axis(track_name) ;
                  
                  bool added = false ;
                  
                  if(new_tav)
                  {
                        MarkerTimeAxis* mta = dynamic_cast<MarkerTimeAxis*>(new_tav) ;
                        if(mta)
                        {
                              added = true ;
                              mta->VisualTimeAxisRemoved.connect(sigc::mem_fun(*this, &ImageFrameSocketHandler::send_marker_time_axis_removed)) ;
                              mta->NameChanged.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameSocketHandler::send_marker_time_axis_renamed), mta)) ;
                        }
                  }
                  
                  if(added)
                  {
                        std::string msg("Addition Failed: ") ;
                        msg.append(track_name) ; 
                        send_return_failure(msg) ;
                  }
            }
            else
            {
                  std::string errmsg("No associated Track Found: ") ;
                  errmsg.append(track_name) ;
                  send_return_failure(errmsg) ;
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index