diff --git a/src/glue/channel.cpp b/src/glue/channel.cpp index 82c3ccc28..7ab97177a 100644 --- a/src/glue/channel.cpp +++ b/src/glue/channel.cpp @@ -81,7 +81,7 @@ Column makeColumn_(const v::Model::Column& modelColumn) for (const v::Model::Channel& channel : modelColumn) { column.channels.push_back(makeData_(channel)); - for (const v::Model::Channel& child : channel.channels.getAll()) // for groups + for (const v::Model::Channel& child : channel) // for groups column.channels.push_back(makeData_(child)); } diff --git a/src/gui/model.cpp b/src/gui/model.cpp index 4a434c9a5..b5f25e9ac 100644 --- a/src/gui/model.cpp +++ b/src/gui/model.cpp @@ -31,6 +31,16 @@ namespace giada::v { +Model::Channel::Channel(ID id, std::size_t columnIndex) +: Container(id) +, columnIndex(columnIndex) +{ +} + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + Model::Column::Column(int width) : width(width) { @@ -232,9 +242,9 @@ void Model::addChannelToGroup(ID channelId, ID groupId, int position) Column& column = getColumnByChannelId(groupId); Channel& group = column.getById(groupId); if (position == -1) - group.channels.add({channelId, column.index}); + group.add({channelId, column.index}); else - group.channels.insert({channelId, column.index}, position); + group.insert({channelId, column.index}, position); } /* -------------------------------------------------------------------------- */ @@ -245,7 +255,7 @@ void Model::removeChannelFromColumn(ID channelId) { column.removeById(channelId); for (Channel& channel : column) - channel.channels.removeById(channelId); + channel.removeById(channelId); } } diff --git a/src/gui/model.h b/src/gui/model.h index 68c938ae0..750b7abc1 100644 --- a/src/gui/model.h +++ b/src/gui/model.h @@ -32,7 +32,6 @@ #include "core/plugins/pluginManager.h" #include "deps/geompp/src/rect.hpp" #include "deps/mcl-container/src/container.hpp" -#include "utils/container.h" #include #include #include @@ -41,18 +40,14 @@ namespace giada::v { struct Model { - template - using Channels = u::Container; - template using Columns = mcl::Container; - struct Channel + struct Channel : public mcl::Container { - ID id; - std::size_t columnIndex; - int index = -1; - Channels channels = {}; + Channel(ID id, std::size_t columnIndex); + + std::size_t columnIndex; }; struct Column : public mcl::Container