summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor_routes.cc22
-rw-r--r--gtk2_ardour/editor_routes.h2
-rw-r--r--gtk2_ardour/mixer_ui.cc6
-rw-r--r--gtk2_ardour/mixer_ui.h4
-rw-r--r--libs/ardour/ardour/route.h16
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/route.cc29
-rw-r--r--libs/ardour/session.cc2
8 files changed, 34 insertions, 49 deletions
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 23e12b1135..161d8c61fb 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -152,8 +152,6 @@ EditorRoutes::show_menu ()
_menu->popup (1, gtk_get_current_event_time());
}
-const char* _order_key = N_("editor");
-
void
EditorRoutes::redisplay ()
{
@@ -181,7 +179,7 @@ EditorRoutes::redisplay ()
to tracks.
*/
- route->set_order_key (_order_key, n);
+ route->set_order_key (N_ ("editor"), n);
}
bool visible = (*i)[_columns.visible];
@@ -218,7 +216,7 @@ EditorRoutes::redisplay ()
}
if (!_redisplay_does_not_reset_order_keys && !_redisplay_does_not_sync_order_keys) {
- _editor->current_session()->sync_order_keys (_order_key);
+ _editor->current_session()->sync_order_keys (N_ ("editor"));
}
}
@@ -264,8 +262,8 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
_ignore_reorder = true;
/* added a new fresh one at the end */
- if ((*x)->route()->order_key(_order_key) == -1) {
- (*x)->route()->set_order_key (_order_key, _model->children().size()-1);
+ if ((*x)->route()->order_key (N_ ("editor")) == -1) {
+ (*x)->route()->set_order_key (N_ ("editor"), _model->children().size()-1);
}
_ignore_reorder = false;
@@ -402,7 +400,7 @@ EditorRoutes::reordered (TreeModel::Path const & path, TreeModel::iterator const
void
-EditorRoutes::sync_order_keys (char const * src)
+EditorRoutes::sync_order_keys (string const & src)
{
vector<int> neworder;
TreeModel::Children rows = _model->children();
@@ -410,7 +408,7 @@ EditorRoutes::sync_order_keys (char const * src)
ARDOUR::Session* s = _editor->current_session ();
- if ((strcmp (src, _order_key) == 0) || !s || (s->state_of_the_state() & Session::Loading) || rows.empty()) {
+ if (src != N_ ("editor") || !s || (s->state_of_the_state() & Session::Loading) || rows.empty()) {
return;
}
@@ -425,7 +423,7 @@ EditorRoutes::sync_order_keys (char const * src)
boost::shared_ptr<Route> route = (*ri)[_columns.route];
int old_key = order;
- int new_key = route->order_key (_order_key);
+ int new_key = route->order_key (N_ ("editor"));
neworder[new_key] = old_key;
@@ -622,7 +620,7 @@ EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path
struct EditorOrderRouteSorter {
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
/* use of ">" forces the correct sort order */
- return a->order_key (_order_key) < b->order_key (_order_key);
+ return a->order_key (N_ ("editor")) < b->order_key (N_ ("editor"));
}
};
@@ -794,12 +792,12 @@ EditorRoutes::move_selected_tracks (bool up)
}
for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) {
- neworder.push_back (leading->second->order_key (_order_key));
+ neworder.push_back (leading->second->order_key (N_ ("editor")));
}
_model->reorder (neworder);
- _editor->current_session()->sync_order_keys (_order_key);
+ _editor->current_session()->sync_order_keys (N_ ("editor"));
}
void
diff --git a/gtk2_ardour/editor_routes.h b/gtk2_ardour/editor_routes.h
index b493b0a905..f416f8f195 100644
--- a/gtk2_ardour/editor_routes.h
+++ b/gtk2_ardour/editor_routes.h
@@ -54,7 +54,7 @@ private:
void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
bool button_press (GdkEventButton *);
void route_name_changed (boost::weak_ptr<ARDOUR::Route>);
- void sync_order_keys (char const *);
+ void sync_order_keys (std::string const &);
void route_removed (TimeAxisView *);
void handle_gui_changes (std::string const &, void *);
void update_rec_display ();
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index d43bd92401..3010f0b0a1 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -374,7 +374,7 @@ Mixer_UI::remove_strip (MixerStrip* strip)
strip_redisplay_does_not_sync_order_keys = false;
}
-const char*
+string
Mixer_UI::get_order_key()
{
return X_("signal");
@@ -388,13 +388,13 @@ Mixer_UI::get_order_key()
}
void
-Mixer_UI::sync_order_keys (const char *src)
+Mixer_UI::sync_order_keys (string const & src)
{
vector<int> neworder;
TreeModel::Children rows = track_model->children();
TreeModel::Children::iterator ri;
- if ((strcmp (src, get_order_key()) == 0) || !session || (session->state_of_the_state() & Session::Loading) || rows.empty()) {
+ if (src != get_order_key() || !session || (session->state_of_the_state() & Session::Loading) || rows.empty()) {
return;
}
diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h
index 1ebe0e031b..894b9b364f 100644
--- a/gtk2_ardour/mixer_ui.h
+++ b/gtk2_ardour/mixer_ui.h
@@ -80,7 +80,7 @@ class Mixer_UI : public Gtk::Window
RouteRedirectSelection& selection() { return _selection; }
- static const char* get_order_key();
+ static std::string get_order_key();
private:
ARDOUR::Session *session;
@@ -243,7 +243,7 @@ class Mixer_UI : public Gtk::Window
Width _strip_width;
- void sync_order_keys (const char *src);
+ void sync_order_keys (std::string const &);
bool strip_redisplay_does_not_reset_order_keys;
bool strip_redisplay_does_not_sync_order_keys;
bool ignore_sync;
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 40a11cdae1..5e04837d91 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -88,8 +88,8 @@ class Route : public SessionObject, public AutomatableControls
bool set_name (const std::string& str);
- long order_key (const char* name) const;
- void set_order_key (const char* name, long n);
+ long order_key (std::string const &) const;
+ void set_order_key (std::string const &, long);
bool is_hidden() const { return _flags & Hidden; }
bool is_master() const { return _flags & MasterOut; }
@@ -312,8 +312,8 @@ class Route : public SessionObject, public AutomatableControls
uint32_t remote_control_id () const;
sigc::signal<void> RemoteControlIDChanged;
- void sync_order_keys (const char* base);
- static sigc::signal<void,const char*> SyncOrderKeys;
+ void sync_order_keys (std::string const &);
+ static sigc::signal<void, std::string const &> SyncOrderKeys;
protected:
friend class Session;
@@ -399,13 +399,7 @@ class Route : public SessionObject, public AutomatableControls
static uint32_t order_key_cnt;
- struct ltstr {
- bool operator()(const char* s1, const char* s2) const {
- return strcmp(s1, s2) < 0;
- }
- };
-
- typedef std::map<const char*,long,ltstr> OrderKeys;
+ typedef std::map<std::string, long> OrderKeys;
OrderKeys order_keys;
void input_change_handler (IOChange, void *src);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 2be7e418dc..429d30a5c1 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -321,7 +321,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
};
- void sync_order_keys (const char* base);
+ void sync_order_keys (std::string const &);
template<class T> void foreach_route (T *obj, void (T::*func)(Route&));
template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 2eeaba176f..af1a7217d0 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -64,7 +64,7 @@ using namespace ARDOUR;
using namespace PBD;
uint32_t Route::order_key_cnt = 0;
-sigc::signal<void,const char*> Route::SyncOrderKeys;
+sigc::signal<void, string const &> Route::SyncOrderKeys;
Route::Route (Session& sess, string name, Flag flg, DataType default_type)
: SessionObject (sess, name)
@@ -121,7 +121,7 @@ Route::init ()
processor_max_streams.reset();
_solo_safe = false;
_recordable = true;
- order_keys[strdup (N_("signal"))] = order_key_cnt++;
+ order_keys[N_("signal")] = order_key_cnt++;
_silent = false;
_meter_point = MeterPostFader;
_initial_delay = 0;
@@ -162,10 +162,6 @@ Route::~Route ()
clear_processors (PreFader);
clear_processors (PostFader);
-
- for (OrderKeys::iterator i = order_keys.begin(); i != order_keys.end(); ++i) {
- free ((void*)(i->first));
- }
}
void
@@ -184,23 +180,20 @@ Route::remote_control_id() const
}
long
-Route::order_key (const char* name) const
+Route::order_key (std::string const & name) const
{
- OrderKeys::const_iterator i;
-
- for (i = order_keys.begin(); i != order_keys.end(); ++i) {
- if (!strcmp (name, i->first)) {
- return i->second;
- }
+ OrderKeys::const_iterator i = order_keys.find (name);
+ if (i == order_keys.end()) {
+ return -1;
}
- return -1;
+ return i->second;
}
void
-Route::set_order_key (const char* name, long n)
+Route::set_order_key (std::string const & name, long n)
{
- order_keys[strdup(name)] = n;
+ order_keys[name] = n;
if (Config->get_sync_all_route_ordering()) {
for (OrderKeys::iterator x = order_keys.begin(); x != order_keys.end(); ++x) {
@@ -212,7 +205,7 @@ Route::set_order_key (const char* name, long n)
}
void
-Route::sync_order_keys (const char* base)
+Route::sync_order_keys (std::string const & base)
{
if (order_keys.empty()) {
return;
@@ -1643,7 +1636,7 @@ Route::_set_state (const XMLNode& node, bool call_base)
error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
<< endmsg;
} else {
- set_order_key (remaining.substr (0, equal).c_str(), n);
+ set_order_key (remaining.substr (0, equal), n);
}
}
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 15dffb928b..58e68cb353 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -4281,7 +4281,7 @@ Session::compute_initial_length ()
}
void
-Session::sync_order_keys (const char* base)
+Session::sync_order_keys (std::string const & base)
{
if (!Config->get_sync_all_route_ordering()) {
/* leave order keys as they are */