X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fvisual_time_axis.cc;h=f1695c00dfc32a2719a3e4c29edd6480c21e2e93;hb=b36d91bb2b05023d23bb855e9fb3fc26d5378cff;hp=b68597114488e8e95a2992d22476b0f15186e1a6;hpb=99904735e066804358f1d0bd138a84f1e9ecda91;p=ardour.git diff --git a/gtk2_ardour/visual_time_axis.cc b/gtk2_ardour/visual_time_axis.cc index b685971144..f1695c00df 100644 --- a/gtk2_ardour/visual_time_axis.cc +++ b/gtk2_ardour/visual_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 @@ -23,9 +23,9 @@ #include #include -#include -#include -#include +#include "pbd/error.h" +#include "pbd/stl_delete.h" +#include "pbd/whitespace.h" #include #include @@ -33,10 +33,10 @@ #include #include -#include -#include -#include -#include +#include "ardour/session.h" +#include "ardour/utils.h" +#include "ardour/processor.h" +#include "ardour/location.h" #include "ardour_ui.h" #include "public_editor.h" @@ -55,9 +55,8 @@ using namespace ARDOUR; using namespace PBD; -using namespace sigc; using namespace Gtk; - + /** * Abstract Constructor for base visual time axis classes * @@ -66,7 +65,7 @@ using namespace Gtk; * @param sess the current session * @param canvas the parent canvas object */ -VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session& sess, Canvas& canvas) +VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Session* sess, Canvas& canvas) : AxisView(sess), TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas), visual_button (_("v")), @@ -74,24 +73,23 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se { time_axis_name = name ; _color = unique_random_color() ; - _marked_for_display = true; - - name_entry.signal_activate().connect(mem_fun(*this, &VisualTimeAxis::name_entry_changed)) ; - name_entry.signal_button_press_event().connect(mem_fun(*this, &VisualTimeAxis::name_entry_button_press_handler)) ; - name_entry.signal_button_release_event().connect(mem_fun(*this, &VisualTimeAxis::name_entry_button_release_handler)) ; - name_entry.signal_key_release_event().connect(mem_fun(*this, &VisualTimeAxis::name_entry_key_release_handler)) ; - + + name_entry.signal_activate().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_changed)) ; + name_entry.signal_button_press_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_button_press_handler)) ; + name_entry.signal_button_release_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_button_release_handler)) ; + name_entry.signal_key_release_event().connect(sigc::mem_fun(*this, &VisualTimeAxis::name_entry_key_release_handler)) ; + 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"))))); - 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")) ; - + size_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VisualTimeAxis::size_click)) ; + visual_button.signal_clicked().connect (sigc::mem_fun (*this, &VisualTimeAxis::visual_click)) ; + hide_button.signal_clicked().connect (sigc::mem_fun (*this, &VisualTimeAxis::hide_click)) ; + ARDOUR_UI::instance()->set_tip(size_button,_("Display Height")) ; + ARDOUR_UI::instance()->set_tip(visual_button, _("Visual options")) ; + ARDOUR_UI::instance()->set_tip(hide_button, _("Hide this track")) ; + 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); @@ -100,8 +98,8 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se size_button.unset_flags(Gtk::CAN_FOCUS) ; hide_button.unset_flags(Gtk::CAN_FOCUS) ; visual_button.unset_flags(Gtk::CAN_FOCUS) ; - - set_height(Normal) ; + + set_height (hNormal) ; } /** @@ -120,13 +118,13 @@ void VisualTimeAxis::set_time_axis_name(const string & name, void* src) { std::string old_name = time_axis_name ; - + if(name != time_axis_name) { time_axis_name = name ; label_view() ; editor.route_name_changed(this) ; - + NameChanged(time_axis_name, old_name, src) ; /* EMIT_SIGNAL */ } } @@ -144,39 +142,25 @@ VisualTimeAxis::name() const /** * Sets the height of this TrackView to one of the defined TrackHeghts * - * @param h the TrackHeight value to set + * @param h */ void -VisualTimeAxis::set_height(TrackHeight h) +VisualTimeAxis::set_height(uint32_t h) { - TimeAxisView::set_height(h) ; - - switch (height) - { - case Largest: - case Large: - case Larger: - case Normal: - { - hide_name_label (); - show_name_entry (); - other_button_hbox.show_all() ; - break; - } - case Smaller: - { - hide_name_label (); - show_name_entry (); - other_button_hbox.hide_all() ; - break; - } - case Small: - { - hide_name_entry (); - show_name_label (); - other_button_hbox.hide_all() ; - } - break; + TimeAxisView::set_height(h); + + if (h >= hNormal) { + hide_name_label (); + show_name_entry (); + other_button_hbox.show_all() ; + } else if (h >= hSmaller) { + hide_name_label (); + show_name_entry (); + other_button_hbox.hide_all() ; + } else if (h >= hSmall) { + hide_name_entry (); + show_name_label (); + other_button_hbox.hide_all() ; } } @@ -200,9 +184,9 @@ VisualTimeAxis::hide_click() { // LAME fix for hide_button display refresh hide_button.set_sensitive(false); - + editor.hide_track_in_display (*this); - + hide_button.set_sensitive(true); } @@ -231,15 +215,15 @@ VisualTimeAxis::choose_time_axis_color() Gdk::Color color ; gdouble current[4] ; Gdk::Color current_color ; - + current[0] = _color.get_red() / 65535.0 ; current[1] = _color.get_green() / 65535.0 ; current[2] = _color.get_blue() / 65535.0 ; current[3] = 1.0 ; current_color.set_rgb_p (current[0],current[1],current[2]); - color = Gtkmm2ext::UI::instance()->get_color(_("ardour: color selection"),picked, ¤t_color) ; - + color = Gtkmm2ext::UI::instance()->get_color(_("Color Selection"),picked, ¤t_color) ; + if (picked) { set_time_axis_color(color) ; @@ -289,7 +273,7 @@ VisualTimeAxis::remove_this_time_axis(void* src) defer to idle loop, otherwise we'll delete this object while we're still inside this function ... */ - Glib::signal_idle().connect(bind(sigc::ptr_fun(&VisualTimeAxis::idle_remove_this_time_axis), this, src)); + Glib::signal_idle().connect(sigc::bind(sigc::ptr_fun(&VisualTimeAxis::idle_remove_this_time_axis), this, src)); } } @@ -315,7 +299,7 @@ VisualTimeAxis::idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) //---------------------------------------------------------------------------------------// // Handle TimeAxis rename - + /** * Construct a new prompt to receive a new name for this TimeAxis * @@ -340,7 +324,7 @@ VisualTimeAxis::start_time_axis_rename() ARDOUR_UI::instance()->popup_error (_("A track already exists with that name")); return ; } - + set_time_axis_name(result, this) ; } } @@ -358,18 +342,18 @@ VisualTimeAxis::label_view() { name_label.set_text(time_axis_name) ; name_entry.set_text(time_axis_name) ; - ARDOUR_UI::instance()->tooltips().set_tip(name_entry, time_axis_name) ; + ARDOUR_UI::instance()->set_tip(name_entry, time_axis_name) ; } //---------------------------------------------------------------------------------------// -// Handle name entry signals +// Handle name entry signals void VisualTimeAxis::name_entry_changed() { string x = name_entry.get_text (); - + if (x == time_axis_name) { return; } @@ -389,7 +373,7 @@ VisualTimeAxis::name_entry_changed() } } -gint +gint VisualTimeAxis::name_entry_button_press_handler(GdkEventButton *ev) { if (ev->button == 3) { @@ -398,7 +382,7 @@ VisualTimeAxis::name_entry_button_press_handler(GdkEventButton *ev) return FALSE; } -gint +gint VisualTimeAxis::name_entry_button_release_handler(GdkEventButton *ev) { return FALSE; @@ -422,7 +406,7 @@ VisualTimeAxis::name_entry_key_release_handler(GdkEventKey* ev) //---------------------------------------------------------------------------------------// // Super class methods not handled by VisualTimeAxis - + void VisualTimeAxis::show_timestretch (nframes_t start, nframes_t end) {