2012-10-26 20:15:45 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2012-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2012-10-26 20:15:45 -04:00
|
|
|
|
|
|
|
#ifndef __gtk2_ardour_route_sorter_h__
|
|
|
|
#define __gtk2_ardour_route_sorter_h__
|
|
|
|
|
2023-02-16 12:59:41 -05:00
|
|
|
#include <memory>
|
|
|
|
|
2012-10-26 20:15:45 -04:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-06-06 12:52:48 -04:00
|
|
|
#include "ardour/stripable.h"
|
|
|
|
|
2017-06-16 17:45:16 -04:00
|
|
|
/* This is used to keep numerical tree-order in sync
|
|
|
|
* with Stripable ordering (mixer_ui.cc editor_routes.cc)
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct TreeOrderKey {
|
2012-10-26 20:15:45 -04:00
|
|
|
uint32_t old_display_order;
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Stripable> stripable;
|
2012-10-26 20:15:45 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
TreeOrderKey (uint32_t ok, std::shared_ptr<ARDOUR::Stripable> s)
|
2016-03-02 12:13:45 -05:00
|
|
|
: old_display_order (ok)
|
2017-01-17 23:14:48 -05:00
|
|
|
, stripable (s)
|
2017-06-16 17:45:16 -04:00
|
|
|
{}
|
2012-10-26 20:15:45 -04:00
|
|
|
};
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2017-06-16 17:45:16 -04:00
|
|
|
typedef std::vector<TreeOrderKey> TreeOrderKeys;
|
2012-10-26 20:15:45 -04:00
|
|
|
|
2017-06-16 17:45:16 -04:00
|
|
|
struct TreeOrderKeySorter
|
|
|
|
{
|
|
|
|
bool operator() (const TreeOrderKey& ok_a, const TreeOrderKey& ok_b)
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::Stripable> const& a = ok_a.stripable;
|
|
|
|
std::shared_ptr<ARDOUR::Stripable> const& b = ok_b.stripable;
|
2017-06-16 17:45:16 -04:00
|
|
|
return ARDOUR::Stripable::Sorter () (a, b);
|
2016-06-06 12:52:48 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-10-26 20:15:45 -04:00
|
|
|
#endif /* __gtk2_ardour_route_sorter_h__ */
|