|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef GUTIL_H
|
|
Toshihiro Shimizu |
890ddd |
#define GUTIL_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
#include <qimage></qimage>
|
|
Toshihiro Shimizu |
890ddd |
#include <qframe></qframe>
|
|
Toshihiro Shimizu |
890ddd |
#include <qcolor></qcolor>
|
|
Toshihiro Shimizu |
890ddd |
#include "traster.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TOONZQT_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// forward declaration
|
|
Toshihiro Shimizu |
890ddd |
class TMouseEvent;
|
|
Toshihiro Shimizu |
890ddd |
class QMouseEvent;
|
|
Toshihiro Shimizu |
890ddd |
class QTabletEvent;
|
|
Toshihiro Shimizu |
890ddd |
class QKeyEvent;
|
|
Toshihiro Shimizu |
890ddd |
class QUrl;
|
|
Toshihiro Shimizu |
890ddd |
class TFilePath;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// Constant definition
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
const QColor grey120(120, 120, 120);
|
|
Toshihiro Shimizu |
890ddd |
const QColor grey210(210, 210, 210);
|
|
Toshihiro Shimizu |
890ddd |
const QColor grey225(225, 225, 225);
|
|
Toshihiro Shimizu |
890ddd |
const QColor grey190(190, 190, 190);
|
|
Toshihiro Shimizu |
890ddd |
const QColor grey150(150, 150, 150);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} // namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class QPainter;
|
|
Toshihiro Shimizu |
890ddd |
class QIcon;
|
|
Toshihiro Shimizu |
890ddd |
class TFilePath;
|
|
Toshihiro Shimizu |
890ddd |
class QPainterPath;
|
|
Toshihiro Shimizu |
890ddd |
class TStroke;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
ea4f7e |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString DVAPI fileSizeString(qint64 size, int precision = 2);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
ea4f7e |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QImage DVAPI rasterToQImage(const TRasterP &ras, bool premultiplied = true, bool mirrored = true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QPixmap DVAPI rasterToQPixmap(const TRaster32P &ras, bool premultiplied = true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P DVAPI rasterFromQImage(QImage image, bool premultiply = true, bool mirror = true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P DVAPI rasterFromQPixmap(QPixmap pixmap, bool premultiply = true, bool mirror = true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void DVAPI drawPolygon(QPainter &p,
|
|
Toshihiro Shimizu |
890ddd |
const std::vector<qpointf> &points,</qpointf>
|
|
Toshihiro Shimizu |
890ddd |
bool fill = false,
|
|
Toshihiro Shimizu |
890ddd |
const QColor colorFill = Qt::white,
|
|
Toshihiro Shimizu |
890ddd |
const QColor colorLine = Qt::black);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void DVAPI drawArrow(QPainter &p,
|
|
Toshihiro Shimizu |
890ddd |
const QPointF a, const QPointF b, const QPointF c,
|
|
Toshihiro Shimizu |
890ddd |
bool fill = false,
|
|
Toshihiro Shimizu |
890ddd |
const QColor colorFill = Qt::white,
|
|
Toshihiro Shimizu |
890ddd |
const QColor colorLine = Qt::black);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QPixmap DVAPI scalePixmapKeepingAspectRatio(QPixmap p, QSize size, QColor color = Qt::white);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
QIcon DVAPI createQIcon(const char *iconSVGName);
|
|
Toshihiro Shimizu |
890ddd |
QIcon DVAPI createQIconPNG(const char *iconPNGName);
|
|
Toshihiro Shimizu |
890ddd |
QIcon DVAPI createQIconOnOff(const char *iconSVGName, bool withOver = true);
|
|
Toshihiro Shimizu |
890ddd |
QIcon DVAPI createQIconOnOffPNG(const char *iconPNGName, bool withOver = true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline QSize DVAPI dimension2QSize(const TDimension &sz) { return QSize(sz.lx, sz.ly); }
|
|
Toshihiro Shimizu |
890ddd |
inline TDimension DVAPI qsize2Dimension(const QSize &sz) { return TDimension(sz.width(), sz.height()); }
|
|
Toshihiro Shimizu |
890ddd |
QString DVAPI toQString(const TFilePath &path);
|
|
Toshihiro Shimizu |
890ddd |
bool DVAPI isSpaceString(const QString &str);
|
|
Toshihiro Shimizu |
890ddd |
bool DVAPI isValidFileName(const QString &fileName);
|
|
Toshihiro Shimizu |
890ddd |
bool DVAPI isValidFileName_message(const QString &fileName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString DVAPI elideText(const QString &columnName, const QFont &font, int width);
|
|
Toshihiro Shimizu |
890ddd |
QString DVAPI elideText(const QString &columnName, const QFontMetrics &fm, int width, const QString &elideSymbol);
|
|
Toshihiro Shimizu |
890ddd |
QUrl DVAPI pathToUrl(const TFilePath &path);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool DVAPI isResource(const QString &path);
|
|
Toshihiro Shimizu |
890ddd |
bool DVAPI isResource(const QUrl &url);
|
|
Toshihiro Shimizu |
890ddd |
bool DVAPI isResourceOrFolder(const QUrl &url);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool DVAPI acceptResourceDrop(const QList<qurl> &urls);</qurl>
|
|
Toshihiro Shimizu |
890ddd |
bool DVAPI acceptResourceOrFolderDrop(const QList<qurl> &urls);</qurl>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline QPointF DVAPI toQPointF(const TPointD &p) { return QPointF(p.x, p.y); }
|
|
Toshihiro Shimizu |
890ddd |
inline QPointF DVAPI toQPointF(const TPoint &p) { return QPointF(p.x, p.y); }
|
|
Toshihiro Shimizu |
890ddd |
inline QPoint DVAPI toQPoint(const TPoint &p) { return QPoint(p.x, p.y); }
|
|
Toshihiro Shimizu |
890ddd |
inline TPointD DVAPI toTPointD(const QPointF &p) { return TPointD(p.x(), p.y()); }
|
|
Toshihiro Shimizu |
890ddd |
inline TPointD DVAPI toTPointD(const QPoint &p) { return TPointD(p.x(), p.y()); }
|
|
Toshihiro Shimizu |
890ddd |
inline TPoint DVAPI toTPoint(const QPoint &p) { return TPoint(p.x(), p.y()); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline QRect DVAPI toQRect(const TRect &r) { return QRect(r.x0, r.y0, r.getLx(), r.getLy()); }
|
|
Toshihiro Shimizu |
890ddd |
inline QRectF DVAPI toQRectF(const TRectD &r) { return QRectF(r.x0, r.y0, r.getLx(), r.getLy()); }
|
|
Toshihiro Shimizu |
890ddd |
inline QRectF DVAPI toQRectF(const TRect &r) { return QRectF(r.x0, r.y0, r.getLx(), r.getLy()); }
|
|
Toshihiro Shimizu |
890ddd |
inline TRect DVAPI toTRect(const QRect &r) { return TRect(r.left(), r.top(), r.right(), r.bottom()); }
|
|
Toshihiro Shimizu |
890ddd |
inline TRectD DVAPI toTRectD(const QRectF &r) { return TRectD(r.left(), r.top(), r.right(), r.bottom()); }
|
|
Toshihiro Shimizu |
890ddd |
inline TRectD DVAPI toTRectD(const QRect &r) { return TRectD(r.left(), r.top(), r.right() + 1, r.bottom() + 1); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QPainterPath DVAPI strokeToPainterPath(TStroke *stroke);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
// This widget is only used to set the background color of the tabBar
|
|
Toshihiro Shimizu |
890ddd |
// using the styleSheet.
|
|
Toshihiro Shimizu |
890ddd |
// It is also used to take 6px on the left before the tabBar
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TabBarContainter : public QFrame
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TabBarContainter(QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
// This widget is only used to set the background color of the playToolBar
|
|
Toshihiro Shimizu |
890ddd |
// using the styleSheet. And to put a line in the upper zone
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI ToolBarContainer : public QFrame
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ToolBarContainer(QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString DVAPI operator+(const QString &a, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif //GUTIL_H
|