allow resizing of startup wizard window
[ardour.git] / gtk2_ardour / location_ui.cc
index c27dbafcc7f5dce81434aad9576732091291e70b..d1b82f8c66459c257d755b22ef7fa4d1277f5180 100644 (file)
@@ -22,8 +22,6 @@
 
 #include <gtkmm2ext/utils.h>
 
-#include "ardour/utils.h"
-#include "ardour/configuration.h"
 #include "ardour/session.h"
 #include "pbd/memento_command.h"
 
@@ -62,6 +60,9 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
 
          remove_button.set_image (*manage (new Image (Stock::REMOVE, Gtk::ICON_SIZE_MENU)));
 
+        start_to_playhead_button.set_name ("LocationEditCdButton");
+        end_to_playhead_button.set_name ("LocationEditCdButton");
+
          number_label.set_name ("LocationEditNumberLabel");
          name_label.set_name ("LocationEditNameLabel");
          name_entry.set_name ("LocationEditNameEntry");
@@ -324,17 +325,17 @@ LocationEditRow::set_location (Location *loc)
                length_clock.hide();
        }
 
-       set_clock_sensitivity ();
+       set_clock_editable_status ();
 
        --i_am_the_modifier;
 
-       location->start_changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::start_changed, this, _1), gui_context());
-       location->end_changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::end_changed, this, _1), gui_context());
-       location->name_changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::name_changed, this, _1), gui_context());
-       location->changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::location_changed, this, _1), gui_context());
-       location->FlagsChanged.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::flags_changed, this, _1, _2), gui_context());
-       location->LockChanged.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::lock_changed, this, _1), gui_context());
-       location->PositionLockStyleChanged.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::position_lock_style_changed, this, _1), gui_context());
+       location->start_changed.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::start_changed, this, _1), gui_context());
+       location->end_changed.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::end_changed, this, _1), gui_context());
+       location->name_changed.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::name_changed, this, _1), gui_context());
+       location->changed.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::location_changed, this, _1), gui_context());
+       location->FlagsChanged.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::flags_changed, this, _1, _2), gui_context());
+       location->LockChanged.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::lock_changed, this, _1), gui_context());
+       location->PositionLockStyleChanged.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::position_lock_style_changed, this, _1), gui_context());
 }
 
 void
@@ -634,7 +635,7 @@ LocationEditRow::location_changed (ARDOUR::Location*)
        end_clock.set (location->end());
        length_clock.set (location->length());
 
-       set_clock_sensitivity ();
+       set_clock_editable_status ();
 
        i_am_the_modifier--;
 
@@ -667,7 +668,7 @@ LocationEditRow::lock_changed (ARDOUR::Location*)
 
        lock_check_button.set_active (location->locked());
 
-       set_clock_sensitivity ();
+       set_clock_editable_status ();
 
        i_am_the_modifier--;
 }
@@ -687,16 +688,17 @@ LocationEditRow::position_lock_style_changed (ARDOUR::Location*)
 }
 
 void
-LocationEditRow::focus_name() {
-       name_entry.grab_focus();
+LocationEditRow::focus_name()
+{
+       name_entry.grab_focus ();
 }
 
 void
-LocationEditRow::set_clock_sensitivity ()
+LocationEditRow::set_clock_editable_status ()
 {
-       start_clock.set_sensitive (!location->locked());
-       end_clock.set_sensitive (!location->locked());
-       length_clock.set_sensitive (!location->locked());
+       start_clock.set_editable (!location->locked());
+       end_clock.set_editable (!location->locked());
+       length_clock.set_editable (!location->locked());
 }
 
 /*------------------------------------------------------------------------*/
@@ -862,9 +864,9 @@ LocationUI::location_redraw_ranges ()
 }
 
 struct LocationSortByStart {
-    bool operator() (Location *a, Location *b) {
-           return a->start() < b->start();
-    }
+       bool operator() (Location *a, Location *b) {
+               return a->start() < b->start();
+       }
 };
 
 void
@@ -879,7 +881,7 @@ LocationUI::location_added (Location* location)
                loc.sort (LocationSortByStart ());
 
                LocationEditRow* erow = manage (new LocationEditRow (_session, location));
-
+               
                 erow->set_clock_group (*_clock_group);
                erow->remove_requested.connect (sigc::mem_fun (*this, &LocationUI::location_remove_requested));
 
@@ -910,6 +912,11 @@ LocationUI::location_added (Location* location)
 
                range_rows.show_all ();
                location_rows.show_all ();
+
+               if (location == newest_location) {
+                       newest_location = 0;
+                       erow->focus_name();
+               }
        }
 }
 
@@ -959,10 +966,6 @@ LocationUI::map_locations (Locations::LocationList& locations)
 
                         Box_Helpers::BoxList & loc_children = location_rows.children();
                        loc_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
-                       if (location == newest_location) {
-                               newest_location = 0;
-                               erow->focus_name();
-                       }
                } else if (location->is_auto_punch()) {
                        punch_edit_row.set_session (_session);
                        punch_edit_row.set_location (location);
@@ -1056,8 +1059,8 @@ LocationUI::set_session(ARDOUR::Session* s)
        if (_session) {
                _session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::locations_changed, this, _1), gui_context());
                _session->locations()->StateChanged.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::refresh_location_list, this), gui_context());
-               _session->locations()->added.connect (_session_connections, invalidator (*this), ui_bind (&LocationUI::location_added, this, _1), gui_context());
-               _session->locations()->removed.connect (_session_connections, invalidator (*this), ui_bind (&LocationUI::location_removed, this, _1), gui_context());
+               _session->locations()->added.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::location_added, this, _1), gui_context());
+               _session->locations()->removed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::location_removed, this, _1), gui_context());
                _clock_group->set_clock_mode (clock_mode_from_session_instant_xml ());
        }