Skip to content

Commit

Permalink
Add groupId property to model::Channel class
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed May 15, 2024
1 parent 78863a6 commit 2bd7c2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/gui/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@

namespace giada::v
{
Model::Channel::Channel(ID id, std::size_t columnIndex)
Model::Channel::Channel(ID id, ID groupId, std::size_t columnIndex)
: Container(id)
, groupId(groupId)
, columnIndex(columnIndex)
{
}
Expand Down Expand Up @@ -169,7 +170,7 @@ void Model::load(const m::Patch& patch)
std::size_t columnIndex = 0;
Column column{pcolumn.width};
for (ID channelId : pcolumn.channels)
column.add({channelId, columnIndex++});
column.add({channelId, /* TODO - group persistence*/ 0, columnIndex++});
columns.add(std::move(column));
}

Expand Down Expand Up @@ -230,9 +231,9 @@ void Model::addChannelToColumn(ID channelId, std::size_t columnIndex, int positi
{
Column& column = getColumnByIndex(columnIndex);
if (position == -1)
column.add({channelId, columnIndex});
column.add({channelId, /*groupId=*/0, columnIndex});
else
column.insert({channelId, columnIndex}, position);
column.insert({channelId, /*groupId=*/0, columnIndex}, position);
}

/* -------------------------------------------------------------------------- */
Expand All @@ -242,9 +243,9 @@ void Model::addChannelToGroup(ID channelId, ID groupId, int position)
Column& column = getColumnByChannelId(groupId);
Channel& group = column.getById(groupId);
if (position == -1)
group.add({channelId, column.index});
group.add({channelId, groupId, column.index});
else
group.insert({channelId, column.index}, position);
group.insert({channelId, groupId, column.index}, position);
}

/* -------------------------------------------------------------------------- */
Expand Down
3 changes: 2 additions & 1 deletion src/gui/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ struct Model

struct Channel : public mcl::Container<Channel, /*Identifiable=*/true, /*Sortable=*/true>
{
Channel(ID id, std::size_t columnIndex);
Channel(ID id, ID groupId, std::size_t columnIndex);

ID groupId;
std::size_t columnIndex;
};

Expand Down

0 comments on commit 2bd7c2f

Please sign in to comment.