fix other panels for high dpi monitors
This commit is contained in:
parent
3807327b41
commit
7c988d9428
14 changed files with 156 additions and 102 deletions
29
toonz/sources/include/toonzqt/glwidget_for_highdpi.h
Normal file
29
toonz/sources/include/toonzqt/glwidget_for_highdpi.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef GLWIDGET_FOR_HIGHDPI_H
|
||||||
|
#define GLWIDGET_FOR_HIGHDPI_H
|
||||||
|
|
||||||
|
#include <QGLWidget>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
|
// use obsolete QGLWidget instead of QOpenGLWidget for now...
|
||||||
|
// TODO: replace with the "modern" OpenGL source and transfer to QOpenGLWidget
|
||||||
|
class GLWidgetForHighDpi : public QGLWidget {
|
||||||
|
public:
|
||||||
|
GLWidgetForHighDpi(QWidget *parent = Q_NULLPTR,
|
||||||
|
const QGLWidget *shareWidget = Q_NULLPTR,
|
||||||
|
Qt::WindowFlags f = Qt::WindowFlags())
|
||||||
|
: QGLWidget(parent, shareWidget, f) {}
|
||||||
|
|
||||||
|
int getDevPixRatio() const {
|
||||||
|
static int devPixRatio = QApplication::desktop()->devicePixelRatio();
|
||||||
|
return devPixRatio;
|
||||||
|
}
|
||||||
|
// modify sizes for high DPI monitors
|
||||||
|
int width() const { return QGLWidget::width() * getDevPixRatio(); }
|
||||||
|
int height() const { return QGLWidget::height() * getDevPixRatio(); }
|
||||||
|
QRect rect() const { return QRect(0, 0, width(), height()); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -21,6 +21,7 @@
|
||||||
#include "toonzqt/doublefield.h"
|
#include "toonzqt/doublefield.h"
|
||||||
#include "toonzqt/colorfield.h"
|
#include "toonzqt/colorfield.h"
|
||||||
#include "toonzqt/tabbar.h"
|
#include "toonzqt/tabbar.h"
|
||||||
|
#include "toonzqt/glwidget_for_highdpi.h"
|
||||||
|
|
||||||
// Toonz includes
|
// Toonz includes
|
||||||
//#include "../toonz/tapp.h" //iwsw commented out temporarily
|
//#include "../toonz/tapp.h" //iwsw commented out temporarily
|
||||||
|
@ -32,7 +33,6 @@
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QOpenGLWidget>
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public:
|
||||||
|
|
||||||
enum CurrentWheel { none, leftWheel, rightTriangle };
|
enum CurrentWheel { none, leftWheel, rightTriangle };
|
||||||
|
|
||||||
class DVAPI HexagonalColorWheel final : public QOpenGLWidget {
|
class DVAPI HexagonalColorWheel final : public GLWidgetForHighDpi {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
// backgoround color (R160, G160, B160)
|
// backgoround color (R160, G160, B160)
|
||||||
|
|
|
@ -200,7 +200,7 @@ public:
|
||||||
|
|
||||||
ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook,
|
ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook,
|
||||||
bool showHistogram)
|
bool showHistogram)
|
||||||
: QOpenGLWidget(parent)
|
: GLWidgetForHighDpi(parent)
|
||||||
, m_pressedMousePos(0, 0)
|
, m_pressedMousePos(0, 0)
|
||||||
, m_mouseButton(Qt::NoButton)
|
, m_mouseButton(Qt::NoButton)
|
||||||
, m_draggingZoomSelection(false)
|
, m_draggingZoomSelection(false)
|
||||||
|
@ -322,7 +322,8 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
|
||||||
|
|
||||||
bool addedSep = false;
|
bool addedSep = false;
|
||||||
|
|
||||||
if (m_isHistogramEnable && visibleRegion().contains(event->pos())) {
|
if (m_isHistogramEnable &&
|
||||||
|
visibleRegion().contains(event->pos() * getDevPixRatio())) {
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
addedSep = true;
|
addedSep = true;
|
||||||
action = menu->addAction(tr("Show Histogram"));
|
action = menu->addAction(tr("Show Histogram"));
|
||||||
|
@ -729,18 +730,20 @@ void ImageViewer::updateCursor(const TPoint &curPos) {
|
||||||
/*! If middle button is pressed pan the image. Update current mouse position.
|
/*! If middle button is pressed pan the image. Update current mouse position.
|
||||||
*/
|
*/
|
||||||
void ImageViewer::mouseMoveEvent(QMouseEvent *event) {
|
void ImageViewer::mouseMoveEvent(QMouseEvent *event) {
|
||||||
TPoint curPos = TPoint(event->pos().x(), event->pos().y());
|
QPoint curQPos = event->pos() * getDevPixRatio();
|
||||||
|
|
||||||
|
TPoint curPos = TPoint(curQPos.x(), curQPos.y());
|
||||||
|
|
||||||
if (m_visualSettings.m_defineLoadbox && m_flipbook) {
|
if (m_visualSettings.m_defineLoadbox && m_flipbook) {
|
||||||
if (m_mouseButton == Qt::LeftButton)
|
if (m_mouseButton == Qt::LeftButton)
|
||||||
updateLoadbox(curPos);
|
updateLoadbox(curPos);
|
||||||
else if (m_mouseButton == Qt::MidButton)
|
else if (m_mouseButton == Qt::MidButton)
|
||||||
panQt(event->pos() - m_pos);
|
panQt(curQPos - m_pos);
|
||||||
else
|
else
|
||||||
updateCursor(curPos);
|
updateCursor(curPos);
|
||||||
update();
|
update();
|
||||||
event->ignore();
|
event->ignore();
|
||||||
m_pos = event->pos();
|
m_pos = curQPos;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,11 +765,11 @@ void ImageViewer::mouseMoveEvent(QMouseEvent *event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_compareSettings.m_dragCompareX || m_compareSettings.m_dragCompareY)
|
if (m_compareSettings.m_dragCompareX || m_compareSettings.m_dragCompareY)
|
||||||
dragCompare(event->pos() - m_pos);
|
dragCompare(curQPos - m_pos);
|
||||||
else if (m_mouseButton == Qt::MidButton)
|
else if (m_mouseButton == Qt::MidButton)
|
||||||
panQt(event->pos() - m_pos);
|
panQt(curQPos - m_pos);
|
||||||
|
|
||||||
m_pos = event->pos();
|
m_pos = curQPos;
|
||||||
|
|
||||||
// pick the color if the histogram popup is opened
|
// pick the color if the histogram popup is opened
|
||||||
if (m_isHistogramEnable && m_histogramPopup->isVisible() && !m_isColorModel) {
|
if (m_isHistogramEnable && m_histogramPopup->isVisible() && !m_isColorModel) {
|
||||||
|
@ -830,8 +833,10 @@ void ImageViewer::pickColor(QMouseEvent *event, bool putValueToStyleEditor) {
|
||||||
if (!m_isHistogramEnable) return;
|
if (!m_isHistogramEnable) return;
|
||||||
if (!m_histogramPopup->isVisible()) return;
|
if (!m_histogramPopup->isVisible()) return;
|
||||||
|
|
||||||
|
QPoint curPos = event->pos() * getDevPixRatio();
|
||||||
|
|
||||||
// avoid to pick outside of the flip
|
// avoid to pick outside of the flip
|
||||||
if ((!m_image) || !rect().contains(event->pos())) {
|
if ((!m_image) || !rect().contains(curPos)) {
|
||||||
// throw transparent color
|
// throw transparent color
|
||||||
m_histogramPopup->updateInfo(TPixel32::Transparent, TPointD(-1, -1));
|
m_histogramPopup->updateInfo(TPixel32::Transparent, TPointD(-1, -1));
|
||||||
return;
|
return;
|
||||||
|
@ -839,7 +844,7 @@ void ImageViewer::pickColor(QMouseEvent *event, bool putValueToStyleEditor) {
|
||||||
|
|
||||||
StylePicker picker(m_image);
|
StylePicker picker(m_image);
|
||||||
|
|
||||||
TPoint mousePos = TPoint(event->pos().x(), height() - 1 - event->pos().y());
|
TPoint mousePos = TPoint(curPos.x(), height() - 1 - curPos.y());
|
||||||
TRectD area = TRectD(mousePos.x, mousePos.y, mousePos.x, mousePos.y);
|
TRectD area = TRectD(mousePos.x, mousePos.y, mousePos.x, mousePos.y);
|
||||||
|
|
||||||
// iwsw commented out temporarily
|
// iwsw commented out temporarily
|
||||||
|
@ -854,7 +859,7 @@ void ImageViewer::pickColor(QMouseEvent *event, bool putValueToStyleEditor) {
|
||||||
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
|
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
|
||||||
// get3DLutUtil()->releaseFBO();
|
// get3DLutUtil()->releaseFBO();
|
||||||
|
|
||||||
QPoint viewP = mapFrom(this, event->pos());
|
QPoint viewP = mapFrom(this, curPos);
|
||||||
TPointD pos = getViewAff().inv() *
|
TPointD pos = getViewAff().inv() *
|
||||||
TPointD(viewP.x() - width() / 2, -viewP.y() + height() / 2);
|
TPointD(viewP.x() - width() / 2, -viewP.y() + height() / 2);
|
||||||
TPointD imagePos = TPointD(0.5 * m_image->getBBox().getLx() + pos.x,
|
TPointD imagePos = TPointD(0.5 * m_image->getBBox().getLx() + pos.x,
|
||||||
|
@ -952,7 +957,7 @@ void ImageViewer::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void ImageViewer::mousePressEvent(QMouseEvent *event) {
|
void ImageViewer::mousePressEvent(QMouseEvent *event) {
|
||||||
m_pos = event->pos();
|
m_pos = event->pos() * getDevPixRatio();
|
||||||
m_pressedMousePos = TPoint(m_pos.x(), m_pos.y());
|
m_pressedMousePos = TPoint(m_pos.x(), m_pos.y());
|
||||||
m_mouseButton = event->button();
|
m_mouseButton = event->button();
|
||||||
m_draggingZoomSelection = false;
|
m_draggingZoomSelection = false;
|
||||||
|
@ -1036,8 +1041,8 @@ void ImageViewer::mouseReleaseEvent(QMouseEvent *event) {
|
||||||
void ImageViewer::wheelEvent(QWheelEvent *event) {
|
void ImageViewer::wheelEvent(QWheelEvent *event) {
|
||||||
if (event->orientation() == Qt::Horizontal) return;
|
if (event->orientation() == Qt::Horizontal) return;
|
||||||
int delta = event->delta() > 0 ? 120 : -120;
|
int delta = event->delta() > 0 ? 120 : -120;
|
||||||
QPoint center(event->pos().x() - width() / 2,
|
QPoint center(event->pos().x() * getDevPixRatio() - width() / 2,
|
||||||
-event->pos().y() + height() / 2);
|
-event->pos().y() * getDevPixRatio() + height() / 2);
|
||||||
zoomQt(center, exp(0.001 * delta));
|
zoomQt(center, exp(0.001 * delta));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1146,7 +1151,8 @@ void ImageViewer::adaptView(const QRect &geomRect) {
|
||||||
void ImageViewer::doSwapBuffers() { glFlush(); }
|
void ImageViewer::doSwapBuffers() { glFlush(); }
|
||||||
|
|
||||||
void ImageViewer::changeSwapBehavior(bool enable) {
|
void ImageViewer::changeSwapBehavior(bool enable) {
|
||||||
setUpdateBehavior(enable ? PartialUpdate : NoPartialUpdate);
|
// do nothing for now as setUpdateBehavior is not available with QGLWidget
|
||||||
|
// setUpdateBehavior(enable ? PartialUpdate : NoPartialUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
//#include "toonzqt/ghibli_3dlut_util.h"
|
//#include "toonzqt/ghibli_3dlut_util.h"
|
||||||
|
|
||||||
#include "toonz/imagepainter.h"
|
#include "toonz/imagepainter.h"
|
||||||
|
#include "toonzqt/glwidget_for_highdpi.h"
|
||||||
#include <QOpenGLWidget>
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -22,7 +21,7 @@ class HistogramPopup;
|
||||||
// ImageViewer
|
// ImageViewer
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
||||||
class ImageViewer final : public QOpenGLWidget {
|
class ImageViewer final : public GLWidgetForHighDpi {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
enum DragType {
|
enum DragType {
|
||||||
eNone,
|
eNone,
|
||||||
|
|
|
@ -466,7 +466,7 @@ public:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
SceneViewer::SceneViewer(ImageUtils::FullScreenWidget *parent)
|
SceneViewer::SceneViewer(ImageUtils::FullScreenWidget *parent)
|
||||||
: QGLWidget(parent, touchProxy())
|
: GLWidgetForHighDpi(parent, touchProxy())
|
||||||
, m_pressure(0)
|
, m_pressure(0)
|
||||||
, m_lastMousePos(0, 0)
|
, m_lastMousePos(0, 0)
|
||||||
, m_mouseButton(Qt::NoButton)
|
, m_mouseButton(Qt::NoButton)
|
||||||
|
@ -2557,7 +2557,7 @@ void SceneViewer::invalidateToolStatus() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TRectD SceneViewer::getGeometry() const {
|
TRectD SceneViewer::getGeometry() const {
|
||||||
int devPixRatio = TApp::instance()->getDevPixRatio();
|
int devPixRatio = getDevPixRatio();
|
||||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||||
TPointD topLeft =
|
TPointD topLeft =
|
||||||
tool->getMatrix().inv() * winToWorld(geometry().topLeft() * devPixRatio);
|
tool->getMatrix().inv() * winToWorld(geometry().topLeft() * devPixRatio);
|
||||||
|
@ -2581,14 +2581,3 @@ TRectD SceneViewer::getGeometry() const {
|
||||||
void SceneViewer::doDeleteSubCamera() {
|
void SceneViewer::doDeleteSubCamera() {
|
||||||
PreviewSubCameraManager::instance()->deleteSubCamera(this);
|
PreviewSubCameraManager::instance()->deleteSubCamera(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/*! modify sizes for high DPI monitors
|
|
||||||
*/
|
|
||||||
int SceneViewer::width() const {
|
|
||||||
return QGLWidget::width() * TApp::instance()->getDevPixRatio();
|
|
||||||
}
|
|
||||||
|
|
||||||
int SceneViewer::height() const {
|
|
||||||
return QGLWidget::height() * TApp::instance()->getDevPixRatio();
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
// TnzQt includes
|
// TnzQt includes
|
||||||
#include "toonzqt/menubarcommand.h"
|
#include "toonzqt/menubarcommand.h"
|
||||||
#include "toonzqt/flipconsole.h"
|
#include "toonzqt/flipconsole.h"
|
||||||
|
#include "toonzqt/glwidget_for_highdpi.h"
|
||||||
// iwsw commented out temporarily
|
// iwsw commented out temporarily
|
||||||
//#include "toonzqt/ghibli_3dlut_util.h"
|
//#include "toonzqt/ghibli_3dlut_util.h"
|
||||||
|
|
||||||
|
@ -23,9 +24,6 @@
|
||||||
#include "pane.h"
|
#include "pane.h"
|
||||||
#include "previewer.h"
|
#include "previewer.h"
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
#include <QGLWidget>
|
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
|
@ -57,7 +55,7 @@ public:
|
||||||
// SceneViewer
|
// SceneViewer
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class SceneViewer final : public QGLWidget,
|
class SceneViewer final : public GLWidgetForHighDpi,
|
||||||
public TTool::Viewer,
|
public TTool::Viewer,
|
||||||
public Previewer::Listener {
|
public Previewer::Listener {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -245,10 +243,6 @@ public:
|
||||||
|
|
||||||
TPoint worldToPos(const TPointD &worldPos) const override;
|
TPoint worldToPos(const TPointD &worldPos) const override;
|
||||||
|
|
||||||
// modify sizes for high DPI monitors
|
|
||||||
int width() const;
|
|
||||||
int height() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Paint vars
|
// Paint vars
|
||||||
TAffine m_drawCameraAff;
|
TAffine m_drawCameraAff;
|
||||||
|
|
|
@ -75,8 +75,7 @@ int modifiers = 0;
|
||||||
|
|
||||||
void initToonzEvent(TMouseEvent &toonzEvent, QMouseEvent *event,
|
void initToonzEvent(TMouseEvent &toonzEvent, QMouseEvent *event,
|
||||||
int widgetHeight, double pressure, bool isTablet,
|
int widgetHeight, double pressure, bool isTablet,
|
||||||
bool isClick) {
|
bool isClick, int devPixRatio) {
|
||||||
int devPixRatio = TApp::instance()->getDevPixRatio();
|
|
||||||
toonzEvent.m_pos = TPoint(event->pos().x() * devPixRatio,
|
toonzEvent.m_pos = TPoint(event->pos().x() * devPixRatio,
|
||||||
widgetHeight - 1 - event->pos().y() * devPixRatio);
|
widgetHeight - 1 - event->pos().y() * devPixRatio);
|
||||||
toonzEvent.m_pressure = isTablet ? int(255 * pressure) : 255;
|
toonzEvent.m_pressure = isTablet ? int(255 * pressure) : 255;
|
||||||
|
@ -275,7 +274,7 @@ void SceneViewer::enterEvent(QEvent *) {
|
||||||
void SceneViewer::mouseMoveEvent(QMouseEvent *event) {
|
void SceneViewer::mouseMoveEvent(QMouseEvent *event) {
|
||||||
if (m_freezedStatus != NO_FREEZED) return;
|
if (m_freezedStatus != NO_FREEZED) return;
|
||||||
|
|
||||||
QPoint curPos = event->pos() * TApp::instance()->getDevPixRatio();
|
QPoint curPos = event->pos() * getDevPixRatio();
|
||||||
bool cursorSet = false;
|
bool cursorSet = false;
|
||||||
m_lastMousePos = curPos;
|
m_lastMousePos = curPos;
|
||||||
|
|
||||||
|
@ -360,7 +359,7 @@ void SceneViewer::mouseMoveEvent(QMouseEvent *event) {
|
||||||
tool->setViewer(this);
|
tool->setViewer(this);
|
||||||
TMouseEvent toonzEvent;
|
TMouseEvent toonzEvent;
|
||||||
initToonzEvent(toonzEvent, event, height(), m_pressure, m_tabletEvent,
|
initToonzEvent(toonzEvent, event, height(), m_pressure, m_tabletEvent,
|
||||||
false);
|
false, getDevPixRatio());
|
||||||
TPointD worldPos = winToWorld(curPos);
|
TPointD worldPos = winToWorld(curPos);
|
||||||
TPointD pos = tool->getMatrix().inv() * worldPos;
|
TPointD pos = tool->getMatrix().inv() * worldPos;
|
||||||
|
|
||||||
|
@ -418,7 +417,7 @@ void SceneViewer::mousePressEvent(QMouseEvent *event) {
|
||||||
|
|
||||||
if (m_mouseButton != Qt::NoButton) return;
|
if (m_mouseButton != Qt::NoButton) return;
|
||||||
|
|
||||||
m_pos = event->pos() * TApp::instance()->getDevPixRatio();
|
m_pos = event->pos() * getDevPixRatio();
|
||||||
m_mouseButton = event->button();
|
m_mouseButton = event->button();
|
||||||
|
|
||||||
// when using tablet, avoid unexpected drawing behavior occurs when
|
// when using tablet, avoid unexpected drawing behavior occurs when
|
||||||
|
@ -477,7 +476,8 @@ void SceneViewer::mousePressEvent(QMouseEvent *event) {
|
||||||
if (m_pressure > 0 && !m_tabletEvent) m_tabletEvent = true;
|
if (m_pressure > 0 && !m_tabletEvent) m_tabletEvent = true;
|
||||||
|
|
||||||
if (TApp::instance()->isPenCloseToTablet()) m_tabletEvent = true;
|
if (TApp::instance()->isPenCloseToTablet()) m_tabletEvent = true;
|
||||||
initToonzEvent(toonzEvent, event, height(), m_pressure, m_tabletEvent, true);
|
initToonzEvent(toonzEvent, event, height(), m_pressure, m_tabletEvent, true,
|
||||||
|
getDevPixRatio());
|
||||||
// if(!m_tabletEvent) qDebug() << "-----------------MOUSE PRESS 'PURO'.
|
// if(!m_tabletEvent) qDebug() << "-----------------MOUSE PRESS 'PURO'.
|
||||||
// POSSIBILE EMBOLO";
|
// POSSIBILE EMBOLO";
|
||||||
TPointD pos = tool->getMatrix().inv() * winToWorld(m_pos);
|
TPointD pos = tool->getMatrix().inv() * winToWorld(m_pos);
|
||||||
|
@ -543,9 +543,9 @@ void SceneViewer::mouseReleaseEvent(QMouseEvent *event) {
|
||||||
{
|
{
|
||||||
TMouseEvent toonzEvent;
|
TMouseEvent toonzEvent;
|
||||||
initToonzEvent(toonzEvent, event, height(), m_pressure, m_tabletEvent,
|
initToonzEvent(toonzEvent, event, height(), m_pressure, m_tabletEvent,
|
||||||
false);
|
false, getDevPixRatio());
|
||||||
TPointD pos = tool->getMatrix().inv() *
|
TPointD pos =
|
||||||
winToWorld(event->pos() * TApp::instance()->getDevPixRatio());
|
tool->getMatrix().inv() * winToWorld(event->pos() * getDevPixRatio());
|
||||||
|
|
||||||
TObjectHandle *objHandle = TApp::instance()->getCurrentObject();
|
TObjectHandle *objHandle = TApp::instance()->getCurrentObject();
|
||||||
if (tool->getToolType() & TTool::LevelTool && !objHandle->isSpline()) {
|
if (tool->getToolType() & TTool::LevelTool && !objHandle->isSpline()) {
|
||||||
|
@ -623,8 +623,7 @@ void SceneViewer::wheelEvent(QWheelEvent *event) {
|
||||||
CommandManager::instance()->execute("MI_PrevDrawing");
|
CommandManager::instance()->execute("MI_PrevDrawing");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
zoomQt(event->pos() * TApp::instance()->getDevPixRatio(),
|
zoomQt(event->pos() * getDevPixRatio(), exp(0.001 * delta));
|
||||||
exp(0.001 * delta));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@ -1004,9 +1003,10 @@ void SceneViewer::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||||
if (!tool || !tool->isEnabled()) return;
|
if (!tool || !tool->isEnabled()) return;
|
||||||
TMouseEvent toonzEvent;
|
TMouseEvent toonzEvent;
|
||||||
initToonzEvent(toonzEvent, event, height(), m_pressure, m_tabletEvent, true);
|
initToonzEvent(toonzEvent, event, height(), m_pressure, m_tabletEvent, true,
|
||||||
TPointD pos = tool->getMatrix().inv() *
|
getDevPixRatio());
|
||||||
winToWorld(event->pos() * TApp::instance()->getDevPixRatio());
|
TPointD pos =
|
||||||
|
tool->getMatrix().inv() * winToWorld(event->pos() * getDevPixRatio());
|
||||||
TObjectHandle *objHandle = TApp::instance()->getCurrentObject();
|
TObjectHandle *objHandle = TApp::instance()->getCurrentObject();
|
||||||
if (tool->getToolType() & TTool::LevelTool && !objHandle->isSpline()) {
|
if (tool->getToolType() & TTool::LevelTool && !objHandle->isSpline()) {
|
||||||
pos.x /= m_dpiScale.x;
|
pos.x /= m_dpiScale.x;
|
||||||
|
@ -1041,7 +1041,7 @@ void SceneViewer::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
if (m_freezedStatus != NO_FREEZED) return;
|
if (m_freezedStatus != NO_FREEZED) return;
|
||||||
if (m_isLocator) return;
|
if (m_isLocator) return;
|
||||||
|
|
||||||
int devPixRatio = TApp::instance()->getDevPixRatio();
|
int devPixRatio = getDevPixRatio();
|
||||||
TPoint winPos(e->pos().x() * devPixRatio,
|
TPoint winPos(e->pos().x() * devPixRatio,
|
||||||
height() - e->pos().y() * devPixRatio);
|
height() - e->pos().y() * devPixRatio);
|
||||||
std::vector<int> columnIndices;
|
std::vector<int> columnIndices;
|
||||||
|
|
|
@ -512,10 +512,11 @@ void RenameCellField::showInRowCol(int row, int col, bool multiColumnSelected) {
|
||||||
m_col = col;
|
m_col = col;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static QFont font("Arial", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
#else
|
#else
|
||||||
static QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
#endif
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
setFont(font);
|
setFont(font);
|
||||||
setAlignment(Qt::AlignRight | Qt::AlignBottom);
|
setAlignment(Qt::AlignRight | Qt::AlignBottom);
|
||||||
|
|
||||||
|
@ -1269,10 +1270,11 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {
|
||||||
: m_viewer->getTextColor());
|
: m_viewer->getTextColor());
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static QFont font("Arial", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
#else
|
#else
|
||||||
static QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
#endif
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
// do not draw frame number under RenameCellField
|
// do not draw frame number under RenameCellField
|
||||||
|
@ -1378,7 +1380,12 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
|
||||||
QRect nameRect = rect.adjusted(8, -H_ADJUST, -10, H_ADJUST);
|
QRect nameRect = rect.adjusted(8, -H_ADJUST, -10, H_ADJUST);
|
||||||
// il nome va scritto se e' diverso dalla cella precedente oppure se
|
// il nome va scritto se e' diverso dalla cella precedente oppure se
|
||||||
// siamo su una marker line
|
// siamo su una marker line
|
||||||
static QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
|
#ifdef _WIN32
|
||||||
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
|
#else
|
||||||
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050500
|
#if QT_VERSION >= 0x050500
|
||||||
|
@ -1487,11 +1494,12 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,
|
||||||
: m_viewer->getTextColor());
|
: m_viewer->getTextColor());
|
||||||
// il nome va scritto se e' diverso dalla cella precedente oppure se
|
// il nome va scritto se e' diverso dalla cella precedente oppure se
|
||||||
// siamo su una marker line
|
// siamo su una marker line
|
||||||
#ifndef _WIN32
|
#ifdef _WIN32
|
||||||
static QFont font("Arial", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
#else
|
#else
|
||||||
static QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
#endif
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ void ChangeObjectParent::refresh() {
|
||||||
QString text;
|
QString text;
|
||||||
QList<QString> pegbarList;
|
QList<QString> pegbarList;
|
||||||
QList<QString> columnList;
|
QList<QString> columnList;
|
||||||
int maxTextLength = 0;
|
QString theLongestTxt;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < objectCount; i++) {
|
for (i = 0; i < objectCount; i++) {
|
||||||
TStageObjectId id = tree->getStageObject(i)->getId();
|
TStageObjectId id = tree->getStageObject(i)->getId();
|
||||||
|
@ -334,12 +334,20 @@ void ChangeObjectParent::refresh() {
|
||||||
newText = QString("Col ") + indexStr;
|
newText = QString("Col ") + indexStr;
|
||||||
columnList.append(newText);
|
columnList.append(newText);
|
||||||
}
|
}
|
||||||
if (newText.length() > maxTextLength) maxTextLength = newText.length();
|
if (newText.length() > theLongestTxt.length()) theLongestTxt = newText;
|
||||||
}
|
}
|
||||||
for (i = 0; i < columnList.size(); i++) addItem(columnList.at(i));
|
for (i = 0; i < columnList.size(); i++) addItem(columnList.at(i));
|
||||||
for (i = 0; i < pegbarList.size(); i++) addItem(pegbarList.at(i));
|
for (i = 0; i < pegbarList.size(); i++) addItem(pegbarList.at(i));
|
||||||
|
|
||||||
m_width = maxTextLength * XSHEET_FONT_SIZE + 2;
|
#ifdef _WIN32
|
||||||
|
static QFont font("Arial", -1, QFont::Bold);
|
||||||
|
#else
|
||||||
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
|
#endif
|
||||||
|
// set font size in pixel
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
|
|
||||||
|
m_width = QFontMetrics(font).width(theLongestTxt) + 2;
|
||||||
selectCurrent(text);
|
selectCurrent(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +459,12 @@ RenameColumnField::RenameColumnField(QWidget *parent, XsheetViewer *viewer)
|
||||||
|
|
||||||
void RenameColumnField::show(QPoint pos, int col) {
|
void RenameColumnField::show(QPoint pos, int col) {
|
||||||
move(pos);
|
move(pos);
|
||||||
static QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
|
#ifdef _WIN32
|
||||||
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
|
#else
|
||||||
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
setFont(font);
|
setFont(font);
|
||||||
m_col = col;
|
m_col = col;
|
||||||
|
|
||||||
|
@ -578,10 +591,11 @@ void ColumnArea::drawLevelColumnHead(QPainter &p, int col) {
|
||||||
|
|
||||||
// Preparing painter
|
// Preparing painter
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
QFont font("Arial", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
#else
|
#else
|
||||||
QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
#endif
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
|
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
||||||
|
@ -789,8 +803,12 @@ void ColumnArea::drawSoundColumnHead(QPainter &p, int col) {
|
||||||
TColumnSelection *selection = m_viewer->getColumnSelection();
|
TColumnSelection *selection = m_viewer->getColumnSelection();
|
||||||
|
|
||||||
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
||||||
QFont font("Helvetica");
|
#ifdef _WIN32
|
||||||
font.setPointSize(XSHEET_FONT_SIZE);
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
|
#else
|
||||||
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
int x = m_viewer->columnToX(col);
|
int x = m_viewer->columnToX(col);
|
||||||
|
@ -940,10 +958,12 @@ void ColumnArea::drawPaletteColumnHead(QPainter &p, int col) {
|
||||||
TColumnSelection *selection = m_viewer->getColumnSelection();
|
TColumnSelection *selection = m_viewer->getColumnSelection();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
QFont font("Arial", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
#else
|
#else
|
||||||
QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
#endif
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
|
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
||||||
|
|
||||||
|
@ -1074,8 +1094,12 @@ void ColumnArea::drawSoundTextColumnHead(QPainter &p, int col) {
|
||||||
TColumnSelection *selection = m_viewer->getColumnSelection();
|
TColumnSelection *selection = m_viewer->getColumnSelection();
|
||||||
|
|
||||||
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
||||||
QFont font("Helvetica");
|
#ifdef _WIN32
|
||||||
font.setPointSize(XSHEET_FONT_SIZE);
|
static QFont font("Arial", -1, QFont::Normal);
|
||||||
|
#else
|
||||||
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
|
#endif
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
int x = m_viewer->columnToX(col);
|
int x = m_viewer->columnToX(col);
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include "toonzqt/spreadsheetviewer.h"
|
#include "toonzqt/spreadsheetviewer.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define XSHEET_FONT_SIZE 9
|
#define XSHEET_FONT_PX_SIZE 12
|
||||||
#define H_ADJUST 2
|
#define H_ADJUST 2
|
||||||
#else
|
#else
|
||||||
#define XSHEET_FONT_SIZE 11
|
#define XSHEET_FONT_PX_SIZE 14
|
||||||
#define H_ADJUST 0
|
#define H_ADJUST 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -89,10 +89,13 @@ void RowArea::drawRows(QPainter &p, int r0, int r1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static QFont font("Arial", XSHEET_FONT_SIZE, QFont::Bold);
|
static QFont font("Arial", -1, QFont::Bold);
|
||||||
#else
|
#else
|
||||||
static QFont font("Helvetica", XSHEET_FONT_SIZE, QFont::Normal);
|
static QFont font("Helvetica", -1, QFont::Normal);
|
||||||
#endif
|
#endif
|
||||||
|
// set font size in pixel
|
||||||
|
font.setPixelSize(XSHEET_FONT_PX_SIZE);
|
||||||
|
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
// marker interval
|
// marker interval
|
||||||
|
|
|
@ -86,6 +86,7 @@ set(MOC_HEADERS
|
||||||
../include/toonzqt/flipconsoleowner.h
|
../include/toonzqt/flipconsoleowner.h
|
||||||
../include/toonzqt/combohistogram.h
|
../include/toonzqt/combohistogram.h
|
||||||
../include/toonzqt/fxiconmanager.h
|
../include/toonzqt/fxiconmanager.h
|
||||||
|
../include/toonzqt/glwidget_for_highdpi.h
|
||||||
pluginhost.h
|
pluginhost.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -548,7 +548,7 @@ QPixmap makeSquareShading(const ColorModel &color, ColorChannel channel,
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
HexagonalColorWheel::HexagonalColorWheel(QWidget *parent)
|
HexagonalColorWheel::HexagonalColorWheel(QWidget *parent)
|
||||||
: QOpenGLWidget(parent)
|
: GLWidgetForHighDpi(parent)
|
||||||
, m_bgColor(128, 128, 128) // defaul value in case this value does not set
|
, m_bgColor(128, 128, 128) // defaul value in case this value does not set
|
||||||
// in the style sheet
|
// in the style sheet
|
||||||
{
|
{
|
||||||
|
@ -597,20 +597,20 @@ void HexagonalColorWheel::initializeGL() {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void HexagonalColorWheel::resizeGL(int width, int height) {
|
void HexagonalColorWheel::resizeGL(int w, int h) {
|
||||||
float d = (width - 5.0f) / 2.5f;
|
float d = (w - 5.0f) / 2.5f;
|
||||||
bool isHorizontallyLong = ((d * 1.732f) < height) ? false : true;
|
bool isHorizontallyLong = ((d * 1.732f) < h) ? false : true;
|
||||||
|
|
||||||
if (isHorizontallyLong) {
|
if (isHorizontallyLong) {
|
||||||
m_triEdgeLen = (float)height / 1.732f;
|
m_triEdgeLen = (float)h / 1.732f;
|
||||||
m_triHeight = (float)height / 2.0f;
|
m_triHeight = (float)h / 2.0f;
|
||||||
m_wheelPosition.setX(((float)width - (m_triEdgeLen * 2.5f + 5.0f)) / 2.0f);
|
m_wheelPosition.setX(((float)w - (m_triEdgeLen * 2.5f + 5.0f)) / 2.0f);
|
||||||
m_wheelPosition.setY(0.0f);
|
m_wheelPosition.setY(0.0f);
|
||||||
} else {
|
} else {
|
||||||
m_triEdgeLen = d;
|
m_triEdgeLen = d;
|
||||||
m_triHeight = m_triEdgeLen * 0.866f;
|
m_triHeight = m_triEdgeLen * 0.866f;
|
||||||
m_wheelPosition.setX(0.0f);
|
m_wheelPosition.setX(0.0f);
|
||||||
m_wheelPosition.setY(((float)height - (m_triHeight * 2.0f)) / 2.0f);
|
m_wheelPosition.setY(((float)h - (m_triHeight * 2.0f)) / 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set all vertices positions
|
// set all vertices positions
|
||||||
|
@ -637,16 +637,16 @@ void HexagonalColorWheel::resizeGL(int width, int height) {
|
||||||
m_leftp[2].setY(0.0f);
|
m_leftp[2].setY(0.0f);
|
||||||
|
|
||||||
// GL settings
|
// GL settings
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, w, h);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0.0, (GLdouble)width, (GLdouble)height, 0.0, 1.0, -1.0);
|
glOrtho(0.0, (GLdouble)w, (GLdouble)h, 0.0, 1.0, -1.0);
|
||||||
|
|
||||||
// iwsw commented out temporarily
|
// iwsw commented out temporarily
|
||||||
/*
|
/*
|
||||||
if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() &&
|
if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() &&
|
||||||
m_ghibli3DLutUtil)
|
m_ghibli3DLutUtil)
|
||||||
m_ghibli3DLutUtil->onResize(width,height);
|
m_ghibli3DLutUtil->onResize(w,h);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,15 +777,16 @@ void HexagonalColorWheel::mousePressEvent(QMouseEvent *event) {
|
||||||
|
|
||||||
// check whether the mouse cursor is in the wheel or in the triangle (or
|
// check whether the mouse cursor is in the wheel or in the triangle (or
|
||||||
// nothing).
|
// nothing).
|
||||||
|
QPoint curPos = event->pos() * getDevPixRatio();
|
||||||
|
|
||||||
QPolygonF wheelPolygon;
|
QPolygonF wheelPolygon;
|
||||||
// in the case of the wheel
|
// in the case of the wheel
|
||||||
wheelPolygon << m_wp[1] << m_wp[2] << m_wp[3] << m_wp[4] << m_wp[5]
|
wheelPolygon << m_wp[1] << m_wp[2] << m_wp[3] << m_wp[4] << m_wp[5]
|
||||||
<< m_wp[6];
|
<< m_wp[6];
|
||||||
wheelPolygon.translate(m_wheelPosition);
|
wheelPolygon.translate(m_wheelPosition);
|
||||||
if (wheelPolygon.toPolygon().containsPoint(event->pos(), Qt::OddEvenFill)) {
|
if (wheelPolygon.toPolygon().containsPoint(curPos, Qt::OddEvenFill)) {
|
||||||
m_currentWheel = leftWheel;
|
m_currentWheel = leftWheel;
|
||||||
clickLeftWheel(event->pos());
|
clickLeftWheel(curPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,9 +794,9 @@ void HexagonalColorWheel::mousePressEvent(QMouseEvent *event) {
|
||||||
// in the case of the triangle
|
// in the case of the triangle
|
||||||
wheelPolygon << m_leftp[0] << m_leftp[1] << m_leftp[2];
|
wheelPolygon << m_leftp[0] << m_leftp[1] << m_leftp[2];
|
||||||
wheelPolygon.translate(m_wheelPosition);
|
wheelPolygon.translate(m_wheelPosition);
|
||||||
if (wheelPolygon.toPolygon().containsPoint(event->pos(), Qt::OddEvenFill)) {
|
if (wheelPolygon.toPolygon().containsPoint(curPos, Qt::OddEvenFill)) {
|
||||||
m_currentWheel = rightTriangle;
|
m_currentWheel = rightTriangle;
|
||||||
clickRightTriangle(event->pos());
|
clickRightTriangle(curPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,10 +812,10 @@ void HexagonalColorWheel::mouseMoveEvent(QMouseEvent *event) {
|
||||||
case none:
|
case none:
|
||||||
break;
|
break;
|
||||||
case leftWheel:
|
case leftWheel:
|
||||||
clickLeftWheel(event->pos());
|
clickLeftWheel(event->pos() * getDevPixRatio());
|
||||||
break;
|
break;
|
||||||
case rightTriangle:
|
case rightTriangle:
|
||||||
clickRightTriangle(event->pos());
|
clickRightTriangle(event->pos() * getDevPixRatio());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue