Merge pull request #1132 from shun-iwasawa/hi_resolution
High dpi monitors support
This commit is contained in:
commit
039ecc9c2c
23 changed files with 236 additions and 105 deletions
|
@ -3,7 +3,7 @@ pushd thirdparty/tiff-4.0.3
|
||||||
CFLAGS="-fPIC" CXXFLAGS="-fPIC" ./configure --disable-jbig && make
|
CFLAGS="-fPIC" CXXFLAGS="-fPIC" ./configure --disable-jbig && make
|
||||||
popd
|
popd
|
||||||
cd toonz && mkdir build && cd build
|
cd toonz && mkdir build && cd build
|
||||||
source /opt/qt55/bin/qt55-env.sh
|
source /opt/qt56/bin/qt56-env.sh
|
||||||
cmake ../sources \
|
cmake ../sources \
|
||||||
-DWITH_SYSTEM_SUPERLU:BOOL=OFF
|
-DWITH_SYSTEM_SUPERLU:BOOL=OFF
|
||||||
# according to https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments
|
# according to https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
sudo add-apt-repository --yes ppa:beineri/opt-qt551-trusty
|
sudo add-apt-repository --yes ppa:beineri/opt-qt562-trusty
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y liblzo2-dev liblz4-dev libfreetype6-dev libpng-dev libsdl2-dev libglew-dev freeglut3-dev qt55script libsuperlu3-dev libpng-dev qt55svg qt55tools qt55multimedia wget libusb-1.0-0-dev libboost-all-dev liblzma-dev
|
sudo apt-get install -y liblzo2-dev liblz4-dev libfreetype6-dev libpng-dev libsdl2-dev libglew-dev freeglut3-dev qt56script libsuperlu3-dev libpng-dev qt56svg qt56tools qt56multimedia wget libusb-1.0-0-dev libboost-all-dev liblzma-dev
|
||||||
# someone forgot to include liblz4.pc with the package, use the version from xenial, as it only depends on libc
|
# someone forgot to include liblz4.pc with the package, use the version from xenial, as it only depends on libc
|
||||||
wget http://mirrors.kernel.org/ubuntu/pool/main/l/lz4/liblz4-1_0.0~r131-2ubuntu2_amd64.deb -O liblz4.deb
|
wget http://mirrors.kernel.org/ubuntu/pool/main/l/lz4/liblz4-1_0.0~r131-2ubuntu2_amd64.deb -O liblz4.deb
|
||||||
wget http://mirrors.kernel.org/ubuntu/pool/main/l/lz4/liblz4-dev_0.0~r131-2ubuntu2_amd64.deb -O liblz4-dev.deb
|
wget http://mirrors.kernel.org/ubuntu/pool/main/l/lz4/liblz4-dev_0.0~r131-2ubuntu2_amd64.deb -O liblz4-dev.deb
|
||||||
|
|
|
@ -6,7 +6,7 @@ Building OpenToonz from source requires the following dependencies:
|
||||||
- Git
|
- Git
|
||||||
- GCC or Clang
|
- GCC or Clang
|
||||||
- CMake (3.4.1 or newer).
|
- CMake (3.4.1 or newer).
|
||||||
- Qt5 (5.5 or newer)
|
- Qt5 (5.6 or newer)
|
||||||
- Boost (1.55 or newer)
|
- Boost (1.55 or newer)
|
||||||
- SDL2
|
- SDL2
|
||||||
- LibPNG
|
- LibPNG
|
||||||
|
|
38
toonz/cmake/BundleInfo.plist.in
Normal file
38
toonz/cmake/BundleInfo.plist.in
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>OpenToonz_1.1</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>OpenToonz.icns</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSRequiresCarbon</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -538,4 +538,6 @@ if(APPLE)
|
||||||
${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH}
|
${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH}
|
||||||
$<TARGET_FILE:executable>
|
$<TARGET_FILE:executable>
|
||||||
)
|
)
|
||||||
|
# add capability for retina displays
|
||||||
|
set_target_properties(OpenToonz_1.1 PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/../cmake/BundleInfo.plist.in)
|
||||||
endif()
|
endif()
|
||||||
|
|
32
toonz/sources/include/toonzqt/glwidget_for_highdpi.h
Normal file
32
toonz/sources/include/toonzqt/glwidget_for_highdpi.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#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) {}
|
||||||
|
|
||||||
|
// returns device-pixel ratio. It is 1 for normal monitors and 2 (or higher
|
||||||
|
// ratio) for high DPI monitors. Setting "Display > Set custom text size(DPI)"
|
||||||
|
// for Windows corresponds to this ratio.
|
||||||
|
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,
|
||||||
|
|
|
@ -263,6 +263,12 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enables high-DPI scaling. This attribute must be set before QApplication is
|
||||||
|
// constructed. Available from Qt 5.6.
|
||||||
|
#if QT_VERSION >= 0x050600
|
||||||
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
#endif
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
|
@ -340,6 +346,9 @@ int main(int argc, char *argv[]) {
|
||||||
a.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
a.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Enable to render smooth icons on high dpi monitors
|
||||||
|
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
|
|
||||||
// Set the app's locale for numeric stuff to standard C. This is important for
|
// Set the app's locale for numeric stuff to standard C. This is important for
|
||||||
// atof() and similar
|
// atof() and similar
|
||||||
// calls that are locale-dependant.
|
// calls that are locale-dependant.
|
||||||
|
@ -360,10 +369,12 @@ int main(int argc, char *argv[]) {
|
||||||
// splash screen
|
// splash screen
|
||||||
QPixmap splashPixmap(":Resources/splash.png");
|
QPixmap splashPixmap(":Resources/splash.png");
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
a.setFont(QFont("Arial", 10));
|
QFont font("Arial", -1);
|
||||||
#else
|
#else
|
||||||
a.setFont(QFont("Helvetica", 10));
|
QFont font("Helvetica", -1);
|
||||||
#endif
|
#endif
|
||||||
|
font.setPixelSize(13);
|
||||||
|
a.setFont(font);
|
||||||
|
|
||||||
QString offsetStr("\n\n\n\n\n\n\n\n");
|
QString offsetStr("\n\n\n\n\n\n\n\n");
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -765,6 +765,7 @@ TPointD SceneViewer::winToWorld(const QPoint &pos) const {
|
||||||
} else
|
} else
|
||||||
return TAffine() * TPointD(0, 0);
|
return TAffine() * TPointD(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getViewMatrix().inv() * pp;
|
return getViewMatrix().inv() * pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2556,10 +2557,12 @@ void SceneViewer::invalidateToolStatus() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TRectD SceneViewer::getGeometry() const {
|
TRectD SceneViewer::getGeometry() const {
|
||||||
|
int devPixRatio = getDevPixRatio();
|
||||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||||
TPointD topLeft = tool->getMatrix().inv() * winToWorld(geometry().topLeft());
|
TPointD topLeft =
|
||||||
TPointD bottomRight =
|
tool->getMatrix().inv() * winToWorld(geometry().topLeft() * devPixRatio);
|
||||||
tool->getMatrix().inv() * winToWorld(geometry().bottomRight());
|
TPointD bottomRight = tool->getMatrix().inv() *
|
||||||
|
winToWorld(geometry().bottomRight() * devPixRatio);
|
||||||
|
|
||||||
TObjectHandle *objHandle = TApp::instance()->getCurrentObject();
|
TObjectHandle *objHandle = TApp::instance()->getCurrentObject();
|
||||||
if (tool->getToolType() & TTool::LevelTool && !objHandle->isSpline()) {
|
if (tool->getToolType() & TTool::LevelTool && !objHandle->isSpline()) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -75,9 +75,9 @@ 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) {
|
||||||
toonzEvent.m_pos =
|
toonzEvent.m_pos = TPoint(event->pos().x() * devPixRatio,
|
||||||
TPoint(event->pos().x(), widgetHeight - 1 - event->pos().y());
|
widgetHeight - 1 - event->pos().y() * devPixRatio);
|
||||||
toonzEvent.m_pressure = isTablet ? int(255 * pressure) : 255;
|
toonzEvent.m_pressure = isTablet ? int(255 * pressure) : 255;
|
||||||
|
|
||||||
toonzEvent.setModifiers(event->modifiers() & Qt::ShiftModifier,
|
toonzEvent.setModifiers(event->modifiers() & Qt::ShiftModifier,
|
||||||
|
@ -274,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();
|
QPoint curPos = event->pos() * getDevPixRatio();
|
||||||
bool cursorSet = false;
|
bool cursorSet = false;
|
||||||
m_lastMousePos = curPos;
|
m_lastMousePos = curPos;
|
||||||
|
|
||||||
|
@ -359,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;
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ void SceneViewer::mousePressEvent(QMouseEvent *event) {
|
||||||
|
|
||||||
if (m_mouseButton != Qt::NoButton) return;
|
if (m_mouseButton != Qt::NoButton) return;
|
||||||
|
|
||||||
m_pos = event->pos();
|
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
|
||||||
|
@ -476,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);
|
||||||
|
@ -542,8 +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() * winToWorld(event->pos());
|
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()) {
|
||||||
|
@ -620,8 +622,9 @@ void SceneViewer::wheelEvent(QWheelEvent *event) {
|
||||||
} else if (delta > 0) {
|
} else if (delta > 0) {
|
||||||
CommandManager::instance()->execute("MI_PrevDrawing");
|
CommandManager::instance()->execute("MI_PrevDrawing");
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
zoomQt(event->pos(), exp(0.001 * delta));
|
zoomQt(event->pos() * getDevPixRatio(), exp(0.001 * delta));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
@ -1000,8 +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() * winToWorld(event->pos());
|
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;
|
||||||
|
@ -1036,7 +1041,9 @@ 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;
|
||||||
|
|
||||||
TPoint winPos(e->pos().x(), height() - e->pos().y());
|
int devPixRatio = getDevPixRatio();
|
||||||
|
TPoint winPos(e->pos().x() * devPixRatio,
|
||||||
|
height() - e->pos().y() * devPixRatio);
|
||||||
std::vector<int> columnIndices;
|
std::vector<int> columnIndices;
|
||||||
// enable to select all the columns regardless of the click position
|
// enable to select all the columns regardless of the click position
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
|
@ -1047,8 +1054,8 @@ void SceneViewer::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
SceneViewerContextMenu *menu = new SceneViewerContextMenu(this);
|
SceneViewerContextMenu *menu = new SceneViewerContextMenu(this);
|
||||||
|
|
||||||
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
TTool *tool = TApp::instance()->getCurrentTool()->getTool();
|
||||||
TPointD pos =
|
TPointD pos = ((tool) ? tool->getMatrix().inv() : TAffine()) *
|
||||||
((tool) ? tool->getMatrix().inv() : TAffine()) * winToWorld(e->pos());
|
winToWorld(e->pos() * devPixRatio);
|
||||||
menu->addEnterGroupCommands(pos);
|
menu->addEnterGroupCommands(pos);
|
||||||
|
|
||||||
menu->addLevelCommands(columnIndices);
|
menu->addLevelCommands(columnIndices);
|
||||||
|
|
|
@ -119,7 +119,7 @@ bool PreviewSubCameraManager::mousePressEvent(SceneViewer *viewer,
|
||||||
if (viewer->is3DView()) return true;
|
if (viewer->is3DView()) return true;
|
||||||
|
|
||||||
m_mousePressed = true;
|
m_mousePressed = true;
|
||||||
m_mousePressPos = event->pos();
|
m_mousePressPos = event->pos() * viewer->getDevPixRatio();
|
||||||
m_dragType = getSubCameraDragEnum(viewer, m_mousePressPos);
|
m_dragType = getSubCameraDragEnum(viewer, m_mousePressPos);
|
||||||
|
|
||||||
if (bitwiseExclude(m_dragType, OUTER))
|
if (bitwiseExclude(m_dragType, OUTER))
|
||||||
|
@ -133,8 +133,7 @@ bool PreviewSubCameraManager::mousePressEvent(SceneViewer *viewer,
|
||||||
bool PreviewSubCameraManager::mouseMoveEvent(SceneViewer *viewer,
|
bool PreviewSubCameraManager::mouseMoveEvent(SceneViewer *viewer,
|
||||||
QMouseEvent *event) {
|
QMouseEvent *event) {
|
||||||
if (viewer->is3DView()) return true;
|
if (viewer->is3DView()) return true;
|
||||||
|
QPoint curPos(event->pos() * viewer->getDevPixRatio());
|
||||||
QPoint curPos(event->pos());
|
|
||||||
if (event->buttons() == Qt::LeftButton) {
|
if (event->buttons() == Qt::LeftButton) {
|
||||||
if (!bitwiseContains(m_dragType, INNER)) {
|
if (!bitwiseContains(m_dragType, INNER)) {
|
||||||
if (abs(curPos.x() - m_mousePressPos.x()) > 10 ||
|
if (abs(curPos.x() - m_mousePressPos.x()) > 10 ||
|
||||||
|
|
|
@ -57,6 +57,8 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
//===================================================================
|
//===================================================================
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
@ -1376,16 +1378,21 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {
|
||||||
QString text = cell.getSoundTextLevel()->getFrameText(fid.getNumber() - 1);
|
QString text = cell.getSoundTextLevel()->getFrameText(fid.getNumber() - 1);
|
||||||
p.setPen(Qt::black);
|
p.setPen(Qt::black);
|
||||||
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
|
||||||
QFontMetrics metric(font);
|
QFontMetrics metric(font);
|
||||||
QString elidaName = elideText(text, metric, nameRect.width(), "~");
|
QString elidaName = elideText(text, metric, nameRect.width(), "~");
|
||||||
#else
|
#else
|
||||||
QString elidaName = elideText(text, font, nameRect.width(), "~");
|
QString elidaName = elideText(text, font, nameRect.width(), "~");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!sameLevel || prevCell.m_frameId != fid)
|
if (!sameLevel || prevCell.m_frameId != fid)
|
||||||
|
@ -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);
|
||||||
|
|
|
@ -13,13 +13,8 @@
|
||||||
#include "cellkeyframeselection.h"
|
#include "cellkeyframeselection.h"
|
||||||
#include "toonzqt/spreadsheetviewer.h"
|
#include "toonzqt/spreadsheetviewer.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#define XSHEET_FONT_PX_SIZE 12
|
||||||
#define XSHEET_FONT_SIZE 9
|
|
||||||
#define H_ADJUST 2
|
#define H_ADJUST 2
|
||||||
#else
|
|
||||||
#define XSHEET_FONT_SIZE 11
|
|
||||||
#define H_ADJUST 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// forward declaration
|
// forward declaration
|
||||||
class TXsheet;
|
class TXsheet;
|
||||||
|
|
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -641,10 +641,11 @@ void FunctionSheetCellViewer::drawCells(QPainter &painter, int r0, int c0,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static QFont font("Arial", 9, QFont::Normal);
|
static QFont font("Arial", -1, QFont::Bold);
|
||||||
#else
|
#else
|
||||||
static QFont font("Helvetica", 9, QFont::Normal);
|
static QFont font("Helvetica", -1, QFont::Bold);
|
||||||
#endif
|
#endif
|
||||||
|
font.setPixelSize(12);
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.drawText(cellRect.adjusted(10, 0, 0, 0),
|
painter.drawText(cellRect.adjusted(10, 0, 0, 0),
|
||||||
Qt::AlignVCenter | Qt::AlignLeft, text);
|
Qt::AlignVCenter | Qt::AlignLeft, text);
|
||||||
|
|
|
@ -237,10 +237,11 @@ DragTool *RowPanel::createDragTool(QMouseEvent *) {
|
||||||
|
|
||||||
void RowPanel::drawRows(QPainter &p, int r0, int r1) {
|
void RowPanel::drawRows(QPainter &p, int r0, int r1) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static QFont font("Arial", 9, QFont::Bold);
|
static QFont font("Arial", -1, QFont::Bold);
|
||||||
#else
|
#else
|
||||||
static QFont font("Helvetica", 9, QFont::Bold);
|
static QFont font("Helvetica", -1, QFont::Bold);
|
||||||
#endif
|
#endif
|
||||||
|
font.setPixelSize(12);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
QRect visibleRect = visibleRegion().boundingRect();
|
QRect visibleRect = visibleRegion().boundingRect();
|
||||||
|
|
|
@ -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