Skip to content
Snippets Groups Projects
Commit dd2d963d authored by jsiegle's avatar jsiegle
Browse files

Fix problem with assigning indices to tabs in DataViewport

parent e77ffb6b
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@
DataViewport::DataViewport() :
TabbedComponent(TabbedButtonBar::TabsAtRight),
tabDepth(32), shutdown(false)
tabDepth(32), shutdown(false), tabIndex(0)
{
tabArray.clear();
......@@ -41,7 +41,6 @@ DataViewport::DataViewport() :
setColour(TabbedComponent::backgroundColourId,
Colours::darkgrey);
}
DataViewport::~DataViewport()
......@@ -55,7 +54,8 @@ int DataViewport::addTabToDataViewport(String name, Component* component, Generi
if (tabArray.size() == 0)
setVisible(true);
int tabIndex = getTabbedButtonBar().getNumTabs();
//int tabIndex = getTabbedButtonBar().getNumTabs();
tabIndex++;
// Viewport* viewport = new Viewport();
// viewport->setViewedComponent(component, false);
......@@ -74,6 +74,10 @@ int DataViewport::addTabToDataViewport(String name, Component* component, Generi
editorArray.add(editor);
std::cout << "Adding tab with index " << tabIndex << std::endl;
setCurrentTabIndex(tabArray.size()-1);
return tabIndex;
}
......@@ -100,7 +104,7 @@ void DataViewport::destroyTab(int index)
if (tabArray.size() == 0)
setVisible(false);
setCurrentTabIndex(0);
setCurrentTabIndex(tabArray.size()-1);
}
......
......@@ -77,6 +77,7 @@ private:
Array<GenericEditor*> editorArray;
void paint(Graphics& g);
int tabDepth;
int tabIndex;
bool shutdown;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment