annotate widgets/Pane.cpp @ 123:842bf484ee15

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