Skip to content

Commit

Permalink
Use mcl::container for Model::Columns
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Apr 18, 2024
1 parent 63f84a3 commit 0ccb028
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/glue/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Data getData(ID channelId)
std::vector<Column> getColumns()
{
std::vector<Column> out;
for (const v::Model::Column& modelColumn : g_ui->model.columns.getAll()) // Model::columns is the source of truth
for (const v::Model::Column& modelColumn : g_ui->model.columns) // Model::columns is the source of truth
out.push_back(makeColumn_(modelColumn));
return out;
}
Expand Down
6 changes: 3 additions & 3 deletions src/gui/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void Model::store(m::Patch& patch) const
{
patch.name = projectName;

for (const Column& column : columns.getAll())
for (const Column& column : columns)
{
m::Patch::Column pcolumn;
pcolumn.width = column.width;
Expand Down Expand Up @@ -168,7 +168,7 @@ Model::Column& Model::getColumnByIndex(int index)

Model::Column& Model::getColumnByChannelId(ID channelId)
{
return *u::vector::findIfSafe(columns.getAll(), [channelId](auto& col)
return *u::vector::findIfSafe(columns, [channelId](auto& col)
{ return col.channels.findById(channelId) != nullptr; });
}

Expand Down Expand Up @@ -232,7 +232,7 @@ void Model::addChannelToGroup(ID channelId, ID groupId, int position)

void Model::removeChannelFromColumn(ID channelId)
{
for (Column& column : columns.getAll()) // Brute force!
for (Column& column : columns) // Brute force!
{
column.channels.removeById(channelId);
for (Channel& channel : column.channels.getAll())
Expand Down
3 changes: 2 additions & 1 deletion src/gui/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "core/const.h"
#include "core/plugins/pluginManager.h"
#include "deps/geompp/src/rect.hpp"
#include "deps/mcl-container/src/container.hpp"
#include "utils/container.h"
#include <FL/Enumerations.H>
#include <string>
Expand All @@ -44,7 +45,7 @@ struct Model
using Channels = u::Container<T, /*Identifiable=*/true, /*Sortable=*/true>;

template <typename T>
using Columns = u::Container<T, /*Identifiable=*/false, /*Sortable=*/true>;
using Columns = mcl::Container<T>;

struct Channel
{
Expand Down

0 comments on commit 0ccb028

Please sign in to comment.