mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Print font size id now appropriate to the page size
This commit is contained in:
parent
33b1e179d3
commit
e69f17aad5
@ -10,8 +10,7 @@
|
|||||||
#define APP_HOMEPAGE "http://www.gpxsee.org"
|
#define APP_HOMEPAGE "http://www.gpxsee.org"
|
||||||
|
|
||||||
#define FONT_FAMILY "Arial"
|
#define FONT_FAMILY "Arial"
|
||||||
#define FONT_SIZE 12
|
#define FONT_SIZE 12 // px
|
||||||
#define SCREEN_DPI 96.0
|
|
||||||
|
|
||||||
#define ELLIPSOID_FILE QString("ellipsoids.csv")
|
#define ELLIPSOID_FILE QString("ellipsoids.csv")
|
||||||
#define DATUM_FILE QString("datums.csv")
|
#define DATUM_FILE QString("datums.csv")
|
||||||
|
@ -326,10 +326,8 @@ void GraphView::mousePressEvent(QMouseEvent *e)
|
|||||||
QGraphicsView::mousePressEvent(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);
|
QSizeF canvas = QSizeF(target.width() / ratio, target.height() / ratio);
|
||||||
|
|
||||||
setUpdatesEnabled(false);
|
setUpdatesEnabled(false);
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
qreal sliderPosition() const {return _sliderPos;}
|
qreal sliderPosition() const {return _sliderPos;}
|
||||||
void setSliderPosition(qreal pos);
|
void setSliderPosition(qreal pos);
|
||||||
|
|
||||||
void plot(QPainter *painter, const QRectF &target);
|
void plot(QPainter *painter, const QRectF &target, qreal ratio);
|
||||||
|
|
||||||
void useOpenGL(bool use);
|
void useOpenGL(bool use);
|
||||||
|
|
||||||
|
12
src/gui.cpp
12
src/gui.cpp
@ -1008,15 +1008,15 @@ void GUI::plot(QPrinter *printer)
|
|||||||
if (tm > 0 && _options.printMovingTime)
|
if (tm > 0 && _options.printMovingTime)
|
||||||
info.insert(tr("Moving time"), Format::timeSpan(tm));
|
info.insert(tr("Moving time"), Format::timeSpan(tm));
|
||||||
|
|
||||||
|
qreal fsr = 96.0 / (qMax(printer->width(), printer->height()) / 3392.0);
|
||||||
ratio = p.paintEngine()->paintDevice()->logicalDpiX() / SCREEN_DPI;
|
ratio = p.paintEngine()->paintDevice()->logicalDpiX() / fsr;
|
||||||
if (info.isEmpty()) {
|
if (info.isEmpty()) {
|
||||||
ih = 0;
|
ih = 0;
|
||||||
mh = 0;
|
mh = 0;
|
||||||
} else {
|
} else {
|
||||||
ih = info.contentSize().height() * ratio;
|
ih = info.contentSize().height() * ratio;
|
||||||
mh = ih / 2;
|
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) {
|
if (_graphTabWidget->isVisible() && !_options.separateGraphPage) {
|
||||||
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
|
qreal r = (((qreal)(printer)->width()) / (qreal)(printer->height()));
|
||||||
@ -1025,7 +1025,8 @@ void GUI::plot(QPrinter *printer)
|
|||||||
: 0.15 * (printer->height() - ih - 2*mh);
|
: 0.15 * (printer->height() - ih - 2*mh);
|
||||||
gh = qMax(gh, ratio * 150);
|
gh = qMax(gh, ratio * 150);
|
||||||
GraphTab *gt = static_cast<GraphTab*>(_graphTabWidget->currentWidget());
|
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
|
} else
|
||||||
gh = 0;
|
gh = 0;
|
||||||
_pathView->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
|
_pathView->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
|
||||||
@ -1046,7 +1047,8 @@ void GUI::plot(QPrinter *printer)
|
|||||||
qreal y = 0;
|
qreal y = 0;
|
||||||
for (int i = 0; i < _tabs.size(); i++) {
|
for (int i = 0; i < _tabs.size(); i++) {
|
||||||
if (_tabs.at(i)->count()) {
|
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;
|
y += gh + sp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,9 +498,11 @@ void PathView::plot(QPainter *painter, const QRectF &target, bool hires)
|
|||||||
origLL = _map->xy2ll(origScene);
|
origLL = _map->xy2ll(origScene);
|
||||||
origRes = _map->resolution(origScene);
|
origRes = _map->resolution(origScene);
|
||||||
|
|
||||||
qreal r = painter->device()->logicalDpiX()
|
QPointF scale(painter->device()->logicalDpiX()
|
||||||
/ (qreal)metric(QPaintDevice::PdmDpiX);
|
/ (qreal)metric(QPaintDevice::PdmDpiX),
|
||||||
adj.setSize(QSize(adj.width() * r, adj.height() * r));
|
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);
|
_map->zoomFit(adj.size(), _tr | _rr | _wr);
|
||||||
rescale();
|
rescale();
|
||||||
QPointF center = contentCenter();
|
QPointF center = contentCenter();
|
||||||
|
@ -16,10 +16,8 @@ void TrackInfo::insert(const QString &key, const QString &value)
|
|||||||
_info->insert(key, 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 canvas = QSizeF(target.width() / ratio, target.height() / ratio);
|
||||||
QSizeF diff = QSizeF(qAbs(canvas.width() - sceneRect().width()),
|
QSizeF diff = QSizeF(qAbs(canvas.width() - sceneRect().width()),
|
||||||
qAbs(canvas.height() - sceneRect().height()));
|
qAbs(canvas.height() - sceneRect().height()));
|
||||||
|
@ -13,7 +13,7 @@ public:
|
|||||||
TrackInfo(QObject *parent = 0);
|
TrackInfo(QObject *parent = 0);
|
||||||
|
|
||||||
void insert(const QString &key, const QString &value);
|
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;
|
bool isEmpty() const;
|
||||||
QSizeF contentSize() const;
|
QSizeF contentSize() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user