comparison layer/TextLayer.cpp @ 1417:2487521e857b

Merge
author Chris Cannam
date Wed, 23 Jan 2019 14:44:16 +0000
parents c8a6fd3f9dff
children 62e908518c71
comparison
equal deleted inserted replaced
1416:d794630429a7 1417:2487521e857b
32 #include <iostream> 32 #include <iostream>
33 #include <cmath> 33 #include <cmath>
34 34
35 TextLayer::TextLayer() : 35 TextLayer::TextLayer() :
36 SingleColourLayer(), 36 SingleColourLayer(),
37 m_model(0), 37 m_model(nullptr),
38 m_editing(false), 38 m_editing(false),
39 m_originalPoint(0, 0.0, tr("Empty Label")), 39 m_originalPoint(0, 0.0, tr("Empty Label")),
40 m_editingPoint(0, 0.0, tr("Empty Label")), 40 m_editingPoint(0, 0.0, tr("Empty Label")),
41 m_editingCommand(0) 41 m_editingCommand(nullptr)
42 { 42 {
43 43
44 } 44 }
45 45
46 void 46 void
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);
478 m_editingCommand = 0; 478 m_editingCommand = nullptr;
479 m_editing = false; 479 m_editing = false;
480 } 480 }
481 481
482 void 482 void
483 TextLayer::eraseStart(LayerGeometryProvider *v, QMouseEvent *e) 483 TextLayer::eraseStart(LayerGeometryProvider *v, QMouseEvent *e)
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 = nullptr;
492 } 492 }
493 493
494 m_editing = true; 494 m_editing = true;
495 } 495 }
496 496
514 (m_model, tr("Erase Point")); 514 (m_model, tr("Erase Point"));
515 515
516 m_editingCommand->deletePoint(m_editingPoint); 516 m_editingCommand->deletePoint(m_editingPoint);
517 517
518 finish(m_editingCommand); 518 finish(m_editingCommand);
519 m_editingCommand = 0; 519 m_editingCommand = nullptr;
520 m_editing = false; 520 m_editing = false;
521 } 521 }
522 522
523 void 523 void
524 TextLayer::editStart(LayerGeometryProvider *v, QMouseEvent *e) 524 TextLayer::editStart(LayerGeometryProvider *v, QMouseEvent *e)
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 = nullptr;
540 } 540 }
541 541
542 m_editing = true; 542 m_editing = true;
543 } 543 }
544 544
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 = nullptr;
597 m_editing = false; 597 m_editing = false;
598 } 598 }
599 599
600 bool 600 bool
601 TextLayer::editOpen(LayerGeometryProvider *v, QMouseEvent *e) 601 TextLayer::editOpen(LayerGeometryProvider *v, QMouseEvent *e)