comparison view/View.cpp @ 338:1d3b27e69bf0

* Make font size in panes configurable, with a smaller default * Add [ and ] to select prev/next pane
author Chris Cannam
date Tue, 11 Dec 2007 14:58:29 +0000
parents 4a542ba875c2
children ac954fc0ec6f
comparison
equal deleted inserted replaced
337:813170c57b13 338:1d3b27e69bf0
17 #include "layer/Layer.h" 17 #include "layer/Layer.h"
18 #include "data/model/Model.h" 18 #include "data/model/Model.h"
19 #include "base/ZoomConstraint.h" 19 #include "base/ZoomConstraint.h"
20 #include "base/Profiler.h" 20 #include "base/Profiler.h"
21 #include "base/Pitch.h" 21 #include "base/Pitch.h"
22 #include "base/Preferences.h"
22 23
23 #include "layer/TimeRulerLayer.h" 24 #include "layer/TimeRulerLayer.h"
24 #include "layer/SingleColourLayer.h" 25 #include "layer/SingleColourLayer.h"
25 #include "data/model/PowerOfSqrtTwoZoomConstraint.h" 26 #include "data/model/PowerOfSqrtTwoZoomConstraint.h"
26 #include "data/model/RangeSummarisableTimeValueModel.h" 27 #include "data/model/RangeSummarisableTimeValueModel.h"
29 #include <QPaintEvent> 30 #include <QPaintEvent>
30 #include <QRect> 31 #include <QRect>
31 #include <QApplication> 32 #include <QApplication>
32 #include <QProgressDialog> 33 #include <QProgressDialog>
33 #include <QTextStream> 34 #include <QTextStream>
35 #include <QFont>
34 36
35 #include <iostream> 37 #include <iostream>
36 #include <cassert> 38 #include <cassert>
37 #include <math.h> 39 #include <math.h>
38 40
501 } 503 }
502 504
503 View::LayerProgressBar::LayerProgressBar(QWidget *parent) : 505 View::LayerProgressBar::LayerProgressBar(QWidget *parent) :
504 QProgressBar(parent) 506 QProgressBar(parent)
505 { 507 {
506 QFont f(font());
507 f.setPointSize(f.pointSize() * 8 / 10);
508 setFont(f);
509 } 508 }
510 509
511 void 510 void
512 View::addLayer(Layer *layer) 511 View::addLayer(Layer *layer)
513 { 512 {
521 520
522 m_progressBars[layer] = new LayerProgressBar(this); 521 m_progressBars[layer] = new LayerProgressBar(this);
523 m_progressBars[layer]->setMinimum(0); 522 m_progressBars[layer]->setMinimum(0);
524 m_progressBars[layer]->setMaximum(100); 523 m_progressBars[layer]->setMaximum(100);
525 m_progressBars[layer]->setMinimumWidth(80); 524 m_progressBars[layer]->setMinimumWidth(80);
525 QFont f(m_progressBars[layer]->font());
526 f.setPointSize(Preferences::getInstance()->getViewFontSize());
527 m_progressBars[layer]->setFont(f);
526 m_progressBars[layer]->hide(); 528 m_progressBars[layer]->hide();
527 529
528 connect(layer, SIGNAL(layerParametersChanged()), 530 connect(layer, SIGNAL(layerParametersChanged()),
529 this, SLOT(layerParametersChanged())); 531 this, SLOT(layerParametersChanged()));
530 connect(layer, SIGNAL(layerParameterRangesChanged()), 532 connect(layer, SIGNAL(layerParameterRangesChanged()),
1582 if (!paintedCacheRect) { 1584 if (!paintedCacheRect) {
1583 1585
1584 if (repaintCache) paint.begin(m_cache); 1586 if (repaintCache) paint.begin(m_cache);
1585 else paint.begin(this); 1587 else paint.begin(this);
1586 1588
1589 QFont font(paint.font());
1590 font.setPointSize(Preferences::getInstance()->getViewFontSize());
1591 paint.setFont(font);
1592
1587 paint.setClipRect(cacheRect); 1593 paint.setClipRect(cacheRect);
1588 1594
1589 paint.setPen(getBackground()); 1595 paint.setPen(getBackground());
1590 paint.setBrush(getBackground()); 1596 paint.setBrush(getBackground());
1591 paint.drawRect(cacheRect); 1597 paint.drawRect(cacheRect);
1622 1628
1623 nonCacheRect |= cacheRect; 1629 nonCacheRect |= cacheRect;
1624 1630
1625 paint.begin(this); 1631 paint.begin(this);
1626 paint.setClipRect(nonCacheRect); 1632 paint.setClipRect(nonCacheRect);
1633
1634 QFont font(paint.font());
1635 font.setPointSize(Preferences::getInstance()->getViewFontSize());
1636 paint.setFont(font);
1627 1637
1628 if (scrollables.empty()) { 1638 if (scrollables.empty()) {
1629 paint.setPen(getBackground()); 1639 paint.setPen(getBackground());
1630 paint.setBrush(getBackground()); 1640 paint.setBrush(getBackground());
1631 paint.drawRect(nonCacheRect); 1641 paint.drawRect(nonCacheRect);