save and restore clock modes
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 8 Jan 2007 17:12:29 +0000 (17:12 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 8 Jan 2007 17:12:29 +0000 (17:12 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1283 d708f5d6-7413-0410-9779-e7cbd77b26cf

17 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/audio_clock.h
gtk2_ardour/audio_region_editor.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_markers.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_rulers.cc
gtk2_ardour/location_ui.cc
gtk2_ardour/main.cc
gtk2_ardour/option_editor.cc
libs/ardour/ardour/location.h
libs/ardour/ardour/session.h
libs/ardour/location.cc

index e47acd1e2f98e8e0f6c3d5e3c18156ec895533c4..8d7e48bc1b7f0b9b7d9ff373b6250a497cc3c7ae 100644 (file)
@@ -93,10 +93,10 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
 
        : Gtkmm2ext::UI ("ardour", argcp, argvp, rcfile),
          
-         primary_clock (X_("TransportClockDisplay"), true, false, true),
-         secondary_clock (X_("SecondaryClockDisplay"), true, false, true),
-         preroll_clock (X_("PreRollClock"), true, true),
-         postroll_clock (X_("PostRollClock"), true, true),
+         primary_clock (X_("primary"), false, X_("TransportClockDisplay"), true, false, true),
+         secondary_clock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, false, true),
+         preroll_clock (X_("preroll"), false, X_("PreRollClock"), true, true),
+         postroll_clock (X_("postroll"), false, X_("PostRollClock"), true, true),
 
          /* adjuster table */
 
@@ -109,7 +109,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
 
          /* big clock */
 
-         big_clock ("BigClockNonRecording", true, false, true),
+         big_clock (X_("bigclock"), false, "BigClockNonRecording", true, false, true),
 
          /* transport */
 
@@ -248,6 +248,10 @@ ARDOUR_UI::set_engine (AudioEngine& e)
                throw failed_constructor();
        }
 
+       /* listen to clock mode changes */
+
+       AudioClock::ModeChanged.connect (mem_fun (*this, &ARDOUR_UI::store_clock_modes));
+
        /* start the time-of-day-clock */
        
        update_wall_clock ();
@@ -1803,9 +1807,8 @@ ARDOUR_UI::load_session (const string & path, const string & snap_name, string*
        /* if it already exists, we must have write access */
 
        if (::access (path.c_str(), F_OK) == 0 && ::access (path.c_str(), W_OK)) {
-               MessageDialog msg (*editor, _("\
-You do not have write access to this session.\n\
-This prevents the session from being loaded."));
+               MessageDialog msg (*editor, _("You do not have write access to this session.\n"
+                                             "This prevents the session from being loaded."));
                msg.run ();
                return -1;
        }
@@ -2436,30 +2439,13 @@ ARDOUR_UI::store_clock_modes ()
 {
        XMLNode* node = new XMLNode(X_("ClockModes"));
 
-       node->add_property (X_("primary"), enum_2_string (primary_clock.mode()));
-       node->add_property (X_("secondary"), enum_2_string (secondary_clock.mode()));
+       for (vector<AudioClock*>::iterator x = AudioClock::clocks.begin(); x != AudioClock::clocks.end(); ++x) {
+               node->add_property ((*x)->name().c_str(), enum_2_string ((*x)->mode()));
+       }
 
        session->add_extra_xml (*node);
        session->set_dirty ();
 }
 
-void
-ARDOUR_UI::restore_clock_modes ()
-{
-       XMLProperty* prop;
-       XMLNode * node = session->extra_xml (X_("ClockModes"));
-       AudioClock::Mode mode;
-
-       if (node) {
-               if ((prop = node->property ("primary")) != 0) {
-                       mode = AudioClock::Mode (string_2_enum (prop->value(), mode));
-                       primary_clock.set_mode (mode);
-               }
 
-               if ((prop = node->property ("secondary")) != 0) {
-                       mode = AudioClock::Mode (string_2_enum (prop->value(), mode));
-                       secondary_clock.set_mode (mode);
-               }
-       }
-}
                
index 39af8bee7ddb69a37bae5ae6c1e628ef22937db7..7ad7e4df65956ab6bfb31e6607f6ae8f92ab07f3 100644 (file)
@@ -22,6 +22,7 @@
 #include <cmath>
 
 #include <pbd/convert.h>
+#include <pbd/enumwriter.h>
 
 #include <gtkmm2ext/utils.h>
 
@@ -40,10 +41,14 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace sigc;
 using namespace Gtk;
+using namespace std;
 
 using PBD::atoi;
 using PBD::atof;
 
+sigc::signal<void> AudioClock::ModeChanged;
+vector<AudioClock*> AudioClock::clocks;
+
 const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
        2,   /* SMPTE_Hours */
        2,   /* SMPTE_Minutes */
@@ -58,8 +63,10 @@ const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
        10   /* Audio Frame */
 };
 
-AudioClock::AudioClock (std::string name, bool allow_edit, bool duration, bool with_info) 
-       : is_duration (duration),
+AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name, bool allow_edit, bool duration, bool with_info) 
+       : _name (clock_name),
+         is_transient (transient),
+         is_duration (duration),
          editable (allow_edit),
          colon1 (":"),
          colon2 (":"),
@@ -177,7 +184,7 @@ AudioClock::AudioClock (std::string name, bool allow_edit, bool duration, bool w
 
        clock_frame.add (clock_base);
 
-       set_name (name);
+       set_widget_name (widget_name);
 
        _mode = BBT; /* lie to force mode switch */
        set_mode (SMPTE);
@@ -205,10 +212,14 @@ AudioClock::AudioClock (std::string name, bool allow_edit, bool duration, bool w
        }
 
        set (last_when, true);
+
+       if (!is_transient) {
+               clocks.push_back (this);
+       }
 }
 
 void
-AudioClock::set_name (string name)
+AudioClock::set_widget_name (string name)
 {
        Widget::set_name (name);
 
@@ -533,10 +544,10 @@ AudioClock::set_smpte (nframes_t when, bool force)
        }
        
        if (smpte_upper_info_label) {
-               float smpte_frames = session->smpte_frames_per_second();
+               double smpte_frames = session->smpte_frames_per_second();
                
                if ( fmod(smpte_frames, 1.0) == 0.0) {
-                       sprintf (buf, "%u", int (smpte_frames));
+                       sprintf (buf, "%u", int (smpte_frames)); 
                } else {
                        sprintf (buf, "%.2f", smpte_frames);
                }
@@ -582,6 +593,18 @@ AudioClock::set_session (Session *s)
        session = s;
 
        if (s) {
+
+               XMLProperty* prop;
+               XMLNode* node = session->extra_xml (X_("ClockModes"));
+               AudioClock::Mode amode;
+               
+               if (node) {
+                       if ((prop = node->property (_name.c_str())) != 0) {
+                               amode = AudioClock::Mode (string_2_enum (prop->value(), amode));
+                               set_mode (amode);
+                       }
+               }
+
                set (last_when, true);
        }
 }
@@ -1861,6 +1884,10 @@ AudioClock::set_mode (Mode m)
        set (last_when, true);
        clock_base.show_all ();
        key_entry_state = 0;
+
+       if (!is_transient) {
+               ModeChanged (); /* EMIT SIGNAL */
+       }
 }
 
 void
index cef5a1b52470a50b525ff7c5fa61d7dbdfddfce5..662cb949e64deeb5880176ee32fcc147c8e01b93 100644 (file)
@@ -43,25 +43,32 @@ class AudioClock : public Gtk::HBox
                Off
        };
        
-       AudioClock (std::string name, bool editable, bool is_duration = false, bool with_info = false);
+       AudioClock (std::string clock_name, bool transient, std::string widget_name, bool editable, bool is_duration = false, bool with_info = false);
 
        Mode mode() const { return _mode; }
        
        void set (nframes_t, bool force = false);
        void set_mode (Mode);
        
-       void set_name (std::string);
+       void set_widget_name (std::string);
+
+       std::string name() const { return _name; }
 
        nframes_t current_time (nframes_t position = 0) const;
        nframes_t current_duration (nframes_t position = 0) const;
        void set_session (ARDOUR::Session *s);
 
        sigc::signal<void> ValueChanged;
-       
+
+       static sigc::signal<void> ModeChanged;
+       static std::vector<AudioClock*> clocks;
+
   private:
        ARDOUR::Session  *session;
        Mode             _mode;
        uint32_t          key_entry_state;
+       std::string      _name;
+       bool              is_transient;
        bool              is_duration;
        bool              editable;
 
index 3ce8c76d2ea4dd58ad35c088af227adc14befceb..b7106a079660ec16bd3eeafdd68a9b48317e2f7b 100644 (file)
@@ -47,10 +47,10 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion>
          name_label (_("NAME:")),
          audition_button (_("play")),
          time_table (3, 2),
-         start_clock ("AudioRegionEditorClock", true),
-         end_clock ("AudioRegionEditorClock", true),
-         length_clock ("AudioRegionEditorClock", true, true),
-         sync_offset_clock ("AudioRegionEditorClock", true, true)
+         start_clock (X_("regionstart"), true, X_("AudioRegionEditorClock"), true),
+         end_clock (X_("regionend"), true, X_("AudioRegionEditorClock"), true),
+         length_clock (X_("regionlength"), true, X_("AudioRegionEditorClock"), true, true),
+         sync_offset_clock (X_("regionsyncoffset"), true, X_("AudioRegionEditorClock"), true, true)
 
 {
        start_clock.set_session (&_session);
index 1f3b9910a0c248b5c4e8e4d2f6cb5d2d1b4d6c18..5c2acc8a2a42243db8800cf83d24d81c74995699 100644 (file)
@@ -196,8 +196,8 @@ Editor::Editor (AudioEngine& eng)
 
          /* tool bar related */
 
-         edit_cursor_clock (X_("EditCursorClock"), true),
-         zoom_range_clock (X_("ZoomRangeClock"), true, true),
+         edit_cursor_clock (X_("editcursor"), false, X_("EditCursorClock"), true),
+         zoom_range_clock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, true),
          
          toolbar_selection_clock_table (2,3),
          
@@ -210,7 +210,7 @@ Editor::Editor (AudioEngine& eng)
 
          /* nudge */
 
-         nudge_clock (X_("NudgeClock"), true, true)
+         nudge_clock (X_("nudge"), false, X_("NudgeClock"), true, true)
 
 {
        constructed = false;
@@ -283,6 +283,7 @@ Editor::Editor (AudioEngine& eng)
        route_list_menu = 0;
        region_list_menu = 0;
        marker_menu = 0;
+       start_end_marker_menu = 0;
        range_marker_menu = 0;
        marker_menu_item = 0;
        tm_marker_menu = 0;
index e64ccf461daacef8cc0cdfca8d759222b845ad6e..68b5bd256ed2ded1d2b970840eca9493589e0a69 100644 (file)
@@ -982,6 +982,8 @@ class Editor : public PublicEditor
        void clear_markers ();
        void clear_ranges ();
        void clear_locations ();
+       void unhide_markers ();
+       void unhide_ranges ();
        void jump_forward_to_mark ();
        void jump_backward_to_mark ();
        void cursor_align (bool playhead_to_edit);
@@ -1218,14 +1220,14 @@ class Editor : public PublicEditor
        void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
-       void build_range_marker_menu ();
-       void build_marker_menu ();
+       void build_range_marker_menu (bool loop_or_punch);
+       void build_marker_menu (bool start_or_end);
        void build_tm_marker_menu ();
-       void build_transport_marker_menu ();
        void build_new_transport_marker_menu ();
 
        Gtk::Menu* tm_marker_menu;
        Gtk::Menu* marker_menu;
+       Gtk::Menu* start_end_marker_menu;
        Gtk::Menu* range_marker_menu;
        Gtk::Menu* transport_marker_menu;
        Gtk::Menu* new_transport_marker_menu;
index ed49235a408b2a0e040dcc23b3552328c7842fad..5415ffa9cfbb93de6bff8e0abe0dde1edfa32f91 100644 (file)
@@ -333,7 +333,7 @@ Editor::track_canvas_idle ()
        if (playhead_cursor) playhead_cursor->set_length (canvas_height);
 
        if (marker_drag_line) {
-               marker_drag_line_points.back().set_x(canvas_height);
+               marker_drag_line_points.back().set_y(canvas_height);
                marker_drag_line->property_points() = marker_drag_line_points;
        }
 
index 29b57e449ae92e27bdb62f94ec5a9bf1fe48335b..238a45c4d13b05d253e37c04186d11f2ccd82090 100644 (file)
@@ -288,8 +288,10 @@ Editor::LocationMarkers::set_color_rgba (uint32_t rgba)
 void
 Editor::mouse_add_new_marker (nframes_t where)
 {
+       string markername;
        if (session) {
-               Location *location = new Location (where, where, "mark", Location::IsMark);
+               session->locations()->next_available_name(markername,"mark");
+               Location *location = new Location (where, where, markername, Location::IsMark);
                session->begin_reversible_command (_("add marker"));
                 XMLNode &before = session->locations()->get_state();
                session->locations()->add (location, true);
@@ -313,17 +315,7 @@ Editor::remove_marker (ArdourCanvas::Item& item, GdkEvent* event)
        Location* loc = find_location_from_marker (marker, is_start);
 
        if (session && loc) {
-               if (loc->is_end()) {
-                       /* you can't hide or delete this marker */
-                       return;
-               }
-               if (loc->is_auto_loop() || loc->is_auto_punch()) {
-                       // just hide them
-                       loc->set_hidden (true, this);
-               }
-               else {
-                       Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::really_remove_marker), loc));
-               }
+               Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::really_remove_marker), loc));
        }
 }
 
@@ -388,16 +380,24 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
        Location * loc = find_location_from_marker (marker, is_start);
        if (loc == transport_loop_location() || loc == transport_punch_location()) {
                if (transport_marker_menu == 0) {
-                       build_transport_marker_menu ();
+                       build_range_marker_menu (true);
                }
                marker_menu_item = item;
                transport_marker_menu->popup (1, ev->time);
        } else {
 
                if (loc->is_mark()) {
-                      if (marker_menu == 0) {
-                             build_marker_menu ();
-                      }
+                       bool start_or_end = loc->is_start() || loc->is_end();
+                       Menu *markerMenu;
+                       if (start_or_end) {
+                               if (start_end_marker_menu == 0)
+                                       build_marker_menu (true);
+                               markerMenu = start_end_marker_menu;
+                       } else {
+                               if (marker_menu == 0)
+                                       build_marker_menu (false);
+                               markerMenu = marker_menu;
+                       }
 
 
                // GTK2FIX use action group sensitivity
@@ -415,12 +415,12 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
                }
 #endif         
                marker_menu_item = item;
-               marker_menu->popup (1, ev->time);
+               markerMenu->popup (1, ev->time);
                }
 
                if (loc->is_range_marker()) {
                       if (range_marker_menu == 0){
-                             build_range_marker_menu ();
+                             build_range_marker_menu (false);
                       }
                       marker_menu_item = item;
                       range_marker_menu->popup (1, ev->time);
@@ -443,20 +443,25 @@ void
 Editor::transport_marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
 {
        if (transport_marker_menu == 0) {
-               build_transport_marker_menu ();
+               build_range_marker_menu (true);
        }
 
        transport_marker_menu->popup (1, ev->time);
 }
 
 void
-Editor::build_marker_menu ()
+Editor::build_marker_menu (bool start_or_end)
 {
        using namespace Menu_Helpers;
 
-       marker_menu = new Menu;
-       MenuList& items = marker_menu->items();
-       marker_menu->set_name ("ArdourContextMenu");
+       Menu *markerMenu = new Menu;
+       if (start_or_end) {
+               start_end_marker_menu = markerMenu;
+       } else {
+               marker_menu = markerMenu;
+       }
+       MenuList& items = markerMenu->items();
+       markerMenu->set_name ("ArdourContextMenu");
 
        items.push_back (MenuElem (_("Locate to Mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
        items.push_back (MenuElem (_("Play from Mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
@@ -464,33 +469,43 @@ Editor::build_marker_menu ()
 
        items.push_back (SeparatorElem());
 
-       items.push_back (MenuElem (_("Rename Mark"), mem_fun(*this, &Editor::marker_menu_rename)));
        items.push_back (MenuElem (_("Hide Mark"), mem_fun(*this, &Editor::marker_menu_hide)));
+       if (start_or_end) return;
+       items.push_back (MenuElem (_("Rename Mark"), mem_fun(*this, &Editor::marker_menu_rename)));
        items.push_back (MenuElem (_("Remove Mark"), mem_fun(*this, &Editor::marker_menu_remove)));
 
 }
 
 void
-Editor::build_range_marker_menu ()
+Editor::build_range_marker_menu (bool loop_or_punch)
 {
        using namespace Menu_Helpers;
 
-       range_marker_menu = new Menu;
-       MenuList& items = range_marker_menu->items();
-       range_marker_menu->set_name ("ArdourContextMenu");
+       Menu *markerMenu = new Menu;
+       if (loop_or_punch) {
+               transport_marker_menu = markerMenu;
+       } else {
+               range_marker_menu = markerMenu;
+       }
+       MenuList& items = markerMenu->items();
+       markerMenu->set_name ("ArdourContextMenu");
 
        items.push_back (MenuElem (_("Locate to Range Mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
        items.push_back (MenuElem (_("Play from Range Mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
-       items.push_back (MenuElem (_("Play Range"), mem_fun(*this, &Editor::marker_menu_play_range)));
-       items.push_back (MenuElem (_("Loop Range"), mem_fun(*this, &Editor::marker_menu_loop_range)));
+       if (! loop_or_punch) {
+               items.push_back (MenuElem (_("Play Range"), mem_fun(*this, &Editor::marker_menu_play_range)));
+               items.push_back (MenuElem (_("Loop Range"), mem_fun(*this, &Editor::marker_menu_loop_range)));
+       }
        items.push_back (MenuElem (_("Set Range Mark from Playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
        items.push_back (MenuElem (_("Set Range from Range Selection"), mem_fun(*this, &Editor::marker_menu_set_from_selection)));
 
        items.push_back (SeparatorElem());
 
-       items.push_back (MenuElem (_("Rename Range"), mem_fun(*this, &Editor::marker_menu_rename)));
        items.push_back (MenuElem (_("Hide Range"), mem_fun(*this, &Editor::marker_menu_hide)));
-       items.push_back (MenuElem (_("Remove Range"), mem_fun(*this, &Editor::marker_menu_remove)));
+       if (! loop_or_punch) {
+               items.push_back (MenuElem (_("Rename Range"), mem_fun(*this, &Editor::marker_menu_rename)));
+               items.push_back (MenuElem (_("Remove Range"), mem_fun(*this, &Editor::marker_menu_remove)));
+       }
 
        items.push_back (SeparatorElem());
 
@@ -527,26 +542,6 @@ Editor::build_new_transport_marker_menu ()
        new_transport_marker_menu->signal_unmap_event().connect ( mem_fun(*this, &Editor::new_transport_marker_menu_popdown)); 
 }
 
-void
-Editor::build_transport_marker_menu ()
-{
-       using namespace Menu_Helpers;
-
-       transport_marker_menu = new Menu;
-       MenuList& items = transport_marker_menu->items();
-       transport_marker_menu->set_name ("ArdourContextMenu");
-
-       items.push_back (MenuElem (_("Locate to Range Mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
-       items.push_back (MenuElem (_("Play from Range Mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
-       items.push_back (MenuElem (_("Set Range Mark from Playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
-       items.push_back (MenuElem (_("Set Range from Range Selection"), mem_fun(*this, &Editor::marker_menu_set_from_selection)));
-       items.push_back (SeparatorElem());
-       items.push_back (MenuElem (_("Hide Range"), mem_fun(*this, &Editor::marker_menu_hide)));
-       items.push_back (SeparatorElem());
-       items.push_back (MenuElem (_("Separate Regions in Range"), mem_fun(*this, &Editor::marker_menu_separate_regions_using_location)));
-       items.push_back (MenuElem (_("Select All in Range"), mem_fun(*this, &Editor::marker_menu_select_all_selectables_using_range)));
-}
-
 void
 Editor::marker_menu_hide ()
 {
index 78867bba25fc7353878dafaf82775b970fdd9113..61a0fdd4205e002e4e8df1cb28cc95f180b99ad7 100644 (file)
@@ -4472,6 +4472,7 @@ void
 Editor::end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event)
 {
        Location * newloc = 0;
+       string rangename;
        
        if (!drag_info.first_move) {
                drag_range_markerbar_op (item, event);
@@ -4481,7 +4482,8 @@ Editor::end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event)
                    {
                        begin_reversible_command (_("new range marker"));
                         XMLNode &before = session->locations()->get_state();
-                       newloc = new Location(temp_location->start(), temp_location->end(), "unnamed", Location::IsRangeMarker);
+                       session->locations()->next_available_name(rangename,"unnamed");
+                       newloc = new Location(temp_location->start(), temp_location->end(), rangename, Location::IsRangeMarker);
                        session->locations()->add (newloc, true);
                         XMLNode &after = session->locations()->get_state();
                        session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
index ddcf02911ab4a0215e44a33bfdf6e1d79c8167d7..e4de1c1e2ea7d528d3247e2255f2266ec5a4b5a9 100644 (file)
@@ -1197,6 +1197,8 @@ Editor::temporal_zoom_to_frame (bool coarser, nframes_t frame)
 void
 Editor::add_location_from_selection ()
 {
+       string rangename;
+
        if (selection->time.empty()) {
                return;
        }
@@ -1208,7 +1210,8 @@ Editor::add_location_from_selection ()
        nframes_t start = selection->time[clicked_selection].start;
        nframes_t end = selection->time[clicked_selection].end;
 
-       Location *location = new Location (start, end, "selection", Location::IsRangeMarker);
+       session->locations()->next_available_name(rangename,"selection");
+       Location *location = new Location (start, end, rangename, Location::IsRangeMarker);
 
        session->begin_reversible_command (_("add marker"));
         XMLNode &before = session->locations()->get_state();
@@ -1221,9 +1224,12 @@ Editor::add_location_from_selection ()
 void
 Editor::add_location_from_playhead_cursor ()
 {
+       string markername;
+
        nframes_t where = session->audible_frame();
        
-       Location *location = new Location (where, where, "mark", Location::IsMark);
+       session->locations()->next_available_name(markername,"mark");
+       Location *location = new Location (where, where, markername, Location::IsMark);
        session->begin_reversible_command (_("add marker"));
         XMLNode &before = session->locations()->get_state();
        session->locations()->add (location, true);
@@ -1649,6 +1655,7 @@ Editor::set_mark ()
        nframes_t pos;
        float prefix;
        bool was_floating;
+       string markername;
 
        if (get_prefix (prefix, was_floating)) {
                pos = session->audible_frame ();
@@ -1660,7 +1667,8 @@ Editor::set_mark ()
                }
        }
 
-       session->locations()->add (new Location (pos, 0, "mark", Location::IsMark), true);
+       session->locations()->next_available_name(markername,"mark");
+       session->locations()->add (new Location (pos, 0, markername, Location::IsMark), true);
 }
 
 void
@@ -1709,6 +1717,28 @@ Editor::clear_locations ()
        session->locations()->clear ();
 }
 
+void
+Editor::unhide_markers ()
+{
+       for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
+               Location *l = (*i).first;
+               if (l->is_hidden() && l->is_mark()) {
+                       l->set_hidden(false, this);
+               }
+       }
+}
+
+void
+Editor::unhide_ranges ()
+{
+       for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
+               Location *l = (*i).first;
+               if (l->is_hidden() && l->is_range_marker()) { 
+                       l->set_hidden(false, this);
+               }
+       }
+}
+
 /* INSERT/REPLACE */
 
 void
index 8e1a65b85692314f533dfe7bef8f9070f2120ccd..7f6ac56d5bf728acb2e5a2858c2e6cf676a720df 100644 (file)
@@ -337,11 +337,13 @@ Editor::popup_ruler_menu (nframes_t where, ItemType t)
        case MarkerBarItem:
                ruler_items.push_back (MenuElem (_("New location marker"), bind ( mem_fun(*this, &Editor::mouse_add_new_marker), where)));
                ruler_items.push_back (MenuElem (_("Clear all locations"), mem_fun(*this, &Editor::clear_markers)));
+               ruler_items.push_back (MenuElem (_("Unhide locations"), mem_fun(*this, &Editor::unhide_markers)));
                ruler_items.push_back (SeparatorElem ());
                break;
        case RangeMarkerBarItem:
                //ruler_items.push_back (MenuElem (_("New Range")));
                ruler_items.push_back (MenuElem (_("Clear all ranges"), mem_fun(*this, &Editor::clear_ranges)));
+               ruler_items.push_back (MenuElem (_("Unhide ranges"), mem_fun(*this, &Editor::unhide_ranges)));
                ruler_items.push_back (SeparatorElem ());
 
                break;
index 4eea862ea4f9eee564605071c7b31519d1dc21b4..b77c3a55615447bc0aa30807b86fe906620c7d36 100644 (file)
@@ -48,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")),
@@ -215,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());
@@ -770,9 +770,12 @@ LocationUI::map_locations (Locations::LocationList& locations)
 void
 LocationUI::add_new_location()
 {
+       string markername;
+
        if (session) {
                nframes_t where = session->audible_frame();
-               Location *location = new Location (where, where, "mark", Location::IsMark);
+               session->locations()->next_available_name(markername,"mark");
+               Location *location = new Location (where, where, markername, Location::IsMark);
                session->begin_reversible_command (_("add marker"));
                XMLNode &before = session->locations()->get_state();
                session->locations()->add (location, true);
@@ -786,10 +789,12 @@ LocationUI::add_new_location()
 void
 LocationUI::add_new_range()
 {
+       string rangename;
+
        if (session) {
                nframes_t where = session->audible_frame();
-               Location *location = new Location (where, where, "unnamed", 
-                                                                                       Location::IsRangeMarker);
+               session->locations()->next_available_name(rangename,"unnamed");
+               Location *location = new Location (where, where, rangename, Location::IsRangeMarker);
                session->begin_reversible_command (_("add range marker"));
                XMLNode &before = session->locations()->get_state();
                session->locations()->add (location, true);
index 78be61231c06d8c310fa9ea84b8c91ffe1006dee..9977dab79fbc85c8a3231785c228d2ccedd7f583 100644 (file)
@@ -320,8 +320,9 @@ maybe_load_session ()
                        
                /* Loading a session, but the session doesn't exist */
                if (isnew) {
-                       error << string_compose (_("\n\nNo session named \"%1\" exists.\n\
-To create it from the command line, start ardour as \"ardour --new %1"), path) << endmsg;
+                       error << string_compose (_("\n\nNo session named \"%1\" exists.\n"
+                                                  "To create it from the command line, start ardour as \"ardour --new %1"), path) 
+                             << endmsg;
                        return false;
                }
 
@@ -362,14 +363,15 @@ int main (int argc, char *argv[])
        ARDOUR::AudioEngine *engine;
        vector<Glib::ustring> null_file_list;
 
+        Glib::thread_init();
        gtk_set_locale ();
 
-       (void)   bindtextdomain (PACKAGE, LOCALEDIR);
+       (void) bindtextdomain (PACKAGE, LOCALEDIR);
        (void) textdomain (PACKAGE);
 
        pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
 
-       // catch_signals ();
+       // catch error message system signals ();
 
        text_receiver.listen_to (error);
        text_receiver.listen_to (info);
@@ -409,9 +411,6 @@ int main (int argc, char *argv[])
                     << endl;
        }
 
-       // needs a better home.
-        Glib::thread_init();
-
         try { 
                ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile());
        } catch (failed_constructor& err) {
index 811c37937cd5b7b59590f79a85a9a7bf9a195eef..1c76f8079b5193496b15b751374c7a05191acea2 100644 (file)
@@ -69,7 +69,7 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
 
          /* Sync */
 
-         smpte_offset_clock (X_("SMPTEOffsetClock"), true, true),
+         smpte_offset_clock (X_("smpteoffset"), false, X_("SMPTEOffsetClock"), true, true),
          smpte_offset_negative_button (_("SMPTE offset is negative")),
 
          /* MIDI */
index b0a7d11ef22248384f48f0bf9327ab71ec2e3714..57e13de5af3542ba1f9d3d5e338206ceb84f53e6 100644 (file)
@@ -153,6 +153,7 @@ class Locations : public PBD::StatefulDestructible
        Location* end_location() const;
        Location* start_location() const;
 
+       int next_available_name(string& result,string base);
        uint32_t num_range_markers() const;
 
        int set_current (Location *, bool want_lock = true);
index e550575ab1a3ff1f175b5ef18608474b9c684cd6..ae4a64802fbdaa926aa841c292bf7ca5c437ff61 100644 (file)
@@ -392,6 +392,7 @@ class Session : public PBD::StatefulDestructible
 
        void set_auto_punch_location (Location *);
        void set_auto_loop_location (Location *);
+       int location_name(string& result, string base = string(""));
 
        void reset_input_monitor_state ();
 
index 5a75c2bc16e06d6223f59e0f12d50a0f82d97c69..bec87e5dd6b6d41863304aa3e5e0183720bdde81 100644 (file)
@@ -36,6 +36,8 @@
 
 #include "i18n.h"
 
+#define SUFFIX_MAX 32
+
 using namespace std;
 using namespace ARDOUR;
 using namespace sigc;
@@ -401,6 +403,40 @@ Locations::set_current (Location *loc, bool want_lock)
        return ret;
 }
 
+int
+Locations::next_available_name(string& result,string base)
+{
+       LocationList::iterator i;
+       Location* location;
+       string temp;
+       string::size_type l;
+       int suffix;
+       char buf[32];
+       bool available[SUFFIX_MAX+1];
+
+       result = base;
+       for (int k=1; k<SUFFIX_MAX; k++) {
+               available[k] = true;
+       }
+       l = base.length();
+       for (i = locations.begin(); i != locations.end(); ++i) {
+               location =* i;
+               temp = location->name();
+               if (l && !temp.find(base,0)) {
+                       suffix = atoi(temp.substr(l,3));
+                       if (suffix) available[suffix] = false;
+               }
+       }
+       for (int k=1; k<=SUFFIX_MAX; k++) {
+               if (available[k]) { 
+                       snprintf (buf, 31, "%d", k);
+                       result += buf;
+                       return 1;
+               }
+       }
+       return 0;
+}
+
 int
 Locations::set_current_unlocked (Location *loc)
 {