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 @@ ...@@ -27,7 +27,7 @@
DataViewport::DataViewport() : DataViewport::DataViewport() :
TabbedComponent(TabbedButtonBar::TabsAtRight), TabbedComponent(TabbedButtonBar::TabsAtRight),
tabDepth(32), shutdown(false) tabDepth(32), shutdown(false), tabIndex(0)
{ {
tabArray.clear(); tabArray.clear();
...@@ -41,7 +41,6 @@ DataViewport::DataViewport() : ...@@ -41,7 +41,6 @@ DataViewport::DataViewport() :
setColour(TabbedComponent::backgroundColourId, setColour(TabbedComponent::backgroundColourId,
Colours::darkgrey); Colours::darkgrey);
} }
DataViewport::~DataViewport() DataViewport::~DataViewport()
...@@ -55,7 +54,8 @@ int DataViewport::addTabToDataViewport(String name, Component* component, Generi ...@@ -55,7 +54,8 @@ int DataViewport::addTabToDataViewport(String name, Component* component, Generi
if (tabArray.size() == 0) if (tabArray.size() == 0)
setVisible(true); setVisible(true);
int tabIndex = getTabbedButtonBar().getNumTabs(); //int tabIndex = getTabbedButtonBar().getNumTabs();
tabIndex++;
// Viewport* viewport = new Viewport(); // Viewport* viewport = new Viewport();
// viewport->setViewedComponent(component, false); // viewport->setViewedComponent(component, false);
...@@ -74,6 +74,10 @@ int DataViewport::addTabToDataViewport(String name, Component* component, Generi ...@@ -74,6 +74,10 @@ int DataViewport::addTabToDataViewport(String name, Component* component, Generi
editorArray.add(editor); editorArray.add(editor);
std::cout << "Adding tab with index " << tabIndex << std::endl;
setCurrentTabIndex(tabArray.size()-1);
return tabIndex; return tabIndex;
} }
...@@ -100,7 +104,7 @@ void DataViewport::destroyTab(int index) ...@@ -100,7 +104,7 @@ void DataViewport::destroyTab(int index)
if (tabArray.size() == 0) if (tabArray.size() == 0)
setVisible(false); setVisible(false);
setCurrentTabIndex(0); setCurrentTabIndex(tabArray.size()-1);
} }
......
...@@ -77,6 +77,7 @@ private: ...@@ -77,6 +77,7 @@ private:
Array<GenericEditor*> editorArray; Array<GenericEditor*> editorArray;
void paint(Graphics& g); void paint(Graphics& g);
int tabDepth; int tabDepth;
int tabIndex;
bool shutdown; 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