hydrogen 1.2.6
SongEditorPositionRuler Class Reference

#include <SongEditor.h>

Inheritance diagram for SongEditorPositionRuler:
WidgetWithScalableFont< 8, 10, 12 > EventListener Object< SongEditorPositionRuler > Base

Public Slots

void createBackground ()
 
void invalidateBackground ()
 
virtual void jackTimebaseStateChangedEvent (int nState) override
 
void onPreferencesChanged (H2Core::Preferences::Changes changes)
 
void showBpmWidget (int nColumn)
 
void showTagWidget (int nColumn)
 
void updatePosition ()
 

Public Member Functions

 SongEditorPositionRuler (QWidget *parent)
 
 ~SongEditorPositionRuler ()
 
uint getGridWidth ()
 
virtual void patternModifiedEvent () override
 
virtual void playingPatternsChangedEvent () override
 
virtual void relocationEvent () override
 
void setGridWidth (uint width)
 
virtual void songModeActivationEvent () override
 
virtual void songSizeChangedEvent () override
 
virtual void tempoChangedEvent (int) override
 
virtual void timelineActivationEvent () override
 
virtual void timelineUpdateEvent (int nValue) override
 
virtual void updateSongEvent (int) override
 
- Public Member Functions inherited from EventListener
virtual ~EventListener ()
 
virtual void actionModeChangeEvent (int nValue)
 
virtual void bbtChangedEvent ()
 
virtual void driverChangedEvent ()
 
virtual void drumkitLoadedEvent ()
 
virtual void errorEvent (int nErrorCode)
 
virtual void gridCellToggledEvent ()
 
virtual void instrumentParametersChangedEvent (int nInstrumentNumber)
 
virtual void jacksessionEvent (int nValue)
 
virtual void jackTimebaseStateChangedEvent (int nValue)
 
virtual void jackTransportActivationEvent ()
 
virtual void loopModeActivationEvent ()
 
virtual void metronomeEvent (int nValue)
 
virtual void midiActivityEvent ()
 
virtual void midiMapChangedEvent ()
 
virtual void nextPatternsChangedEvent ()
 
virtual void nextShotEvent ()
 
virtual void noteOnEvent (int nInstrument)
 
virtual void patternEditorLockedEvent ()
 
virtual void playbackTrackChangedEvent ()
 
virtual void playlistLoadSongEvent (int nIndex)
 
virtual void progressEvent (int nValue)
 
virtual void quitEvent (int nValue)
 
virtual void selectedInstrumentChangedEvent ()
 
virtual void selectedPatternChangedEvent ()
 
virtual void songModifiedEvent ()
 
virtual void soundLibraryChangedEvent ()
 
virtual void stackedModeActivationEvent (int nValue)
 
virtual void stateChangedEvent (H2Core::AudioEngine::State state)
 
virtual void undoRedoActionEvent (int nValue)
 
virtual void updatePreferencesEvent (int nValue)
 
virtual void XRunEvent ()
 
- Public Member Functions inherited from Object< SongEditorPositionRuler >
 Object ()
 
 Object (const Object< SongEditorPositionRuler > &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 Member Functions

static int tickToColumn (float fTick, uint nGridWidth)
 
- 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 Public Attributes

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

Private Types

enum class  HoveredRow { None , TempoMarker , Tag , Ruler }
 Indicated the part of the widget the cursor is hovering over. More...
 

Private Member Functions

QRect calcTempoMarkerRect (std::shared_ptr< const H2Core::Timeline::TempoMarker > pTempoMarker, bool bEmphasize=false) const
 
int columnToX (int nColumn) const
 Calculates the position in pixel required to the painter for a particular nColumn of the grid.
 
void drawTempoMarker (std::shared_ptr< const H2Core::Timeline::TempoMarker > pTempoMarker, bool bEmphasize, QPainter &painter)
 
virtual bool event (QEvent *ev) override
 
virtual void leaveEvent (QEvent *ev) override
 
virtual void mouseMoveEvent (QMouseEvent *ev) override
 
virtual void mousePressEvent (QMouseEvent *ev) override
 
virtual void mouseReleaseEvent (QMouseEvent *ev) override
 
virtual void paintEvent (QPaintEvent *ev) override
 
void showToolTip (const QPoint &pos, const QPoint &globalPos)
 
int xToColumn (int nX) const
 

Private Attributes

bool m_bBackgroundInvalid
 
bool m_bRightBtnPressed
 
float m_fTick
 Cached position of the playhead.
 
HoveredRow m_hoveredRow
 
int m_nActiveBpmWidgetColumn
 
int m_nActiveColumns
 Area covering the length of the song columns.
 
int m_nColumn
 Cached and coarsed-grained position of the playhead.
 
uint m_nGridWidth
 
int m_nHoveredColumn
 
int m_nTagHeight
 
H2Core::AudioEnginem_pAudioEngine
 
QPixmap * m_pBackgroundPixmap
 
H2Core::Hydrogenm_pHydrogen
 
QTimer * m_pTimer
 

Additional Inherited Members

- Protected Member Functions inherited from WidgetWithScalableFont< 8, 10, 12 >
constexpr int getPointSize (H2Core::FontTheme::FontSize fontSize) const
 
- Protected Member Functions inherited from EventListener
virtual ~EventListener ()
 
virtual void actionModeChangeEvent (int nValue)
 
virtual void bbtChangedEvent ()
 
virtual void driverChangedEvent ()
 
virtual void drumkitLoadedEvent ()
 
virtual void errorEvent (int nErrorCode)
 
virtual void gridCellToggledEvent ()
 
virtual void instrumentParametersChangedEvent (int nInstrumentNumber)
 
virtual void jacksessionEvent (int nValue)
 
virtual void jackTimebaseStateChangedEvent (int nValue)
 
virtual void jackTransportActivationEvent ()
 
virtual void loopModeActivationEvent ()
 
virtual void metronomeEvent (int nValue)
 
virtual void midiActivityEvent ()
 
virtual void midiMapChangedEvent ()
 
virtual void nextPatternsChangedEvent ()
 
virtual void nextShotEvent ()
 
virtual void noteOnEvent (int nInstrument)
 
virtual void patternEditorLockedEvent ()
 
virtual void playbackTrackChangedEvent ()
 
virtual void playlistLoadSongEvent (int nIndex)
 
virtual void progressEvent (int nValue)
 
virtual void quitEvent (int nValue)
 
virtual void selectedInstrumentChangedEvent ()
 
virtual void selectedPatternChangedEvent ()
 
virtual void songModifiedEvent ()
 
virtual void soundLibraryChangedEvent ()
 
virtual void stackedModeActivationEvent (int nValue)
 
virtual void stateChangedEvent (H2Core::AudioEngine::State state)
 
virtual void undoRedoActionEvent (int nValue)
 
virtual void updatePreferencesEvent (int nValue)
 
virtual void XRunEvent ()
 
- Protected Member Functions inherited from Object< SongEditorPositionRuler >
 ~Object ()
 
 Object ()
 
 Object (const Object< SongEditorPositionRuler > &other)
 
- Protected Member Functions inherited from Base
 ~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 Protected Member Functions inherited from Base
static void registerClass (const char *name, const atomic_obj_cpt_t *counters)
 
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 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
 
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes.
 

Detailed Description

Definition at line 370 of file SongEditor.h.

Member Enumeration Documentation

◆ HoveredRow

enum class HoveredRow
strongprivate

Indicated the part of the widget the cursor is hovering over.

Enumerator
None 

Cursor is not hovering the widget.

TempoMarker 

Upper half until the lower end of the tempo marker text.

Tag 

Still part of the upper half, but only the last m_nTagHeight pixels.

Ruler 

Lower half.

Definition at line 414 of file SongEditor.h.

Constructor & Destructor Documentation

◆ SongEditorPositionRuler()

SongEditorPositionRuler ( QWidget * parent)
explicit

Definition at line 2498 of file SongEditor.cpp.

◆ ~SongEditorPositionRuler()

Definition at line 2548 of file SongEditor.cpp.

Member Function Documentation

◆ calcTempoMarkerRect()

QRect calcTempoMarkerRect ( std::shared_ptr< const H2Core::Timeline::TempoMarker > pTempoMarker,
bool bEmphasize = false ) const
private
Parameters
pTempoMarkerAssociated TempoMarker
bEmphasizeWhether the text of pTempoMarker will be printed with bold font.

Definition at line 3205 of file SongEditor.cpp.

◆ columnToX()

int columnToX ( int nColumn) const
private

Calculates the position in pixel required to the painter for a particular nColumn of the grid.

TODO: There needs to be some refactoring / common basis for song (and pattern) editor classes.

Definition at line 3376 of file SongEditor.cpp.

◆ createBackground

void createBackground ( )
slot

Definition at line 2585 of file SongEditor.cpp.

◆ drawTempoMarker()

void drawTempoMarker ( std::shared_ptr< const H2Core::Timeline::TempoMarker > pTempoMarker,
bool bEmphasize,
QPainter & painter )
private

Definition at line 3239 of file SongEditor.cpp.

◆ event()

bool event ( QEvent * ev)
overrideprivatevirtual

Definition at line 2790 of file SongEditor.cpp.

◆ getGridWidth()

uint getGridWidth ( )

Definition at line 2565 of file SongEditor.cpp.

◆ invalidateBackground

void invalidateBackground ( )
slot

Definition at line 2581 of file SongEditor.cpp.

◆ jackTimebaseStateChangedEvent

void jackTimebaseStateChangedEvent ( int nState)
overridevirtualslot

Definition at line 2811 of file SongEditor.cpp.

◆ leaveEvent()

void leaveEvent ( QEvent * ev)
overrideprivatevirtual

Definition at line 2736 of file SongEditor.cpp.

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent * ev)
overrideprivatevirtual

Definition at line 2744 of file SongEditor.cpp.

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent * ev)
overrideprivatevirtual

Definition at line 2878 of file SongEditor.cpp.

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QMouseEvent * ev)
overrideprivatevirtual

Definition at line 2935 of file SongEditor.cpp.

◆ onPreferencesChanged

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

Definition at line 3397 of file SongEditor.cpp.

◆ paintEvent()

void paintEvent ( QPaintEvent * ev)
overrideprivatevirtual

Definition at line 2942 of file SongEditor.cpp.

◆ patternModifiedEvent()

void patternModifiedEvent ( )
overridevirtual

Reimplemented from EventListener.

Definition at line 2724 of file SongEditor.cpp.

◆ playingPatternsChangedEvent()

void playingPatternsChangedEvent ( )
overridevirtual

Reimplemented from EventListener.

Definition at line 2730 of file SongEditor.cpp.

◆ relocationEvent()

void relocationEvent ( )
overridevirtual

Reimplemented from EventListener.

Definition at line 2555 of file SongEditor.cpp.

◆ setGridWidth()

void setGridWidth ( uint width)

Definition at line 2570 of file SongEditor.cpp.

◆ showBpmWidget

void showBpmWidget ( int nColumn)
slot

Definition at line 2863 of file SongEditor.cpp.

◆ showTagWidget

void showTagWidget ( int nColumn)
slot

Definition at line 2857 of file SongEditor.cpp.

◆ showToolTip()

void showToolTip ( const QPoint & pos,
const QPoint & globalPos )
private

Definition at line 2824 of file SongEditor.cpp.

◆ songModeActivationEvent()

void songModeActivationEvent ( )
overridevirtual

Reimplemented from EventListener.

Definition at line 2800 of file SongEditor.cpp.

◆ songSizeChangedEvent()

void songSizeChangedEvent ( )
overridevirtual

Reimplemented from EventListener.

Definition at line 2559 of file SongEditor.cpp.

◆ tempoChangedEvent()

void tempoChangedEvent ( int )
overridevirtual

Reimplemented from EventListener.

Definition at line 2707 of file SongEditor.cpp.

◆ tickToColumn()

int tickToColumn ( float fTick,
uint nGridWidth )
static

Definition at line 3384 of file SongEditor.cpp.

◆ timelineActivationEvent()

void timelineActivationEvent ( )
overridevirtual

Reimplemented from EventListener.

Definition at line 2806 of file SongEditor.cpp.

◆ timelineUpdateEvent()

void timelineUpdateEvent ( int nValue)
overridevirtual

Reimplemented from EventListener.

Definition at line 3391 of file SongEditor.cpp.

◆ updatePosition

void updatePosition ( )
slot

Definition at line 3298 of file SongEditor.cpp.

◆ updateSongEvent()

void updateSongEvent ( int nValue)
overridevirtual

Reimplemented from EventListener.

Definition at line 2816 of file SongEditor.cpp.

◆ xToColumn()

int xToColumn ( int nX) const
private

Definition at line 3379 of file SongEditor.cpp.

Field Documentation

◆ m_bBackgroundInvalid

bool m_bBackgroundInvalid
private

Definition at line 439 of file SongEditor.h.

◆ m_bRightBtnPressed

bool m_bRightBtnPressed
private

Definition at line 440 of file SongEditor.h.

◆ m_fTick

float m_fTick
private

Cached position of the playhead.

Definition at line 429 of file SongEditor.h.

◆ m_hoveredRow

HoveredRow m_hoveredRow
private

Definition at line 426 of file SongEditor.h.

◆ m_nActiveBpmWidgetColumn

int m_nActiveBpmWidgetColumn
private

Definition at line 410 of file SongEditor.h.

◆ m_nActiveColumns

int m_nActiveColumns
private

Area covering the length of the song columns.

Definition at line 436 of file SongEditor.h.

◆ m_nColumn

int m_nColumn
private

Cached and coarsed-grained position of the playhead.

Definition at line 431 of file SongEditor.h.

◆ m_nGridWidth

uint m_nGridWidth
private

Definition at line 408 of file SongEditor.h.

◆ m_nHoveredColumn

int m_nHoveredColumn
private

Definition at line 411 of file SongEditor.h.

◆ m_nMinimumHeight

int m_nMinimumHeight = 50
staticconstexpr

Definition at line 393 of file SongEditor.h.

◆ m_nTagHeight

int m_nTagHeight
private

Definition at line 433 of file SongEditor.h.

◆ m_pAudioEngine

H2Core::AudioEngine* m_pAudioEngine
private

Definition at line 406 of file SongEditor.h.

◆ m_pBackgroundPixmap

QPixmap* m_pBackgroundPixmap
private

Definition at line 438 of file SongEditor.h.

◆ m_pHydrogen

H2Core::Hydrogen* m_pHydrogen
private

Definition at line 405 of file SongEditor.h.

◆ m_pTimer

QTimer* m_pTimer
private

Definition at line 407 of file SongEditor.h.