hydrogen 1.1.1
AutomationPathView Class Reference

#include <AutomationPathView.h>

Inheritance diagram for AutomationPathView:
Object

Signals

void valueChanged ()
 
void pointAdded (float x, float y)
 
void pointRemoved (float x, float y)
 
void pointMoved (float ox, float oy, float tx, float ty)
 

Public Member Functions

 AutomationPathView (QWidget *parent=nullptr)
 < Point that is being dragged More...
 
H2Core::AutomationPathgetAutomationPath () const noexcept
 
void setAutomationPath (H2Core::AutomationPath *path)
 
int getGridWidth () const noexcept
 
void setGridWidth (int width)
 
- Public Member Functions inherited from Object
 ~Object ()
 destructor More...
 
 Object (const Object &obj)
 copy constructor More...
 
 Object (const char *class_name)
 constructor More...
 
const char * class_name () const
 return the class name More...
 
virtual QString toQString (const QString &sPrefix, bool bShort=true) const
 Formatted string version for debugging purposes. More...
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG. More...
 

Protected Member Functions

void paintEvent (QPaintEvent *event) override
 Repaint widget. More...
 
void mousePressEvent (QMouseEvent *event) override
 Handle mouse click. More...
 
void mouseReleaseEvent (QMouseEvent *event) override
 Handler for releasing mouse button. More...
 
void mouseMoveEvent (QMouseEvent *event) override
 Handler for mouse moves. More...
 
void keyPressEvent (QKeyEvent *event) override
 Handler for key presses. More...
 
QPoint translatePoint (float x, float y) const
 Locate path point on a wdiget surface. More...
 
QPoint translatePoint (const std::pair< float, float > &p) const
 Locate path point on a wdiget surface. More...
 
bool checkBounds (QMouseEvent *event) const
 Check if user clicked within area inside margins. More...
 
std::pair< const float, float > locate (QMouseEvent *) const
 Locate clicked point on a path. More...
 
void autoResize ()
 Resize widget to fit everything. More...
 

Private Attributes

H2_OBJECT H2Core::AutomationPath_path
 
int m_nGridWidth
 
int m_nMarginWidth
 < Width of song grid cell size - in order to properly align AutomationPathView and SongEditor More...
 
int m_nMarginHeight
 < Width of an empty space on the left side More...
 
int m_nMaxPatternSequence
 < Height of top and bottom margins More...
 
bool m_bIsHolding
 
bool m_bPointAdded
 < Whether any points are being dragged More...
 
float m_fOriginX
 < Whether a new point was added during mouse move More...
 
float m_fOriginY
 < Original position of selected point More...
 
H2Core::AutomationPath::iterator _selectedPoint
 < Original position of selected point More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void set_count (bool flag)
 enable/disable class instances counting More...
 
static bool count_active ()
 return true if class instances counting is enabled More...
 
static unsigned objects_count ()
 return the number of objects More...
 
static void write_objects_map_to (std::ostream &out)
 output the full objects map to a given ostream More...
 
static void write_objects_map_to_cerr ()
 output objects map to stderr More...
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation ! More...
 
static Loggerlogger ()
 return the logger instance More...
 
- Static Public Attributes inherited from Object
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes. More...
 
- Static Protected Attributes inherited from Object
static Logger__logger = nullptr
 logger instance pointer More...
 

Constructor & Destructor Documentation

◆ AutomationPathView()

AutomationPathView ( QWidget *  parent = nullptr)

< Point that is being dragged

Member Function Documentation

◆ autoResize()

void autoResize ( )
protected

Resize widget to fit everything.

◆ checkBounds()

bool checkBounds ( QMouseEvent *  event) const
protected

Check if user clicked within area inside margins.

◆ getAutomationPath()

H2Core::AutomationPath * getAutomationPath ( ) const
inlinenoexcept

◆ getGridWidth()

int getGridWidth ( ) const
inlinenoexcept

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  event)
overrideprotected

Handler for key presses.

Removed selected point

◆ locate()

std::pair< const float, float > locate ( QMouseEvent *  event) const
protected

Locate clicked point on a path.

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

Handler for mouse moves.

Moves selected point.

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent *  event)
overrideprotected

Handle mouse click.

This function locates point within click proximity, moves it along Y axis. If threre's no point to move, new point is created. That point is marked for move by mouseMoveEvent().

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

Handler for releasing mouse button.

Ends any point drags

◆ paintEvent()

void paintEvent ( QPaintEvent *  event)
overrideprotected

Repaint widget.

◆ pointAdded

void pointAdded ( float  x,
float  y 
)
signal

◆ pointMoved

void pointMoved ( float  ox,
float  oy,
float  tx,
float  ty 
)
signal

◆ pointRemoved

void pointRemoved ( float  x,
float  y 
)
signal

◆ setAutomationPath()

void setAutomationPath ( H2Core::AutomationPath path)

◆ setGridWidth()

void setGridWidth ( int  width)

◆ translatePoint() [1/2]

QPoint translatePoint ( const std::pair< float, float > &  p) const
protected

Locate path point on a wdiget surface.

◆ translatePoint() [2/2]

QPoint translatePoint ( float  x,
float  y 
) const
protected

Locate path point on a wdiget surface.

◆ valueChanged

void valueChanged ( )
signal

Field Documentation

◆ _path

◆ _selectedPoint

H2Core::AutomationPath::iterator _selectedPoint
private

< Original position of selected point

◆ m_bIsHolding

bool m_bIsHolding
private

◆ m_bPointAdded

bool m_bPointAdded
private

< Whether any points are being dragged

◆ m_fOriginX

float m_fOriginX
private

< Whether a new point was added during mouse move

◆ m_fOriginY

float m_fOriginY
private

< Original position of selected point

◆ m_nGridWidth

int m_nGridWidth
private

◆ m_nMarginHeight

int m_nMarginHeight
private

< Width of an empty space on the left side

◆ m_nMarginWidth

int m_nMarginWidth
private

< Width of song grid cell size - in order to properly align AutomationPathView and SongEditor

◆ m_nMaxPatternSequence

int m_nMaxPatternSequence
private

< Height of top and bottom margins