kwave
18.07.70
|
#include <SelectionTracker.h>
Classes | |
class | Undo |
Signals | |
void | sigTrackInserted (const QUuid &uuid) |
void | sigTrackDeleted (const QUuid &uuid) |
void | sigOffsetChanged (sample_index_t offset) |
void | sigLengthChanged (sample_index_t length) |
void | sigInvalidated (const QUuid *track, sample_index_t first, sample_index_t last) |
Public Member Functions | |
SelectionTracker (Kwave::SignalManager *signal, sample_index_t offset, sample_index_t length, const QList< unsigned int > *tracks) | |
virtual | ~SelectionTracker () Q_DECL_OVERRIDE |
QList< QUuid > | allTracks () |
void | selectRange (QList< QUuid > tracks, sample_index_t offset, sample_index_t length) |
sample_index_t | offset () const |
sample_index_t | length () const |
sample_index_t | first () const |
sample_index_t | last () const |
Protected Member Functions | |
virtual bool | saveUndoData (Kwave::UndoTransaction &undo) Q_DECL_OVERRIDE |
Private Slots | |
void | slotTrackInserted (unsigned int index, Kwave::Track *track) |
void | slotTrackDeleted (unsigned int index, Kwave::Track *track) |
void | slotSamplesInserted (unsigned int track, sample_index_t offset, sample_index_t length) |
void | slotSamplesDeleted (unsigned int track, sample_index_t offset, sample_index_t length) |
void | slotSamplesModified (unsigned int track, sample_index_t offset, sample_index_t length) |
Private Attributes | |
QPointer< Kwave::SignalManager > | m_signal |
sample_index_t | m_offset |
sample_index_t | m_length |
QList< QUuid > | m_tracks |
bool | m_selection_only |
QMutex | m_lock |
Additional Inherited Members | |
![]() | |
UndoHandler () | |
virtual | ~UndoHandler () |
Definition at line 40 of file SelectionTracker.h.
Kwave::SelectionTracker::SelectionTracker | ( | Kwave::SignalManager * | signal, |
sample_index_t | offset, | ||
sample_index_t | length, | ||
const QList< unsigned int > * | tracks | ||
) |
Constructor
signal | the signal manager to track |
offset | index of the first selected sample |
length | number of selected samples |
tracks | list of selected tracks or null pointer for "all" |
Definition at line 28 of file SelectionTracker.cpp.
References Kwave::connect(), m_selection_only, m_signal, m_tracks, Kwave::UndoManager::registerHandler(), sigTrackDeleted(), sigTrackInserted(), slotSamplesDeleted(), slotSamplesInserted(), slotSamplesModified(), slotTrackDeleted(), slotTrackInserted(), and Kwave::SignalManager::undoManager().
|
virtual |
Destructor
Definition at line 88 of file SelectionTracker.cpp.
References m_signal, and Kwave::UndoManager::unregisterHandler().
QList< QUuid > Kwave::SelectionTracker::allTracks | ( | ) |
Returns all currently selected tracks
Definition at line 98 of file SelectionTracker.cpp.
References m_tracks.
Referenced by Kwave::OverViewCache::getMinMax(), Kwave::SonagramPlugin::makeAllValid(), and Kwave::OverViewCache::OverViewCache().
|
inline |
Returns the start of the selected range
Definition at line 92 of file SelectionTracker.h.
Referenced by Kwave::SonagramPlugin::makeAllValid().
|
inline |
Returns the end of the selected range
Definition at line 98 of file SelectionTracker.h.
Referenced by Kwave::OverViewCache::getMinMax(), and Kwave::SonagramPlugin::makeAllValid().
|
inline |
Returns the length of the selected range
Definition at line 85 of file SelectionTracker.h.
Referenced by Kwave::OverViewCache::getMinMax(), Kwave::SonagramPlugin::makeAllValid(), Kwave::OverViewCache::scaleDown(), Kwave::OverViewCache::scaleUp(), selectRange(), slotSamplesDeleted(), slotSamplesInserted(), and Kwave::OverViewCache::slotTrackInserted().
|
inline |
Returns the start of the selected range
Definition at line 79 of file SelectionTracker.h.
Referenced by Kwave::OverViewCache::getMinMax(), selectRange(), Kwave::OverViewCache::slotInvalidated(), Kwave::SonagramPlugin::slotInvalidated(), slotSamplesDeleted(), and slotSamplesModified().
|
protectedvirtual |
Called by an undo manager to notify us that it is time to save data for undo.
undo | an undo transaction to append some undo data |
true | if successful |
false | if saving undo data failed, e.g. out of memory or aborted |
Implements Kwave::UndoHandler.
Definition at line 104 of file SelectionTracker.cpp.
References m_selection_only, m_signal, and Kwave::UndoAction::store().
void Kwave::SelectionTracker::selectRange | ( | QList< QUuid > | tracks, |
sample_index_t | offset, | ||
sample_index_t | length | ||
) |
changes the selected range covered by the cache
used during undo/redo
tracks | list of selected tracks |
offset | index of the first selected sample |
length | number of selected samples |
Definition at line 321 of file SelectionTracker.cpp.
References length(), m_length, m_lock, m_offset, m_selection_only, m_signal, m_tracks, offset(), SAMPLE_INDEX_MAX, sigInvalidated(), sigLengthChanged(), sigOffsetChanged(), sigTrackDeleted(), and sigTrackInserted().
|
signal |
signals that a range of samples has become invalid
track | UUID of the track or null for "all tracks" |
first | index of the first invalidated sample |
last | index of the last invalidated sample |
Referenced by selectRange(), slotSamplesDeleted(), slotSamplesInserted(), and slotSamplesModified().
|
signal |
signals that the length of the selection has changed
length | new length of the selection [samples] |
Referenced by selectRange(), slotSamplesDeleted(), slotSamplesInserted(), slotTrackDeleted(), and slotTrackInserted().
|
signal |
signals that the offset of the selection has changed
offset | new index of the selected area [samples] |
Referenced by selectRange(), slotSamplesDeleted(), and slotSamplesInserted().
|
signal |
Signals that a track has been deleted.
uuid | unique ID of the track |
Referenced by SelectionTracker(), selectRange(), and slotTrackDeleted().
|
signal |
Signals that a track has been inserted.
uuid | unique ID of the track |
Referenced by SelectionTracker(), selectRange(), and slotTrackInserted().
|
privateslot |
Connected to the signal's sigSamplesDeleted.
track | index of the source track [0...tracks-1] |
offset | position from which the data was removed |
length | number of samples deleted |
Definition at line 233 of file SelectionTracker.cpp.
References length(), m_length, m_lock, m_offset, m_signal, m_tracks, offset(), SAMPLE_INDEX_MAX, sigInvalidated(), sigLengthChanged(), and sigOffsetChanged().
Referenced by SelectionTracker().
|
privateslot |
Connected to the signal's sigSamplesInserted.
track | index of the source track [0...tracks-1] |
offset | position from which the data was inserted |
length | number of samples inserted |
Definition at line 189 of file SelectionTracker.cpp.
References length(), m_length, m_lock, m_offset, m_selection_only, m_signal, m_tracks, SAMPLE_INDEX_MAX, sigInvalidated(), sigLengthChanged(), and sigOffsetChanged().
Referenced by SelectionTracker().
|
privateslot |
Connected to the signal's sigSamplesModified
track | index of the source track [0...tracks-1] |
offset | position from which the data was modified |
length | number of samples modified |
Definition at line 290 of file SelectionTracker.cpp.
References m_length, m_lock, m_offset, m_signal, m_tracks, offset(), and sigInvalidated().
Referenced by SelectionTracker().
|
privateslot |
Connected to the signal's sigTrackInserted.
index | the index of the inserted track |
track | pointer to the track instance |
Definition at line 159 of file SelectionTracker.cpp.
References m_length, m_lock, m_selection_only, m_signal, m_tracks, sigLengthChanged(), sigTrackDeleted(), and Kwave::Track::uuid().
Referenced by SelectionTracker().
|
privateslot |
Connected to the signal's sigTrackInserted.
index | the index [0...tracks()-1] of the inserted track |
track | pointer to the track instance |
Definition at line 132 of file SelectionTracker.cpp.
References m_length, m_lock, m_selection_only, m_signal, m_tracks, sigLengthChanged(), sigTrackInserted(), and Kwave::Track::uuid().
Referenced by SelectionTracker().
|
private |
length of the source in samples, or zero for "whole signal"
Definition at line 301 of file SelectionTracker.h.
Referenced by selectRange(), slotSamplesDeleted(), slotSamplesInserted(), slotSamplesModified(), slotTrackDeleted(), and slotTrackInserted().
|
private |
mutex for threadsafe access to the selection
Definition at line 310 of file SelectionTracker.h.
Referenced by selectRange(), slotSamplesDeleted(), slotSamplesInserted(), slotSamplesModified(), slotTrackDeleted(), and slotTrackInserted().
|
private |
first sample index in the source
Definition at line 298 of file SelectionTracker.h.
Referenced by selectRange(), slotSamplesDeleted(), slotSamplesInserted(), and slotSamplesModified().
|
private |
if true, track the selection only, otherwise the whole signal
Definition at line 307 of file SelectionTracker.h.
Referenced by saveUndoData(), SelectionTracker(), selectRange(), slotSamplesInserted(), slotTrackDeleted(), and slotTrackInserted().
|
private |
signal with the data to be shown
Definition at line 295 of file SelectionTracker.h.
Referenced by saveUndoData(), SelectionTracker(), selectRange(), slotSamplesDeleted(), slotSamplesInserted(), slotSamplesModified(), slotTrackDeleted(), slotTrackInserted(), and ~SelectionTracker().
|
private |
list of currently selected source tracks
Definition at line 304 of file SelectionTracker.h.
Referenced by allTracks(), SelectionTracker(), selectRange(), slotSamplesDeleted(), slotSamplesInserted(), slotSamplesModified(), slotTrackDeleted(), and slotTrackInserted().