Restore Use PH button in locations UI (#3667).
authorCarl Hetherington <carl@carlh.net>
Thu, 10 Mar 2011 00:43:23 +0000 (00:43 +0000)
committerCarl Hetherington <carl@carlh.net>
Thu, 10 Mar 2011 00:43:23 +0000 (00:43 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9117 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/location_ui.cc
gtk2_ardour/location_ui.h

index 849ce9de221477419fe9ad5bf23b3a6f20c9b66a..c24da57685573d11690c28c04f84803ce3dabc56 100644 (file)
@@ -83,6 +83,12 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
          composer_label.set_name ("LocationEditNumberLabel");
          composer_entry.set_name ("LocationEditNameEntry");
 
+        Gtk::Button* start_to_playhead_button = manage (new Button (_("Use PH")));
+        Gtk::Button* end_to_playhead_button = manage (new Button (_("Use PH")));
+
+        ARDOUR_UI::instance()->tooltips().set_tip (*start_to_playhead_button, _("Set value to playhead"));
+        ARDOUR_UI::instance()->tooltips().set_tip (*end_to_playhead_button, _("Set value to playhead"));
+        
          isrc_label.set_text ("ISRC: ");
          isrc_label.set_size_request (30, -1);
          performer_label.set_text ("Performer: ");
@@ -121,19 +127,23 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
 
          start_hbox.pack_start (start_go_button, false, false);
          start_hbox.pack_start (start_clock, false, false);
+        start_hbox.pack_start (*start_to_playhead_button, false, false);
 
          /* this is always in this location, no matter what the location is */
 
          item_table.attach (start_hbox, 1, 2, 0, 1, FILL, FILL, 4, 0);
 
          start_go_button.signal_clicked().connect(sigc::bind (sigc::mem_fun (*this, &LocationEditRow::go_button_pressed), LocStart));
+        start_to_playhead_button->signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::to_playhead_button_pressed), LocStart));
          start_clock.ValueChanged.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::clock_changed), LocStart));
          start_clock.ChangeAborted.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::change_aborted), LocStart));
 
          end_hbox.pack_start (end_go_button, false, false);
          end_hbox.pack_start (end_clock, false, false);
+        end_hbox.pack_start (*end_to_playhead_button, false, false);
 
          end_go_button.signal_clicked().connect(sigc::bind (sigc::mem_fun (*this, &LocationEditRow::go_button_pressed), LocEnd));
+        end_to_playhead_button->signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::to_playhead_button_pressed), LocEnd));
          end_clock.ValueChanged.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::clock_changed), LocEnd));
          end_clock.ChangeAborted.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::change_aborted), LocEnd));
 
@@ -406,6 +416,25 @@ LocationEditRow::go_button_pressed (LocationPart part)
        }
 }
 
+void
+LocationEditRow::to_playhead_button_pressed (LocationPart part)
+{
+       if (!location) {
+               return;
+       }
+
+       switch (part) {
+       case LocStart:
+               location->set_start (_session->transport_frame ());
+               break;
+       case LocEnd:
+               location->set_end (_session->transport_frame ());
+               break;
+       default:
+               break;
+       }
+}
+
 void
 LocationEditRow::clock_changed (LocationPart part)
 {
index bf4474e669bdd79b67200ef4f26cb4e38cc99f66..84c6fa9fc5b0fb419d63be98c21ab3f1c034085c 100644 (file)
@@ -115,7 +115,7 @@ class LocationEditRow  : public Gtk::HBox, public ARDOUR::SessionHandlePtr
        void performer_entry_changed ();
        void composer_entry_changed ();
 
-       void set_button_pressed (LocationPart part);
+       void to_playhead_button_pressed (LocationPart part);
        void go_button_pressed (LocationPart part);
 
        void clock_changed (LocationPart part);