af90cdedbe
* add multi arc mockup * implement mutli arc * add join and smooth option * reset multiarc and arc when deactivated * create self loop if the last point is the same as the first * make join option in multiarc consistent with tape tool * fix a bug where thickness don't affect mutliarc in vector level * remove join option in geometric tool * stop mutliarc after closing shape * double click can also end multi arc * fix a bug where multiArc will produce buggy stroke * fix a bug where geometric tools is not deactivated * add multiArc shortcut * rewrite multiArc * revert changes to tvectorimage * add undo data for multiArc * Paste as Copy Command for XSheet * Remove unneeded code * Bug fix * prevent guide lines from jumping around in MultiArc * make stroke color consistent in MultiArc * remove color in MultiArc's undo data * make color consistent in MultiArc with previous version * Fix single image raster levels * fix compilation error * fix a bug where multiArc might generate bugged stroke * Remove ICONV dep (#3304) * fix crash on saving studio palette * Move to Paste Special Menu * Don't Set Fixed Width if Docking a Floating Panel * Update how_to_build_win.md New draft of pr for requested changes to windows build instructions. * fix geometric tool multiarc smooth option * fix level saving failure * fix wrong warning after saving palette * fix a bug where moving a control point while holding alt has unintended result * fix travis-install (#3389) * Fix assert debug crash in flipconsole.cpp Fix crash when using the viewer controls in the console (debug) * Redraw Audio Waveform Fills the waveform rather than outlines it. * Update .gitignore * fix undo data when drawing arc and mutliarc * fix overwriting raster drawing palette (#3387) * mode sensitive fx settings * Create New Style Command Button (#3394) * Create New Style Command Button This PR creates a new button in the pallette editor that creates a new style. Button is large and easy access for a faster and easier workflow. Original code developed by Turtletooth for Tahoma. Given permission to develop within Openoonz. Co-Authored-By: Jeremy Bullock <turtletooth@users.noreply.github.com> * Update paletteviewergui.cpp Made changes to the PR per request by Shun. * Fixed a space within the code that wasn't suppose to be there. Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> * tahoma license (#3396) * new style button optional * fix loading pegbars (removing updateKeyframes) * periodic random expression * add fx in linear color space this commit is based on source for the ComposeAdd plugin fx by DWANGO Co., Ltd. in dwango_opentoonz_plugins and opentoonz_plugin_utility repositories. * fractal noise iwa fx * skip unnecessary icon invalidation * fix frame range fill with tablet * stop function editor to open by dbl clicking key * Expanding the radius of the rotation handle. This just changes when the cursor transforms into the rotation tool. (cherry picked from commit 7722ae989bbdc6aa5cb48df7a4c08bae1fe6ea39) * fix vector img patern stroke style * Update Stylesheets - Support the new icon sizes - XSheet and Timeline significantly redesigned - Lots of margin fixes and refactoring - Remove deprecated icons, as some icons are moved into binary - New Light theme * New Icons - Redesigns almost every icon as symbolic - Adds icons for most commands * Add Option for Icon Themes - Adds option for icon themes - Removes useless label from Preferences category list * Update Icon Functions - Adds themePath() boolean - Adds function for recoloring black pixels in pixmaps to any color - Rebuilds createQIcon to use fromTheme() and recolorPixmap() - Removes createQIconOnOff as it seemed to be a rarely used duplicate of createQIcon - Removes a grey horizontal line drawn above the console play bar in the viewer * Set Default Icon Theme and Paths - Sets search paths for icons for use with QIcon::fromTheme() - Sets default start icon theme on first install - Sets flag for displaying icons in menus, so we can selectively hide them * Set Icons for Commands - Sets icons for the commands - Hides icons being displayed in menus as most icons are 20x20, they will look blurry when shrunk to 16x16 - Selectively allows icons to display for Tools in menus * Change Icon Sizes, General Fixes and Stylesheet Additions - Change icon sizes to new size - Remove margin around FX Editor window - Remove white line under color sliders in Style Editor - Make keyframe icons uniform and color stylable in the stylesheets - Removes deprecated stylesheet strings - Redesign GUI for palette list view - Make tree list header sort row stylable - Remove black lines from scrollbars in New Project window - Remove margin around combobox in Level Strip - Alter how some lines are drawn in the Timeline to fix some alpha issues - Make conditional fixed onion skin and normal onion skin dots contrast more against a light background area to make sure they have good visibility - Make text always viewable in the FPS field in console bar - Increase size of radio buttons in Cleanup Settings - Increase size of switches in motion path nodes - Remove unessesary "Layer" label in Timeline and other rects - Various colors made stylable in the stylesheets; palette numpad and selection frame, cleanup settings border, scene cast folder path, schematic lines, ruler, xsheet lines, keyframes, cell input box and more - Moves some external stylesheet icons into binary * Make TPanelTitleBar Icon States Stylable - Makes icon states for TPanelTitleBar buttons stylable in stylesheets * Travis Fixes * Swap Startup Popup Logos They were in the wrong folders * Revert "Swap Startup Popup Logos" This reverts commit 815908a9f3e725f48507dab8a2270bdfa045649d. * Fix Startup Popup Logo It wasn't switching * Feedback Changes - Change render visualization to clapboard - Fix text contrast on levels in XSheet * Make Cell Selection More Clear * Darken Light Theme and Tint Empty Cell Selection * Fix missing icons * Fix memo button * Bring back colors * Hide Motion Tab * Fix Play Range Area (Light) Make play range area more visible * Vector Column Color Co-authored-by: pojienie <pojienie@gmail.com> Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun.iwasawa@ghibli.jp> Co-authored-by: Rodney <rodney.baker@gmail.com> Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com> Co-authored-by: Kite <konero@users.noreply.github.com> Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> Co-authored-by: DoctorRyan <doctorryan1969.gmail.com>
215 lines
7.6 KiB
C++
215 lines
7.6 KiB
C++
#pragma once
|
|
|
|
#ifndef GUTIL_H
|
|
#define GUTIL_H
|
|
|
|
#include "tcommon.h"
|
|
#include <QImage>
|
|
#include <QFrame>
|
|
#include <QColor>
|
|
#include "traster.h"
|
|
#include "toonz/preferences.h"
|
|
|
|
#undef DVAPI
|
|
#undef DVVAR
|
|
#ifdef TOONZQT_EXPORTS
|
|
#define DVAPI DV_EXPORT_API
|
|
#define DVVAR DV_EXPORT_VAR
|
|
#else
|
|
#define DVAPI DV_IMPORT_API
|
|
#define DVVAR DV_IMPORT_VAR
|
|
#endif
|
|
|
|
// forward declaration
|
|
class TMouseEvent;
|
|
class QMouseEvent;
|
|
class QTabletEvent;
|
|
class QKeyEvent;
|
|
class QUrl;
|
|
class TFilePath;
|
|
|
|
//=============================================================================
|
|
// Constant definition
|
|
//-----------------------------------------------------------------------------
|
|
|
|
namespace {
|
|
const QColor grey120(120, 120, 120);
|
|
const QColor grey210(210, 210, 210);
|
|
const QColor grey225(225, 225, 225);
|
|
const QColor grey190(190, 190, 190);
|
|
const QColor grey150(150, 150, 150);
|
|
|
|
} // namespace
|
|
|
|
class QPainter;
|
|
class QIcon;
|
|
class TFilePath;
|
|
class QPainterPath;
|
|
class TStroke;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QString DVAPI getIconThemePath(const QString &filePath);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QString DVAPI fileSizeString(qint64 size, int precision = 2);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QImage DVAPI rasterToQImage(const TRasterP &ras, bool premultiplied = true,
|
|
bool mirrored = true);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QPixmap DVAPI rasterToQPixmap(const TRaster32P &ras, bool premultiplied = true,
|
|
bool setDevPixRatio = false);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
TRaster32P DVAPI rasterFromQImage(QImage image, bool premultiply = true,
|
|
bool mirror = true);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
TRaster32P DVAPI rasterFromQPixmap(QPixmap pixmap, bool premultiply = true,
|
|
bool mirror = true);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void DVAPI drawPolygon(QPainter &p, const std::vector<QPointF> &points,
|
|
bool fill = false, const QColor colorFill = Qt::white,
|
|
const QColor colorLine = Qt::black);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void DVAPI drawArrow(QPainter &p, const QPointF a, const QPointF b,
|
|
const QPointF c, bool fill = false,
|
|
const QColor colorFill = Qt::white,
|
|
const QColor colorLine = Qt::black);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QPixmap DVAPI scalePixmapKeepingAspectRatio(QPixmap p, QSize size,
|
|
QColor color = Qt::white);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QPixmap DVAPI
|
|
svgToPixmap(const QString &svgFilePath, const QSize &size = QSize(),
|
|
Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio,
|
|
QColor bgColor = Qt::transparent);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// 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 DVAPI getDevPixRatio();
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QPixmap DVAPI setOpacity(QPixmap pixmap, const qreal &opacity = 0.8);
|
|
QPixmap DVAPI recolorPixmap(
|
|
QPixmap pixmap, QColor color = Preferences::instance()->getIconTheme()
|
|
? Qt::black
|
|
: Qt::white);
|
|
QIcon DVAPI createQIcon(const char *iconSVGName, bool useFullOpacity = false);
|
|
QIcon DVAPI createQIconPNG(const char *iconPNGName);
|
|
QIcon DVAPI createQIconOnOffPNG(const char *iconPNGName, bool withOver = true);
|
|
|
|
inline QSize dimension2QSize(const TDimension &sz) {
|
|
return QSize(sz.lx, sz.ly);
|
|
}
|
|
inline TDimension qsize2Dimension(const QSize &sz) {
|
|
return TDimension(sz.width(), sz.height());
|
|
}
|
|
QString DVAPI toQString(const TFilePath &path);
|
|
bool DVAPI isSpaceString(const QString &str);
|
|
bool DVAPI isValidFileName(const QString &fileName);
|
|
bool DVAPI isValidFileName_message(const QString &fileName);
|
|
bool DVAPI isReservedFileName(const QString &fileName);
|
|
bool DVAPI isReservedFileName_message(const QString &fileName);
|
|
|
|
QString DVAPI elideText(const QString &columnName, const QFont &font,
|
|
int width);
|
|
QString DVAPI elideText(const QString &columnName, const QFontMetrics &fm,
|
|
int width, const QString &elideSymbol);
|
|
QUrl DVAPI pathToUrl(const TFilePath &path);
|
|
|
|
bool DVAPI isResource(const QString &path);
|
|
bool DVAPI isResource(const QUrl &url);
|
|
bool DVAPI isResourceOrFolder(const QUrl &url);
|
|
|
|
bool DVAPI acceptResourceDrop(const QList<QUrl> &urls);
|
|
bool DVAPI acceptResourceOrFolderDrop(const QList<QUrl> &urls);
|
|
|
|
inline QPointF toQPointF(const TPointD &p) { return QPointF(p.x, p.y); }
|
|
inline QPointF toQPointF(const TPoint &p) { return QPointF(p.x, p.y); }
|
|
inline QPoint toQPoint(const TPoint &p) { return QPoint(p.x, p.y); }
|
|
inline TPointD toTPointD(const QPointF &p) { return TPointD(p.x(), p.y()); }
|
|
inline TPointD toTPointD(const QPoint &p) { return TPointD(p.x(), p.y()); }
|
|
inline TPoint toTPoint(const QPoint &p) { return TPoint(p.x(), p.y()); }
|
|
|
|
inline QRect toQRect(const TRect &r) {
|
|
return QRect(r.x0, r.y0, r.getLx(), r.getLy());
|
|
}
|
|
inline QRectF toQRectF(const TRectD &r) {
|
|
return QRectF(r.x0, r.y0, r.getLx(), r.getLy());
|
|
}
|
|
inline QRectF toQRectF(const TRect &r) {
|
|
return QRectF(r.x0, r.y0, r.getLx(), r.getLy());
|
|
}
|
|
inline TRect toTRect(const QRect &r) {
|
|
return TRect(r.left(), r.top(), r.right(), r.bottom());
|
|
}
|
|
inline TRectD toTRectD(const QRectF &r) {
|
|
return TRectD(r.left(), r.top(), r.right(), r.bottom());
|
|
}
|
|
inline TRectD toTRectD(const QRect &r) {
|
|
return TRectD(r.left(), r.top(), r.right() + 1, r.bottom() + 1);
|
|
}
|
|
|
|
QPainterPath DVAPI strokeToPainterPath(TStroke *stroke);
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// This widget is only used to set the background color of the tabBar
|
|
// using the styleSheet.
|
|
// It is also used to take 6px on the left before the tabBar
|
|
|
|
class DVAPI TabBarContainter final : public QFrame {
|
|
Q_OBJECT
|
|
public:
|
|
TabBarContainter(QWidget *parent = 0);
|
|
|
|
protected:
|
|
QColor m_bottomBelowLineColor, m_bottomAboveLineColor;
|
|
Q_PROPERTY(QColor BottomBelowLineColor READ getBottomBelowLineColor WRITE
|
|
setBottomBelowLineColor);
|
|
Q_PROPERTY(QColor BottomAboveLineColor READ getBottomAboveLineColor WRITE
|
|
setBottomAboveLineColor);
|
|
void paintEvent(QPaintEvent *event) override;
|
|
void setBottomBelowLineColor(const QColor &color) {
|
|
m_bottomBelowLineColor = color;
|
|
}
|
|
QColor getBottomBelowLineColor() const { return m_bottomBelowLineColor; }
|
|
void setBottomAboveLineColor(const QColor &color) {
|
|
m_bottomAboveLineColor = color;
|
|
}
|
|
QColor getBottomAboveLineColor() const { return m_bottomAboveLineColor; }
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// This widget is only used to set the background color of the playToolBar
|
|
// using the styleSheet. And to put a line in the upper zone
|
|
|
|
class DVAPI ToolBarContainer final : public QFrame {
|
|
public:
|
|
ToolBarContainer(QWidget *parent = 0);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
};
|
|
|
|
QString DVAPI operator+(const QString &a, const TFilePath &fp);
|
|
|
|
#endif // GUTIL_H
|