comparison layer/TextLayer.cpp @ 1266:a34a2a25907c

Untabify
author Chris Cannam
date Thu, 01 Mar 2018 18:02:22 +0000
parents 4fe7a09be0fe
children c8a6fd3f9dff
comparison
equal deleted inserted replaced
1265:6e724c81f18f 1266:a34a2a25907c
75 return SingleColourLayer::getPropertyType(name); 75 return SingleColourLayer::getPropertyType(name);
76 } 76 }
77 77
78 int 78 int
79 TextLayer::getPropertyRangeAndValue(const PropertyName &name, 79 TextLayer::getPropertyRangeAndValue(const PropertyName &name,
80 int *min, int *max, int *deflt) const 80 int *min, int *max, int *deflt) const
81 { 81 {
82 return SingleColourLayer::getPropertyRangeAndValue(name, min, max, deflt); 82 return SingleColourLayer::getPropertyRangeAndValue(name, min, max, deflt);
83 } 83 }
84 84
85 QString 85 QString
86 TextLayer::getPropertyValueLabel(const PropertyName &name, 86 TextLayer::getPropertyValueLabel(const PropertyName &name,
87 int value) const 87 int value) const
88 { 88 {
89 return SingleColourLayer::getPropertyValueLabel(name, value); 89 return SingleColourLayer::getPropertyValueLabel(name, value);
90 } 90 }
91 91
92 void 92 void
121 121
122 TextModel::PointList rv; 122 TextModel::PointList rv;
123 QFontMetrics metrics = QFontMetrics(QFont()); 123 QFontMetrics metrics = QFontMetrics(QFont());
124 124
125 for (TextModel::PointList::iterator i = points.begin(); 125 for (TextModel::PointList::iterator i = points.begin();
126 i != points.end(); ++i) { 126 i != points.end(); ++i) {
127 127
128 const TextModel::Point &p(*i); 128 const TextModel::Point &p(*i);
129 129
130 int px = v->getXForFrame(p.frame); 130 int px = v->getXForFrame(p.frame);
131 int py = getYForHeight(v, p.height); 131 int py = getYForHeight(v, p.height);
132 132
133 QString label = p.label; 133 QString label = p.label;
134 if (label == "") { 134 if (label == "") {
135 label = tr("<no text>"); 135 label = tr("<no text>");
136 } 136 }
137 137
138 QRect rect = metrics.boundingRect 138 QRect rect = metrics.boundingRect
139 (QRect(0, 0, 150, 200), 139 (QRect(0, 0, 150, 200),
140 Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, label); 140 Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, label);
141 141
142 if (py + rect.height() > v->getPaintHeight()) { 142 if (py + rect.height() > v->getPaintHeight()) {
143 if (rect.height() > v->getPaintHeight()) py = 0; 143 if (rect.height() > v->getPaintHeight()) py = 0;
144 else py = v->getPaintHeight() - rect.height() - 1; 144 else py = v->getPaintHeight() - rect.height() - 1;
145 } 145 }
146 146
147 if (x >= px && x < px + rect.width() && 147 if (x >= px && x < px + rect.width() &&
148 y >= py && y < py + rect.height()) { 148 y >= py && y < py + rect.height()) {
149 rv.insert(p); 149 rv.insert(p);
150 } 150 }
151 } 151 }
152 152
153 return rv; 153 return rv;
154 } 154 }
155 155
189 if (!m_model || !m_model->getSampleRate()) return ""; 189 if (!m_model || !m_model->getSampleRate()) return "";
190 190
191 TextModel::PointList points = getLocalPoints(v, x, pos.y()); 191 TextModel::PointList points = getLocalPoints(v, x, pos.y());
192 192
193 if (points.empty()) { 193 if (points.empty()) {
194 if (!m_model->isReady()) { 194 if (!m_model->isReady()) {
195 return tr("In progress"); 195 return tr("In progress");
196 } else { 196 } else {
197 return ""; 197 return "";
198 } 198 }
199 } 199 }
200 200
201 sv_frame_t useFrame = points.begin()->frame; 201 sv_frame_t useFrame = points.begin()->frame;
202 202
203 RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate()); 203 RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate());
204 204
205 QString text; 205 QString text;
206 206
207 if (points.begin()->label == "") { 207 if (points.begin()->label == "") {
208 text = QString(tr("Time:\t%1\nHeight:\t%2\nLabel:\t%3")) 208 text = QString(tr("Time:\t%1\nHeight:\t%2\nLabel:\t%3"))
209 .arg(rt.toText(true).c_str()) 209 .arg(rt.toText(true).c_str())
210 .arg(points.begin()->height) 210 .arg(points.begin()->height)
211 .arg(points.begin()->label); 211 .arg(points.begin()->label);
212 } 212 }
213 213
214 pos = QPoint(v->getXForFrame(useFrame), 214 pos = QPoint(v->getXForFrame(useFrame),
215 getYForHeight(v, points.begin()->height)); 215 getYForHeight(v, points.begin()->height));
216 return text; 216 return text;
217 } 217 }
218 218
219 219
220 //!!! too much overlap with TimeValueLayer/TimeInstantLayer 220 //!!! too much overlap with TimeValueLayer/TimeInstantLayer
221 221
222 bool 222 bool
223 TextLayer::snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, 223 TextLayer::snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame,
224 int &resolution, 224 int &resolution,
225 SnapType snap) const 225 SnapType snap) const
226 { 226 {
227 if (!m_model) { 227 if (!m_model) {
228 return Layer::snapToFeatureFrame(v, frame, resolution, snap); 228 return Layer::snapToFeatureFrame(v, frame, resolution, snap);
229 } 229 }
230 230
231 resolution = m_model->getResolution(); 231 resolution = m_model->getResolution();
232 TextModel::PointList points; 232 TextModel::PointList points;
233 233
234 if (snap == SnapNeighbouring) { 234 if (snap == SnapNeighbouring) {
235 235
236 points = getLocalPoints(v, v->getXForFrame(frame), -1); 236 points = getLocalPoints(v, v->getXForFrame(frame), -1);
237 if (points.empty()) return false; 237 if (points.empty()) return false;
238 frame = points.begin()->frame; 238 frame = points.begin()->frame;
239 return true; 239 return true;
240 } 240 }
241 241
242 points = m_model->getPoints(frame, frame); 242 points = m_model->getPoints(frame, frame);
243 sv_frame_t snapped = frame; 243 sv_frame_t snapped = frame;
244 bool found = false; 244 bool found = false;
245 245
246 for (TextModel::PointList::const_iterator i = points.begin(); 246 for (TextModel::PointList::const_iterator i = points.begin();
247 i != points.end(); ++i) { 247 i != points.end(); ++i) {
248 248
249 if (snap == SnapRight) { 249 if (snap == SnapRight) {
250 250
251 if (i->frame > frame) { 251 if (i->frame > frame) {
252 snapped = i->frame; 252 snapped = i->frame;
253 found = true; 253 found = true;
254 break; 254 break;
255 } 255 }
256 256
257 } else if (snap == SnapLeft) { 257 } else if (snap == SnapLeft) {
258 258
259 if (i->frame <= frame) { 259 if (i->frame <= frame) {
260 snapped = i->frame; 260 snapped = i->frame;
261 found = true; // don't break, as the next may be better 261 found = true; // don't break, as the next may be better
262 } else { 262 } else {
263 break; 263 break;
264 } 264 }
265 265
266 } else { // nearest 266 } else { // nearest
267 267
268 TextModel::PointList::const_iterator j = i; 268 TextModel::PointList::const_iterator j = i;
269 ++j; 269 ++j;
270 270
271 if (j == points.end()) { 271 if (j == points.end()) {
272 272
273 snapped = i->frame; 273 snapped = i->frame;
274 found = true; 274 found = true;
275 break; 275 break;
276 276
277 } else if (j->frame >= frame) { 277 } else if (j->frame >= frame) {
278 278
279 if (j->frame - frame < frame - i->frame) { 279 if (j->frame - frame < frame - i->frame) {
280 snapped = j->frame; 280 snapped = j->frame;
281 } else { 281 } else {
282 snapped = i->frame; 282 snapped = i->frame;
283 } 283 }
284 found = true; 284 found = true;
285 break; 285 break;
286 } 286 }
287 } 287 }
288 } 288 }
289 289
290 frame = snapped; 290 frame = snapped;
291 return found; 291 return found;
292 } 292 }
330 330
331 QColor penColour; 331 QColor penColour;
332 penColour = v->getForeground(); 332 penColour = v->getForeground();
333 333
334 // SVDEBUG << "TextLayer::paint: resolution is " 334 // SVDEBUG << "TextLayer::paint: resolution is "
335 // << m_model->getResolution() << " frames" << endl; 335 // << m_model->getResolution() << " frames" << endl;
336 336
337 QPoint localPos; 337 QPoint localPos;
338 TextModel::Point illuminatePoint(0); 338 TextModel::Point illuminatePoint(0);
339 bool shouldIlluminate = false; 339 bool shouldIlluminate = false;
340 340
348 348
349 paint.save(); 349 paint.save();
350 paint.setClipRect(rect.x(), 0, rect.width() + boxMaxWidth, v->getPaintHeight()); 350 paint.setClipRect(rect.x(), 0, rect.width() + boxMaxWidth, v->getPaintHeight());
351 351
352 for (TextModel::PointList::const_iterator i = points.begin(); 352 for (TextModel::PointList::const_iterator i = points.begin();
353 i != points.end(); ++i) { 353 i != points.end(); ++i) {
354 354
355 const TextModel::Point &p(*i); 355 const TextModel::Point &p(*i);
356 356
357 int x = v->getXForFrame(p.frame); 357 int x = v->getXForFrame(p.frame);
358 int y = getYForHeight(v, p.height); 358 int y = getYForHeight(v, p.height);
359 359
360 if (!shouldIlluminate || 360 if (!shouldIlluminate ||
361 // "illuminatePoint != p" 361 // "illuminatePoint != p"
362 TextModel::Point::Comparator()(illuminatePoint, p) || 362 TextModel::Point::Comparator()(illuminatePoint, p) ||
363 TextModel::Point::Comparator()(p, illuminatePoint)) { 363 TextModel::Point::Comparator()(p, illuminatePoint)) {
364 paint.setPen(penColour); 364 paint.setPen(penColour);
365 paint.setBrush(brushColour); 365 paint.setBrush(brushColour);
366 } else { 366 } else {
367 paint.setBrush(penColour); 367 paint.setBrush(penColour);
368 paint.setPen(v->getBackground()); 368 paint.setPen(v->getBackground());
369 } 369 }
370 370
371 QString label = p.label; 371 QString label = p.label;
372 if (label == "") { 372 if (label == "") {
373 label = tr("<no text>"); 373 label = tr("<no text>");
374 } 374 }
375 375
376 QRect boxRect = paint.fontMetrics().boundingRect 376 QRect boxRect = paint.fontMetrics().boundingRect
377 (QRect(0, 0, boxMaxWidth, boxMaxHeight), 377 (QRect(0, 0, boxMaxWidth, boxMaxHeight),
378 Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, label); 378 Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, label);
379 379
380 QRect textRect = QRect(3, 2, boxRect.width(), boxRect.height()); 380 QRect textRect = QRect(3, 2, boxRect.width(), boxRect.height());
381 boxRect = QRect(0, 0, boxRect.width() + 6, boxRect.height() + 2); 381 boxRect = QRect(0, 0, boxRect.width() + 6, boxRect.height() + 2);
382 382
383 if (y + boxRect.height() > v->getPaintHeight()) { 383 if (y + boxRect.height() > v->getPaintHeight()) {
384 if (boxRect.height() > v->getPaintHeight()) y = 0; 384 if (boxRect.height() > v->getPaintHeight()) y = 0;
385 else y = v->getPaintHeight() - boxRect.height() - 1; 385 else y = v->getPaintHeight() - boxRect.height() - 1;
386 } 386 }
387 387
388 boxRect = QRect(x, y, boxRect.width(), boxRect.height()); 388 boxRect = QRect(x, y, boxRect.width(), boxRect.height());
389 textRect = QRect(x + 3, y + 2, textRect.width(), textRect.height()); 389 textRect = QRect(x + 3, y + 2, textRect.width(), textRect.height());
390 390
391 // boxRect = QRect(x, y, boxRect.width(), boxRect.height()); 391 // boxRect = QRect(x, y, boxRect.width(), boxRect.height());
392 // textRect = QRect(x + 3, y + 2, textRect.width(), textRect.height()); 392 // textRect = QRect(x + 3, y + 2, textRect.width(), textRect.height());
393 393
394 paint.setRenderHint(QPainter::Antialiasing, false); 394 paint.setRenderHint(QPainter::Antialiasing, false);
395 paint.drawRect(boxRect); 395 paint.drawRect(boxRect);
396 396
397 paint.setRenderHint(QPainter::Antialiasing, true); 397 paint.setRenderHint(QPainter::Antialiasing, true);
398 paint.drawText(textRect, 398 paint.drawText(textRect,
399 Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, 399 Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap,
400 label); 400 label);
401 401
402 /// if (p.label != "") { 402 /// if (p.label != "") {
403 /// paint.drawText(x + 5, y - paint.fontMetrics().height() + paint.fontMetrics().ascent(), p.label); 403 /// paint.drawText(x + 5, y - paint.fontMetrics().height() + paint.fontMetrics().ascent(), p.label);
404 /// } 404 /// }
405 } 405 }
406 406
407 paint.restore(); 407 paint.restore();
408 408
409 // looks like save/restore doesn't deal with this: 409 // looks like save/restore doesn't deal with this:
414 TextLayer::drawStart(LayerGeometryProvider *v, QMouseEvent *e) 414 TextLayer::drawStart(LayerGeometryProvider *v, QMouseEvent *e)
415 { 415 {
416 // SVDEBUG << "TextLayer::drawStart(" << e->x() << "," << e->y() << ")" << endl; 416 // SVDEBUG << "TextLayer::drawStart(" << e->x() << "," << e->y() << ")" << endl;
417 417
418 if (!m_model) { 418 if (!m_model) {
419 SVDEBUG << "TextLayer::drawStart: no model" << endl; 419 SVDEBUG << "TextLayer::drawStart: no model" << endl;
420 return; 420 return;
421 } 421 }
422 422
423 sv_frame_t frame = v->getFrameForX(e->x()); 423 sv_frame_t frame = v->getFrameForX(e->x());
424 if (frame < 0) frame = 0; 424 if (frame < 0) frame = 0;
425 frame = frame / m_model->getResolution() * m_model->getResolution(); 425 frame = frame / m_model->getResolution() * m_model->getResolution();
461 // SVDEBUG << "TextLayer::drawEnd(" << e->x() << "," << e->y() << ")" << endl; 461 // SVDEBUG << "TextLayer::drawEnd(" << e->x() << "," << e->y() << ")" << endl;
462 if (!m_model || !m_editing) return; 462 if (!m_model || !m_editing) return;
463 463
464 bool ok = false; 464 bool ok = false;
465 QString label = QInputDialog::getText(v->getView(), tr("Enter label"), 465 QString label = QInputDialog::getText(v->getView(), tr("Enter label"),
466 tr("Please enter a new label:"), 466 tr("Please enter a new label:"),
467 QLineEdit::Normal, "", &ok); 467 QLineEdit::Normal, "", &ok);
468 468
469 if (ok) { 469 if (ok) {
470 TextModel::RelabelCommand *command = 470 TextModel::RelabelCommand *command =
471 new TextModel::RelabelCommand(m_model, m_editingPoint, label); 471 new TextModel::RelabelCommand(m_model, m_editingPoint, label);
472 m_editingCommand->addCommand(command); 472 m_editingCommand->addCommand(command);
473 } else { 473 } else {
474 m_editingCommand->deletePoint(m_editingPoint); 474 m_editingCommand->deletePoint(m_editingPoint);
475 } 475 }
476 476
477 finish(m_editingCommand); 477 finish(m_editingCommand);
485 if (!m_model) return; 485 if (!m_model) return;
486 486
487 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return; 487 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return;
488 488
489 if (m_editingCommand) { 489 if (m_editingCommand) {
490 finish(m_editingCommand); 490 finish(m_editingCommand);
491 m_editingCommand = 0; 491 m_editingCommand = 0;
492 } 492 }
493 493
494 m_editing = true; 494 m_editing = true;
495 } 495 }
496 496
533 533
534 m_editOrigin = e->pos(); 534 m_editOrigin = e->pos();
535 m_originalPoint = m_editingPoint; 535 m_originalPoint = m_editingPoint;
536 536
537 if (m_editingCommand) { 537 if (m_editingCommand) {
538 finish(m_editingCommand); 538 finish(m_editingCommand);
539 m_editingCommand = 0; 539 m_editingCommand = 0;
540 } 540 }
541 541
542 m_editing = true; 542 m_editing = true;
543 } 543 }
544 544
558 frame = (frame / m_model->getResolution()) * m_model->getResolution(); 558 frame = (frame / m_model->getResolution()) * m_model->getResolution();
559 559
560 // double height = getHeightForY(v, e->y()); 560 // double height = getHeightForY(v, e->y());
561 561
562 if (!m_editingCommand) { 562 if (!m_editingCommand) {
563 m_editingCommand = new TextModel::EditCommand(m_model, tr("Drag Label")); 563 m_editingCommand = new TextModel::EditCommand(m_model, tr("Drag Label"));
564 } 564 }
565 565
566 m_editingCommand->deletePoint(m_editingPoint); 566 m_editingCommand->deletePoint(m_editingPoint);
567 m_editingPoint.frame = frame; 567 m_editingPoint.frame = frame;
568 m_editingPoint.height = float(height); 568 m_editingPoint.height = float(height);
575 // SVDEBUG << "TextLayer::editEnd(" << e->x() << "," << e->y() << ")" << endl; 575 // SVDEBUG << "TextLayer::editEnd(" << e->x() << "," << e->y() << ")" << endl;
576 if (!m_model || !m_editing) return; 576 if (!m_model || !m_editing) return;
577 577
578 if (m_editingCommand) { 578 if (m_editingCommand) {
579 579
580 QString newName = m_editingCommand->getName(); 580 QString newName = m_editingCommand->getName();
581 581
582 if (m_editingPoint.frame != m_originalPoint.frame) { 582 if (m_editingPoint.frame != m_originalPoint.frame) {
583 if (m_editingPoint.height != m_originalPoint.height) { 583 if (m_editingPoint.height != m_originalPoint.height) {
584 newName = tr("Move Label"); 584 newName = tr("Move Label");
585 } else { 585 } else {
586 newName = tr("Move Label Horizontally"); 586 newName = tr("Move Label Horizontally");
587 } 587 }
588 } else { 588 } else {
589 newName = tr("Move Label Vertically"); 589 newName = tr("Move Label Vertically");
590 } 590 }
591 591
592 m_editingCommand->setName(newName); 592 m_editingCommand->setName(newName);
593 finish(m_editingCommand); 593 finish(m_editingCommand);
594 } 594 }
595 595
596 m_editingCommand = 0; 596 m_editingCommand = 0;
597 m_editing = false; 597 m_editing = false;
598 } 598 }
607 607
608 QString label = text.label; 608 QString label = text.label;
609 609
610 bool ok = false; 610 bool ok = false;
611 label = QInputDialog::getText(v->getView(), tr("Enter label"), 611 label = QInputDialog::getText(v->getView(), tr("Enter label"),
612 tr("Please enter a new label:"), 612 tr("Please enter a new label:"),
613 QLineEdit::Normal, label, &ok); 613 QLineEdit::Normal, label, &ok);
614 if (ok && label != text.label) { 614 if (ok && label != text.label) {
615 TextModel::RelabelCommand *command = 615 TextModel::RelabelCommand *command =
616 new TextModel::RelabelCommand(m_model, text, label); 616 new TextModel::RelabelCommand(m_model, text, label);
617 CommandHistory::getInstance()->addCommand(command); 617 CommandHistory::getInstance()->addCommand(command);
618 } 618 }
619 619
620 return true; 620 return true;
621 } 621 }
622 622
624 TextLayer::moveSelection(Selection s, sv_frame_t newStartFrame) 624 TextLayer::moveSelection(Selection s, sv_frame_t newStartFrame)
625 { 625 {
626 if (!m_model) return; 626 if (!m_model) return;
627 627
628 TextModel::EditCommand *command = 628 TextModel::EditCommand *command =
629 new TextModel::EditCommand(m_model, tr("Drag Selection")); 629 new TextModel::EditCommand(m_model, tr("Drag Selection"));
630 630
631 TextModel::PointList points = 631 TextModel::PointList points =
632 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); 632 m_model->getPoints(s.getStartFrame(), s.getEndFrame());
633 633
634 for (TextModel::PointList::iterator i = points.begin(); 634 for (TextModel::PointList::iterator i = points.begin();
635 i != points.end(); ++i) { 635 i != points.end(); ++i) {
636 636
637 if (s.contains(i->frame)) { 637 if (s.contains(i->frame)) {
638 TextModel::Point newPoint(*i); 638 TextModel::Point newPoint(*i);
639 newPoint.frame = i->frame + newStartFrame - s.getStartFrame(); 639 newPoint.frame = i->frame + newStartFrame - s.getStartFrame();
640 command->deletePoint(*i); 640 command->deletePoint(*i);
641 command->addPoint(newPoint); 641 command->addPoint(newPoint);
642 } 642 }
643 } 643 }
644 644
645 finish(command); 645 finish(command);
646 } 646 }
647 647
649 TextLayer::resizeSelection(Selection s, Selection newSize) 649 TextLayer::resizeSelection(Selection s, Selection newSize)
650 { 650 {
651 if (!m_model) return; 651 if (!m_model) return;
652 652
653 TextModel::EditCommand *command = 653 TextModel::EditCommand *command =
654 new TextModel::EditCommand(m_model, tr("Resize Selection")); 654 new TextModel::EditCommand(m_model, tr("Resize Selection"));
655 655
656 TextModel::PointList points = 656 TextModel::PointList points =
657 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); 657 m_model->getPoints(s.getStartFrame(), s.getEndFrame());
658 658
659 double ratio = 659 double ratio =
660 double(newSize.getEndFrame() - newSize.getStartFrame()) / 660 double(newSize.getEndFrame() - newSize.getStartFrame()) /
661 double(s.getEndFrame() - s.getStartFrame()); 661 double(s.getEndFrame() - s.getStartFrame());
662 662
663 for (TextModel::PointList::iterator i = points.begin(); 663 for (TextModel::PointList::iterator i = points.begin();
664 i != points.end(); ++i) { 664 i != points.end(); ++i) {
665 665
666 if (s.contains(i->frame)) { 666 if (s.contains(i->frame)) {
667 667
668 double target = double(i->frame); 668 double target = double(i->frame);
669 target = double(newSize.getStartFrame()) + 669 target = double(newSize.getStartFrame()) +
670 target - double(s.getStartFrame()) * ratio; 670 target - double(s.getStartFrame()) * ratio;
671 671
672 TextModel::Point newPoint(*i); 672 TextModel::Point newPoint(*i);
673 newPoint.frame = lrint(target); 673 newPoint.frame = lrint(target);
674 command->deletePoint(*i); 674 command->deletePoint(*i);
675 command->addPoint(newPoint); 675 command->addPoint(newPoint);
676 } 676 }
677 } 677 }
678 678
679 finish(command); 679 finish(command);
680 } 680 }
681 681
683 TextLayer::deleteSelection(Selection s) 683 TextLayer::deleteSelection(Selection s)
684 { 684 {
685 if (!m_model) return; 685 if (!m_model) return;
686 686
687 TextModel::EditCommand *command = 687 TextModel::EditCommand *command =
688 new TextModel::EditCommand(m_model, tr("Delete Selection")); 688 new TextModel::EditCommand(m_model, tr("Delete Selection"));
689 689
690 TextModel::PointList points = 690 TextModel::PointList points =
691 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); 691 m_model->getPoints(s.getStartFrame(), s.getEndFrame());
692 692
693 for (TextModel::PointList::iterator i = points.begin(); 693 for (TextModel::PointList::iterator i = points.begin();
694 i != points.end(); ++i) { 694 i != points.end(); ++i) {
695 if (s.contains(i->frame)) command->deletePoint(*i); 695 if (s.contains(i->frame)) command->deletePoint(*i);
696 } 696 }
697 697
698 finish(command); 698 finish(command);
699 } 699 }
700 700
702 TextLayer::copy(LayerGeometryProvider *v, Selection s, Clipboard &to) 702 TextLayer::copy(LayerGeometryProvider *v, Selection s, Clipboard &to)
703 { 703 {
704 if (!m_model) return; 704 if (!m_model) return;
705 705
706 TextModel::PointList points = 706 TextModel::PointList points =
707 m_model->getPoints(s.getStartFrame(), s.getEndFrame()); 707 m_model->getPoints(s.getStartFrame(), s.getEndFrame());
708 708
709 for (TextModel::PointList::iterator i = points.begin(); 709 for (TextModel::PointList::iterator i = points.begin();
710 i != points.end(); ++i) { 710 i != points.end(); ++i) {
711 if (s.contains(i->frame)) { 711 if (s.contains(i->frame)) {
712 Clipboard::Point point(i->frame, i->height, i->label); 712 Clipboard::Point point(i->frame, i->height, i->label);
713 point.setReferenceFrame(alignToReference(v, i->frame)); 713 point.setReferenceFrame(alignToReference(v, i->frame));
714 to.addPoint(point); 714 to.addPoint(point);
715 } 715 }
716 } 716 }
741 realign = true; 741 realign = true;
742 } 742 }
743 } 743 }
744 744
745 TextModel::EditCommand *command = 745 TextModel::EditCommand *command =
746 new TextModel::EditCommand(m_model, tr("Paste")); 746 new TextModel::EditCommand(m_model, tr("Paste"));
747 747
748 double valueMin = 0.0, valueMax = 1.0; 748 double valueMin = 0.0, valueMax = 1.0;
749 for (Clipboard::PointList::const_iterator i = points.begin(); 749 for (Clipboard::PointList::const_iterator i = points.begin();
750 i != points.end(); ++i) { 750 i != points.end(); ++i) {
751 if (i->haveValue()) { 751 if (i->haveValue()) {