Decreased region opacity, smoothed out canvas/tempo line colours.
[ardour.git] / gtk2_ardour / marker_time_axis.cc
index 9efde933bb336a9eb7f0b3bad94d251e43aa1c18..1c6e7af2c79e81817734e0324f770d582553c383 100644 (file)
@@ -22,7 +22,9 @@
 
 #include <pbd/error.h>
 
-#include <gtkmmext/utils.h>
+#include <gtkmm/menu.h>
+
+#include <gtkmm2ext/utils.h>
 
 #include <ardour/session.h>
 #include <ardour/utils.h>
 #include "ardour_ui.h"
 #include "public_editor.h"
 #include "imageframe_time_axis.h"
-#include "canvas-simplerect.h"
 #include "selection.h"
 #include "imageframe_time_axis_view.h"
 #include "marker_time_axis_view.h"
 #include "imageframe_view.h"
 #include "marker_time_axis.h"
+#include "canvas_impl.h"
 
 #include "i18n.h"
 
 using namespace ARDOUR;
-using namespace SigC;
+using namespace PBD;
+using namespace sigc;
 using namespace Gtk;
 
 //---------------------------------------------------------------------------------------//
@@ -55,7 +58,7 @@ using namespace Gtk;
  * @param name the name/id of this time axis
  * @param tav the associated track view that this MarkerTimeAxis is marking up
  */
-MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Widget *canvas, std::string name, TimeAxisView* tav)
+MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& canvas, const string & name, TimeAxisView* tav)
        : AxisView(sess),
          VisualTimeAxis(name, ed, sess, canvas)
 {
@@ -65,11 +68,10 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Widget
        _color = unique_random_color() ;
        time_axis_name = name ;
 
-       selection_group = gtk_canvas_item_new (GTK_CANVAS_GROUP(canvas_display), gtk_canvas_group_get_type (), 0) ;
-       gtk_canvas_item_hide(selection_group) ;
+       selection_group = new Group (*canvas_display);
+       selection_group->hide();
 
        // intialize our data items
-       name_prompter = 0 ;
        marker_menu = 0 ;
 
        y_position = -1 ;
@@ -90,32 +92,12 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Widget
  */
 MarkerTimeAxis::~MarkerTimeAxis()
 {
-        GoingAway() ; /* EMIT_SIGNAL */
-
-       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)) ;
-               selection_group = 0 ;
-       }
+       GoingAway() ; /* EMIT_SIGNAL */
 
        // destroy the view helper
        // this handles removing and destroying individual marker items
-       if(view)
-       {
+
+       if(view) {
                delete view ;
                view = 0 ;
        }
@@ -223,14 +205,14 @@ MarkerTimeAxis::build_display_menu()
        /* now fill it with our stuff */
        MenuList& items = display_menu->items();
 
-       items.push_back(MenuElem (_("Rename"), slot (*this, &VisualTimeAxis::start_time_axis_rename)));
+       items.push_back(MenuElem (_("Rename"), mem_fun(*this, &VisualTimeAxis::start_time_axis_rename)));
 
        items.push_back(SeparatorElem()) ;
        items.push_back(MenuElem (_("Height"), *size_menu));
-       items.push_back(MenuElem (_("Color"), slot (*this, &MarkerTimeAxis::select_track_color)));
+       items.push_back(MenuElem (_("Color"), mem_fun(*this, &MarkerTimeAxis::select_track_color)));
        items.push_back(SeparatorElem()) ;
        
-       items.push_back(MenuElem (_("Remove"), bind(slot(*this, &MarkerTimeAxis::remove_this_time_axis), (void*)this)));
+       items.push_back(MenuElem (_("Remove"), bind(mem_fun(*this, &MarkerTimeAxis::remove_this_time_axis), (void*)this)));
 }
 
 /**
@@ -240,6 +222,7 @@ void
 MarkerTimeAxis::build_marker_menu()
 {
        using namespace Menu_Helpers;
+       using Gtk::Menu;
 
        marker_menu = manage(new Menu) ;
        marker_menu->set_name ("ArdourContextMenu");
@@ -256,22 +239,22 @@ MarkerTimeAxis::build_marker_menu()
        
        if(view)
        {
-               duration_items.push_back(MenuElem (_("1 seconds"), bind (slot (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.0))) ;
-               duration_items.push_back(MenuElem (_("1.5 seconds"), bind (slot (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.5))) ;
-               duration_items.push_back(MenuElem (_("2 seconds"), bind (slot (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.0))) ;
-               duration_items.push_back(MenuElem (_("2.5 seconds"), bind (slot (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.5))) ;
-               duration_items.push_back(MenuElem (_("3 seconds"), bind (slot (view, &MarkerTimeAxisView::set_marker_duration_sec), 3.0))) ;
+               duration_items.push_back(MenuElem (_("1 seconds"), bind (mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.0))) ;
+               duration_items.push_back(MenuElem (_("1.5 seconds"), bind (mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.5))) ;
+               duration_items.push_back(MenuElem (_("2 seconds"), bind (mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.0))) ;
+               duration_items.push_back(MenuElem (_("2.5 seconds"), bind (mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.5))) ;
+               duration_items.push_back(MenuElem (_("3 seconds"), bind (mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 3.0))) ;
        }
        //duration_items.push_back(SeparatorElem()) ;
-       //duration_items.push_back(MenuElem (_("custom"), slot (*this, &ImageFrameTimeAxis::set_marker_duration_custom))) ;
+       //duration_items.push_back(MenuElem (_("custom"), mem_fun(*this, &ImageFrameTimeAxis::set_marker_duration_custom))) ;
 
        marker_sub_items.push_back(MenuElem(_("Duration (sec)"), *duration_menu)) ;
 
        marker_sub_items.push_back(SeparatorElem()) ;
-       marker_sub_items.push_back(MenuElem (_("Remove Marker"), bind(slot(view, &MarkerTimeAxisView::remove_selected_marker_view),(void*)this))) ;
+       marker_sub_items.push_back(MenuElem (_("Remove Marker"), bind(mem_fun(view, &MarkerTimeAxisView::remove_selected_marker_view),(void*)this))) ;
        
        items.push_back(MenuElem(_("Marker"), *marker_item_menu)) ;
-       items.push_back(MenuElem (_("Rename Track"), slot (*this,&MarkerTimeAxis::start_time_axis_rename))) ;
+       items.push_back(MenuElem (_("Rename Track"), mem_fun(*this,&MarkerTimeAxis::start_time_axis_rename))) ;
 
        marker_menu->show_all() ;
 }
@@ -303,31 +286,3 @@ MarkerTimeAxis::get_marked_time_axis()
 
 
 
-/**
- * Handle the closing of the renaming dialog during the rename of this item
- */
-void
-MarkerTimeAxis::finish_route_rename()
-{
-       name_prompter->hide_all ();
-       ARDOUR_UI::instance()->allow_focus (false);
-
-       if (name_prompter->status == Gtkmmext::Prompter::cancelled) {
-               return;
-       }
-       
-       string result;
-       name_prompter->get_result(result);
-       time_axis_name = result ;
-       editor.route_name_changed(this) ;
-       label_view() ;
-       delete name_prompter ;
-       name_prompter = 0 ;
-}
-
-
-
-
-
-
-