~quadrispro/qtractor/trunk

« back to all changes in this revision

Viewing changes to src/qtractorTakeRangeForm.cpp

  • Committer: rncbc
  • Date: 2014-11-11 12:00:14 UTC
  • Revision ID: svn-v4:e0d40dc8-ea4a-44c7-bef6-bdaa6cc6c87d:trunk:4148
- Clip/Take/Range... input dialog values are now properly
  sanitized as long to prevent invalid take/folding ranges.

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
                        m_ui.EditRangeRadioButton->setChecked(true);
135
135
                else
136
136
                        m_ui.CustomRangeRadioButton->setChecked(true);
 
137
                // Set range limits...
 
138
                const unsigned long iClipStart = m_pClip->clipStart();
 
139
                const unsigned long iClipEnd = iClipStart + m_pClip->clipLength();
 
140
                m_ui.TakeStartSpinBox->setMinimum(iClipStart);
 
141
                m_ui.TakeEndSpinBox->setMaximum(iClipEnd);
 
142
 
137
143
                // Populate range values...
138
144
                rangeChanged();
139
145
        }
233
239
        int iCurrentTake = m_ui.CurrentTakeListBox->currentRow();
234
240
        m_ui.CurrentTakeListBox->clear();
235
241
        if (m_pClip) {
236
 
                int iTakeCount = qtractorClip::TakeInfo(
 
242
                const int iTakeCount = qtractorClip::TakeInfo(
237
243
                        m_pClip->clipStart(),
238
244
                        m_pClip->clipOffset(),
239
245
                        m_pClip->clipLength(),
254
260
// Stabilize current form state.
255
261
void qtractorTakeRangeForm::stabilizeForm (void)
256
262
{
 
263
        m_ui.DialogButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
 
264
 
 
265
        if (m_pClip == NULL)
 
266
                return;
 
267
 
257
268
        qtractorSession *pSession = qtractorSession::getInstance();
258
269
        if (pSession == NULL)
259
270
                return;
260
271
 
261
272
        m_ui.SelectionRangeRadioButton->setEnabled(
262
 
                m_pClip && m_pClip->isClipSelected());
 
273
                m_pClip->isClipSelected());
263
274
        m_ui.LoopRangeRadioButton->setEnabled(pSession->isLooping());
264
275
        m_ui.PunchRangeRadioButton->setEnabled(pSession->isPunching());
265
276
        m_ui.EditRangeRadioButton->setEnabled(
266
277
                pSession->editHead() < pSession->editTail());
267
278
 
 
279
        const unsigned long iClipStart = m_pClip->clipStart();
 
280
        const unsigned long iClipEnd = iClipStart + m_pClip->clipLength();
 
281
 
 
282
        const unsigned long iTakeStart = m_ui.TakeStartSpinBox->value();
 
283
        const unsigned long iTakeEnd = m_ui.TakeEndSpinBox->value();
 
284
 
268
285
        m_ui.DialogButtonBox->button(QDialogButtonBox::Ok)->setEnabled(
269
 
                m_ui.TakeStartSpinBox->value() < m_ui.TakeEndSpinBox->value());
 
286
                iTakeStart < iTakeEnd && m_ui.CurrentTakeListBox->count() > 0
 
287
                && iTakeStart >= iClipStart && iTakeEnd < iClipEnd);
270
288
}
271
289
 
272
290