annotate widgets/Pane.cpp @ 120:8dfa20f1c70a

* some work on scaling and zooming for spectrogram
author Chris Cannam
date Wed, 19 Jul 2006 16:55:29 +0000
parents 0f36cdf407a6
children 71992cee2ece
rev   line source
Chris@58 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@59 4 Sonic Visualiser
Chris@59 5 An audio file viewer and annotation editor.
Chris@59 6 Centre for Digital Music, Queen Mary, University of London.
Chris@59 7 This file copyright 2006 Chris Cannam.
Chris@0 8
Chris@59 9 This program is free software; you can redistribute it and/or
Chris@59 10 modify it under the terms of the GNU General Public License as
Chris@59 11 published by the Free Software Foundation; either version 2 of the
Chris@59 12 License, or (at your option) any later version. See the file
Chris@59 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@0 16 #include "widgets/Pane.h"
Chris@0 17 #include "base/Layer.h"
Chris@0 18 #include "base/Model.h"
Chris@0 19 #include "base/ZoomConstraint.h"
Chris@0 20 #include "base/RealTime.h"
Chris@0 21 #include "base/Profiler.h"
Chris@13 22 #include "base/ViewManager.h"
Chris@99 23 #include "base/CommandHistory.h"
Chris@41 24 #include "layer/WaveformLayer.h"
Chris@0 25
Chris@0 26 #include <QPaintEvent>
Chris@0 27 #include <QPainter>
Chris@0 28 #include <iostream>
Chris@0 29 #include <cmath>
Chris@0 30
Chris@0 31 using std::cerr;
Chris@0 32 using std::endl;
Chris@0 33
Chris@0 34 Pane::Pane(QWidget *w) :
Chris@0 35 View(w, true),
Chris@0 36 m_identifyFeatures(false),
Chris@0 37 m_clickedInRange(false),
Chris@0 38 m_shiftPressed(false),
Chris@13 39 m_ctrlPressed(false),
Chris@17 40 m_navigating(false),
Chris@17 41 m_resizing(false),
Chris@0 42 m_centreLineVisible(true)
Chris@0 43 {
Chris@0 44 setObjectName("Pane");
Chris@0 45 setMouseTracking(true);
Chris@0 46 }
Chris@0 47
Chris@0 48 bool
Chris@44 49 Pane::shouldIlluminateLocalFeatures(const Layer *layer, QPoint &pos) const
Chris@0 50 {
Chris@42 51 QPoint discard;
Chris@42 52 bool b0, b1;
Chris@42 53
Chris@42 54 if (layer == getSelectedLayer() &&
Chris@42 55 !shouldIlluminateLocalSelection(discard, b0, b1)) {
Chris@42 56
Chris@27 57 pos = m_identifyPoint;
Chris@27 58 return m_identifyFeatures;
Chris@27 59 }
Chris@0 60
Chris@0 61 return false;
Chris@0 62 }
Chris@0 63
Chris@42 64 bool
Chris@42 65 Pane::shouldIlluminateLocalSelection(QPoint &pos,
Chris@42 66 bool &closeToLeft,
Chris@44 67 bool &closeToRight) const
Chris@42 68 {
Chris@42 69 if (m_identifyFeatures &&
Chris@42 70 m_manager &&
Chris@42 71 m_manager->getToolMode() == ViewManager::EditMode &&
Chris@42 72 !m_manager->getSelections().empty() &&
Chris@42 73 !selectionIsBeingEdited()) {
Chris@42 74
Chris@42 75 Selection s(getSelectionAt(m_identifyPoint.x(),
Chris@42 76 closeToLeft, closeToRight));
Chris@42 77
Chris@42 78 if (!s.isEmpty()) {
Chris@42 79 if (getSelectedLayer() && getSelectedLayer()->isLayerEditable()) {
Chris@42 80
Chris@42 81 pos = m_identifyPoint;
Chris@42 82 return true;
Chris@42 83 }
Chris@42 84 }
Chris@42 85 }
Chris@42 86
Chris@42 87 return false;
Chris@42 88 }
Chris@42 89
Chris@42 90 bool
Chris@42 91 Pane::selectionIsBeingEdited() const
Chris@42 92 {
Chris@42 93 if (!m_editingSelection.isEmpty()) {
Chris@42 94 if (m_mousePos != m_clickPos &&
Chris@42 95 getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) {
Chris@42 96 return true;
Chris@42 97 }
Chris@42 98 }
Chris@42 99 return false;
Chris@42 100 }
Chris@42 101
Chris@0 102 void
Chris@0 103 Pane::setCentreLineVisible(bool visible)
Chris@0 104 {
Chris@0 105 m_centreLineVisible = visible;
Chris@0 106 update();
Chris@0 107 }
Chris@0 108
Chris@0 109 void
Chris@0 110 Pane::paintEvent(QPaintEvent *e)
Chris@0 111 {
Chris@0 112 QPainter paint;
Chris@0 113
Chris@0 114 QRect r(rect());
Chris@0 115
Chris@0 116 if (e) {
Chris@0 117 r = e->rect();
Chris@0 118 }
Chris@0 119 /*
Chris@0 120 paint.begin(this);
Chris@0 121 paint.setClipRect(r);
Chris@0 122
Chris@0 123 if (hasLightBackground()) {
Chris@0 124 paint.setPen(Qt::white);
Chris@0 125 paint.setBrush(Qt::white);
Chris@0 126 } else {
Chris@0 127 paint.setPen(Qt::black);
Chris@0 128 paint.setBrush(Qt::black);
Chris@0 129 }
Chris@0 130 paint.drawRect(r);
Chris@0 131
Chris@0 132 paint.end();
Chris@0 133 */
Chris@0 134 View::paintEvent(e);
Chris@0 135
Chris@0 136 paint.begin(this);
Chris@0 137
Chris@0 138 if (e) {
Chris@0 139 paint.setClipRect(r);
Chris@0 140 }
Chris@41 141
Chris@41 142 const Model *waveformModel = 0; // just for reporting purposes
Chris@51 143 int verticalScaleWidth = 0;
Chris@41 144
Chris@55 145 int fontHeight = paint.fontMetrics().height();
Chris@55 146 int fontAscent = paint.fontMetrics().ascent();
Chris@55 147
Chris@99 148 if (m_manager &&
Chris@99 149 !m_manager->isPlaying() &&
Chris@99 150 m_manager->getToolMode() == ViewManager::SelectMode) {
Chris@0 151
Chris@99 152 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) {
Chris@99 153 --vi;
Chris@41 154
Chris@77 155 std::vector<QRect> crosshairExtents;
Chris@77 156
Chris@77 157 if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint,
Chris@77 158 crosshairExtents)) {
Chris@77 159 (*vi)->paintCrosshairs(this, paint, m_identifyPoint);
Chris@99 160 break;
Chris@99 161 } else if ((*vi)->isLayerOpaque()) {
Chris@99 162 break;
Chris@70 163 }
Chris@77 164 }
Chris@99 165 }
Chris@99 166
Chris@99 167 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) {
Chris@99 168 --vi;
Chris@99 169
Chris@99 170 if (dynamic_cast<WaveformLayer *>(*vi)) {
Chris@99 171 waveformModel = (*vi)->getModel();
Chris@99 172 }
Chris@0 173
Chris@77 174 if (!m_manager ||
Chris@77 175 m_manager->getOverlayMode() == ViewManager::NoOverlays) {
Chris@77 176 break;
Chris@77 177 }
Chris@70 178
Chris@77 179 verticalScaleWidth = (*vi)->getVerticalScaleWidth(this, paint);
Chris@77 180
Chris@77 181 if (verticalScaleWidth > 0 && r.left() < verticalScaleWidth) {
Chris@0 182
Chris@0 183 // Profiler profiler("Pane::paintEvent - painting vertical scale", true);
Chris@0 184
Chris@0 185 // std::cerr << "Pane::paintEvent: calling paint.save() in vertical scale block" << std::endl;
Chris@77 186 paint.save();
Chris@77 187
Chris@77 188 paint.setPen(Qt::black);
Chris@77 189 paint.setBrush(Qt::white);
Chris@77 190 paint.drawRect(0, -1, verticalScaleWidth, height()+1);
Chris@77 191
Chris@77 192 paint.setBrush(Qt::NoBrush);
Chris@77 193 (*vi)->paintVerticalScale
Chris@77 194 (this, paint, QRect(0, 0, verticalScaleWidth, height()));
Chris@77 195
Chris@77 196 paint.restore();
Chris@77 197 }
Chris@77 198
Chris@77 199 if (m_identifyFeatures) {
Chris@77 200
Chris@77 201 QPoint pos = m_identifyPoint;
Chris@77 202 QString desc = (*vi)->getFeatureDescription(this, pos);
Chris@77 203
Chris@77 204 if (desc != "") {
Chris@77 205
Chris@70 206 paint.save();
Chris@77 207
Chris@77 208 int tabStop =
Chris@77 209 paint.fontMetrics().width(tr("Some lengthy prefix:"));
Chris@77 210
Chris@77 211 QRect boundingRect =
Chris@77 212 paint.fontMetrics().boundingRect
Chris@77 213 (rect(),
Chris@77 214 Qt::AlignRight | Qt::AlignTop | Qt::TextExpandTabs,
Chris@77 215 desc, tabStop);
Chris@0 216
Chris@77 217 if (hasLightBackground()) {
Chris@77 218 paint.setPen(Qt::NoPen);
Chris@77 219 paint.setBrush(QColor(250, 250, 250, 200));
Chris@77 220 } else {
Chris@77 221 paint.setPen(Qt::NoPen);
Chris@77 222 paint.setBrush(QColor(50, 50, 50, 200));
Chris@77 223 }
Chris@0 224
Chris@77 225 int extra = paint.fontMetrics().descent();
Chris@77 226 paint.drawRect(width() - boundingRect.width() - 10 - extra,
Chris@77 227 10 - extra,
Chris@77 228 boundingRect.width() + 2 * extra,
Chris@77 229 boundingRect.height() + extra);
Chris@77 230
Chris@77 231 if (hasLightBackground()) {
Chris@77 232 paint.setPen(QColor(150, 20, 0));
Chris@77 233 } else {
Chris@77 234 paint.setPen(QColor(255, 150, 100));
Chris@77 235 }
Chris@77 236
Chris@77 237 QTextOption option;
Chris@77 238 option.setWrapMode(QTextOption::NoWrap);
Chris@77 239 option.setAlignment(Qt::AlignRight | Qt::AlignTop);
Chris@77 240 option.setTabStop(tabStop);
Chris@77 241 paint.drawText(QRectF(width() - boundingRect.width() - 10, 10,
Chris@77 242 boundingRect.width(),
Chris@77 243 boundingRect.height()),
Chris@77 244 desc,
Chris@77 245 option);
Chris@0 246
Chris@70 247 paint.restore();
Chris@70 248 }
Chris@77 249 }
Chris@25 250
Chris@77 251 break;
Chris@0 252 }
Chris@0 253
Chris@55 254 int sampleRate = getModelsSampleRate();
Chris@55 255 paint.setBrush(Qt::NoBrush);
Chris@55 256
Chris@0 257 if (m_centreLineVisible) {
Chris@0 258
Chris@0 259 if (hasLightBackground()) {
Chris@0 260 paint.setPen(QColor(50, 50, 50));
Chris@0 261 } else {
Chris@0 262 paint.setPen(QColor(200, 200, 200));
Chris@0 263 }
Chris@0 264 paint.drawLine(width() / 2, 0, width() / 2, height() - 1);
Chris@0 265
Chris@55 266 paint.setPen(QColor(50, 50, 50));
Chris@55 267
Chris@55 268 int y = height() - fontHeight
Chris@55 269 + fontAscent - 6;
Chris@0 270
Chris@0 271 LayerList::iterator vi = m_layers.end();
Chris@0 272
Chris@0 273 if (vi != m_layers.begin()) {
Chris@0 274
Chris@0 275 switch ((*--vi)->getPreferredFrameCountPosition()) {
Chris@0 276
Chris@0 277 case Layer::PositionTop:
Chris@55 278 y = fontAscent + 6;
Chris@0 279 break;
Chris@0 280
Chris@0 281 case Layer::PositionMiddle:
Chris@55 282 y = (height() - fontHeight) / 2
Chris@55 283 + fontAscent;
Chris@0 284 break;
Chris@0 285
Chris@0 286 case Layer::PositionBottom:
Chris@0 287 // y already set correctly
Chris@0 288 break;
Chris@0 289 }
Chris@0 290 }
Chris@0 291
Chris@70 292 if (m_manager &&
Chris@70 293 m_manager->getOverlayMode() != ViewManager::NoOverlays) {
Chris@0 294
Chris@70 295 if (sampleRate) {
Chris@0 296
Chris@70 297 QString text(QString::fromStdString
Chris@70 298 (RealTime::frame2RealTime
Chris@70 299 (m_centreFrame, sampleRate).toText(true)));
Chris@70 300
Chris@70 301 int tw = paint.fontMetrics().width(text);
Chris@70 302 int x = width()/2 - 4 - tw;
Chris@70 303
Chris@70 304 drawVisibleText(paint, x, y, text, OutlinedText);
Chris@70 305 }
Chris@70 306
Chris@70 307 QString text = QString("%1").arg(m_centreFrame);
Chris@70 308
Chris@70 309 int tw = paint.fontMetrics().width(text);
Chris@70 310 int x = width()/2 + 4;
Chris@70 311
Chris@70 312 drawVisibleText(paint, x, y, text, OutlinedText);
Chris@70 313 }
Chris@55 314
Chris@55 315 } else {
Chris@55 316
Chris@55 317 paint.setPen(QColor(50, 50, 50));
Chris@55 318 }
Chris@55 319
Chris@55 320 if (waveformModel &&
Chris@70 321 m_manager &&
Chris@70 322 m_manager->getOverlayMode() != ViewManager::NoOverlays &&
Chris@55 323 r.y() + r.height() >= height() - fontHeight - 6) {
Chris@55 324
Chris@55 325 size_t mainModelRate = m_manager->getMainModelSampleRate();
Chris@55 326 size_t playbackRate = m_manager->getPlaybackSampleRate();
Chris@55 327
Chris@55 328 QString srNote = "";
Chris@55 329
Chris@55 330 // Show (R) for waveform models that will be resampled on
Chris@55 331 // playback, and (X) for waveform models that will be played
Chris@55 332 // at the wrong rate because their rate differs from that of
Chris@55 333 // the main model.
Chris@55 334
Chris@55 335 if (sampleRate == mainModelRate) {
Chris@55 336 if (sampleRate != playbackRate) srNote = " " + tr("(R)");
Chris@0 337 } else {
Chris@55 338 std::cerr << "Sample rate = " << sampleRate << ", main model rate = " << mainModelRate << std::endl;
Chris@55 339 srNote = " " + tr("(X)");
Chris@0 340 }
Chris@41 341
Chris@55 342 QString desc = tr("%1 / %2Hz%3")
Chris@55 343 .arg(RealTime::frame2RealTime(waveformModel->getEndFrame(),
Chris@55 344 sampleRate)
Chris@55 345 .toText(false).c_str())
Chris@55 346 .arg(sampleRate)
Chris@55 347 .arg(srNote);
Chris@49 348
Chris@55 349 if (r.x() < verticalScaleWidth + 5 + paint.fontMetrics().width(desc)) {
Chris@55 350 drawVisibleText(paint, verticalScaleWidth + 5,
Chris@55 351 height() - fontHeight + fontAscent - 6,
Chris@55 352 desc, OutlinedText);
Chris@55 353 }
Chris@55 354 }
Chris@50 355
Chris@70 356 if (m_manager &&
Chris@70 357 m_manager->getOverlayMode() == ViewManager::AllOverlays &&
Chris@70 358 r.y() + r.height() >= height() - m_layers.size() * fontHeight - 6) {
Chris@51 359
Chris@51 360 std::vector<QString> texts;
Chris@51 361 int maxTextWidth = 0;
Chris@51 362
Chris@51 363 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
Chris@51 364
Chris@56 365 QString text = (*i)->getLayerPresentationName();
Chris@51 366 int tw = paint.fontMetrics().width(text);
Chris@61 367 bool reduced = false;
Chris@61 368 while (tw > width() / 3 && text.length() > 4) {
Chris@61 369 if (!reduced && text.length() > 8) {
Chris@61 370 text = text.left(text.length() - 4);
Chris@61 371 } else {
Chris@61 372 text = text.left(text.length() - 2);
Chris@61 373 }
Chris@61 374 reduced = true;
Chris@61 375 tw = paint.fontMetrics().width(text + "...");
Chris@61 376 }
Chris@61 377 if (reduced) {
Chris@61 378 texts.push_back(text + "...");
Chris@61 379 } else {
Chris@61 380 texts.push_back(text);
Chris@61 381 }
Chris@51 382 if (tw > maxTextWidth) maxTextWidth = tw;
Chris@51 383 }
Chris@55 384
Chris@51 385 int lly = height() - 6;
Chris@51 386
Chris@55 387 if (r.x() + r.width() >= width() - maxTextWidth - 5) {
Chris@55 388
Chris@55 389 for (int i = 0; i < texts.size(); ++i) {
Chris@51 390
Chris@55 391 if (i == texts.size() - 1) {
Chris@51 392 paint.setPen(Qt::black);
Chris@51 393 }
Chris@55 394
Chris@55 395 drawVisibleText(paint, width() - maxTextWidth - 5,
Chris@55 396 lly - fontHeight + fontAscent,
Chris@55 397 texts[i], OutlinedText);
Chris@55 398
Chris@55 399 lly -= fontHeight;
Chris@51 400 }
Chris@51 401 }
Chris@0 402 }
Chris@0 403
Chris@0 404 if (m_clickedInRange && m_shiftPressed) {
Chris@19 405 if (m_manager && (m_manager->getToolMode() == ViewManager::NavigateMode)) {
Chris@19 406 //!!! be nice if this looked a bit more in keeping with the
Chris@19 407 //selection block
Chris@19 408 paint.setPen(Qt::blue);
Chris@19 409 paint.drawRect(m_clickPos.x(), m_clickPos.y(),
Chris@19 410 m_mousePos.x() - m_clickPos.x(),
Chris@19 411 m_mousePos.y() - m_clickPos.y());
Chris@19 412 }
Chris@0 413 }
Chris@0 414
Chris@42 415 if (selectionIsBeingEdited()) {
Chris@42 416
Chris@42 417 int offset = m_mousePos.x() - m_clickPos.x();
Chris@42 418 int p0 = getXForFrame(m_editingSelection.getStartFrame()) + offset;
Chris@42 419 int p1 = getXForFrame(m_editingSelection.getEndFrame()) + offset;
Chris@42 420
Chris@42 421 if (m_editingSelectionEdge < 0) {
Chris@42 422 p1 = getXForFrame(m_editingSelection.getEndFrame());
Chris@42 423 } else if (m_editingSelectionEdge > 0) {
Chris@42 424 p0 = getXForFrame(m_editingSelection.getStartFrame());
Chris@42 425 }
Chris@42 426
Chris@42 427 paint.save();
Chris@42 428 if (hasLightBackground()) {
Chris@42 429 paint.setPen(QPen(Qt::black, 2));
Chris@42 430 } else {
Chris@42 431 paint.setPen(QPen(Qt::white, 2));
Chris@42 432 }
Chris@42 433
Chris@42 434 //!!! duplicating display policy with View::drawSelections
Chris@42 435
Chris@42 436 if (m_editingSelectionEdge < 0) {
Chris@42 437 paint.drawLine(p0, 1, p1, 1);
Chris@42 438 paint.drawLine(p0, 0, p0, height());
Chris@42 439 paint.drawLine(p0, height() - 1, p1, height() - 1);
Chris@42 440 } else if (m_editingSelectionEdge > 0) {
Chris@42 441 paint.drawLine(p0, 1, p1, 1);
Chris@42 442 paint.drawLine(p1, 0, p1, height());
Chris@42 443 paint.drawLine(p0, height() - 1, p1, height() - 1);
Chris@42 444 } else {
Chris@42 445 paint.setBrush(Qt::NoBrush);
Chris@42 446 paint.drawRect(p0, 1, p1 - p0, height() - 2);
Chris@42 447 }
Chris@42 448 paint.restore();
Chris@42 449 }
Chris@42 450
Chris@0 451 paint.end();
Chris@0 452 }
Chris@0 453
Chris@17 454 Selection
Chris@44 455 Pane::getSelectionAt(int x, bool &closeToLeftEdge, bool &closeToRightEdge) const
Chris@17 456 {
Chris@17 457 closeToLeftEdge = closeToRightEdge = false;
Chris@17 458
Chris@17 459 if (!m_manager) return Selection();
Chris@17 460
Chris@20 461 long testFrame = getFrameForX(x - 5);
Chris@17 462 if (testFrame < 0) {
Chris@20 463 testFrame = getFrameForX(x);
Chris@17 464 if (testFrame < 0) return Selection();
Chris@17 465 }
Chris@17 466
Chris@17 467 Selection selection = m_manager->getContainingSelection(testFrame, true);
Chris@17 468 if (selection.isEmpty()) return selection;
Chris@17 469
Chris@20 470 int lx = getXForFrame(selection.getStartFrame());
Chris@20 471 int rx = getXForFrame(selection.getEndFrame());
Chris@17 472
Chris@17 473 int fuzz = 2;
Chris@17 474 if (x < lx - fuzz || x > rx + fuzz) return Selection();
Chris@17 475
Chris@17 476 int width = rx - lx;
Chris@17 477 fuzz = 3;
Chris@17 478 if (width < 12) fuzz = width / 4;
Chris@17 479 if (fuzz < 1) fuzz = 1;
Chris@17 480
Chris@17 481 if (x < lx + fuzz) closeToLeftEdge = true;
Chris@17 482 if (x > rx - fuzz) closeToRightEdge = true;
Chris@17 483
Chris@17 484 return selection;
Chris@17 485 }
Chris@17 486
Chris@0 487 void
Chris@0 488 Pane::mousePressEvent(QMouseEvent *e)
Chris@0 489 {
Chris@89 490 if (e->buttons() & Qt::RightButton) {
Chris@89 491 emit rightButtonMenuRequested(mapToGlobal(e->pos()));
Chris@89 492 return;
Chris@89 493 }
Chris@89 494
Chris@0 495 m_clickPos = e->pos();
Chris@0 496 m_clickedInRange = true;
Chris@42 497 m_editingSelection = Selection();
Chris@42 498 m_editingSelectionEdge = 0;
Chris@0 499 m_shiftPressed = (e->modifiers() & Qt::ShiftModifier);
Chris@13 500 m_ctrlPressed = (e->modifiers() & Qt::ControlModifier);
Chris@13 501
Chris@13 502 ViewManager::ToolMode mode = ViewManager::NavigateMode;
Chris@13 503 if (m_manager) mode = m_manager->getToolMode();
Chris@13 504
Chris@17 505 m_navigating = false;
Chris@13 506
Chris@17 507 if (mode == ViewManager::NavigateMode || (e->buttons() & Qt::MidButton)) {
Chris@17 508
Chris@17 509 if (mode != ViewManager::NavigateMode) {
Chris@17 510 setCursor(Qt::PointingHandCursor);
Chris@17 511 }
Chris@17 512
Chris@17 513 m_navigating = true;
Chris@13 514 m_dragCentreFrame = m_centreFrame;
Chris@13 515
Chris@13 516 } else if (mode == ViewManager::SelectMode) {
Chris@13 517
Chris@17 518 bool closeToLeft = false, closeToRight = false;
Chris@17 519 Selection selection = getSelectionAt(e->x(), closeToLeft, closeToRight);
Chris@17 520
Chris@17 521 if ((closeToLeft || closeToRight) && !(closeToLeft && closeToRight)) {
Chris@17 522
Chris@17 523 m_manager->removeSelection(selection);
Chris@17 524
Chris@17 525 if (closeToLeft) {
Chris@17 526 m_selectionStartFrame = selection.getEndFrame();
Chris@17 527 } else {
Chris@17 528 m_selectionStartFrame = selection.getStartFrame();
Chris@17 529 }
Chris@17 530
Chris@17 531 m_manager->setInProgressSelection(selection, false);
Chris@17 532 m_resizing = true;
Chris@13 533
Chris@17 534 } else {
Chris@17 535
Chris@20 536 int mouseFrame = getFrameForX(e->x());
Chris@17 537 size_t resolution = 1;
Chris@17 538 int snapFrame = mouseFrame;
Chris@17 539
Chris@17 540 Layer *layer = getSelectedLayer();
Chris@82 541 if (layer && !m_shiftPressed) {
Chris@44 542 layer->snapToFeatureFrame(this, snapFrame,
Chris@44 543 resolution, Layer::SnapLeft);
Chris@17 544 }
Chris@17 545
Chris@17 546 if (snapFrame < 0) snapFrame = 0;
Chris@17 547 m_selectionStartFrame = snapFrame;
Chris@17 548 if (m_manager) {
Chris@17 549 m_manager->setInProgressSelection(Selection(snapFrame,
Chris@17 550 snapFrame + resolution),
Chris@17 551 !m_ctrlPressed);
Chris@17 552 }
Chris@17 553
Chris@17 554 m_resizing = false;
Chris@17 555 }
Chris@17 556
Chris@17 557 update();
Chris@17 558
Chris@17 559 } else if (mode == ViewManager::DrawMode) {
Chris@17 560
Chris@13 561 Layer *layer = getSelectedLayer();
Chris@23 562 if (layer && layer->isLayerEditable()) {
Chris@44 563 layer->drawStart(this, e);
Chris@13 564 }
Chris@18 565
Chris@18 566 } else if (mode == ViewManager::EditMode) {
Chris@18 567
Chris@42 568 if (!editSelectionStart(e)) {
Chris@42 569 Layer *layer = getSelectedLayer();
Chris@42 570 if (layer && layer->isLayerEditable()) {
Chris@44 571 layer->editStart(this, e);
Chris@42 572 }
Chris@18 573 }
Chris@13 574 }
Chris@0 575
Chris@0 576 emit paneInteractedWith();
Chris@0 577 }
Chris@0 578
Chris@0 579 void
Chris@0 580 Pane::mouseReleaseEvent(QMouseEvent *e)
Chris@0 581 {
Chris@89 582 if (e->buttons() & Qt::RightButton) {
Chris@89 583 return;
Chris@89 584 }
Chris@89 585
Chris@13 586 ViewManager::ToolMode mode = ViewManager::NavigateMode;
Chris@13 587 if (m_manager) mode = m_manager->getToolMode();
Chris@13 588
Chris@0 589 if (m_clickedInRange) {
Chris@0 590 mouseMoveEvent(e);
Chris@0 591 }
Chris@0 592
Chris@17 593 if (m_navigating || mode == ViewManager::NavigateMode) {
Chris@17 594
Chris@17 595 m_navigating = false;
Chris@17 596
Chris@17 597 if (mode != ViewManager::NavigateMode) {
Chris@17 598 // restore cursor
Chris@17 599 toolModeChanged();
Chris@17 600 }
Chris@0 601
Chris@13 602 if (m_shiftPressed) {
Chris@0 603
Chris@13 604 int x0 = std::min(m_clickPos.x(), m_mousePos.x());
Chris@13 605 int x1 = std::max(m_clickPos.x(), m_mousePos.x());
Chris@13 606 int w = x1 - x0;
Chris@120 607
Chris@120 608 int y0 = std::min(m_clickPos.y(), m_mousePos.y());
Chris@120 609 int y1 = std::max(m_clickPos.y(), m_mousePos.y());
Chris@120 610 // int h = y1 - y0;
Chris@13 611
Chris@20 612 long newStartFrame = getFrameForX(x0);
Chris@13 613
Chris@20 614 long visibleFrames = getEndFrame() - getStartFrame();
Chris@20 615 if (newStartFrame <= -visibleFrames) {
Chris@20 616 newStartFrame = -visibleFrames + 1;
Chris@13 617 }
Chris@13 618
Chris@13 619 if (newStartFrame >= long(getModelsEndFrame())) {
Chris@13 620 newStartFrame = getModelsEndFrame() - 1;
Chris@13 621 }
Chris@13 622
Chris@13 623 float ratio = float(w) / float(width());
Chris@13 624 // std::cerr << "ratio: " << ratio << std::endl;
Chris@13 625 size_t newZoomLevel = (size_t)nearbyint(m_zoomLevel * ratio);
Chris@13 626 if (newZoomLevel < 1) newZoomLevel = 1;
Chris@13 627
Chris@13 628 // std::cerr << "start: " << m_startFrame << ", level " << m_zoomLevel << std::endl;
Chris@13 629 setZoomLevel(getZoomConstraintBlockSize(newZoomLevel));
Chris@13 630 setStartFrame(newStartFrame);
Chris@13 631
Chris@120 632 //!!! lots of faff, shouldn't be here
Chris@120 633
Chris@120 634 QString unit;
Chris@120 635 float min, max;
Chris@120 636 bool log;
Chris@120 637 Layer *layer = 0;
Chris@120 638 for (LayerList::const_iterator i = m_layers.begin();
Chris@120 639 i != m_layers.end(); ++i) {
Chris@120 640 if ((*i)->getValueExtents(min, max, log, unit) &&
Chris@120 641 (*i)->getDisplayExtents(min, max)) {
Chris@120 642 layer = *i;
Chris@120 643 break;
Chris@120 644 }
Chris@120 645 }
Chris@120 646
Chris@120 647 if (layer) {
Chris@120 648 if (log) {
Chris@120 649 min = (min < 0.0) ? -log10f(-min) : (min == 0.0) ? 0.0 : log10f(min);
Chris@120 650 max = (max < 0.0) ? -log10f(-max) : (max == 0.0) ? 0.0 : log10f(max);
Chris@120 651 }
Chris@120 652 float rmin = min + ((max - min) * (height() - y1)) / height();
Chris@120 653 float rmax = min + ((max - min) * (height() - y0)) / height();
Chris@120 654 std::cerr << "min: " << min << ", max: " << max << ", y0: " << y0 << ", y1: " << y1 << ", h: " << height() << ", rmin: " << rmin << ", rmax: " << rmax << std::endl;
Chris@120 655 if (log) {
Chris@120 656 rmin = powf(10, rmin);
Chris@120 657 rmax = powf(10, rmax);
Chris@120 658 }
Chris@120 659 std::cerr << "finally: rmin: " << rmin << ", rmax: " << rmax << " " << unit.toStdString() << std::endl;
Chris@120 660
Chris@120 661 layer->setDisplayExtents(rmin, rmax);
Chris@120 662 }
Chris@120 663
Chris@13 664 //cerr << "mouseReleaseEvent: start frame now " << m_startFrame << endl;
Chris@13 665 // update();
Chris@0 666 }
Chris@0 667
Chris@13 668 } else if (mode == ViewManager::SelectMode) {
Chris@13 669
Chris@13 670 if (m_manager && m_manager->haveInProgressSelection()) {
Chris@13 671
Chris@13 672 bool exclusive;
Chris@13 673 Selection selection = m_manager->getInProgressSelection(exclusive);
Chris@13 674
Chris@13 675 if (selection.getEndFrame() < selection.getStartFrame() + 2) {
Chris@13 676 selection = Selection();
Chris@13 677 }
Chris@13 678
Chris@13 679 m_manager->clearInProgressSelection();
Chris@13 680
Chris@13 681 if (exclusive) {
Chris@13 682 m_manager->setSelection(selection);
Chris@13 683 } else {
Chris@13 684 m_manager->addSelection(selection);
Chris@13 685 }
Chris@0 686 }
Chris@13 687
Chris@13 688 update();
Chris@17 689
Chris@17 690 } else if (mode == ViewManager::DrawMode) {
Chris@17 691
Chris@17 692 Layer *layer = getSelectedLayer();
Chris@23 693 if (layer && layer->isLayerEditable()) {
Chris@44 694 layer->drawEnd(this, e);
Chris@17 695 update();
Chris@17 696 }
Chris@18 697
Chris@18 698 } else if (mode == ViewManager::EditMode) {
Chris@18 699
Chris@42 700 if (!editSelectionEnd(e)) {
Chris@42 701 Layer *layer = getSelectedLayer();
Chris@42 702 if (layer && layer->isLayerEditable()) {
Chris@44 703 layer->editEnd(this, e);
Chris@42 704 update();
Chris@42 705 }
Chris@18 706 }
Chris@17 707 }
Chris@0 708
Chris@0 709 m_clickedInRange = false;
Chris@0 710
Chris@0 711 emit paneInteractedWith();
Chris@0 712 }
Chris@0 713
Chris@0 714 void
Chris@0 715 Pane::mouseMoveEvent(QMouseEvent *e)
Chris@0 716 {
Chris@89 717 if (e->buttons() & Qt::RightButton) {
Chris@89 718 return;
Chris@89 719 }
Chris@89 720
Chris@13 721 ViewManager::ToolMode mode = ViewManager::NavigateMode;
Chris@13 722 if (m_manager) mode = m_manager->getToolMode();
Chris@13 723
Chris@28 724 QPoint prevPoint = m_identifyPoint;
Chris@28 725 m_identifyPoint = e->pos();
Chris@28 726
Chris@0 727 if (!m_clickedInRange) {
Chris@0 728
Chris@17 729 if (mode == ViewManager::SelectMode) {
Chris@17 730 bool closeToLeft = false, closeToRight = false;
Chris@17 731 getSelectionAt(e->x(), closeToLeft, closeToRight);
Chris@17 732 if ((closeToLeft || closeToRight) && !(closeToLeft && closeToRight)) {
Chris@17 733 setCursor(Qt::SizeHorCursor);
Chris@17 734 } else {
Chris@17 735 setCursor(Qt::ArrowCursor);
Chris@17 736 }
Chris@17 737 }
Chris@0 738
Chris@35 739 //!!! if (mode != ViewManager::DrawMode) {
Chris@0 740
Chris@67 741 if (!m_manager->isPlaying()) {
Chris@67 742
Chris@55 743 if (getSelectedLayer()) {
Chris@55 744
Chris@17 745 bool previouslyIdentifying = m_identifyFeatures;
Chris@17 746 m_identifyFeatures = true;
Chris@17 747
Chris@17 748 if (m_identifyFeatures != previouslyIdentifying ||
Chris@17 749 m_identifyPoint != prevPoint) {
Chris@17 750 update();
Chris@17 751 }
Chris@55 752 }
Chris@55 753
Chris@67 754 }
Chris@67 755
Chris@35 756 // }
Chris@0 757
Chris@13 758 return;
Chris@13 759 }
Chris@0 760
Chris@17 761 if (m_navigating || mode == ViewManager::NavigateMode) {
Chris@0 762
Chris@13 763 if (m_shiftPressed) {
Chris@0 764
Chris@13 765 m_mousePos = e->pos();
Chris@13 766 update();
Chris@0 767
Chris@0 768 } else {
Chris@13 769
Chris@20 770 long frameOff = getFrameForX(e->x()) - getFrameForX(m_clickPos.x());
Chris@20 771
Chris@13 772 size_t newCentreFrame = m_dragCentreFrame;
Chris@13 773
Chris@13 774 if (frameOff < 0) {
Chris@13 775 newCentreFrame -= frameOff;
Chris@13 776 } else if (newCentreFrame >= size_t(frameOff)) {
Chris@13 777 newCentreFrame -= frameOff;
Chris@13 778 } else {
Chris@13 779 newCentreFrame = 0;
Chris@13 780 }
Chris@13 781
Chris@13 782 if (newCentreFrame >= getModelsEndFrame()) {
Chris@13 783 newCentreFrame = getModelsEndFrame();
Chris@13 784 if (newCentreFrame > 0) --newCentreFrame;
Chris@13 785 }
Chris@20 786
Chris@20 787 if (getXForFrame(m_centreFrame) != getXForFrame(newCentreFrame)) {
Chris@13 788 setCentreFrame(newCentreFrame);
Chris@13 789 }
Chris@0 790 }
Chris@0 791
Chris@13 792 } else if (mode == ViewManager::SelectMode) {
Chris@13 793
Chris@20 794 int mouseFrame = getFrameForX(e->x());
Chris@13 795 size_t resolution = 1;
Chris@13 796 int snapFrameLeft = mouseFrame;
Chris@13 797 int snapFrameRight = mouseFrame;
Chris@13 798
Chris@13 799 Layer *layer = getSelectedLayer();
Chris@82 800 if (layer && !m_shiftPressed) {
Chris@44 801 layer->snapToFeatureFrame(this, snapFrameLeft,
Chris@44 802 resolution, Layer::SnapLeft);
Chris@44 803 layer->snapToFeatureFrame(this, snapFrameRight,
Chris@44 804 resolution, Layer::SnapRight);
Chris@13 805 }
Chris@13 806
Chris@37 807 // std::cerr << "snap: frame = " << mouseFrame << ", start frame = " << m_selectionStartFrame << ", left = " << snapFrameLeft << ", right = " << snapFrameRight << std::endl;
Chris@28 808
Chris@13 809 if (snapFrameLeft < 0) snapFrameLeft = 0;
Chris@13 810 if (snapFrameRight < 0) snapFrameRight = 0;
Chris@13 811
Chris@13 812 size_t min, max;
Chris@13 813
Chris@13 814 if (m_selectionStartFrame > snapFrameLeft) {
Chris@13 815 min = snapFrameLeft;
Chris@13 816 max = m_selectionStartFrame;
Chris@13 817 } else if (snapFrameRight > m_selectionStartFrame) {
Chris@13 818 min = m_selectionStartFrame;
Chris@13 819 max = snapFrameRight;
Chris@13 820 } else {
Chris@13 821 min = snapFrameLeft;
Chris@13 822 max = snapFrameRight;
Chris@0 823 }
Chris@0 824
Chris@13 825 if (m_manager) {
Chris@13 826 m_manager->setInProgressSelection(Selection(min, max),
Chris@17 827 !m_resizing && !m_ctrlPressed);
Chris@0 828 }
Chris@15 829
Chris@15 830 bool doScroll = false;
Chris@15 831 if (!m_manager) doScroll = true;
Chris@15 832 if (!m_manager->isPlaying()) doScroll = true;
Chris@15 833 if (m_followPlay != PlaybackScrollContinuous) doScroll = true;
Chris@15 834
Chris@15 835 if (doScroll) {
Chris@13 836 int offset = mouseFrame - getStartFrame();
Chris@13 837 int available = getEndFrame() - getStartFrame();
Chris@15 838 if (offset >= available * 0.95) {
Chris@15 839 int move = int(offset - available * 0.95) + 1;
Chris@14 840 setCentreFrame(m_centreFrame + move);
Chris@15 841 } else if (offset <= available * 0.10) {
Chris@15 842 int move = int(available * 0.10 - offset) + 1;
Chris@14 843 if (m_centreFrame > move) {
Chris@14 844 setCentreFrame(m_centreFrame - move);
Chris@14 845 } else {
Chris@14 846 setCentreFrame(0);
Chris@14 847 }
Chris@13 848 }
Chris@13 849 }
Chris@13 850
Chris@13 851 update();
Chris@17 852
Chris@17 853 } else if (mode == ViewManager::DrawMode) {
Chris@17 854
Chris@17 855 Layer *layer = getSelectedLayer();
Chris@23 856 if (layer && layer->isLayerEditable()) {
Chris@44 857 layer->drawDrag(this, e);
Chris@17 858 }
Chris@18 859
Chris@18 860 } else if (mode == ViewManager::EditMode) {
Chris@18 861
Chris@42 862 if (!editSelectionDrag(e)) {
Chris@42 863 Layer *layer = getSelectedLayer();
Chris@42 864 if (layer && layer->isLayerEditable()) {
Chris@44 865 layer->editDrag(this, e);
Chris@42 866 }
Chris@18 867 }
Chris@0 868 }
Chris@0 869 }
Chris@0 870
Chris@0 871 void
Chris@0 872 Pane::mouseDoubleClickEvent(QMouseEvent *e)
Chris@0 873 {
Chris@89 874 if (e->buttons() & Qt::RightButton) {
Chris@89 875 return;
Chris@89 876 }
Chris@89 877
Chris@101 878 // std::cerr << "mouseDoubleClickEvent" << std::endl;
Chris@36 879
Chris@36 880 m_clickPos = e->pos();
Chris@36 881 m_clickedInRange = true;
Chris@36 882 m_shiftPressed = (e->modifiers() & Qt::ShiftModifier);
Chris@36 883 m_ctrlPressed = (e->modifiers() & Qt::ControlModifier);
Chris@36 884
Chris@36 885 ViewManager::ToolMode mode = ViewManager::NavigateMode;
Chris@36 886 if (m_manager) mode = m_manager->getToolMode();
Chris@36 887
Chris@101 888 if (mode == ViewManager::NavigateMode ||
Chris@101 889 mode == ViewManager::EditMode) {
Chris@36 890
Chris@36 891 Layer *layer = getSelectedLayer();
Chris@36 892 if (layer && layer->isLayerEditable()) {
Chris@44 893 layer->editOpen(this, e);
Chris@36 894 }
Chris@36 895 }
Chris@0 896 }
Chris@0 897
Chris@0 898 void
Chris@0 899 Pane::leaveEvent(QEvent *)
Chris@0 900 {
Chris@0 901 bool previouslyIdentifying = m_identifyFeatures;
Chris@0 902 m_identifyFeatures = false;
Chris@0 903 if (previouslyIdentifying) update();
Chris@0 904 }
Chris@0 905
Chris@0 906 void
Chris@0 907 Pane::wheelEvent(QWheelEvent *e)
Chris@0 908 {
Chris@0 909 //std::cerr << "wheelEvent, delta " << e->delta() << std::endl;
Chris@0 910
Chris@0 911 int count = e->delta();
Chris@0 912
Chris@0 913 if (count > 0) {
Chris@0 914 if (count >= 120) count /= 120;
Chris@0 915 else count = 1;
Chris@0 916 }
Chris@0 917
Chris@0 918 if (count < 0) {
Chris@0 919 if (count <= -120) count /= 120;
Chris@0 920 else count = -1;
Chris@0 921 }
Chris@17 922
Chris@17 923 if (e->modifiers() & Qt::ControlModifier) {
Chris@17 924
Chris@20 925 // Scroll left or right, rapidly
Chris@20 926
Chris@17 927 if (getStartFrame() < 0 &&
Chris@17 928 getEndFrame() >= getModelsEndFrame()) return;
Chris@17 929
Chris@17 930 long delta = ((width() / 2) * count * m_zoomLevel);
Chris@17 931
Chris@17 932 if (int(m_centreFrame) < delta) {
Chris@17 933 setCentreFrame(0);
Chris@17 934 } else if (int(m_centreFrame) - delta >= int(getModelsEndFrame())) {
Chris@17 935 setCentreFrame(getModelsEndFrame());
Chris@17 936 } else {
Chris@17 937 setCentreFrame(m_centreFrame - delta);
Chris@17 938 }
Chris@17 939
Chris@17 940 } else {
Chris@17 941
Chris@20 942 // Zoom in or out
Chris@20 943
Chris@17 944 int newZoomLevel = m_zoomLevel;
Chris@0 945
Chris@17 946 while (count > 0) {
Chris@17 947 if (newZoomLevel <= 2) {
Chris@17 948 newZoomLevel = 1;
Chris@17 949 break;
Chris@17 950 }
Chris@17 951 newZoomLevel = getZoomConstraintBlockSize(newZoomLevel - 1,
Chris@17 952 ZoomConstraint::RoundDown);
Chris@17 953 --count;
Chris@0 954 }
Chris@17 955
Chris@17 956 while (count < 0) {
Chris@17 957 newZoomLevel = getZoomConstraintBlockSize(newZoomLevel + 1,
Chris@17 958 ZoomConstraint::RoundUp);
Chris@17 959 ++count;
Chris@17 960 }
Chris@17 961
Chris@17 962 if (newZoomLevel != m_zoomLevel) {
Chris@17 963 setZoomLevel(newZoomLevel);
Chris@17 964 }
Chris@0 965 }
Chris@0 966
Chris@0 967 emit paneInteractedWith();
Chris@0 968 }
Chris@8 969
Chris@42 970 bool
Chris@42 971 Pane::editSelectionStart(QMouseEvent *e)
Chris@42 972 {
Chris@43 973 if (!m_identifyFeatures ||
Chris@43 974 !m_manager ||
Chris@43 975 m_manager->getToolMode() != ViewManager::EditMode) {
Chris@43 976 return false;
Chris@43 977 }
Chris@43 978
Chris@42 979 bool closeToLeft, closeToRight;
Chris@42 980 Selection s(getSelectionAt(e->x(), closeToLeft, closeToRight));
Chris@42 981 if (s.isEmpty()) return false;
Chris@42 982 m_editingSelection = s;
Chris@42 983 m_editingSelectionEdge = (closeToLeft ? -1 : closeToRight ? 1 : 0);
Chris@42 984 m_mousePos = e->pos();
Chris@42 985 return true;
Chris@42 986 }
Chris@42 987
Chris@42 988 bool
Chris@42 989 Pane::editSelectionDrag(QMouseEvent *e)
Chris@42 990 {
Chris@42 991 if (m_editingSelection.isEmpty()) return false;
Chris@42 992 m_mousePos = e->pos();
Chris@42 993 update();
Chris@42 994 return true;
Chris@42 995 }
Chris@42 996
Chris@42 997 bool
Chris@42 998 Pane::editSelectionEnd(QMouseEvent *e)
Chris@42 999 {
Chris@42 1000 if (m_editingSelection.isEmpty()) return false;
Chris@43 1001
Chris@43 1002 int offset = m_mousePos.x() - m_clickPos.x();
Chris@43 1003 Layer *layer = getSelectedLayer();
Chris@43 1004
Chris@43 1005 if (offset == 0 || !layer) {
Chris@43 1006 m_editingSelection = Selection();
Chris@43 1007 return true;
Chris@43 1008 }
Chris@43 1009
Chris@43 1010 int p0 = getXForFrame(m_editingSelection.getStartFrame()) + offset;
Chris@43 1011 int p1 = getXForFrame(m_editingSelection.getEndFrame()) + offset;
Chris@43 1012
Chris@43 1013 long f0 = getFrameForX(p0);
Chris@43 1014 long f1 = getFrameForX(p1);
Chris@43 1015
Chris@43 1016 Selection newSelection(f0, f1);
Chris@43 1017
Chris@43 1018 if (m_editingSelectionEdge == 0) {
Chris@43 1019
Chris@99 1020 CommandHistory::getInstance()->startCompoundOperation
Chris@99 1021 (tr("Drag Selection"), true);
Chris@99 1022
Chris@43 1023 layer->moveSelection(m_editingSelection, f0);
Chris@43 1024
Chris@43 1025 } else {
Chris@43 1026
Chris@99 1027 CommandHistory::getInstance()->startCompoundOperation
Chris@99 1028 (tr("Resize Selection"), true);
Chris@99 1029
Chris@43 1030 if (m_editingSelectionEdge < 0) {
Chris@43 1031 f1 = m_editingSelection.getEndFrame();
Chris@43 1032 } else {
Chris@43 1033 f0 = m_editingSelection.getStartFrame();
Chris@43 1034 }
Chris@43 1035
Chris@43 1036 newSelection = Selection(f0, f1);
Chris@43 1037 layer->resizeSelection(m_editingSelection, newSelection);
Chris@43 1038 }
Chris@43 1039
Chris@43 1040 m_manager->removeSelection(m_editingSelection);
Chris@43 1041 m_manager->addSelection(newSelection);
Chris@43 1042
Chris@99 1043 CommandHistory::getInstance()->endCompoundOperation();
Chris@99 1044
Chris@42 1045 m_editingSelection = Selection();
Chris@42 1046 return true;
Chris@42 1047 }
Chris@42 1048
Chris@13 1049 void
Chris@13 1050 Pane::toolModeChanged()
Chris@13 1051 {
Chris@13 1052 ViewManager::ToolMode mode = m_manager->getToolMode();
Chris@101 1053 // std::cerr << "Pane::toolModeChanged(" << mode << ")" << std::endl;
Chris@13 1054
Chris@13 1055 switch (mode) {
Chris@13 1056
Chris@13 1057 case ViewManager::NavigateMode:
Chris@13 1058 setCursor(Qt::PointingHandCursor);
Chris@13 1059 break;
Chris@13 1060
Chris@13 1061 case ViewManager::SelectMode:
Chris@13 1062 setCursor(Qt::ArrowCursor);
Chris@13 1063 break;
Chris@13 1064
Chris@13 1065 case ViewManager::EditMode:
Chris@19 1066 setCursor(Qt::UpArrowCursor);
Chris@13 1067 break;
Chris@13 1068
Chris@13 1069 case ViewManager::DrawMode:
Chris@13 1070 setCursor(Qt::CrossCursor);
Chris@13 1071 break;
Chris@36 1072 /*
Chris@13 1073 case ViewManager::TextMode:
Chris@13 1074 setCursor(Qt::IBeamCursor);
Chris@13 1075 break;
Chris@36 1076 */
Chris@13 1077 }
Chris@13 1078 }
Chris@13 1079
Chris@8 1080 QString
Chris@8 1081 Pane::toXmlString(QString indent, QString extraAttributes) const
Chris@8 1082 {
Chris@8 1083 return View::toXmlString
Chris@8 1084 (indent,
Chris@55 1085 QString("type=\"pane\" centreLineVisible=\"%1\" height=\"%2\" %3")
Chris@55 1086 .arg(m_centreLineVisible).arg(height()).arg(extraAttributes));
Chris@8 1087 }
Chris@8 1088
Chris@0 1089
Chris@0 1090 #ifdef INCLUDE_MOCFILES
Chris@0 1091 #include "Pane.moc.cpp"
Chris@0 1092 #endif
Chris@0 1093