mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 20:26:30 +01:00
Use std::string for order key map.
git-svn-id: svn://localhost/ardour2/branches/3.0@5318 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
12bf437c6e
commit
36564e4f91
8 changed files with 34 additions and 49 deletions
|
|
@ -152,8 +152,6 @@ EditorRoutes::show_menu ()
|
||||||
_menu->popup (1, gtk_get_current_event_time());
|
_menu->popup (1, gtk_get_current_event_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _order_key = N_("editor");
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorRoutes::redisplay ()
|
EditorRoutes::redisplay ()
|
||||||
{
|
{
|
||||||
|
|
@ -181,7 +179,7 @@ EditorRoutes::redisplay ()
|
||||||
to tracks.
|
to tracks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
route->set_order_key (_order_key, n);
|
route->set_order_key (N_ ("editor"), n);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool visible = (*i)[_columns.visible];
|
bool visible = (*i)[_columns.visible];
|
||||||
|
|
@ -218,7 +216,7 @@ EditorRoutes::redisplay ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_redisplay_does_not_reset_order_keys && !_redisplay_does_not_sync_order_keys) {
|
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;
|
_ignore_reorder = true;
|
||||||
|
|
||||||
/* added a new fresh one at the end */
|
/* added a new fresh one at the end */
|
||||||
if ((*x)->route()->order_key(_order_key) == -1) {
|
if ((*x)->route()->order_key (N_ ("editor")) == -1) {
|
||||||
(*x)->route()->set_order_key (_order_key, _model->children().size()-1);
|
(*x)->route()->set_order_key (N_ ("editor"), _model->children().size()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ignore_reorder = false;
|
_ignore_reorder = false;
|
||||||
|
|
@ -402,7 +400,7 @@ EditorRoutes::reordered (TreeModel::Path const & path, TreeModel::iterator const
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EditorRoutes::sync_order_keys (char const * src)
|
EditorRoutes::sync_order_keys (string const & src)
|
||||||
{
|
{
|
||||||
vector<int> neworder;
|
vector<int> neworder;
|
||||||
TreeModel::Children rows = _model->children();
|
TreeModel::Children rows = _model->children();
|
||||||
|
|
@ -410,7 +408,7 @@ EditorRoutes::sync_order_keys (char const * src)
|
||||||
|
|
||||||
ARDOUR::Session* s = _editor->current_session ();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -425,7 +423,7 @@ EditorRoutes::sync_order_keys (char const * src)
|
||||||
boost::shared_ptr<Route> route = (*ri)[_columns.route];
|
boost::shared_ptr<Route> route = (*ri)[_columns.route];
|
||||||
|
|
||||||
int old_key = order;
|
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;
|
neworder[new_key] = old_key;
|
||||||
|
|
||||||
|
|
@ -622,7 +620,7 @@ EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path
|
||||||
struct EditorOrderRouteSorter {
|
struct EditorOrderRouteSorter {
|
||||||
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
|
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
|
||||||
/* use of ">" forces the correct sort order */
|
/* 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) {
|
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);
|
_model->reorder (neworder);
|
||||||
|
|
||||||
_editor->current_session()->sync_order_keys (_order_key);
|
_editor->current_session()->sync_order_keys (N_ ("editor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ private:
|
||||||
void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
|
void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
|
||||||
bool button_press (GdkEventButton *);
|
bool button_press (GdkEventButton *);
|
||||||
void route_name_changed (boost::weak_ptr<ARDOUR::Route>);
|
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 route_removed (TimeAxisView *);
|
||||||
void handle_gui_changes (std::string const &, void *);
|
void handle_gui_changes (std::string const &, void *);
|
||||||
void update_rec_display ();
|
void update_rec_display ();
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,7 @@ Mixer_UI::remove_strip (MixerStrip* strip)
|
||||||
strip_redisplay_does_not_sync_order_keys = false;
|
strip_redisplay_does_not_sync_order_keys = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
string
|
||||||
Mixer_UI::get_order_key()
|
Mixer_UI::get_order_key()
|
||||||
{
|
{
|
||||||
return X_("signal");
|
return X_("signal");
|
||||||
|
|
@ -388,13 +388,13 @@ Mixer_UI::get_order_key()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Mixer_UI::sync_order_keys (const char *src)
|
Mixer_UI::sync_order_keys (string const & src)
|
||||||
{
|
{
|
||||||
vector<int> neworder;
|
vector<int> neworder;
|
||||||
TreeModel::Children rows = track_model->children();
|
TreeModel::Children rows = track_model->children();
|
||||||
TreeModel::Children::iterator ri;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class Mixer_UI : public Gtk::Window
|
||||||
|
|
||||||
RouteRedirectSelection& selection() { return _selection; }
|
RouteRedirectSelection& selection() { return _selection; }
|
||||||
|
|
||||||
static const char* get_order_key();
|
static std::string get_order_key();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ARDOUR::Session *session;
|
ARDOUR::Session *session;
|
||||||
|
|
@ -243,7 +243,7 @@ class Mixer_UI : public Gtk::Window
|
||||||
|
|
||||||
Width _strip_width;
|
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_reset_order_keys;
|
||||||
bool strip_redisplay_does_not_sync_order_keys;
|
bool strip_redisplay_does_not_sync_order_keys;
|
||||||
bool ignore_sync;
|
bool ignore_sync;
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,8 @@ class Route : public SessionObject, public AutomatableControls
|
||||||
|
|
||||||
bool set_name (const std::string& str);
|
bool set_name (const std::string& str);
|
||||||
|
|
||||||
long order_key (const char* name) const;
|
long order_key (std::string const &) const;
|
||||||
void set_order_key (const char* name, long n);
|
void set_order_key (std::string const &, long);
|
||||||
|
|
||||||
bool is_hidden() const { return _flags & Hidden; }
|
bool is_hidden() const { return _flags & Hidden; }
|
||||||
bool is_master() const { return _flags & MasterOut; }
|
bool is_master() const { return _flags & MasterOut; }
|
||||||
|
|
@ -312,8 +312,8 @@ class Route : public SessionObject, public AutomatableControls
|
||||||
uint32_t remote_control_id () const;
|
uint32_t remote_control_id () const;
|
||||||
sigc::signal<void> RemoteControlIDChanged;
|
sigc::signal<void> RemoteControlIDChanged;
|
||||||
|
|
||||||
void sync_order_keys (const char* base);
|
void sync_order_keys (std::string const &);
|
||||||
static sigc::signal<void,const char*> SyncOrderKeys;
|
static sigc::signal<void, std::string const &> SyncOrderKeys;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class Session;
|
friend class Session;
|
||||||
|
|
@ -399,13 +399,7 @@ class Route : public SessionObject, public AutomatableControls
|
||||||
|
|
||||||
static uint32_t order_key_cnt;
|
static uint32_t order_key_cnt;
|
||||||
|
|
||||||
struct ltstr {
|
typedef std::map<std::string, long> OrderKeys;
|
||||||
bool operator()(const char* s1, const char* s2) const {
|
|
||||||
return strcmp(s1, s2) < 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::map<const char*,long,ltstr> OrderKeys;
|
|
||||||
OrderKeys order_keys;
|
OrderKeys order_keys;
|
||||||
|
|
||||||
void input_change_handler (IOChange, void *src);
|
void input_change_handler (IOChange, void *src);
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
|
||||||
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
|
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)(Route&));
|
||||||
template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
|
template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ using namespace ARDOUR;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
|
||||||
uint32_t Route::order_key_cnt = 0;
|
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)
|
Route::Route (Session& sess, string name, Flag flg, DataType default_type)
|
||||||
: SessionObject (sess, name)
|
: SessionObject (sess, name)
|
||||||
|
|
@ -121,7 +121,7 @@ Route::init ()
|
||||||
processor_max_streams.reset();
|
processor_max_streams.reset();
|
||||||
_solo_safe = false;
|
_solo_safe = false;
|
||||||
_recordable = true;
|
_recordable = true;
|
||||||
order_keys[strdup (N_("signal"))] = order_key_cnt++;
|
order_keys[N_("signal")] = order_key_cnt++;
|
||||||
_silent = false;
|
_silent = false;
|
||||||
_meter_point = MeterPostFader;
|
_meter_point = MeterPostFader;
|
||||||
_initial_delay = 0;
|
_initial_delay = 0;
|
||||||
|
|
@ -162,10 +162,6 @@ Route::~Route ()
|
||||||
|
|
||||||
clear_processors (PreFader);
|
clear_processors (PreFader);
|
||||||
clear_processors (PostFader);
|
clear_processors (PostFader);
|
||||||
|
|
||||||
for (OrderKeys::iterator i = order_keys.begin(); i != order_keys.end(); ++i) {
|
|
||||||
free ((void*)(i->first));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -184,23 +180,20 @@ Route::remote_control_id() const
|
||||||
}
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
Route::order_key (const char* name) const
|
Route::order_key (std::string const & name) const
|
||||||
{
|
{
|
||||||
OrderKeys::const_iterator i;
|
OrderKeys::const_iterator i = order_keys.find (name);
|
||||||
|
if (i == order_keys.end()) {
|
||||||
for (i = order_keys.begin(); i != order_keys.end(); ++i) {
|
|
||||||
if (!strcmp (name, i->first)) {
|
|
||||||
return i->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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()) {
|
if (Config->get_sync_all_route_ordering()) {
|
||||||
for (OrderKeys::iterator x = order_keys.begin(); x != order_keys.end(); ++x) {
|
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
|
void
|
||||||
Route::sync_order_keys (const char* base)
|
Route::sync_order_keys (std::string const & base)
|
||||||
{
|
{
|
||||||
if (order_keys.empty()) {
|
if (order_keys.empty()) {
|
||||||
return;
|
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)
|
error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
|
||||||
<< endmsg;
|
<< endmsg;
|
||||||
} else {
|
} else {
|
||||||
set_order_key (remaining.substr (0, equal).c_str(), n);
|
set_order_key (remaining.substr (0, equal), n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4281,7 +4281,7 @@ Session::compute_initial_length ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::sync_order_keys (const char* base)
|
Session::sync_order_keys (std::string const & base)
|
||||||
{
|
{
|
||||||
if (!Config->get_sync_all_route_ordering()) {
|
if (!Config->get_sync_all_route_ordering()) {
|
||||||
/* leave order keys as they are */
|
/* leave order keys as they are */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue