1
/* cdrdao - write audio CD-Rs in disc-at-once mode
3
* Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
#include "TocEditView.h"
24
#include "guiUpdate.h"
27
TocEditView::TocEditView(TocEdit *t)
31
sampleMarkerValid_ = 0;
32
sampleSelectionValid_ = 0;
33
sampleViewMin_ = sampleViewMax_ = 0;
34
trackSelectionValid_ = 0;
35
indexSelectionValid_ = 0;
38
TocEditView::~TocEditView()
43
TocEdit *TocEditView::tocEdit() const
49
void TocEditView::sampleMarker(unsigned long sample)
51
if (sample < tocEdit_->toc()->length().samples()) {
52
sampleMarker_ = sample;
53
sampleMarkerValid_ = 1;
56
sampleMarkerValid_ = 0;
59
tocEdit_->updateLevel_ |= UPD_SAMPLE_MARKER;
62
int TocEditView::sampleMarker(unsigned long *sample) const
64
if (sampleMarkerValid_)
65
*sample = sampleMarker_;
67
return sampleMarkerValid_;
70
void TocEditView::sampleSelection(unsigned long smin, unsigned long smax)
80
if (smax < tocEdit_->toc()->length().samples()) {
81
sampleSelectionMin_ = smin;
82
sampleSelectionMax_ = smax;
84
sampleSelectionValid_ = 1;
87
sampleSelectionValid_ = 0;
90
tocEdit_->updateLevel_ |= UPD_SAMPLE_SEL;
93
void TocEditView::sampleSelectionClear()
95
if (sampleSelectionValid_)
96
tocEdit_->updateLevel_ |= UPD_SAMPLE_SEL;
98
sampleSelectionValid_ = 0;
101
int TocEditView::sampleSelection(unsigned long *smin, unsigned long *smax) const
103
if (sampleSelectionValid_) {
104
*smin = sampleSelectionMin_;
105
*smax = sampleSelectionMax_;
108
return sampleSelectionValid_;
111
void TocEditView::sampleView(unsigned long smin, unsigned long smax)
113
if (smin <= smax && smax < tocEdit_->lengthSample()) {
114
sampleViewMin_ = smin;
115
sampleViewMax_ = smax;
116
tocEdit_->updateLevel_ |= UPD_SAMPLES;
120
void TocEditView::sampleView(unsigned long *smin, unsigned long *smax) const
122
*smin = sampleViewMin_;
123
*smax = sampleViewMax_;
126
void TocEditView::sampleViewFull()
130
if ((sampleViewMax_ = tocEdit_->lengthSample()) > 0)
133
tocEdit_->updateLevel_ |= UPD_SAMPLES;
136
void TocEditView::sampleViewUpdate()
138
if (sampleViewMax_ >= tocEdit_->lengthSample()) {
139
unsigned long len = sampleViewMax_ - sampleViewMin_;
141
if ((sampleViewMax_ = tocEdit_->lengthSample()) > 0)
145
if (sampleViewMax_ >= len)
146
sampleViewMin_ = sampleViewMax_ - len;
150
tocEdit_->updateLevel_ |= UPD_SAMPLES;
154
void TocEditView::sampleViewInclude(unsigned long smin, unsigned long smax)
156
if (smin < sampleViewMin_) {
157
sampleViewMin_ = smin;
158
tocEdit_->updateLevel_ |= UPD_SAMPLES;
161
if (smax < tocEdit_->lengthSample() && smax > sampleViewMax_) {
162
sampleViewMax_ = smax;
163
tocEdit_->updateLevel_ |= UPD_SAMPLES;
167
void TocEditView::trackSelection(int tnum)
170
trackSelection_ = tnum;
171
trackSelectionValid_ = 1;
174
trackSelectionValid_ = 0;
177
tocEdit_->updateLevel_ |= UPD_TRACK_MARK_SEL;
181
int TocEditView::trackSelection(int *tnum) const
183
if (trackSelectionValid_)
184
*tnum = trackSelection_;
186
return trackSelectionValid_;
189
void TocEditView::indexSelection(int inum)
192
indexSelection_ = inum;
193
indexSelectionValid_ = 1;
196
indexSelectionValid_ = 0;
199
tocEdit_->updateLevel_ |= UPD_TRACK_MARK_SEL;
202
int TocEditView::indexSelection(int *inum) const
204
if (indexSelectionValid_)
205
*inum = indexSelection_;
207
return indexSelectionValid_;