some fixes/improvements for track selection; add upload target to manual makefile...
[ardour.git] / gtk2_ardour / imageframe_time_axis.cc
index e8204a3e66589e62db0a8984e2b2632cfd3b9b9b..ae288ec9ab28738828a9ebd4f61a0b0a8eef3fba 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <pbd/error.h>
 
+#include <gtkmm/menu.h>
+
 #include <gtkmm2ext/utils.h>
 #include <gtkmm2ext/gtk_ui.h>
 
@@ -31,7 +33,7 @@
 
 #include "public_editor.h"
 #include "imageframe_time_axis.h"
-#include "canvas-simplerect.h"
+#include "simplerect.h"
 #include "enums.h"
 #include "imageframe_time_axis_view.h"
 #include "imageframe_time_axis_group.h"
 #include "marker_time_axis.h"
 #include "marker_view.h"
 #include "gui_thread.h"
+#include "canvas_impl.h"
 
 #include "i18n.h"
 
-using namespace ARDOUR ;
-using namespace sigc ;
-using namespace Gtk ;
+using namespace ARDOUR;
+using namespace PBD;
+using namespace sigc;
+using namespace Gtk;
 
 /**
  * Constructs a new ImageFrameTimeAxis.
@@ -55,19 +59,18 @@ using namespace Gtk ;
  * @param sess the current session
  * @param canvas the parent canvas item
  */
-ImageFrameTimeAxis::ImageFrameTimeAxis(std::string track_id, PublicEditor& ed, ARDOUR::Session& sess, Widget *canvas)
+ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas)
        : AxisView(sess),
          VisualTimeAxis(track_id, ed, sess, canvas)
 {
        _color = unique_random_color() ;
        
-       selection_group = gtk_canvas_item_new (GTK_CANVAS_GROUP(canvas_display), gtk_canvas_group_get_type (), NULL) ;
-       gtk_canvas_item_hide(selection_group) ;
+       selection_group = new ArdourCanvas::Group (*canvas_display);
+       selection_group->hide();
 
        // intialize our data items
        _marked_for_display = true;
        y_position = -1 ;
-       name_prompter = 0 ;
 
        /* create our new image frame view */
        view = new ImageFrameTimeAxisView(*this) ;
@@ -111,23 +114,9 @@ ImageFrameTimeAxis::~ImageFrameTimeAxis ()
                image_action_menu = 0 ;
        }
        
-       for(list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i)
-       {
-               gtk_object_destroy (GTK_OBJECT((*i)->rect));
-               gtk_object_destroy (GTK_OBJECT((*i)->start_trim));
-               gtk_object_destroy (GTK_OBJECT((*i)->end_trim));
-       }
-
-       for(list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i)
-       {
-               gtk_object_destroy (GTK_OBJECT((*i)->rect));
-               gtk_object_destroy (GTK_OBJECT((*i)->start_trim));
-               gtk_object_destroy (GTK_OBJECT((*i)->end_trim));
-       }
-       
        if (selection_group)
        {
-               gtk_object_destroy (GTK_OBJECT (selection_group));
+               delete selection_group;
                selection_group = 0 ;
        }
        
@@ -242,6 +231,7 @@ void
 ImageFrameTimeAxis::build_display_menu()
 {
        using namespace Menu_Helpers;
+       using Gtk::Menu;
 
        /* get the size menu ready */
 
@@ -255,7 +245,7 @@ ImageFrameTimeAxis::build_display_menu()
 
        MenuList& items = display_menu->items();
 
-       items.push_back (MenuElem (_("Rename"), slot(*this, &ImageFrameTimeAxis::start_time_axis_rename)));
+       items.push_back (MenuElem (_("Rename"), mem_fun(*this, &ImageFrameTimeAxis::start_time_axis_rename)));
 
        image_action_menu = new Menu() ;
        image_action_menu->set_name ("ArdourContextMenu");
@@ -263,10 +253,10 @@ ImageFrameTimeAxis::build_display_menu()
        
        items.push_back (SeparatorElem());
        items.push_back (MenuElem (_("Height"), *size_menu));
-       items.push_back (MenuElem (_("Color"), slot(*this, &ImageFrameTimeAxis::select_track_color)));
+       items.push_back (MenuElem (_("Color"), mem_fun(*this, &ImageFrameTimeAxis::select_track_color)));
 
        items.push_back (SeparatorElem());
-       items.push_back (MenuElem (_("Remove"), bind(slot(*this, &VisualTimeAxis::remove_this_time_axis), (void*)this))) ;
+       items.push_back (MenuElem (_("Remove"), bind(mem_fun(*this, &VisualTimeAxis::remove_this_time_axis), (void*)this))) ;
 }
 
 /**
@@ -276,6 +266,7 @@ void
 ImageFrameTimeAxis::create_imageframe_menu()
 {
        using namespace Menu_Helpers;
+       using Gtk::Menu;
 
        imageframe_menu = manage(new Menu) ;
        imageframe_menu->set_name ("ArdourContextMenu");
@@ -292,14 +283,14 @@ ImageFrameTimeAxis::create_imageframe_menu()
 
        if(view)
        {
-               duration_items.push_back(MenuElem (_("0.5 seconds"), bind (slot (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 0.5))) ;
-               duration_items.push_back(MenuElem (_("1 seconds"), bind (slot (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 1.0))) ;
-               duration_items.push_back(MenuElem (_("1.5 seconds"), bind (slot (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 1.5))) ;
-               duration_items.push_back(MenuElem (_("2 seconds"), bind (slot (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 2.0))) ;
-               duration_items.push_back(MenuElem (_("2.5 seconds"), bind (slot (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 2.5))) ;
-               duration_items.push_back(MenuElem (_("3 seconds"), bind (slot (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 3.0))) ;
+               duration_items.push_back(MenuElem (_("0.5 seconds"), bind (mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 0.5))) ;
+               duration_items.push_back(MenuElem (_("1 seconds"), bind (mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 1.0))) ;
+               duration_items.push_back(MenuElem (_("1.5 seconds"), bind (mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 1.5))) ;
+               duration_items.push_back(MenuElem (_("2 seconds"), bind (mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 2.0))) ;
+               duration_items.push_back(MenuElem (_("2.5 seconds"), bind (mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 2.5))) ;
+               duration_items.push_back(MenuElem (_("3 seconds"), bind (mem_fun (view, &ImageFrameTimeAxisView::set_imageframe_duration_sec), 3.0))) ;
                //duration_items.push_back(SeparatorElem()) ;
-               //duration_items.push_back(MenuElem (_("custom"), slot (*this, &ImageFrameTimeAxis::set_imageframe_duration_custom))) ;
+               //duration_items.push_back(MenuElem (_("custom"), mem_fun(*this, &ImageFrameTimeAxis::set_imageframe_duration_custom))) ;
        }
 
        imageframe_sub_items.push_back(MenuElem(_("Duration (sec)"), *duration_menu)) ;
@@ -307,11 +298,11 @@ ImageFrameTimeAxis::create_imageframe_menu()
        imageframe_sub_items.push_back(SeparatorElem()) ;
        if(view)
        {
-               imageframe_sub_items.push_back(MenuElem (_("Remove Frame"), bind(slot (view, &ImageFrameTimeAxisView::remove_selected_imageframe_item), (void*)this))) ;
+               imageframe_sub_items.push_back(MenuElem (_("Remove Frame"), bind(mem_fun (view, &ImageFrameTimeAxisView::remove_selected_imageframe_item), (void*)this))) ;
        }
        
        items.push_back(MenuElem(_("Image Frame"), *imageframe_item_menu)) ;
-       items.push_back(MenuElem (_("Rename Track"), slot (*this,&ImageFrameTimeAxis::start_time_axis_rename))) ;
+       items.push_back(MenuElem (_("Rename Track"), mem_fun(*this,&ImageFrameTimeAxis::start_time_axis_rename))) ;
 
        imageframe_menu->show_all() ;
 }
@@ -342,7 +333,7 @@ ImageFrameTimeAxis::add_marker_time_axis(MarkerTimeAxis* marker_track, void* src
        else
        {
                marker_time_axis_list.push_back(marker_track) ;
-               marker_track->GoingAway.connect(bind(slot(*this, &ImageFrameTimeAxis::remove_time_axis_view), marker_track, (void*)this));
+               marker_track->GoingAway.connect(bind(mem_fun(*this, &ImageFrameTimeAxis::remove_time_axis_view), marker_track, (void*)this));
        
                 MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */
                ret = true ;
@@ -358,7 +349,7 @@ ImageFrameTimeAxis::add_marker_time_axis(MarkerTimeAxis* marker_track, void* src
  * @return the named markerTimeAxis, or 0 if the named MarkerTimeAxis is not associated with this ImageFrameTimeAxis
  */
 MarkerTimeAxis*
-ImageFrameTimeAxis::get_named_marker_time_axis(std::string track_id)
+ImageFrameTimeAxis::get_named_marker_time_axis(const string & track_id)
 {
        MarkerTimeAxis* mta =  0 ;
        
@@ -381,7 +372,7 @@ ImageFrameTimeAxis::get_named_marker_time_axis(std::string track_id)
  * @return the removed MarkerTimeAxis
  */
 MarkerTimeAxis*
-ImageFrameTimeAxis::remove_named_marker_time_axis(std::string track_id, void* src)
+ImageFrameTimeAxis::remove_named_marker_time_axis(const string & track_id, void* src)
 {
        MarkerTimeAxis* mta = 0 ;
        
@@ -412,7 +403,7 @@ ImageFrameTimeAxis::remove_named_marker_time_axis(std::string track_id, void* sr
 void
 ImageFrameTimeAxis::remove_time_axis_view(MarkerTimeAxis* mta, void* src)
 {
-       ENSURE_GUI_THREAD(bind (slot (*this, &ImageFrameTimeAxis::remove_time_axis_view), mta, src));
+       ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameTimeAxis::remove_time_axis_view), mta, src));
        
        MarkerTimeAxisList::iterator i;
        if((i = find (marker_time_axis_list.begin(), marker_time_axis_list.end(), mta)) != marker_time_axis_list.end())