48 lines
1.6 KiB
C++
48 lines
1.6 KiB
C++
// See view_tracks.h. Compiled into the reaper_reasampler module; includes
|
|
// reaper_plugin_functions.h without REAPERAPI_IMPLEMENT (main.cpp owns that).
|
|
|
|
#include "shell/view/view_tracks.h"
|
|
|
|
#include <string>
|
|
|
|
#include "shell/capture/track_guid.h"
|
|
|
|
#define REAPERAPI_MINIMAL
|
|
#define REAPERAPI_WANT_CountTracks
|
|
#define REAPERAPI_WANT_GetTrack
|
|
#define REAPERAPI_WANT_GetMediaTrackInfo_Value
|
|
#define REAPERAPI_WANT_PreventUIRefresh
|
|
#include "reaper_plugin_functions.h"
|
|
|
|
namespace reasampler {
|
|
|
|
std::vector<view::TrackFolderEntry> readFolderEntries(ReaProject* proj,
|
|
TrackHandles& handleByGuid) {
|
|
std::vector<view::TrackFolderEntry> entries;
|
|
const int count = CountTracks(proj);
|
|
entries.reserve(static_cast<std::size_t>(count));
|
|
handleByGuid.reserve(static_cast<std::size_t>(count));
|
|
for (int i = 0; i < count; ++i) {
|
|
MediaTrack* tr = GetTrack(proj, i);
|
|
if (!tr) continue;
|
|
std::string guid = guidString(tr);
|
|
if (guid.empty()) continue;
|
|
const int depth = static_cast<int>(GetMediaTrackInfo_Value(tr, "I_FOLDERDEPTH"));
|
|
entries.push_back(view::TrackFolderEntry{guid, depth});
|
|
handleByGuid.emplace_back(std::move(guid), tr);
|
|
}
|
|
return entries;
|
|
}
|
|
|
|
TrackByGuid indexHandles(const TrackHandles& handleByGuid) {
|
|
TrackByGuid byGuid;
|
|
byGuid.reserve(handleByGuid.size());
|
|
for (const auto& kv : handleByGuid) byGuid.emplace(kv.first, kv.second);
|
|
return byGuid;
|
|
}
|
|
|
|
UiRefreshHold::UiRefreshHold() { PreventUIRefresh(1); }
|
|
UiRefreshHold::~UiRefreshHold() { PreventUIRefresh(-1); }
|
|
|
|
} // namespace reasampler
|