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

FilterViewport can now be hidden

- Added a FilterViewportButton class to the UIComponent file, which shows/hides
the FilterViewport whenever it's clicked
- Thus, the DataViewport can now fill up almost the entire window
parent 1ad5f3ae
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<MAINWINDOW>
<BOUNDS x="1870" y="189" w="927" h="718" fullscreen="0"/>
<BOUNDS x="1600" y="52" w="1680" h="973" fullscreen="0"/>
</MAINWINDOW>
......@@ -393,11 +393,11 @@ void FilterList::mouseDown(const MouseEvent& e)
if (fli == baseItem)
{
if (fli->isOpen()) {
UI->filterListOpened();
UI->childComponentChanged();
}
else
{
UI->filterListClosed();
UI->childComponentChanged();
//setBounds(0,0,225,itemHeight + 2*yBuffer);
totalHeight = itemHeight + 2*yBuffer;
}
......
......@@ -47,10 +47,12 @@ void FilterViewport::paint (Graphics& g)
g.setColour (Colours::magenta);
} else {
g.setColour (Colour(127,137,147));
g.setColour (Colour(48,48,48));
}
g.fillRoundedRectangle (tabSize, 0, getWidth(), getHeight(), 8);
g.fillRect (0, 0, getWidth(), getHeight());
//g.fillRoundedRectangle (tabSize, 0, getWidth(), getHeight(), 8);
g.setColour (Colour(170,178,183));
g.fillRect (tabSize+borderSize,borderSize,
......
......@@ -30,9 +30,9 @@ MessageCenter::~MessageCenter() {
void MessageCenter::paint(Graphics& g)
{
g.setColour (Colour(103,116,140));
g.setColour (Colour(58,58,58));
g.fillRoundedRectangle (0, 0, getWidth(), getHeight(), 5);
g.fillRect (0, 0, getWidth(), getHeight());
g.setColour (messageBackground);
......
......@@ -33,6 +33,9 @@ UIComponent::UIComponent (ProcessorGraph* pgraph, AudioComponent* audio_)
std::cout << "Created filter viewport." << std::endl;
filterViewportButton = new FilterViewportButton(this);
addAndMakeVisible(filterViewportButton);
controlPanel = new ControlPanel(processorGraph, audio);
addAndMakeVisible(controlPanel);
......@@ -87,14 +90,29 @@ void UIComponent::resized()
int h = getHeight();
if (dataViewport != 0) {
if (filterList->isOpen())
dataViewport->setBounds(202,40,w-207,h-230);
else
dataViewport->setBounds(6,40,w-11,h-230);
if (filterList->isOpen() && filterViewportButton->isOpen())
dataViewport->setBounds(202,40,w-207,h-235);
else if (!filterList->isOpen() && filterViewportButton->isOpen())
dataViewport->setBounds(6,40,w-11,h-235);
else if (filterList->isOpen() && !filterViewportButton->isOpen())
dataViewport->setBounds(202,40,w-207,h-85);
else
dataViewport->setBounds(6,40,w-11,h-85);
}
if (filterViewportButton != 0)
{
filterViewportButton->setBounds(w-230, h-40, 225, 35);
}
if (filterViewport != 0)
filterViewport->setBounds(10,h-175,w-20,125);
if (filterViewport != 0) {
if (filterViewportButton->isOpen() && !filterViewport->isVisible())
filterViewport->setVisible(true);
else if (!filterViewportButton->isOpen() && filterViewport->isVisible())
filterViewport->setVisible(false);
filterViewport->setBounds(6,h-190,w-11,150);
}
if (controlPanel != 0)
controlPanel->setBounds(201,6,w-210,32);
......@@ -107,7 +125,7 @@ void UIComponent::resized()
}
if (messageCenter != 0)
messageCenter->setBounds(40,h-40,w-160,30);
messageCenter->setBounds(6,h-35,w-241,30);
}
......@@ -117,13 +135,98 @@ void UIComponent::disableCallbacks()
controlPanel->disableCallbacks();
}
void UIComponent::filterListOpened()
void UIComponent::childComponentChanged()
{
resized();
}
void UIComponent::filterListClosed()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FilterViewportButton::FilterViewportButton(UIComponent* ui) : UI(ui)
{
open = true;
const unsigned char* buffer = reinterpret_cast<const unsigned char*>(BinaryData::cpmono_light_otf);
size_t bufferSize = BinaryData::cpmono_light_otfSize;
font = new FTPixmapFont(buffer, bufferSize);
resized();
}
FilterViewportButton::~FilterViewportButton()
{
}
void FilterViewportButton::newOpenGLContextCreated()
{
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho (0, 1, 1, 0, 0, 1);
glMatrixMode (GL_MODELVIEW);
glEnable(GL_TEXTURE_2D);
glClearColor(0.23f, 0.23f, 0.23f, 1.0f);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
void FilterViewportButton::renderOpenGL()
{
glClear(GL_COLOR_BUFFER_BIT);
drawName();
drawButton();
}
void FilterViewportButton::drawName()
{
glColor4f(1.0f,1.0f,1.0f,1.0f);
glRasterPos2f(5.0/getWidth(),0.75f);
font->FaceSize(23);
font->Render("SIGNAL CHAIN");
}
void FilterViewportButton::drawButton()
{
glColor4f(1.0f,1.0f,1.0f,1.0f);
glLineWidth(1.0f);
glBegin(GL_LINE_LOOP);
if (open)
{
glVertex2f(0.90,0.65);
glVertex2f(0.925,0.35);
} else {
glVertex2f(0.95,0.35);
glVertex2f(0.90,0.5);
}
glVertex2f(0.95,0.65);
glEnd();
}
void FilterViewportButton::mouseDown(const MouseEvent& e)
{
open = !open;
UI->childComponentChanged();
repaint();
}
\ No newline at end of file
......@@ -23,6 +23,31 @@
#include "../Processors/ProcessorGraph.h"
#include "../Audio/AudioComponent.h"
#ifdef _WIN32
#include <windows.h>
#endif
#if JUCE_WINDOWS
#include <gl/gl.h>
#include <gl/glu.h>
#elif JUCE_LINUX
#include <GL/gl.h>
#include <GL/glut.h>
#undef KeyPress
#elif JUCE_IPHONE
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#elif JUCE_MAC
#include <GLUT/glut.h>
#endif
#ifndef GL_BGRA_EXT
#define GL_BGRA_EXT 0x80e1
#endif
#include <FTGL/ftgl.h>
class FilterViewportButton;
class UIComponent : public Component,
public ActionBroadcaster,
......@@ -42,13 +67,13 @@ public:
//void transmitMessage(const String& message);
void disableCallbacks();
void filterListOpened();
void filterListClosed();
void childComponentChanged();
private:
DataViewport* dataViewport;
FilterViewport* filterViewport;
FilterViewportButton* filterViewportButton;
FilterList* filterList;
ControlPanel* controlPanel;
MessageCenter* messageCenter;
......@@ -64,4 +89,31 @@ private:
};
class FilterViewportButton : public OpenGLComponent
{
public:
FilterViewportButton(UIComponent* ui);
~FilterViewportButton();
bool isOpen() {return open;}
void newOpenGLContextCreated();
void renderOpenGL();
void drawName();
void drawButton();
void mouseDown(const MouseEvent& e);
private:
UIComponent* UI;
bool open;
FTPixmapFont* font;
};
#endif // __UICOMPONENT_H_D97C73CF__
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