Files
mpsk_rx_gui/Source/GraphComponent.h
T
2014-07-19 08:20:53 +00:00

130 lines
3.5 KiB
C++

/*
==============================================================================
This is an automatically generated GUI class created by the Introjucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Introjucer version: 3.1.0
------------------------------------------------------------------------------
The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-13 by Raw Material Software Ltd.
==============================================================================
*/
#ifndef __GRAPH_COMPONENT__
#define __GRAPH_COMPONENT__
//[Headers] -- You can add your own extra header files here --
#include "JuceHeader.h"
#include "Receiver.h"
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Introjucer.
Describe your class and how it works here!
//[/Comments]
*/
class GraphComponent : public Component,
public ReceiverStatusListener
{
public:
//==============================================================================
GraphComponent ();
~GraphComponent();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
void setGraphBounds(float minX, float maxX, float minY, float maxY);
//[/UserMethods]
void paint (Graphics& g);
void resized();
void mouseDown (const MouseEvent& e);
private:
//[UserVariables] -- You can add your own custom variables in this section.
typedef struct _point_t
{
float x;
float y;
} point_t;
class Curve
{
uint32_t m_maxNumPoints;
public:
point_t *m_pPointArray;
uint32_t m_numPoints;
Curve()
: m_pPointArray(0)
, m_maxNumPoints(0)
, m_numPoints(0)
{
}
~Curve()
{
if (m_pPointArray)
delete m_pPointArray;
}
void alloc(uint32_t maxNumPoints)
{
m_maxNumPoints = maxNumPoints;
if (m_pPointArray)
delete m_pPointArray;
m_pPointArray = new point_t[m_maxNumPoints];
}
};
uint32_t m_screenWidth;
uint32_t m_screenHeight;
uint32_t m_screenOffsetX;
uint32_t m_screenOffsetY;
float m_graphMinX;
float m_graphMinY;
float m_graphMaxX;
float m_graphMaxY;
float m_tickStepX;
float m_tickStepY;
uint32_t m_maxNumPoints;
uint32_t m_maxNumCurves;
Curve *m_pCurves;
float getScreenCoordX(float x);
float getScreenCoordY(float y);
void drawBorder(Graphics& g);
void drawMainTicks(Graphics& g);
void drawCurve(Graphics& g, uint32_t index);
void drawReference(Graphics& g, uint32_t numConst, float radius, float size);
void drawCross(Graphics& g, juce::Point<float> point, float size);
void drawCircle(Graphics& g, juce::Point<float> point, float size);
void receiverStatusChanged(ReceiverInterface *pReceiver);
//[/UserVariables]
//==============================================================================
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GraphComponent)
};
//[EndFile] You can add extra defines here...
//[/EndFile]
#endif // __GRAPH_COMPONENT__