save and restore clock modes

git-svn-id: svn://localhost/ardour2/trunk@1283 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2007-01-08 17:12:29 +00:00
parent caa89c121d
commit 57bafcd1f4
17 changed files with 213 additions and 119 deletions

View 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);

View 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 ();

View 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)
{