Skip to content

Commit dfd2a6f

Browse files
committed
Prevent double-adding tabs when using merger
1 parent bba640e commit dfd2a6f

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

Source/UI/DataViewport.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ int DataViewport::addTabToDataViewport(String name,
4747
if (tabArray.size() == 0)
4848
setVisible(true);
4949

50-
if (tabArray.contains(tabIndex))
51-
return tabIndex;
50+
//if (tabArray.contains(tabIndex))
51+
// return tabIndex;
5252

5353
addTab(name, Colours::lightgrey, component, false, tabIndex);
5454

@@ -77,10 +77,13 @@ int DataViewport::addTabToDataViewport(String name,
7777
void DataViewport::addTabAtIndex(int tabIndex_, String tabName, Component* tabComponent)
7878
{
7979

80-
savedTabIndices.add(tabIndex_);
81-
savedTabComponents.add(tabComponent);
82-
savedTabNames.add(tabName);
83-
80+
if (!savedTabIndices.contains(tabIndex_))
81+
{
82+
savedTabIndices.add(tabIndex_);
83+
savedTabComponents.add(tabComponent);
84+
savedTabNames.add(tabName);
85+
}
86+
8487
}
8588

8689

@@ -127,6 +130,8 @@ void DataViewport::saveStateToXml(XmlElement* xml)
127130
void DataViewport::loadStateFromXml(XmlElement* xml)
128131
{
129132

133+
//LOGD("DataViewport::loadStateFromXml()");
134+
130135
std::vector<int> tabOrder(savedTabIndices.size());
131136
std::iota(tabOrder.begin(), tabOrder.end(), 0); //Initializing
132137
sort(tabOrder.begin(), tabOrder.end(), [&](int i, int j)

0 commit comments

Comments
 (0)