X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmarker_time_axis.cc;h=cf4ba58823136d2ebcb86294652274dafae1b689;hb=285e4c648a794a1bf311621029883b1adbb32c8d;hp=767bb458f3e7742e155b77e26977780b1f7807a0;hpb=f16caf535c3e7a697c7464ecc153bce1b341d0ef;p=ardour.git diff --git a/gtk2_ardour/marker_time_axis.cc b/gtk2_ardour/marker_time_axis.cc index 767bb458f3..cf4ba58823 100644 --- a/gtk2_ardour/marker_time_axis.cc +++ b/gtk2_ardour/marker_time_axis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,17 +15,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #include -#include +#include "pbd/error.h" + +#include #include -#include -#include +#include "ardour/session.h" +#include "ardour/utils.h" #include "ardour_ui.h" #include "public_editor.h" @@ -40,7 +41,7 @@ #include "i18n.h" using namespace ARDOUR; -using namespace sigc; +using namespace PBD; using namespace Gtk; //---------------------------------------------------------------------------------------// @@ -55,13 +56,13 @@ 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, Canvas& 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) { /* the TimeAxisView these markers are associated with */ marked_time_axis = tav ; - + _color = unique_random_color() ; time_axis_name = name ; @@ -69,7 +70,6 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& selection_group->hide(); // intialize our data items - name_prompter = 0 ; marker_menu = 0 ; y_position = -1 ; @@ -79,9 +79,9 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& // set the initial time axis text label label_view() ; - + // set the initial height of this time axis - set_height(Small) ; + set_height(hSmall) ; } /** @@ -90,27 +90,7 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& */ MarkerTimeAxis::~MarkerTimeAxis() { - GoingAway() ; /* EMIT_SIGNAL */ - - for (list::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) - { - delete (*i)->rect; - delete (*i)->start_trim; - delete (*i)->end_trim; - } - - for (list::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) - { - delete (*i)->rect; - delete (*i)->start_trim; - delete (*i)->end_trim; - } - - if(selection_group) - { - delete selection_group; - selection_group = 0 ; - } + CatchDeletion (this); /* EMIT_SIGNAL */ // destroy the view helper // this handles removing and destroying individual marker items @@ -124,23 +104,18 @@ MarkerTimeAxis::~MarkerTimeAxis() //---------------------------------------------------------------------------------------// // ui methods & data - -/** - * Sets the height of this TrackView to one of the defined TrackHeights - * - * @param h the TrackHeight value to set - */ + void -MarkerTimeAxis::set_height (TrackHeight h) +MarkerTimeAxis::set_height (uint32_t h) { VisualTimeAxis::set_height(h) ; - + // tell out view helper of the change too if (view != 0) { view->set_height((double) height) ; } - + // tell those interested that we have had our height changed gui_changed("track_height",(void*)0) ; /* EMIT_SIGNAL */ } @@ -185,7 +160,7 @@ MarkerTimeAxis::popup_marker_time_axis_edit_menu(int button, int32_t time, Marke { marker_item_menu->set_sensitive(false) ; } - + marker_menu->popup(button,time) ; } @@ -223,14 +198,14 @@ MarkerTimeAxis::build_display_menu() /* now fill it with our stuff */ MenuList& items = display_menu->items(); - items.push_back(MenuElem (_("Rename"), mem_fun(*this, &VisualTimeAxis::start_time_axis_rename))); + items.push_back(MenuElem (_("Rename"), sigc::mem_fun(*this, &VisualTimeAxis::start_time_axis_rename))); items.push_back(SeparatorElem()) ; items.push_back(MenuElem (_("Height"), *size_menu)); - items.push_back(MenuElem (_("Color"), mem_fun(*this, &MarkerTimeAxis::select_track_color))); + items.push_back(MenuElem (_("Color"), sigc::mem_fun(*this, &MarkerTimeAxis::select_track_color))); items.push_back(SeparatorElem()) ; - - items.push_back(MenuElem (_("Remove"), bind(mem_fun(*this, &MarkerTimeAxis::remove_this_time_axis), (void*)this))); + + items.push_back(MenuElem (_("Remove"), sigc::bind(sigc::mem_fun(*this, &MarkerTimeAxis::remove_this_time_axis), (void*)this))); } /** @@ -240,11 +215,12 @@ void MarkerTimeAxis::build_marker_menu() { using namespace Menu_Helpers; + using Gtk::Menu; marker_menu = manage(new Menu) ; marker_menu->set_name ("ArdourContextMenu"); MenuList& items = marker_menu->items(); - + marker_item_menu = manage(new Menu) ; marker_item_menu->set_name ("ArdourContextMenu"); MenuList& marker_sub_items = marker_item_menu->items() ; @@ -253,25 +229,25 @@ MarkerTimeAxis::build_marker_menu() Menu* duration_menu = manage(new Menu) ; duration_menu->set_name ("ArdourContextMenu"); MenuList& duration_items = duration_menu->items() ; - + if(view) { - 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(MenuElem (_("1 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.0))) ; + duration_items.push_back(MenuElem (_("1.5 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.5))) ; + duration_items.push_back(MenuElem (_("2 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.0))) ; + duration_items.push_back(MenuElem (_("2.5 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 2.5))) ; + duration_items.push_back(MenuElem (_("3 seconds"), sigc::bind (sigc::mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 3.0))) ; } //duration_items.push_back(SeparatorElem()) ; - //duration_items.push_back(MenuElem (_("custom"), mem_fun(*this, &ImageFrameTimeAxis::set_marker_duration_custom))) ; + //duration_items.push_back(MenuElem (_("custom"), sigc::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(mem_fun(view, &MarkerTimeAxisView::remove_selected_marker_view),(void*)this))) ; - + marker_sub_items.push_back(MenuElem (_("Remove Marker"), sigc::bind(sigc::mem_fun(view, &MarkerTimeAxisView::remove_selected_marker_view),(void*)this))) ; + items.push_back(MenuElem(_("Marker"), *marker_item_menu)) ; - items.push_back(MenuElem (_("Rename Track"), mem_fun(*this,&MarkerTimeAxis::start_time_axis_rename))) ; + items.push_back(MenuElem (_("Rename Track"), sigc::mem_fun(*this,&MarkerTimeAxis::start_time_axis_rename))) ; marker_menu->show_all() ; }