hydrogen 1.2.6
AutomationPathView Class Reference

#include <AutomationPathView.h>

Inheritance diagram for AutomationPathView:
Object< AutomationPathView > Base

Public Slots

void onPreferencesChanged (H2Core::Preferences::Changes changes)
 

Signals

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

Public Member Functions

 AutomationPathView (QWidget *parent=nullptr)
 
 ~AutomationPathView ()
 
H2Core::AutomationPathgetAutomationPath () const noexcept
 
int getGridWidth () const noexcept
 
void setAutomationPath (H2Core::AutomationPath *path, bool bUpdate=true)
 
void setGridWidth (int width)
 
void updateAutomationPath ()
 
void updatePosition (float fTick)
 
- Public Member Functions inherited from Object< AutomationPathView >
 Object ()
 
 Object (const Object< AutomationPathView > &other)
 
- Public Member Functions inherited from Base
 Base ()
 
 Base (const Base &other)
 
virtual const char * class_name () const
 
void logBacktrace () const
 Print the current stack at point into the debug log.
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG.
 
virtual QString toQString (const QString &sPrefix="", bool bShort=true) const
 Formatted string version for debugging purposes.
 

Static Public Attributes

static constexpr int m_nMinimumHeight = 64
 
- Static Public Attributes inherited from Base
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes.
 

Protected Member Functions

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

Private Member Functions

void createBackground ()
 

Private Attributes

H2Core::AutomationPath_path
 
H2Core::AutomationPath::iterator _selectedPoint
 < Original position of selected point
 
bool m_bIsHolding
 
bool m_bPointAdded
 < Whether any points are being dragged
 
float m_fOriginX
 < Whether a new point was added during mouse move
 
float m_fOriginY
 < Original position of selected point
 
float m_fTick
 < Point that is being dragged
 
int m_nGridWidth
 
int m_nMarginHeight
 < Width of song grid cell size - in order to properly align AutomationPathView and SongEditor
 
int m_nMaxPatternSequence
 < Height of top and bottom margins
 
QPixmap * m_pBackgroundPixmap
 

Additional Inherited Members

- Static Public Member Functions inherited from Base
static const char * _class_name ()
 return the class name
 
static QString base_clock (const QString &sMsg)
 Measures the current time and stores it in __last_clock.
 
static QString base_clock_in (const QString &sMsg)
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation !
 
static bool count_active ()
 
static int getAliveObjectCount ()
 
static object_map_t getObjectMap ()
 
static Loggerlogger ()
 return the logger instance
 
static int objects_count ()
 
static void printObjectMapDiff (object_map_t map)
 Creates the difference between a snapshot of the object map and its current state and prints it to std::cout.
 
static void set_count (bool flag)
 enable/disable class instances counting
 
static void write_objects_map_to (std::ostream &out, object_map_t *map=nullptr)
 output the full objects map to a given ostream
 
static void write_objects_map_to_cerr ()
 output objects map to stderr
 
- Static Protected Member Functions inherited from Base
static void registerClass (const char *name, const atomic_obj_cpt_t *counters)
 
- Static Protected Attributes inherited from Base
static bool __count = false
 should we count class instances
 
static timeval __last_clock = { 0, 0 }
 
static Logger__logger = nullptr
 
static bool bLogColors = true
 

Detailed Description

Definition at line 34 of file AutomationPathView.h.

Constructor & Destructor Documentation

◆ AutomationPathView()

AutomationPathView ( QWidget * parent = nullptr)

Definition at line 33 of file AutomationPathView.cpp.

◆ ~AutomationPathView()

Definition at line 57 of file AutomationPathView.cpp.

Member Function Documentation

◆ autoResize()

void autoResize ( )
protected

Resize widget to fit everything.

Definition at line 424 of file AutomationPathView.cpp.

◆ checkBounds()

bool checkBounds ( QMouseEvent * event) const
protected

Check if user clicked within area inside margins.

Definition at line 137 of file AutomationPathView.cpp.

◆ createBackground()

void createBackground ( )
private

Definition at line 211 of file AutomationPathView.cpp.

◆ getAutomationPath()

H2Core::AutomationPath * getAutomationPath ( ) const
inlinenoexcept

Definition at line 59 of file AutomationPathView.h.

◆ getGridWidth()

int getGridWidth ( ) const
inlinenoexcept

Definition at line 62 of file AutomationPathView.h.

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent * event)
overrideprotected

Handler for key presses.

Removed selected point

Definition at line 395 of file AutomationPathView.cpp.

◆ locate()

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

Locate clicked point on a path.

Definition at line 150 of file AutomationPathView.cpp.

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent * event)
overrideprotected

Handler for mouse moves.

Moves selected point.

Definition at line 369 of file AutomationPathView.cpp.

◆ 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().

Definition at line 302 of file AutomationPathView.cpp.

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QMouseEvent * event)
overrideprotected

Handler for releasing mouse button.

Ends any point drags

Definition at line 342 of file AutomationPathView.cpp.

◆ onPreferencesChanged

void onPreferencesChanged ( H2Core::Preferences::Changes changes)
slot

Definition at line 64 of file AutomationPathView.cpp.

◆ paintEvent()

void paintEvent ( QPaintEvent * event)
overrideprotected

Repaint widget.

Definition at line 172 of file AutomationPathView.cpp.

◆ 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,
bool bUpdate = true )

Definition at line 72 of file AutomationPathView.cpp.

◆ setGridWidth()

void setGridWidth ( int width)

Definition at line 100 of file AutomationPathView.cpp.

◆ translatePoint() [1/2]

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

Locate path point on a wdiget surface.

Definition at line 123 of file AutomationPathView.cpp.

◆ translatePoint() [2/2]

QPoint translatePoint ( float x,
float y ) const
protected

Locate path point on a wdiget surface.

Definition at line 114 of file AutomationPathView.cpp.

◆ updateAutomationPath()

void updateAutomationPath ( )

Definition at line 90 of file AutomationPathView.cpp.

◆ updatePosition()

void updatePosition ( float fTick)

Definition at line 164 of file AutomationPathView.cpp.

◆ valueChanged

void valueChanged ( )
signal

Field Documentation

◆ _path

H2Core::AutomationPath* _path
private

Definition at line 41 of file AutomationPathView.h.

◆ _selectedPoint

H2Core::AutomationPath::iterator _selectedPoint
private

< Original position of selected point

Definition at line 50 of file AutomationPathView.h.

◆ m_bIsHolding

bool m_bIsHolding
private

Definition at line 46 of file AutomationPathView.h.

◆ m_bPointAdded

bool m_bPointAdded
private

< Whether any points are being dragged

Definition at line 47 of file AutomationPathView.h.

◆ m_fOriginX

float m_fOriginX
private

< Whether a new point was added during mouse move

Definition at line 48 of file AutomationPathView.h.

◆ m_fOriginY

float m_fOriginY
private

< Original position of selected point

Definition at line 49 of file AutomationPathView.h.

◆ m_fTick

float m_fTick
private

< Point that is being dragged

Definition at line 52 of file AutomationPathView.h.

◆ m_nGridWidth

int m_nGridWidth
private

Definition at line 42 of file AutomationPathView.h.

◆ m_nMarginHeight

int m_nMarginHeight
private

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

Definition at line 43 of file AutomationPathView.h.

◆ m_nMaxPatternSequence

int m_nMaxPatternSequence
private

< Height of top and bottom margins

Definition at line 44 of file AutomationPathView.h.

◆ m_nMinimumHeight

int m_nMinimumHeight = 64
staticconstexpr

Definition at line 68 of file AutomationPathView.h.

◆ m_pBackgroundPixmap

QPixmap* m_pBackgroundPixmap
private

Definition at line 53 of file AutomationPathView.h.