comparison layer/TextLayer.cpp @ 1051:c02c51ae5238 3.0-plus-imaf

Merge branches 3.0-integration and imaf_enc to 3.0-plus-imaf
author Chris Cannam
date Wed, 20 Apr 2016 12:06:28 +0100
parents 4fe7a09be0fe 3437e0fad7ae
children
comparison
equal deleted inserted replaced
1050:3691af49291c 1051:c02c51ae5238
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
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
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);
451 451
452 m_editingCommand->deletePoint(m_editingPoint); 452 m_editingCommand->deletePoint(m_editingPoint);
453 m_editingPoint.frame = frame; 453 m_editingPoint.frame = frame;
454 m_editingPoint.height = float(height); 454 m_editingPoint.height = float(height);
455 m_editingCommand->addPoint(m_editingPoint); 455 m_editingCommand->addPoint(m_editingPoint);
456
457
456 } 458 }
457 459
458 void 460 void
459 TextLayer::drawEnd(LayerGeometryProvider *v, QMouseEvent *) 461 TextLayer::drawEnd(LayerGeometryProvider *v, QMouseEvent *)
460 { 462 {