Decreased region opacity, smoothed out canvas/tempo line colours.
[ardour.git] / gtk2_ardour / location_ui.cc
index f0fe230b5720df95bbf84bd804e821d5ea5e83ac..b77c3a55615447bc0aa30807b86fe906620c7d36 100644 (file)
@@ -27,6 +27,7 @@
 #include <ardour/utils.h>
 #include <ardour/configuration.h>
 #include <ardour/session.h>
+#include <pbd/memento_command.h>
 
 #include "ardour_ui.h"
 #include "prompter.h"
@@ -47,11 +48,11 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
          item_table (1, 7, false),
          start_set_button (_("Set")),
          start_go_button (_("Go")),
-         start_clock (X_("LocationEditRowClock"), true),
+         start_clock (X_("locationstart"), true, X_("LocationEditRowClock"), true),
          end_set_button (_("Set")),
          end_go_button (_("Go")),
-         end_clock (X_("LocationEditRowClock"), true),
-         length_clock (X_("LocationEditRowClock"), true, true),
+         end_clock (X_("locationend"), true, X_("LocationEditRowClock"), true),
+         length_clock (X_("locationlength"), true, X_("LocationEditRowClock"), true, true),
          cd_check_button (_("CD")),
          hide_check_button (_("Hidden")),
          remove_button (_("Remove")),
@@ -214,7 +215,7 @@ LocationEditRow::set_location (Location *loc)
        }
        hide_check_button.set_active (location->is_hidden());
        
-       if (location->is_auto_loop() || location->is_auto_punch()) {
+       if (location->is_auto_loop() || location-> is_auto_punch()) {
                // use label instead of entry
 
                name_label.set_text (location->name());
@@ -249,7 +250,7 @@ LocationEditRow::set_location (Location *loc)
                   the row spacing, so make it insensitive (paul).
                */
 
-               if (location->is_end()) {
+               if (location->is_end() || location->is_start()) {
                        remove_button.set_sensitive (false);
                }
 
@@ -573,7 +574,7 @@ LocationUI::LocationUI ()
        i_am_the_modifier = 0;
 
        set_title(_("ardour: locations"));
-       set_wmclass(_("ardour_locations"), "Ardour");
+       set_wmclass(X_("ardour_locations"), "Ardour");
 
        set_name ("LocationWindow");
 
@@ -654,9 +655,10 @@ gint LocationUI::do_location_remove (ARDOUR::Location *loc)
        }
 
        session->begin_reversible_command (_("remove marker"));
-       session->add_undo (session->locations()->get_memento());
+       XMLNode &before = session->locations()->get_state();
        session->locations()->remove (loc);
-       session->add_redo_no_execute (session->locations()->get_memento());
+       XMLNode &after = session->locations()->get_state();
+       session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
        session->commit_reversible_command ();
 
        return FALSE;
@@ -768,13 +770,17 @@ LocationUI::map_locations (Locations::LocationList& locations)
 void
 LocationUI::add_new_location()
 {
+       string markername;
+
        if (session) {
-               jack_nframes_t where = session->audible_frame();
-               Location *location = new Location (where, where, "mark", Location::IsMark);
+               nframes_t where = session->audible_frame();
+               session->locations()->next_available_name(markername,"mark");
+               Location *location = new Location (where, where, markername, Location::IsMark);
                session->begin_reversible_command (_("add marker"));
-               session->add_undo (session->locations()->get_memento());
+               XMLNode &before = session->locations()->get_state();
                session->locations()->add (location, true);
-               session->add_redo_no_execute (session->locations()->get_memento());
+               XMLNode &after = session->locations()->get_state();
+               session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
                session->commit_reversible_command ();
        }
        
@@ -783,14 +789,17 @@ LocationUI::add_new_location()
 void
 LocationUI::add_new_range()
 {
+       string rangename;
+
        if (session) {
-               jack_nframes_t where = session->audible_frame();
-               Location *location = new Location (where, where, "unnamed", 
-                                                                                       Location::IsRangeMarker);
+               nframes_t where = session->audible_frame();
+               session->locations()->next_available_name(rangename,"unnamed");
+               Location *location = new Location (where, where, rangename, Location::IsRangeMarker);
                session->begin_reversible_command (_("add range marker"));
-               session->add_undo (session->locations()->get_memento());
+               XMLNode &before = session->locations()->get_state();
                session->locations()->add (location, true);
-               session->add_redo_no_execute (session->locations()->get_memento());
+               XMLNode &after = session->locations()->get_state();
+               session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
                session->commit_reversible_command ();
        }
 }
@@ -832,7 +841,7 @@ LocationUI::set_session(ARDOUR::Session* sess)
                session->locations()->StateChanged.connect (mem_fun(*this, &LocationUI::refresh_location_list_s));
                session->locations()->added.connect (mem_fun(*this, &LocationUI::location_added));
                session->locations()->removed.connect (mem_fun(*this, &LocationUI::location_removed));
-               session->going_away.connect (mem_fun(*this, &LocationUI::session_gone));
+               session->GoingAway.connect (mem_fun(*this, &LocationUI::session_gone));
        }
        refresh_location_list ();
 }