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

Add scroll bar to ProcessorList. Closes #127

parent 416a9cec
No related branches found
No related tags found
No related merge requests found
...@@ -118,6 +118,11 @@ ProcessorList::~ProcessorList() ...@@ -118,6 +118,11 @@ ProcessorList::~ProcessorList()
} }
void ProcessorList::resized()
{
setBounds(0,0,195,getTotalHeight());
}
bool ProcessorList::isOpen() bool ProcessorList::isOpen()
...@@ -137,7 +142,7 @@ void ProcessorList::paint(Graphics& g) ...@@ -137,7 +142,7 @@ void ProcessorList::paint(Graphics& g)
void ProcessorList::drawItems(Graphics& g) void ProcessorList::drawItems(Graphics& g)
{ {
totalHeight = yBuffer; totalHeight = yBuffer + itemHeight;
category = baseItem->getName(); category = baseItem->getName();
...@@ -167,6 +172,11 @@ void ProcessorList::drawItems(Graphics& g) ...@@ -167,6 +172,11 @@ void ProcessorList::drawItems(Graphics& g)
} }
} }
if (isOpen())
setSize(getWidth(),totalHeight);
//resized();
} }
void ProcessorList::drawItem(Graphics& g, ProcessorListItem* item) void ProcessorList::drawItem(Graphics& g, ProcessorListItem* item)
...@@ -451,7 +461,7 @@ void ProcessorList::mouseDown(const MouseEvent& e) ...@@ -451,7 +461,7 @@ void ProcessorList::mouseDown(const MouseEvent& e)
else else
{ {
getUIComponent()->childComponentChanged(); getUIComponent()->childComponentChanged();
totalHeight = itemHeight + 2*yBuffer; // totalHeight = itemHeight + 2*yBuffer;
} }
} }
......
...@@ -82,6 +82,12 @@ public: ...@@ -82,6 +82,12 @@ public:
/** Loads the ProcessorList state. */ /** Loads the ProcessorList state. */
void loadStateFromXml(XmlElement*); void loadStateFromXml(XmlElement*);
void resized();
/** Returns the height requested by the ProcessorList. Determines whether or not
to draw scroll bars.*/
int getTotalHeight();
private: private:
/** The main method for drawing the ProcessorList.*/ /** The main method for drawing the ProcessorList.*/
...@@ -104,9 +110,7 @@ private: ...@@ -104,9 +110,7 @@ private:
int currentColor; int currentColor;
/** Returns the height requested by the ProcessorList. Determines whether or not
to draw scroll bars.*/
int getTotalHeight();
/** Deselects all items within the ProcessorList.*/ /** Deselects all items within the ProcessorList.*/
void clearSelectionState(); void clearSelectionState();
......
...@@ -59,8 +59,11 @@ UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioC ...@@ -59,8 +59,11 @@ UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioC
std::cout << "Created control panel." << std::endl; std::cout << "Created control panel." << std::endl;
processorList = new ProcessorList(); processorList = new ProcessorList();
addAndMakeVisible(processorList); processorListViewport.setViewedComponent(processorList,false);
processorListViewport.setScrollBarsShown(true,false);
addAndMakeVisible(&processorListViewport);
processorList->setVisible(true);
processorList->setBounds(0,0,195,processorList->getTotalHeight());
std::cout << "Created filter list." << std::endl; std::cout << "Created filter list." << std::endl;
messageCenter = new MessageCenter(); messageCenter = new MessageCenter();
...@@ -171,15 +174,23 @@ void UIComponent::resized() ...@@ -171,15 +174,23 @@ void UIComponent::resized()
if (processorList != 0) if (processorList != 0)
{ {
if (processorList->isOpen()) if (processorList->isOpen())
{
if (editorViewportButton->isOpen()) if (editorViewportButton->isOpen())
processorList->setBounds(5,5,195,h-200); processorListViewport.setBounds(5,5,195,h-200);
else else
processorList->setBounds(5,5,195,h-50); processorListViewport.setBounds(5,5,195,h-50);
else
processorList->setBounds(5,5,195,34); processorListViewport.setScrollBarsShown(true,false);
}
else{
processorListViewport.setBounds(5,5,195,34);
processorListViewport.setScrollBarsShown(false,false);
processorListViewport.setViewPosition (0, 0);
}
if (w < 460) if (w < 460)
processorList->setBounds(5-460+getWidth(),5,195,processorList->getHeight()); processorListViewport.setBounds(5-460+getWidth(),5,195,processorList->getHeight());
} }
if (dataViewport != 0) if (dataViewport != 0)
...@@ -189,7 +200,7 @@ void UIComponent::resized() ...@@ -189,7 +200,7 @@ void UIComponent::resized()
top = 40; top = 40;
if (processorList->isOpen()) if (processorList->isOpen())
left = processorList->getX()+processorList->getWidth()+2; left = processorListViewport.getX()+processorListViewport.getWidth()+2;
else else
left = 6; left = 6;
......
...@@ -174,6 +174,8 @@ private: ...@@ -174,6 +174,8 @@ private:
ScopedPointer<MessageCenter> messageCenter; ScopedPointer<MessageCenter> messageCenter;
ScopedPointer<InfoLabel> infoLabel; ScopedPointer<InfoLabel> infoLabel;
ScopedPointer<GraphViewer> graphViewer; ScopedPointer<GraphViewer> graphViewer;
Viewport processorListViewport;
/** Pointer to the GUI's MainWindow, which owns the UIComponent. */ /** Pointer to the GUI's MainWindow, which owns the UIComponent. */
MainWindow* mainWindow; MainWindow* mainWindow;
......
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