Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow control panel to collapse gracefully

  • Loading branch information...
commit 48b862a8eb91276895a79b6d5d6c9269df8e7e85 1 parent 1506500
jsiegle authored
Showing with 64 additions and 40 deletions.
  1. +17 −8 Source/UI/ControlPanel.cpp
  2. +47 −32 Source/UI/UIComponent.cpp
View
25 Source/UI/ControlPanel.cpp
@@ -525,7 +525,7 @@ void ControlPanel::resized()
if (playButton != 0)
{
- if (w > 350)
+ if (w > 330)
playButton->setBounds(w-h*10,5,h-5,h-10);\
else
playButton->setBounds(5,5,h-5,h-10);\
@@ -533,7 +533,7 @@ void ControlPanel::resized()
if (recordButton != 0)
{
- if (w > 350)
+ if (w > 330)
recordButton->setBounds(w-h*9,5,h-5,h-10);
else
recordButton->setBounds(5+h,5,h-5,h-10);
@@ -541,18 +541,27 @@ void ControlPanel::resized()
if (masterClock != 0)
{
- if (w > 350)
+ if (w > 330)
masterClock->setBounds(w-h*7-15,0,h*7-15,h);
else
masterClock->setBounds(5+h*2+15,0,h*7-15,h);
}
+ int offset1 = 750 - getWidth();
+ if (offset1 > h)
+ offset1 = h;
+
+ int offset2 = 570 - getWidth();
+ if (offset2 > h)
+ offset2 = h;
+
if (cpuMeter != 0)
{
+
if (getWidth() < 750 && getWidth() >= 570)
- cpuMeter->setBounds(8,h/4+h,h*3,h/2);
+ cpuMeter->setBounds(8,h/4+offset1,h*3,h/2);
else if (getWidth() < 570)
- cpuMeter->setBounds(8,h/4+h*2,h*3,h/2);
+ cpuMeter->setBounds(8,h/4+offset1+offset2,h*3,h/2);
else
cpuMeter->setBounds(8,h/4,h*3,h/2);
}
@@ -560,9 +569,9 @@ void ControlPanel::resized()
if (diskMeter != 0)
{
if (getWidth() < 750 && getWidth() >= 570)
- diskMeter->setBounds(16+h*3,h/4+h,h*3,h/2);
+ diskMeter->setBounds(16+h*3,h/4+offset1,h*3,h/2);
else if (getWidth() < 570)
- diskMeter->setBounds(16+h*3,h/4+h*2,h*3,h/2);
+ diskMeter->setBounds(16+h*3,h/4+offset1+offset2,h*3,h/2);
else
diskMeter->setBounds(16+h*3,h/4,h*3,h/2);
@@ -573,7 +582,7 @@ void ControlPanel::resized()
if (getWidth() < 750 && getWidth() >= 570)
audioEditor->setBounds(w-526,5,h*8,h-10);
else if (getWidth() < 570)
- audioEditor->setBounds(8,5+h,h*8,h-10);
+ audioEditor->setBounds(8,5+offset2,h*8,h-10);
else
audioEditor->setBounds(h*7,5,h*8,h-10);
}
View
79 Source/UI/UIComponent.cpp
@@ -120,14 +120,22 @@ void UIComponent::resized()
{
editorViewportButton->setBounds(w-230, h-40, 225, 35);
- if (h < 400)
- editorViewportButton->setVisible(false);
- else
- editorViewportButton->setVisible(true);
+ if (h < 300 && editorViewportButton->isOpen())
+ editorViewportButton->toggleState();
+
+ if (h < 200)
+ editorViewportButton->setBounds(w-230,h-40+200-h,225,35);
+ //else
+ // editorViewportButton->setVisible(true);
}
if (editorViewport != 0)
{
+ //if (h < 400)
+ // editorViewport->setVisible(false);
+ //else
+ // editorViewport->setVisible(true);
+
if (editorViewportButton->isOpen() && !editorViewport->isVisible())
editorViewport->setVisible(true);
else if (!editorViewportButton->isOpen() && editorViewport->isVisible())
@@ -135,10 +143,7 @@ void UIComponent::resized()
editorViewport->setBounds(6,h-190,w-11,150);
- if (h < 400)
- editorViewport->setVisible(false);
- else
- editorViewport->setVisible(true);
+
}
if (controlPanel != 0)
@@ -149,18 +154,28 @@ void UIComponent::resized()
int leftBound;
if (w >= 460){
- leftBound = 210;
+ leftBound = 202;
}
else {
- leftBound = w-250;
+ leftBound = w-258;
controlPanelWidth = w-leftBound;
}
if (controlPanelWidth < 750)
- addHeight += 32;
+ {
+ addHeight = 750-controlPanelWidth;
+
+ if (addHeight > 32)
+ addHeight = 32;
+ }
if (controlPanelWidth < 570)
- addHeight += 32;
+ {
+ addHeight = 32 + 570-controlPanelWidth;
+
+ if (addHeight > 64)
+ addHeight = 64;
+ }
if (controlPanel->isOpen())
controlPanel->setBounds(leftBound,6,controlPanelWidth,64+addHeight);
@@ -168,6 +183,20 @@ void UIComponent::resized()
controlPanel->setBounds(leftBound,6,controlPanelWidth,32+addHeight);
}
+ if (processorList != 0)
+ {
+ if (processorList->isOpen())
+ if (editorViewportButton->isOpen())
+ processorList->setBounds(5,5,195,h-200);
+ else
+ processorList->setBounds(5,5,195,h-50);
+ else
+ processorList->setBounds(5,5,195,34);
+
+ if (w < 460)
+ processorList->setBounds(5-460+getWidth(),5,195,processorList->getHeight());
+ }
+
if (dataViewport != 0)
{
int left, top, width, height;
@@ -175,7 +204,7 @@ void UIComponent::resized()
top = 40;
if (processorList->isOpen())
- left = 202;
+ left = processorList->getX()+processorList->getWidth()+2;
else
left = 6;
@@ -197,29 +226,15 @@ void UIComponent::resized()
}
- if (processorList != 0)
- {
- if (processorList->isOpen())
- if (editorViewportButton->isOpen())
- processorList->setBounds(5,5,195,h-200);
- else
- processorList->setBounds(5,5,195,h-50);
- else
- processorList->setBounds(5,5,195,34);
-
- if (w < 460)
- processorList->setVisible(false);
- else
- processorList->setVisible(true);
- }
+
if (messageCenter != 0)
{
messageCenter->setBounds(6,h-35,w-241,30);
- if (h < 400)
- messageCenter->setVisible(false);
- else
- messageCenter->setVisible(true);
+ if (h < 200)
+ messageCenter->setBounds(6,h-35+200-h,w-241,30);
+ // else
+ // messageCenter->setVisible(true);
}
// for debugging qpurposes:
Please sign in to comment.
Something went wrong with that request. Please try again.