1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
|
// qtractorTracks.h
//
/****************************************************************************
Copyright (C) 2005-2022, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
#ifndef __qtractorTracks_h
#define __qtractorTracks_h
#include <QSplitter>
// Forward declarations.
class qtractorTrackList;
class qtractorTrackTime;
class qtractorTrackView;
class qtractorTrack;
class qtractorClip;
class qtractorClipCommand;
class qtractorClipRangeCommand;
class qtractorClipToolCommand;
class qtractorMidiToolsForm;
class qtractorMidiManager;
//----------------------------------------------------------------------------
// qtractorTracks -- The main session track listview widget.
class qtractorTracks : public QSplitter
{
Q_OBJECT
public:
// Constructor.
qtractorTracks(QWidget *pParent);
// Destructor.
~qtractorTracks();
// Child widgets accessors.
qtractorTrackList *trackList() const;
qtractorTrackTime *trackTime() const;
qtractorTrackView *trackView() const;
// Update/sync from session tracks.
void updateContents(bool bRefresh = false);
// Primordial track management methods.
qtractorTrack *currentTrack() const;
bool addTrack();
bool removeTrack(qtractorTrack *pTrack = nullptr);
bool editTrack(qtractorTrack *pTrack = nullptr);
bool copyTrack(qtractorTrack *pTrack = nullptr);
// Import Audio/MIDI files into new tracks...
bool addAudioTracks(const QStringList& files,
unsigned long iClipStart, unsigned long iClipOffset = 0,
unsigned long iClipLength = 0, qtractorTrack *pAfterTrack = nullptr);
bool addMidiTracks(const QStringList& files,
unsigned long iClipStart, qtractorTrack *pAfterTrack = nullptr);
bool addMidiTrackChannel(const QString& sPath, int iTrackChannel,
unsigned long iClipStart, qtractorTrack *pAfterTrack = nullptr);
// Track-list active maintenance update.
void updateTrack(qtractorTrack *pTrack = nullptr);
// MIDI track/bus/channel alias active maintenance method.
void updateMidiTrack(qtractorTrack *pMidiTrack);
// MIDI track meters maintenance method.
void updateMidiTrackItem(qtractorMidiManager *pMidiManager);
// Primordial clip management methods.
void setCurrentClip(qtractorClip *pClip);
qtractorClip *currentClip() const;
bool newClip();
bool editClip(qtractorClip *pClip = nullptr);
bool unlinkClip(qtractorClip *pClip = nullptr);
bool splitClip(qtractorClip *pClip = nullptr);
bool normalizeClip(qtractorClip *pClip = nullptr);
bool rangeClip(qtractorClip *pClip = nullptr);
bool loopClip(qtractorClip *pClip = nullptr);
bool tempoClip(qtractorClip *pClip = nullptr);
bool crossFadeClip(qtractorClip *pClip = nullptr);
bool executeClipTool(int iTool, qtractorClip *pClip = nullptr);
bool importClips(QStringList files, unsigned long iClipStart = 0);
bool exportClips();
bool mergeClips();
// Whether there's anything currently selected.
bool isSelected() const;
// Whether there's any clip currently selected.
bool isClipSelected() const;
// Whether there's any curve/automation currently selected.
bool isCurveSelected() const;
// Whether there's a single track selection.
qtractorTrack *singleTrackSelected();
// Retrieve actual clip selection range.
void clipSelectedRange(
unsigned long& iSelectStart,
unsigned long& iSelectEnd) const;
// Clipboard methods.
void cutClipboard();
void copyClipboard();
void pasteClipboard();
// Special paste/repeat prompt.
void pasteRepeatClipboard();
// Delete selection method.
void deleteSelect();
// Split selection method.
void splitSelect();
// Selection methods.
void selectEditRange(bool bReset = false);
void selectCurrentTrack(bool bReset = false);
void selectCurrentTrackRange(bool bReset = false);
void selectAll();
void selectNone();
void selectInvert();
// Insertion and removal methods.
bool insertEditRange(qtractorTrack *pTrack = nullptr);
bool removeEditRange(qtractorTrack *pTrack = nullptr);
// Simple main-form redirectors.
void selectionChangeNotify();
void contentsChangeNotify();
void dirtyChangeNotify();
// Overall selection clear/reset.
void clearSelect(bool bReset = false);
// Overall selection update.
void updateSelect();
// Overall contents reset.
void clear();
// Zoom (view) modes.
enum { ZoomNone = 0, ZoomHorizontal = 1, ZoomVertical = 2, ZoomAll = 3 };
void setZoomMode(int iZoomMode);
int zoomMode() const;
// Zoom view actuators.
void zoomIn();
void zoomOut();
void zoomReset();
// Track-list update (current track only).
void updateTrackList(qtractorTrack *pTrack = nullptr);
// Update/sync recording tracks.
void updateContentsRecord();
protected:
// Zoom factor constants.
enum { ZoomMin = 10, ZoomBase = 100, ZoomMax = 1000, ZoomStep = 10 };
// Zoom step evaluator.
int zoomStep() const;
// Common zoom factor settlers.
void horizontalZoomStep(int iZoomStep);
void verticalZoomStep(int iZoomStep);
// Zoom centering context.
struct ZoomCenter
{
int x, y, ch;
unsigned long frame;
};
// Zoom centering prepare and post methods.
void zoomCenterPre(ZoomCenter& zc) const;
void zoomCenterPost(const ZoomCenter& zc);
// Multi-clip command builders.
bool normalizeClipCommand(
qtractorClipCommand *pClipCommand, qtractorClip *pClip);
bool executeClipToolCommand(
qtractorClipToolCommand *pClipToolCommand, qtractorClip *pClip,
qtractorMidiToolsForm *pMidiToolsForm);
// Common clip-export/merge methods.
bool mergeExportClips(qtractorClipCommand *pClipCommand);
// Specialized clip-export/merge methods.
bool mergeExportAudioClips(qtractorClipCommand *pClipCommand);
bool mergeExportMidiClips(qtractorClipCommand *pClipCommand);
bool rangeClipEx(qtractorClip *pClip, bool bLoopSet);
// Insertion and removal methods (track).
int insertEditRangeTrack(
qtractorClipRangeCommand *pClipRangeCommand, qtractorTrack *pTrack,
unsigned long iInsertStart, unsigned long iInsertEnd,
unsigned int iInsertOptions) const;
int removeEditRangeTrack(
qtractorClipRangeCommand *pClipRangeCommand, qtractorTrack *pTrack,
unsigned long iRemoveStart, unsigned long iRemoveEnd,
unsigned int iRemoveOptions) const;
public slots:
// Track-view update (obviously a slot).
void updateTrackView();
protected slots:
// Zoom view slots.
void horizontalZoomInSlot();
void horizontalZoomOutSlot();
void verticalZoomInSlot();
void verticalZoomOutSlot();
void viewZoomResetSlot();
private:
// The main child widgets.
qtractorTrackList *m_pTrackList;
qtractorTrackTime *m_pTrackTime;
qtractorTrackView *m_pTrackView;
// Zoom mode flag.
int m_iZoomMode;
};
#endif // __qtractorTracks_h
// end of qtractorTracks.h
|