comparison layer/TimeValueLayer.cpp @ 70:bf306158803d

* Add stub for item-edit dialog (for editing properties of an item on double- click) -- doesn't actually do anything yet * Add code to invoke said non-working item-edit dialog on double-click in time-value, time-instants and note layers * Add overlay mode (no text, basic text, all text)
author Chris Cannam
date Thu, 30 Mar 2006 15:00:22 +0000
parents 193b569a975f
children ad1fe715b480
comparison
equal deleted inserted replaced
69:6dad2724f3aa 70:bf306158803d
19 #include "base/RealTime.h" 19 #include "base/RealTime.h"
20 #include "base/Profiler.h" 20 #include "base/Profiler.h"
21 #include "base/View.h" 21 #include "base/View.h"
22 22
23 #include "model/SparseTimeValueModel.h" 23 #include "model/SparseTimeValueModel.h"
24
25 #include "widgets/ItemEditDialog.h"
24 26
25 #include "SpectrogramLayer.h" // for optional frequency alignment 27 #include "SpectrogramLayer.h" // for optional frequency alignment
26 28
27 #include <QPainter> 29 #include <QPainter>
28 #include <QPainterPath> 30 #include <QPainterPath>
843 m_editingCommand = 0; 845 m_editingCommand = 0;
844 m_editing = false; 846 m_editing = false;
845 } 847 }
846 848
847 void 849 void
850 TimeValueLayer::editOpen(View *v, QMouseEvent *e)
851 {
852 if (!m_model) return;
853
854 SparseTimeValueModel::PointList points = getLocalPoints(v, e->x());
855 if (points.empty()) return;
856
857 SparseTimeValueModel::Point point = *points.begin();
858
859 ItemEditDialog *dialog = new ItemEditDialog
860 (m_model->getSampleRate(),
861 ItemEditDialog::ShowTime |
862 ItemEditDialog::ShowValue |
863 ItemEditDialog::ShowText);
864
865 dialog->setFrameTime(point.frame);
866 dialog->setValue(point.value);
867 dialog->setText(point.label);
868
869 if (dialog->exec() == QDialog::Accepted) {
870
871 SparseTimeValueModel::Point newPoint = point;
872 newPoint.frame = dialog->getFrameTime();
873 newPoint.value = dialog->getValue();
874 newPoint.label = dialog->getText();
875
876 SparseTimeValueModel::EditCommand *command =
877 new SparseTimeValueModel::EditCommand(m_model, tr("Edit Point"));
878 command->deletePoint(point);
879 command->addPoint(newPoint);
880 command->finish();
881 }
882
883 delete dialog;
884 }
885
886 void
848 TimeValueLayer::moveSelection(Selection s, size_t newStartFrame) 887 TimeValueLayer::moveSelection(Selection s, size_t newStartFrame)
849 { 888 {
850 SparseTimeValueModel::EditCommand *command = 889 SparseTimeValueModel::EditCommand *command =
851 new SparseTimeValueModel::EditCommand(m_model, 890 new SparseTimeValueModel::EditCommand(m_model,
852 tr("Drag Selection")); 891 tr("Drag Selection"));