1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Print font size id now appropriate to the page size

This commit is contained in:
Martin Tůma 2017-08-30 13:09:54 +02:00
parent 33b1e179d3
commit e69f17aad5
7 changed files with 17 additions and 18 deletions

View File

@ -10,8 +10,7 @@
#define APP_HOMEPAGE "http://www.gpxsee.org"
#define FONT_FAMILY "Arial"
#define FONT_SIZE 12
#define SCREEN_DPI 96.0
#define FONT_SIZE 12 // px
#define ELLIPSOID_FILE QString("ellipsoids.csv")
#define DATUM_FILE QString("datums.csv")

View File

@ -326,10 +326,8 @@ void GraphView::mousePressEvent(QMouseEvent *e)
QGraphicsView::mousePressEvent(e);
}
void GraphView::plot(QPainter *painter, const QRectF &target)
void GraphView::plot(QPainter *painter, const QRectF &target, qreal ratio)
{
qreal ratio = painter->paintEngine()->paintDevice()->logicalDpiX()
/ SCREEN_DPI;
QSizeF canvas = QSizeF(target.width() / ratio, target.height() / ratio);
setUpdatesEnabled(false);

View File

@ -53,7 +53,7 @@ public:
qreal sliderPosition() const {return _sliderPos;}
void setSliderPosition(qreal pos);
void plot(QPainter *painter, const QRectF &target);
void plot(QPainter *painter, const QRectF &target, qreal ratio);
void useOpenGL(bool use);

View File

@ -1008,15 +1008,15 @@ void GUI::plot(QPrinter *printer)
if (tm > 0 && _options.printMovingTime)
info.insert(tr("Moving time"), Format::timeSpan(tm));
ratio = p.paintEngine()->paintDevice()->logicalDpiX() / SCREEN_DPI;
qreal fsr = 96.0 / (qMax(printer->width(), printer->height()) / 3392.0);
ratio = p.paintEngine()->paintDevice()->logicalDpiX() / fsr;
if (info.isEmpty()) {
ih = 0;
mh = 0;
} else {
ih = info.contentSize().height() * ratio;
mh = ih / 2;
info.plot(&p, QRectF(0, 0, printer->width(), ih));
info.plot(&p, QRectF(0, 0, printer->width(), ih), ratio);
}
if (_graphTabWidget->isVisible() && !_options.separateGraphPage) {
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
@ -1025,7 +1025,8 @@ void GUI::plot(QPrinter *printer)
: 0.15 * (printer->height() - ih - 2*mh);
gh = qMax(gh, ratio * 150);
GraphTab *gt = static_cast<GraphTab*>(_graphTabWidget->currentWidget());
gt->plot(&p, QRectF(0, printer->height() - gh, printer->width(), gh));
gt->plot(&p, QRectF(0, printer->height() - gh, printer->width(), gh),
ratio);
} else
gh = 0;
_pathView->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
@ -1046,7 +1047,8 @@ void GUI::plot(QPrinter *printer)
qreal y = 0;
for (int i = 0; i < _tabs.size(); i++) {
if (_tabs.at(i)->count()) {
_tabs.at(i)->plot(&p, QRectF(0, y, printer->width(), gh));
_tabs.at(i)->plot(&p, QRectF(0, y, printer->width(), gh),
ratio);
y += gh + sp;
}
}

View File

@ -498,9 +498,11 @@ void PathView::plot(QPainter *painter, const QRectF &target, bool hires)
origLL = _map->xy2ll(origScene);
origRes = _map->resolution(origScene);
qreal r = painter->device()->logicalDpiX()
/ (qreal)metric(QPaintDevice::PdmDpiX);
adj.setSize(QSize(adj.width() * r, adj.height() * r));
QPointF scale(painter->device()->logicalDpiX()
/ (qreal)metric(QPaintDevice::PdmDpiX),
painter->device()->logicalDpiY()
/ (qreal)metric(QPaintDevice::PdmDpiY));
adj.setSize(QSize(adj.width() * scale.x(), adj.height() * scale.y()));
_map->zoomFit(adj.size(), _tr | _rr | _wr);
rescale();
QPointF center = contentCenter();

View File

@ -16,10 +16,8 @@ void TrackInfo::insert(const QString &key, const QString &value)
_info->insert(key, value);
}
void TrackInfo::plot(QPainter *painter, const QRectF &target)
void TrackInfo::plot(QPainter *painter, const QRectF &target, qreal ratio)
{
qreal ratio = painter->paintEngine()->paintDevice()->logicalDpiX()
/ SCREEN_DPI;
QSizeF canvas = QSizeF(target.width() / ratio, target.height() / ratio);
QSizeF diff = QSizeF(qAbs(canvas.width() - sceneRect().width()),
qAbs(canvas.height() - sceneRect().height()));

View File

@ -13,7 +13,7 @@ public:
TrackInfo(QObject *parent = 0);
void insert(const QString &key, const QString &value);
void plot(QPainter *painter, const QRectF &target);
void plot(QPainter *painter, const QRectF &target, qreal ratio);
bool isEmpty() const;
QSizeF contentSize() const;