|
Jaroslav |
203cc8 |
#include "orientation.h"
|
|
Jaroslav |
203cc8 |
#include "toonz/columnfan.h"
|
|
manongjohn |
399e7d |
#include "toonz/preferences.h"
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
#include <qpainterpath></qpainterpath>
|
|
Jaroslav |
203cc8 |
#include <qboxlayout></qboxlayout>
|
|
Jaroslav |
203cc8 |
#include <math.h></math.h>
|
|
![](https://seccdn.libravatar.org/avatar/2e5dd0bee1e7e619066117de357c8458fc7e847f4345b0cb8a7a5413aa2a45a0?s=16&d=retro) |
d63d61 |
#include <stdexcept></stdexcept>
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
using std::pair;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
namespace {
|
|
Jaroslav |
203cc8 |
const int KEY_ICON_WIDTH = 11;
|
|
Jaroslav |
203cc8 |
const int KEY_ICON_HEIGHT = 13;
|
|
Jaroslav |
203cc8 |
const int EASE_TRIANGLE_SIZE = 4;
|
|
Jaroslav |
203cc8 |
const int PLAY_MARKER_SIZE = 10;
|
|
Jaroslav |
203cc8 |
const int ONION_SIZE = 19;
|
|
Jaroslav |
203cc8 |
const int ONION_DOT_SIZE = 8;
|
|
Jaroslav |
203cc8 |
const int PINNED_SIZE = 10;
|
|
manongjohn |
a21b06 |
const int FRAME_MARKER_SIZE = 4;
|
|
manongjohn |
2e094e |
const int FOLDED_CELL_SIZE = 9;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
class TopToBottomOrientation : public Orientation {
|
|
shun_iwasawa |
0cae24 |
const int CELL_WIDTH = 74;
|
|
shun_iwasawa |
0cae24 |
const int CELL_HEIGHT = 20;
|
|
shun_iwasawa |
0cae24 |
const int CELL_DRAG_WIDTH = 7;
|
|
manongjohn |
399e7d |
const int EXTENDER_WIDTH = 20;
|
|
shun_iwasawa |
0cae24 |
const int EXTENDER_HEIGHT = 8;
|
|
shun_iwasawa |
0cae24 |
const int SOUND_PREVIEW_WIDTH = 7;
|
|
manongjohn |
399e7d |
const int LAYER_HEADER_HEIGHT = 119;
|
|
Jaroslav |
203cc8 |
const int FOLDED_LAYER_HEADER_HEIGHT = LAYER_HEADER_HEIGHT;
|
|
shun_iwasawa |
0cae24 |
const int FOLDED_LAYER_HEADER_WIDTH = 8;
|
|
shun_iwasawa |
0cae24 |
const int FRAME_HEADER_WIDTH = CELL_WIDTH;
|
|
shun_iwasawa |
0cae24 |
const int PLAY_RANGE_X = FRAME_HEADER_WIDTH / 2 - PLAY_MARKER_SIZE;
|
|
Jaroslav |
203cc8 |
const int ONION_X = 0, ONION_Y = 0;
|
|
manongjohn |
399e7d |
const int ICON_WIDTH = 18;
|
|
manongjohn |
399e7d |
const int ICON_HEIGHT = 18;
|
|
manongjohn |
399e7d |
const int TRACKLEN = 60;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
public:
|
|
Jaroslav |
203cc8 |
TopToBottomOrientation();
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual CellPosition xyToPosition(const QPoint &xy,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const override;
|
|
Jaroslav |
203cc8 |
virtual QPoint positionToXY(const CellPosition &position,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const override;
|
|
Jaroslav |
203cc8 |
virtual CellPositionRatio xyToPositionRatio(const QPoint &xy) const override;
|
|
Jaroslav |
203cc8 |
virtual QPoint positionRatioToXY(
|
|
Jaroslav |
203cc8 |
const CellPositionRatio &ratio) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual int colToLayerAxis(int layer, const ColumnFan *fan) const override;
|
|
Jaroslav |
203cc8 |
virtual int rowToFrameAxis(int frame) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual QPoint frameLayerToXY(int frameAxis, int layerAxis) const override;
|
|
Jaroslav |
203cc8 |
virtual int layerAxis(const QPoint &xy) const override;
|
|
Jaroslav |
203cc8 |
virtual int frameAxis(const QPoint &xy) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual NumberRange layerSide(const QRect &area) const override;
|
|
Jaroslav |
203cc8 |
virtual NumberRange frameSide(const QRect &area) const override;
|
|
Jaroslav |
203cc8 |
virtual QPoint topRightCorner(const QRect &area) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual CellPosition arrowShift(int direction) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual QString name() const override { return "TopToBottom"; }
|
|
shun-iwasawa |
e87e08 |
virtual QString caption() const override { return QObject::tr("Xsheet"); }
|
|
Jaroslav |
203cc8 |
virtual const Orientation *next() const override {
|
|
Jaroslav |
203cc8 |
return Orientations::leftToRight();
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual bool isVerticalTimeline() const override { return true; }
|
|
manongjohn |
399e7d |
virtual bool flipVolume() const override { return false; }
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual int cellWidth() const override { return CELL_WIDTH; }
|
|
Jaroslav |
203cc8 |
virtual int cellHeight() const override { return CELL_HEIGHT; }
|
|
manongjohn |
2e094e |
virtual int foldedCellSize() const override { return FOLDED_CELL_SIZE; }
|
|
Jaroslav |
203cc8 |
};
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
class LeftToRightOrientation : public Orientation {
|
|
Jaroslav |
203cc8 |
const int CELL_WIDTH = 50;
|
|
Jaroslav |
203cc8 |
const int CELL_HEIGHT = 20;
|
|
Jaroslav |
203cc8 |
const int CELL_DRAG_HEIGHT = 5;
|
|
Jaroslav |
203cc8 |
const int EXTENDER_WIDTH = 8;
|
|
Jaroslav |
203cc8 |
const int EXTENDER_HEIGHT = 12;
|
|
Jaroslav |
203cc8 |
const int SOUND_PREVIEW_HEIGHT = 6;
|
|
Jaroslav |
203cc8 |
const int FRAME_HEADER_HEIGHT = 50;
|
|
manongjohn |
f643b0 |
const int ONION_X = 0, ONION_Y = 0;
|
|
Jaroslav |
203cc8 |
const int PLAY_RANGE_Y = ONION_SIZE;
|
|
manongjohn |
399e7d |
const int ICON_WIDTH = 20;
|
|
manongjohn |
399e7d |
const int ICON_HEIGHT = 20;
|
|
Jaroslav |
203cc8 |
const int ICON_OFFSET = ICON_WIDTH;
|
|
manongjohn |
399e7d |
const int ICONS_WIDTH = ICON_OFFSET * 4; // 88
|
|
Jaroslav |
203cc8 |
const int LAYER_NUMBER_WIDTH = 20;
|
|
manongjohn |
399e7d |
const int LAYER_NAME_WIDTH = 150;
|
|
Jaroslav |
203cc8 |
const int LAYER_HEADER_WIDTH =
|
|
Jaroslav |
203cc8 |
ICONS_WIDTH + LAYER_NUMBER_WIDTH + LAYER_NAME_WIDTH;
|
|
Jaroslav |
203cc8 |
const int FOLDED_LAYER_HEADER_HEIGHT = 8;
|
|
shun_iwasawa |
0cae24 |
const int FOLDED_LAYER_HEADER_WIDTH = LAYER_HEADER_WIDTH;
|
|
manongjohn |
399e7d |
const int TRACKLEN = 60;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
public:
|
|
Jaroslav |
203cc8 |
LeftToRightOrientation();
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual CellPosition xyToPosition(const QPoint &xy,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const override;
|
|
Jaroslav |
203cc8 |
virtual QPoint positionToXY(const CellPosition &position,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const override;
|
|
Jaroslav |
203cc8 |
virtual CellPositionRatio xyToPositionRatio(const QPoint &xy) const override;
|
|
Jaroslav |
203cc8 |
virtual QPoint positionRatioToXY(
|
|
Jaroslav |
203cc8 |
const CellPositionRatio &ratio) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual int colToLayerAxis(int layer, const ColumnFan *fan) const override;
|
|
Jaroslav |
203cc8 |
virtual int rowToFrameAxis(int frame) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual QPoint frameLayerToXY(int frameAxis, int layerAxis) const override;
|
|
Jaroslav |
203cc8 |
virtual int layerAxis(const QPoint &xy) const override;
|
|
Jaroslav |
203cc8 |
virtual int frameAxis(const QPoint &xy) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual NumberRange layerSide(const QRect &area) const override;
|
|
Jaroslav |
203cc8 |
virtual NumberRange frameSide(const QRect &area) const override;
|
|
Jaroslav |
203cc8 |
virtual QPoint topRightCorner(const QRect &area) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual CellPosition arrowShift(int direction) const override;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual QString name() const override { return "LeftToRight"; }
|
|
shun-iwasawa |
e87e08 |
virtual QString caption() const override { return QObject::tr("Timeline"); }
|
|
Jaroslav |
203cc8 |
virtual const Orientation *next() const override {
|
|
Jaroslav |
203cc8 |
return Orientations::topToBottom();
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual bool isVerticalTimeline() const override { return false; }
|
|
Jaroslav |
203cc8 |
virtual bool flipVolume() const override { return false; }
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
virtual int cellWidth() const override { return CELL_WIDTH; }
|
|
Jaroslav |
203cc8 |
virtual int cellHeight() const override { return CELL_HEIGHT; }
|
|
manongjohn |
2e094e |
virtual int foldedCellSize() const override { return FOLDED_CELL_SIZE; }
|
|
Jaroslav |
203cc8 |
};
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
/// -------------------------------------------------------------------------------
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
int NumberRange::weight(double toWeight) const { // weight ranging 0..1
|
|
Jaroslav |
203cc8 |
return _from + (_to - _from) * toWeight;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
NumberRange NumberRange::adjusted(int addFrom, int addTo) const {
|
|
Jaroslav |
203cc8 |
return NumberRange(_from + addFrom, _to + addTo);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
double NumberRange::ratio(int at) const {
|
|
Jaroslav |
203cc8 |
double result = ((double)at - _from) / (_to - _from);
|
|
Jaroslav |
203cc8 |
if (result < 0) result = 0;
|
|
Jaroslav |
203cc8 |
if (result > 1) result = 1;
|
|
Jaroslav |
203cc8 |
return result;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
/// -------------------------------------------------------------------------------
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// const int Orientations::COUNT = 2;
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
Orientations::Orientations() : _topToBottom(nullptr), _leftToRight(nullptr) {
|
|
Jaroslav |
203cc8 |
_topToBottom = new TopToBottomOrientation();
|
|
Jaroslav |
203cc8 |
_leftToRight = new LeftToRightOrientation();
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
_all.push_back(_topToBottom);
|
|
Jaroslav |
203cc8 |
_all.push_back(_leftToRight);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
Orientations::~Orientations() {
|
|
Jaroslav |
203cc8 |
delete _topToBottom;
|
|
Jaroslav |
203cc8 |
_topToBottom = nullptr;
|
|
Jaroslav |
203cc8 |
delete _leftToRight;
|
|
Jaroslav |
203cc8 |
_leftToRight = nullptr;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
const Orientations &Orientations::instance() {
|
|
Jaroslav |
203cc8 |
static Orientations singleton;
|
|
Jaroslav |
203cc8 |
return singleton;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
const Orientation *Orientations::topToBottom() {
|
|
Jaroslav |
203cc8 |
return instance()._topToBottom;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
const Orientation *Orientations::leftToRight() {
|
|
Jaroslav |
203cc8 |
return instance()._leftToRight;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
const vector<const *="" orientation=""> &Orientations::all() {</const>
|
|
Jaroslav |
203cc8 |
return instance()._all;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
const Orientation *Orientations::byName(const QString &name) {
|
|
Jaroslav |
203cc8 |
vector<const *="" orientation=""> m_all = all();</const>
|
|
Jaroslav |
203cc8 |
for (auto it = m_all.begin(); it != m_all.end(); it++)
|
|
Jaroslav |
203cc8 |
if ((*it)->name() == name) return *it;
|
|
Jaroslav |
203cc8 |
throw std::runtime_error(
|
|
Jaroslav |
203cc8 |
(QString("no such orientation: ") + name).toStdString().c_str());
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
/// -------------------------------------------------------------------------------
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QLine Orientation::verticalLine(int layerAxis,
|
|
Jaroslav |
203cc8 |
const NumberRange &frameAxis) const {
|
|
Jaroslav |
203cc8 |
QPoint first = frameLayerToXY(frameAxis.from(), layerAxis);
|
|
Jaroslav |
203cc8 |
QPoint second = frameLayerToXY(frameAxis.to(), layerAxis);
|
|
Jaroslav |
203cc8 |
return QLine(first, second);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QLine Orientation::horizontalLine(int frameAxis,
|
|
Jaroslav |
203cc8 |
const NumberRange &layerAxis) const {
|
|
Jaroslav |
203cc8 |
QPoint first = frameLayerToXY(frameAxis, layerAxis.from());
|
|
Jaroslav |
203cc8 |
QPoint second = frameLayerToXY(frameAxis, layerAxis.to());
|
|
Jaroslav |
203cc8 |
return QLine(first, second);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QRect Orientation::frameLayerRect(const NumberRange &frameAxis,
|
|
Jaroslav |
203cc8 |
const NumberRange &layerAxis) const {
|
|
Jaroslav |
203cc8 |
QPoint topLeft = frameLayerToXY(frameAxis.from(), layerAxis.from());
|
|
Jaroslav |
203cc8 |
QPoint bottomRight = frameLayerToXY(frameAxis.to(), layerAxis.to());
|
|
Jaroslav |
203cc8 |
return QRect(topLeft, bottomRight);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QRect Orientation::foldedRectangle(int layerAxis, const NumberRange &frameAxis,
|
|
Jaroslav |
203cc8 |
int i) const {
|
|
Jaroslav |
203cc8 |
QPoint topLeft = frameLayerToXY(frameAxis.from(), layerAxis + 1 + i * 3);
|
|
Jaroslav |
203cc8 |
QPoint size = frameLayerToXY(frameAxis.length(), 2);
|
|
Jaroslav |
203cc8 |
return QRect(topLeft, QSize(size.x(), size.y()));
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QLine Orientation::foldedRectangleLine(int layerAxis,
|
|
Jaroslav |
203cc8 |
const NumberRange &frameAxis,
|
|
Jaroslav |
203cc8 |
int i) const {
|
|
Jaroslav |
203cc8 |
return verticalLine(layerAxis + i * 3, frameAxis);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
void Orientation::addRect(PredefinedRect which, const QRect &rect) {
|
|
manongjohn |
399e7d |
_rects.erase(which);
|
|
Jaroslav |
203cc8 |
_rects.insert(pair<predefinedrect, qrect="">(which, rect));</predefinedrect,>
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
void Orientation::addLine(PredefinedLine which, const QLine &line) {
|
|
manongjohn |
399e7d |
_lines.erase(which);
|
|
Jaroslav |
203cc8 |
_lines.insert(pair<predefinedline, qline="">(which, line));</predefinedline,>
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
void Orientation::addDimension(PredefinedDimension which, int dimension) {
|
|
manongjohn |
399e7d |
_dimensions.erase(which);
|
|
Jaroslav |
203cc8 |
_dimensions.insert(pair<predefineddimension, int="">(which, dimension));</predefineddimension,>
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
void Orientation::addPath(PredefinedPath which, const QPainterPath &path) {
|
|
manongjohn |
399e7d |
_paths.erase(which);
|
|
Jaroslav |
203cc8 |
_paths.insert(pair<predefinedpath, qpainterpath="">(which, path));</predefinedpath,>
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
void Orientation::addPoint(PredefinedPoint which, const QPoint &point) {
|
|
manongjohn |
399e7d |
_points.erase(which);
|
|
Jaroslav |
203cc8 |
_points.insert(pair<predefinedpoint, qpoint="">(which, point));</predefinedpoint,>
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
void Orientation::addRange(PredefinedRange which, const NumberRange &range) {
|
|
manongjohn |
399e7d |
_ranges.erase(which);
|
|
Jaroslav |
203cc8 |
_ranges.insert(pair<predefinedrange, numberrange="">(which, range));</predefinedrange,>
|
|
Jaroslav |
203cc8 |
}
|
|
manongjohn |
399e7d |
void Orientation::addFlag(PredefinedFlag which, const bool &flag) {
|
|
manongjohn |
399e7d |
_flags.erase(which);
|
|
manongjohn |
399e7d |
_flags.insert(pair<predefinedflag, bool="">(which, flag));</predefinedflag,>
|
|
manongjohn |
399e7d |
}
|
|
Jaroslav |
203cc8 |
/// -------------------------------------------------------------------------------
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
TopToBottomOrientation::TopToBottomOrientation() {
|
|
manongjohn |
399e7d |
QString layout = Preferences::instance()->getLoadedXsheetLayout();
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
int use_header_height = LAYER_HEADER_HEIGHT;
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
if (layout == QString("Compact")) use_header_height -= 18;
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
int user_folded_header_height = use_header_height;
|
|
manongjohn |
399e7d |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Area rectangles
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// Cell viewer
|
|
Jaroslav |
203cc8 |
QRect cellRect(0, 0, CELL_WIDTH, CELL_HEIGHT);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::CELL, cellRect);
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::DRAG_HANDLE_CORNER,
|
|
shun_iwasawa |
0cae24 |
QRect(0, 0, CELL_DRAG_WIDTH, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
QRect keyRect(CELL_WIDTH - KEY_ICON_WIDTH,
|
|
shun_iwasawa |
0cae24 |
(CELL_HEIGHT - KEY_ICON_HEIGHT) / 2, KEY_ICON_WIDTH,
|
|
shun_iwasawa |
0cae24 |
KEY_ICON_HEIGHT);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::KEY_ICON, keyRect);
|
|
Jaroslav |
203cc8 |
QRect nameRect = cellRect.adjusted(8, 0, -6, 0);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::CELL_NAME, nameRect);
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::CELL_NAME_WITH_KEYFRAME,
|
|
shun_iwasawa |
0cae24 |
nameRect.adjusted(0, 0, -KEY_ICON_WIDTH, 0));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::END_EXTENDER,
|
|
shun_iwasawa |
0cae24 |
QRect(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0, EXTENDER_WIDTH,
|
|
shun_iwasawa |
0cae24 |
EXTENDER_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::BEGIN_EXTENDER,
|
|
shun_iwasawa |
0cae24 |
QRect(-EXTENDER_WIDTH - KEY_ICON_WIDTH, -EXTENDER_HEIGHT,
|
|
shun_iwasawa |
0cae24 |
EXTENDER_WIDTH, EXTENDER_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::KEYFRAME_AREA,
|
|
shun_iwasawa |
0cae24 |
QRect(CELL_WIDTH - KEY_ICON_WIDTH, 0, KEY_ICON_WIDTH, CELL_HEIGHT));
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::DRAG_AREA, QRect(0, 0, CELL_DRAG_WIDTH, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
QRect soundRect(CELL_DRAG_WIDTH, 0,
|
|
shun_iwasawa |
0cae24 |
CELL_WIDTH - CELL_DRAG_WIDTH - SOUND_PREVIEW_WIDTH,
|
|
shun_iwasawa |
0cae24 |
CELL_HEIGHT);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::SOUND_TRACK, soundRect);
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::PREVIEW_TRACK,
|
|
shun_iwasawa |
0cae24 |
QRect(CELL_WIDTH - SOUND_PREVIEW_WIDTH + 1, 0, SOUND_PREVIEW_WIDTH,
|
|
shun_iwasawa |
0cae24 |
CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::BEGIN_SOUND_EDIT,
|
|
shun_iwasawa |
0cae24 |
QRect(CELL_DRAG_WIDTH, 0, CELL_WIDTH - CELL_DRAG_WIDTH, 2));
|
|
shun_iwasawa |
0cae24 |
addRect(
|
|
shun_iwasawa |
0cae24 |
PredefinedRect::END_SOUND_EDIT,
|
|
shun_iwasawa |
0cae24 |
QRect(CELL_DRAG_WIDTH, CELL_HEIGHT - 2, CELL_WIDTH - CELL_DRAG_WIDTH, 2));
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::LOOP_ICON, QRect(keyRect.left(), 0, 10, 11));
|
|
manongjohn |
a21b06 |
addRect(PredefinedRect::FRAME_MARKER_AREA, QRect(0, 0, -1, -1)); // hide
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// Note viewer
|
|
shun_iwasawa |
0cae24 |
addRect(
|
|
shun_iwasawa |
0cae24 |
PredefinedRect::NOTE_AREA,
|
|
manongjohn |
399e7d |
QRect(QPoint(0, 0), QSize(FRAME_HEADER_WIDTH, use_header_height - 1)));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::NOTE_ICON,
|
|
shun_iwasawa |
0cae24 |
QRect(QPoint(0, 0), QSize(CELL_WIDTH - 2, CELL_HEIGHT - 2)));
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::LAYER_HEADER_PANEL, QRect(0, 0, -1, -1)); // hide
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// Row viewer
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::FRAME_LABEL,
|
|
shun_iwasawa |
0cae24 |
QRect(CELL_WIDTH / 2, 1, CELL_WIDTH / 2, CELL_HEIGHT - 2));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::FRAME_HEADER,
|
|
manongjohn |
98ab1a |
QRect(0, 0, FRAME_HEADER_WIDTH, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::PLAY_RANGE,
|
|
shun_iwasawa |
0cae24 |
QRect(PLAY_RANGE_X, 0, PLAY_MARKER_SIZE, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION,
|
|
shun_iwasawa |
0cae24 |
QRect(ONION_X + (3 * ONION_DOT_SIZE - ONION_SIZE) / 2, ONION_Y,
|
|
manongjohn |
1be264 |
ONION_SIZE, ONION_SIZE)
|
|
manongjohn |
1be264 |
.adjusted(2, 1, 2, 1));
|
|
Jaroslav |
203cc8 |
int adjustOnion = (ONION_SIZE - ONION_DOT_SIZE) / 2;
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION_DOT,
|
|
shun_iwasawa |
0cae24 |
QRect(ONION_X + ONION_DOT_SIZE, ONION_Y + adjustOnion, ONION_DOT_SIZE,
|
|
manongjohn |
1be264 |
ONION_DOT_SIZE)
|
|
manongjohn |
1be264 |
.adjusted(1, 1, 1, 1));
|
|
manongjohn |
1be264 |
addRect(PredefinedRect::ONION_DOT_FIXED,
|
|
manongjohn |
1be264 |
QRect(ONION_X, ONION_Y + adjustOnion, ONION_DOT_SIZE, ONION_DOT_SIZE)
|
|
manongjohn |
1be264 |
.adjusted(1, 1, 1, 1));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION_AREA,
|
|
shun_iwasawa |
0cae24 |
QRect(ONION_X, ONION_Y, PLAY_RANGE_X, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION_FIXED_DOT_AREA,
|
|
shun_iwasawa |
0cae24 |
QRect(ONION_X, ONION_Y, ONION_DOT_SIZE, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(
|
|
shun_iwasawa |
0cae24 |
PredefinedRect::ONION_DOT_AREA,
|
|
shun_iwasawa |
0cae24 |
QRect(ONION_X + ONION_DOT_SIZE, ONION_Y, ONION_DOT_SIZE, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::PINNED_CENTER_KEY,
|
|
shun_iwasawa |
0cae24 |
QRect((FRAME_HEADER_WIDTH - PINNED_SIZE) / 2,
|
|
shun_iwasawa |
0cae24 |
(CELL_HEIGHT - PINNED_SIZE) / 2, PINNED_SIZE, PINNED_SIZE));
|
|
manongjohn |
a21b06 |
addRect(
|
|
manongjohn |
a21b06 |
PredefinedRect::PREVIEW_FRAME_AREA,
|
|
manongjohn |
a21b06 |
QRect(PLAY_RANGE_X, 0, (FRAME_HEADER_WIDTH - PLAY_RANGE_X), CELL_HEIGHT));
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// Column viewer
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::LAYER_HEADER,
|
|
manongjohn |
399e7d |
QRect(0, 1, CELL_WIDTH, use_header_height - 3));
|
|
shun_iwasawa |
0cae24 |
addRect(
|
|
shun_iwasawa |
0cae24 |
PredefinedRect::FOLDED_LAYER_HEADER,
|
|
manongjohn |
399e7d |
QRect(0, 1, FOLDED_LAYER_HEADER_WIDTH, user_folded_header_height - 3));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
static int THUMBNAIL_HEIGHT;
|
|
manongjohn |
399e7d |
static int HDRROW_HEIGHT;
|
|
manongjohn |
399e7d |
static int HDRROW_HEIGHT2;
|
|
manongjohn |
399e7d |
static int INDENT;
|
|
manongjohn |
399e7d |
static int HDRROW1;
|
|
manongjohn |
399e7d |
static int HDRROW2;
|
|
manongjohn |
399e7d |
static int HDRROW3;
|
|
manongjohn |
399e7d |
static int HDRROW4;
|
|
manongjohn |
399e7d |
static int HDRROW5;
|
|
manongjohn |
399e7d |
QRect layername, eyeArea, eye, previewArea, preview, lockArea, lock,
|
|
manongjohn |
399e7d |
configArea, config, thumbnailArea, thumbnail, pegbarname, volumeArea;
|
|
manongjohn |
399e7d |
QPoint soundTopLeft;
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
if (layout == QString("Compact")) {
|
|
manongjohn |
399e7d |
THUMBNAIL_HEIGHT = 44;
|
|
manongjohn |
399e7d |
HDRROW_HEIGHT = CELL_HEIGHT - 2;
|
|
manongjohn |
399e7d |
INDENT = 0;
|
|
manongjohn |
399e7d |
HDRROW1 = 1; // Name, number
|
|
manongjohn |
399e7d |
HDRROW2 = HDRROW1 + HDRROW_HEIGHT; // eye, preview, lock, config
|
|
manongjohn |
399e7d |
HDRROW3 = HDRROW2 + HDRROW_HEIGHT; // thumbnail
|
|
manongjohn |
399e7d |
HDRROW4 = HDRROW3 + THUMBNAIL_HEIGHT; // pegbar, parent handle
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::DRAG_LAYER, QRect(0, 0, -1, -1));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::RENAME_COLUMN,
|
|
manongjohn |
399e7d |
QRect(0, HDRROW1, CELL_WIDTH, HDRROW_HEIGHT));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
layername =
|
|
manongjohn |
399e7d |
QRect(INDENT + 1, HDRROW1 + 1, CELL_WIDTH - 1, HDRROW_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LAYER_NAME, layername);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LAYER_NUMBER,
|
|
manongjohn |
399e7d |
QRect(INDENT + layername.width() - 20, HDRROW1, 20, HDRROW_HEIGHT));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
eyeArea = QRect(INDENT, HDRROW2, ICON_WIDTH + 1, HDRROW_HEIGHT); // Compact
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::EYE_AREA, eyeArea);
|
|
manongjohn |
399e7d |
eye = QRect(
|
|
manongjohn |
399e7d |
eyeArea.left() + 1 + ((eyeArea.width() / 2) - (ICON_WIDTH / 2)),
|
|
manongjohn |
399e7d |
eyeArea.top() + ((eyeArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH, ICON_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::EYE, eye);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
previewArea =
|
|
manongjohn |
399e7d |
QRect(INDENT + eyeArea.width(), HDRROW2, ICON_WIDTH + 1, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PREVIEW_LAYER_AREA, previewArea);
|
|
manongjohn |
399e7d |
preview = QRect(
|
|
manongjohn |
399e7d |
previewArea.left() + 1 + ((previewArea.width() / 2) - (ICON_WIDTH / 2)),
|
|
manongjohn |
399e7d |
previewArea.top() +
|
|
manongjohn |
399e7d |
((previewArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH, ICON_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PREVIEW_LAYER, preview);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
lockArea = QRect(INDENT + eyeArea.width() + previewArea.width(), HDRROW2,
|
|
manongjohn |
399e7d |
ICON_WIDTH, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LOCK_AREA, lockArea);
|
|
manongjohn |
399e7d |
lock = QRect(
|
|
manongjohn |
399e7d |
lockArea.left() + ((lockArea.width() / 2) - ((ICON_WIDTH - 1) / 2)),
|
|
manongjohn |
399e7d |
lockArea.top() + ((lockArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH - 1, ICON_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LOCK, lock);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
configArea =
|
|
manongjohn |
399e7d |
QRect(INDENT + eyeArea.width() + previewArea.width() + lockArea.width(),
|
|
manongjohn |
399e7d |
HDRROW2, ICON_WIDTH, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::CONFIG_AREA, configArea);
|
|
manongjohn |
399e7d |
config = QRect(
|
|
manongjohn |
399e7d |
configArea.left() + ((configArea.width() / 2) - ((ICON_WIDTH - 1) / 2)),
|
|
manongjohn |
399e7d |
configArea.top() +
|
|
manongjohn |
399e7d |
((configArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH - 1, ICON_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::CONFIG, config);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
thumbnailArea = QRect(INDENT, HDRROW3, CELL_WIDTH, THUMBNAIL_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea);
|
|
manongjohn |
399e7d |
thumbnail = thumbnailArea.adjusted(1, 1, 0, 0);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::THUMBNAIL, thumbnail);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::FILTER_COLOR,
|
|
manongjohn |
399e7d |
QRect(thumbnail.right() - 14, thumbnail.top() + 3, 12, 12));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::SOUND_ICON,
|
|
manongjohn |
399e7d |
QRect(thumbnailArea.topLeft(), QSize(27, 20))
|
|
manongjohn |
399e7d |
.adjusted((thumbnailArea.width() / 2) - (27 / 2), 3,
|
|
manongjohn |
399e7d |
(thumbnailArea.width() / 2) - (27 / 2), 3));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
volumeArea =
|
|
manongjohn |
399e7d |
QRect(QPoint(thumbnailArea.left() + 3, thumbnailArea.bottom() - 16),
|
|
manongjohn |
399e7d |
QSize(TRACKLEN + 8, 14));
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::VOLUME_AREA, volumeArea);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
pegbarname = QRect(INDENT, HDRROW4, CELL_WIDTH, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PEGBAR_NAME, pegbarname);
|
|
manongjohn |
399e7d |
addRect(
|
|
manongjohn |
399e7d |
PredefinedRect::PARENT_HANDLE_NAME,
|
|
manongjohn |
399e7d |
QRect(INDENT + pegbarname.width() - 20, HDRROW4, 20, HDRROW_HEIGHT));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::DRAG_LAYER_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::DRAG_LAYER_VISIBLE, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NAME_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NUMBER_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NUMBER_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::EYE_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::EYE_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LOCK_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LOCK_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::CONFIG_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PARENT_HANDLE_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false);
|
|
manongjohn |
399e7d |
} else if (layout == QString("Classic-revised")) {
|
|
manongjohn |
399e7d |
THUMBNAIL_HEIGHT = 44;
|
|
manongjohn |
399e7d |
HDRROW_HEIGHT = CELL_HEIGHT - 2;
|
|
manongjohn |
399e7d |
INDENT = 0;
|
|
manongjohn |
399e7d |
HDRROW1 = 1; // Name, number
|
|
manongjohn |
399e7d |
HDRROW2 = HDRROW1 + HDRROW_HEIGHT; // eye, lock
|
|
manongjohn |
399e7d |
HDRROW3 = HDRROW2 + HDRROW_HEIGHT; // preview, config
|
|
manongjohn |
399e7d |
HDRROW4 = HDRROW3 + HDRROW_HEIGHT; // thumbnail
|
|
manongjohn |
399e7d |
HDRROW5 = HDRROW4 + THUMBNAIL_HEIGHT; // pegbar, parent handle
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::DRAG_LAYER,
|
|
manongjohn |
399e7d |
QRect(0, 0, -1, -1)); // hide - Theme/Compact
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::RENAME_COLUMN,
|
|
manongjohn |
399e7d |
QRect(0, HDRROW1, CELL_WIDTH, HDRROW_HEIGHT));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
layername =
|
|
manongjohn |
399e7d |
QRect(INDENT + 1, HDRROW1 + 1, CELL_WIDTH - 1, HDRROW_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LAYER_NAME, layername);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LAYER_NUMBER,
|
|
manongjohn |
399e7d |
QRect(INDENT + layername.width() - 20, HDRROW1, 20, HDRROW_HEIGHT));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
eyeArea = QRect(INDENT, HDRROW2, CELL_WIDTH - ICON_WIDTH, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::EYE_AREA, eyeArea);
|
|
manongjohn |
399e7d |
eye = QRect(
|
|
manongjohn |
399e7d |
eyeArea.left() + 1 + ((eyeArea.width() / 2) - (ICON_WIDTH / 2)),
|
|
manongjohn |
399e7d |
eyeArea.top() + ((eyeArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH, ICON_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::EYE, eye);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
previewArea =
|
|
manongjohn |
399e7d |
QRect(INDENT, HDRROW3, CELL_WIDTH - ICON_WIDTH, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PREVIEW_LAYER_AREA, previewArea);
|
|
manongjohn |
399e7d |
preview = QRect(
|
|
manongjohn |
399e7d |
previewArea.left() + 1 + ((previewArea.width() / 2) - (ICON_WIDTH / 2)),
|
|
manongjohn |
399e7d |
previewArea.top() +
|
|
manongjohn |
399e7d |
((previewArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH, ICON_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PREVIEW_LAYER, preview);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
lockArea =
|
|
manongjohn |
399e7d |
QRect(INDENT + eyeArea.width(), HDRROW2, ICON_WIDTH, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LOCK_AREA, lockArea);
|
|
manongjohn |
399e7d |
lock = QRect(
|
|
manongjohn |
399e7d |
lockArea.left() + ((lockArea.width() / 2) - ((ICON_WIDTH - 1) / 2)),
|
|
manongjohn |
399e7d |
lockArea.top() + ((lockArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH - 1, ICON_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LOCK, lock);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
configArea =
|
|
manongjohn |
399e7d |
QRect(INDENT + previewArea.width(), HDRROW3, ICON_WIDTH, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::CONFIG_AREA, configArea);
|
|
manongjohn |
399e7d |
config = QRect(
|
|
manongjohn |
399e7d |
configArea.left() + ((configArea.width() / 2) - ((ICON_WIDTH - 1) / 2)),
|
|
manongjohn |
399e7d |
configArea.top() +
|
|
manongjohn |
399e7d |
((configArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH - 1, ICON_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::CONFIG, config);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
thumbnailArea = QRect(INDENT, HDRROW4, CELL_WIDTH, THUMBNAIL_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea);
|
|
manongjohn |
399e7d |
thumbnail = thumbnailArea.adjusted(1, 1, 0, 0);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::THUMBNAIL, thumbnail);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::FILTER_COLOR,
|
|
manongjohn |
399e7d |
QRect(thumbnail.right() - 14, thumbnail.top() + 3, 12, 12));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::SOUND_ICON,
|
|
manongjohn |
399e7d |
QRect(thumbnailArea.topLeft(), QSize(27, 20))
|
|
manongjohn |
399e7d |
.adjusted((thumbnailArea.width() / 2) - (27 / 2), 3,
|
|
manongjohn |
399e7d |
(thumbnailArea.width() / 2) - (27 / 2), 3));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
volumeArea =
|
|
manongjohn |
399e7d |
QRect(QPoint(thumbnailArea.left() + 3, thumbnailArea.bottom() - 16),
|
|
manongjohn |
399e7d |
QSize(TRACKLEN + 8, 14));
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::VOLUME_AREA, volumeArea);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
pegbarname = QRect(INDENT, HDRROW5, CELL_WIDTH, HDRROW_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PEGBAR_NAME, pegbarname);
|
|
manongjohn |
399e7d |
addRect(
|
|
manongjohn |
399e7d |
PredefinedRect::PARENT_HANDLE_NAME,
|
|
manongjohn |
399e7d |
QRect(INDENT + pegbarname.width() - 20, HDRROW5, 20, HDRROW_HEIGHT));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::DRAG_LAYER_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::DRAG_LAYER_VISIBLE, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NAME_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NUMBER_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NUMBER_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::EYE_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::EYE_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LOCK_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LOCK_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::CONFIG_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PARENT_HANDLE_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false);
|
|
manongjohn |
399e7d |
} else {
|
|
manongjohn |
399e7d |
THUMBNAIL_HEIGHT = 43;
|
|
manongjohn |
399e7d |
HDRROW_HEIGHT = CELL_HEIGHT - 2;
|
|
manongjohn |
399e7d |
INDENT = CELL_DRAG_WIDTH + 2;
|
|
manongjohn |
399e7d |
HDRROW1 = 7; // Name/eye
|
|
manongjohn |
399e7d |
HDRROW2 = HDRROW1 + CELL_HEIGHT; // lock, preview
|
|
manongjohn |
399e7d |
HDRROW3 = HDRROW2 + CELL_HEIGHT; // thumbnail
|
|
manongjohn |
399e7d |
HDRROW4 = HDRROW3 + THUMBNAIL_HEIGHT + 5; // pegbar, parenthandle
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::DRAG_LAYER,
|
|
manongjohn |
399e7d |
QRect(0, 0, CELL_DRAG_WIDTH, use_header_height - 3));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::RENAME_COLUMN,
|
|
manongjohn |
399e7d |
QRect(0, HDRROW1, CELL_WIDTH, HDRROW_HEIGHT));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
layername = QRect(INDENT + 1, HDRROW1 + 1, CELL_WIDTH - INDENT - 3,
|
|
manongjohn |
399e7d |
HDRROW_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LAYER_NAME, layername);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LAYER_NUMBER, QRect(0, 0, -1, -1));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
eyeArea =
|
|
manongjohn |
399e7d |
QRect(INDENT, HDRROW1, CELL_WIDTH - INDENT - 2, HDRROW_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::EYE_AREA, eyeArea);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::EYE,
|
|
manongjohn |
399e7d |
eyeArea.adjusted(eyeArea.width() - ICON_WIDTH, 0, 0, 0));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
previewArea = QRect(INDENT, HDRROW2, CELL_WIDTH - INDENT - 2,
|
|
manongjohn |
399e7d |
HDRROW_HEIGHT - 1); // Legacy
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PREVIEW_LAYER_AREA, previewArea);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PREVIEW_LAYER,
|
|
manongjohn |
399e7d |
previewArea.adjusted(previewArea.width() - ICON_WIDTH, 0, 0, 0));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
lockArea = QRect(INDENT, HDRROW2, ICON_WIDTH - 1, HDRROW_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LOCK_AREA, lockArea);
|
|
manongjohn |
399e7d |
/*
|
|
manongjohn |
399e7d |
lock = QRect(lockArea.left() + ((lockArea.width() / 2) -
|
|
manongjohn |
399e7d |
((ICON_WIDTH - 3) / 2)),
|
|
manongjohn |
399e7d |
lockArea.top() + ((lockArea.height() / 2) -
|
|
manongjohn |
399e7d |
((ICON_HEIGHT - 3) / 2)),
|
|
manongjohn |
399e7d |
ICON_WIDTH - 3, ICON_HEIGHT - 3);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LOCK, lock);
|
|
manongjohn |
399e7d |
*/
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::LOCK, lockArea);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::CONFIG_AREA, QRect(0, 0, -1, -1));
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::CONFIG, QRect(0, 0, -1, -1));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
thumbnailArea =
|
|
manongjohn |
399e7d |
QRect(INDENT - 1, HDRROW3, CELL_WIDTH - INDENT - 1, THUMBNAIL_HEIGHT);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea);
|
|
manongjohn |
399e7d |
thumbnail = thumbnailArea.adjusted(1, 1, 0, 0);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::THUMBNAIL, thumbnail);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::FILTER_COLOR,
|
|
manongjohn |
399e7d |
QRect(thumbnail.right() - 14, thumbnail.top() + 3, 12, 12));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addRect(
|
|
manongjohn |
399e7d |
PredefinedRect::SOUND_ICON,
|
|
manongjohn |
399e7d |
QRect(thumbnailArea.topLeft(), QSize(40, 30)).adjusted(21, 19, 21, 19));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
volumeArea =
|
|
manongjohn |
399e7d |
QRect(QPoint(thumbnailArea.left() + 3, thumbnailArea.top() - 1),
|
|
manongjohn |
399e7d |
QSize(14, TRACKLEN + 8));
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::VOLUME_AREA, volumeArea);
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
pegbarname =
|
|
manongjohn |
399e7d |
QRect(INDENT, HDRROW4, CELL_WIDTH - INDENT - 2, HDRROW_HEIGHT - 1);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PEGBAR_NAME, pegbarname);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::PARENT_HANDLE_NAME,
|
|
manongjohn |
399e7d |
QRect(INDENT + pegbarname.width() - 20, HDRROW4, 20,
|
|
manongjohn |
399e7d |
HDRROW_HEIGHT - 1));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::DRAG_LAYER_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::DRAG_LAYER_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NAME_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NUMBER_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NUMBER_VISIBLE, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::EYE_AREA_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::EYE_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
// addFlag(PredefinedFlag::LOCK_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LOCK_AREA_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LOCK_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::CONFIG_AREA_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PARENT_HANDLE_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, true);
|
|
manongjohn |
399e7d |
}
|
|
Jaroslav |
203cc8 |
|
|
manongjohn |
399e7d |
if (flag(PredefinedFlag::VOLUME_AREA_VERTICAL)) {
|
|
manongjohn |
399e7d |
soundTopLeft = QPoint(volumeArea.left() + 4, volumeArea.top() + 4);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::VOLUME_TRACK,
|
|
manongjohn |
399e7d |
QRect(soundTopLeft, QSize(3, TRACKLEN)));
|
|
manongjohn |
399e7d |
} else {
|
|
manongjohn |
399e7d |
soundTopLeft = QPoint(volumeArea.left() + 4, volumeArea.bottom() - 6);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::VOLUME_TRACK,
|
|
manongjohn |
399e7d |
QRect(soundTopLeft, QSize(TRACKLEN, 3)));
|
|
manongjohn |
399e7d |
}
|
|
Jaroslav |
203cc8 |
|
|
manongjohn |
e71b98 |
// Layer footer panel
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::LAYER_FOOTER_PANEL, QRect(0, 0, -1, -1)); // hide
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_SLIDER, QRect(0, 0, -1, -1));
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_IN, QRect(0, 0, -1, -1));
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_OUT, QRect(0, 0, -1, -1));
|
|
manongjohn |
e71b98 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Lines
|
|
Jaroslav |
203cc8 |
//
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::LOCKED,
|
|
shun_iwasawa |
0cae24 |
verticalLine((CELL_DRAG_WIDTH + 1) / 2, NumberRange(0, CELL_HEIGHT)));
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::SEE_MARKER_THROUGH,
|
|
shun_iwasawa |
0cae24 |
horizontalLine(0, NumberRange(0, CELL_DRAG_WIDTH)));
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::CONTINUE_LEVEL,
|
|
shun_iwasawa |
0cae24 |
verticalLine(CELL_WIDTH / 2, NumberRange(0, CELL_HEIGHT)));
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::CONTINUE_LEVEL_WITH_NAME,
|
|
shun_iwasawa |
0cae24 |
verticalLine(CELL_WIDTH - 11, NumberRange(0, CELL_HEIGHT)));
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::EXTENDER_LINE,
|
|
shun_iwasawa |
0cae24 |
horizontalLine(0, NumberRange(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0)));
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Dimensions
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::LAYER, CELL_WIDTH);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::FRAME, CELL_HEIGHT);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::INDEX, 0);
|
|
shun_iwasawa |
0cae24 |
addDimension(PredefinedDimension::SOUND_AMPLITUDE,
|
|
shun_iwasawa |
0cae24 |
int(sqrt(CELL_HEIGHT * soundRect.width()) / 2));
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::FRAME_LABEL_ALIGN, Qt::AlignCenter);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::ONION_TURN, 0);
|
|
shun_iwasawa |
0cae24 |
addDimension(PredefinedDimension::QBOXLAYOUT_DIRECTION,
|
|
shun_iwasawa |
0cae24 |
QBoxLayout::Direction::TopToBottom);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::CENTER_ALIGN, Qt::AlignHCenter);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Paths
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
QPainterPath corner(QPointF(0, CELL_HEIGHT));
|
|
Jaroslav |
203cc8 |
corner.lineTo(QPointF(CELL_DRAG_WIDTH, CELL_HEIGHT));
|
|
Jaroslav |
203cc8 |
corner.lineTo(QPointF(CELL_DRAG_WIDTH, CELL_HEIGHT - CELL_DRAG_WIDTH));
|
|
Jaroslav |
203cc8 |
corner.lineTo(QPointF(0, CELL_HEIGHT));
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath fromTriangle(QPointF(0, EASE_TRIANGLE_SIZE / 2));
|
|
Jaroslav |
203cc8 |
fromTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE, -EASE_TRIANGLE_SIZE / 2));
|
|
Jaroslav |
203cc8 |
fromTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE, -EASE_TRIANGLE_SIZE / 2));
|
|
Jaroslav |
203cc8 |
fromTriangle.lineTo(QPointF(0, EASE_TRIANGLE_SIZE / 2));
|
|
Jaroslav |
203cc8 |
fromTriangle.translate(keyRect.center());
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::BEGIN_EASE_TRIANGLE, fromTriangle);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath toTriangle(QPointF(0, -EASE_TRIANGLE_SIZE / 2));
|
|
Jaroslav |
203cc8 |
toTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE, EASE_TRIANGLE_SIZE / 2));
|
|
Jaroslav |
203cc8 |
toTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE, EASE_TRIANGLE_SIZE / 2));
|
|
Jaroslav |
203cc8 |
toTriangle.lineTo(QPointF(0, -EASE_TRIANGLE_SIZE / 2));
|
|
Jaroslav |
203cc8 |
toTriangle.translate(keyRect.center());
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::END_EASE_TRIANGLE, toTriangle);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath playFrom(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
playFrom.lineTo(QPointF(PLAY_MARKER_SIZE, 0));
|
|
Jaroslav |
203cc8 |
playFrom.lineTo(QPointF(0, PLAY_MARKER_SIZE));
|
|
Jaroslav |
203cc8 |
playFrom.lineTo(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
playFrom.translate(PLAY_RANGE_X, 1);
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::BEGIN_PLAY_RANGE, playFrom);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath playTo(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
playTo.lineTo(QPointF(PLAY_MARKER_SIZE, 0));
|
|
Jaroslav |
203cc8 |
playTo.lineTo(QPointF(0, -PLAY_MARKER_SIZE));
|
|
Jaroslav |
203cc8 |
playTo.lineTo(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
playTo.translate(PLAY_RANGE_X, CELL_HEIGHT - 1);
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::END_PLAY_RANGE, playTo);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath track(QPointF(0, 0));
|
|
manongjohn |
399e7d |
if (flag(PredefinedFlag::VOLUME_AREA_VERTICAL)) {
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(1, 1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(1, TRACKLEN - 1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(0, TRACKLEN));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(-1, TRACKLEN - 1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(-1, 1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(0, 0));
|
|
manongjohn |
399e7d |
track.translate(soundTopLeft + QPoint(3, 0));
|
|
manongjohn |
399e7d |
} else {
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(1, 1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(TRACKLEN - 1, 1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(TRACKLEN, 0));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(TRACKLEN - 1, -1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(1, -1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(0, 0));
|
|
manongjohn |
399e7d |
track.translate(soundTopLeft);
|
|
manongjohn |
399e7d |
}
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::VOLUME_SLIDER_TRACK, track);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath head(QPointF(0, 0));
|
|
manongjohn |
399e7d |
if (flag(PredefinedFlag::VOLUME_AREA_VERTICAL)) {
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(4, 4));
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(8, 4));
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(8, -4));
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(4, -4));
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(0, 0));
|
|
manongjohn |
399e7d |
} else {
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(4, -4));
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(4, -8));
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(-4, -8));
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(-4, -4));
|
|
manongjohn |
399e7d |
head.lineTo(QPointF(0, 0));
|
|
manongjohn |
399e7d |
}
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::VOLUME_SLIDER_HEAD, head);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Points
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
addPoint(PredefinedPoint::KEY_HIDDEN, QPoint(KEY_ICON_WIDTH, 0));
|
|
Jaroslav |
203cc8 |
addPoint(PredefinedPoint::EXTENDER_XY_RADIUS, QPoint(30, 75));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
399e7d |
if (flag(PredefinedFlag::VOLUME_AREA_VERTICAL))
|
|
manongjohn |
399e7d |
addPoint(PredefinedPoint::VOLUME_DIVISIONS_TOP_LEFT, soundTopLeft);
|
|
manongjohn |
399e7d |
else
|
|
manongjohn |
399e7d |
addPoint(PredefinedPoint::VOLUME_DIVISIONS_TOP_LEFT,
|
|
manongjohn |
399e7d |
soundTopLeft + QPoint(0, 3));
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Ranges
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
addRange(PredefinedRange::HEADER_LAYER, NumberRange(0, FRAME_HEADER_WIDTH));
|
|
manongjohn |
399e7d |
addRange(PredefinedRange::HEADER_FRAME, NumberRange(0, use_header_height));
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
CellPosition TopToBottomOrientation::xyToPosition(const QPoint &xy,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const {
|
|
Jaroslav |
203cc8 |
int layer = fan->layerAxisToCol(xy.x());
|
|
Jaroslav |
203cc8 |
int frame = xy.y() / CELL_HEIGHT;
|
|
Jaroslav |
203cc8 |
return CellPosition(frame, layer);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QPoint TopToBottomOrientation::positionToXY(const CellPosition &position,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const {
|
|
Jaroslav |
203cc8 |
int x = colToLayerAxis(position.layer(), fan);
|
|
Jaroslav |
203cc8 |
int y = rowToFrameAxis(position.frame());
|
|
Jaroslav |
203cc8 |
return QPoint(x, y);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
CellPositionRatio TopToBottomOrientation::xyToPositionRatio(
|
|
Jaroslav |
203cc8 |
const QPoint &xy) const {
|
|
Jaroslav |
203cc8 |
Ratio frame{xy.y(), CELL_HEIGHT};
|
|
Jaroslav |
203cc8 |
Ratio layer{xy.x(), CELL_WIDTH};
|
|
Jaroslav |
203cc8 |
return CellPositionRatio{frame, layer};
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QPoint TopToBottomOrientation::positionRatioToXY(
|
|
Jaroslav |
203cc8 |
const CellPositionRatio &ratio) const {
|
|
Jaroslav |
203cc8 |
int x = ratio.layer() * CELL_WIDTH;
|
|
Jaroslav |
203cc8 |
int y = ratio.frame() * CELL_HEIGHT;
|
|
Jaroslav |
203cc8 |
return QPoint(x, y);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
int TopToBottomOrientation::colToLayerAxis(int layer,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const {
|
|
Jaroslav |
203cc8 |
return fan->colToLayerAxis(layer);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
int TopToBottomOrientation::rowToFrameAxis(int frame) const {
|
|
Jaroslav |
203cc8 |
return frame * CELL_HEIGHT;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QPoint TopToBottomOrientation::frameLayerToXY(int frameAxis,
|
|
Jaroslav |
203cc8 |
int layerAxis) const {
|
|
Jaroslav |
203cc8 |
return QPoint(layerAxis, frameAxis);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
int TopToBottomOrientation::layerAxis(const QPoint &xy) const { return xy.x(); }
|
|
Jaroslav |
203cc8 |
int TopToBottomOrientation::frameAxis(const QPoint &xy) const { return xy.y(); }
|
|
Jaroslav |
203cc8 |
NumberRange TopToBottomOrientation::layerSide(const QRect &area) const {
|
|
Jaroslav |
203cc8 |
return NumberRange(area.left(), area.right());
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
NumberRange TopToBottomOrientation::frameSide(const QRect &area) const {
|
|
Jaroslav |
203cc8 |
return NumberRange(area.top(), area.bottom());
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QPoint TopToBottomOrientation::topRightCorner(const QRect &area) const {
|
|
Jaroslav |
203cc8 |
return area.topRight();
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
CellPosition TopToBottomOrientation::arrowShift(int direction) const {
|
|
Jaroslav |
203cc8 |
switch (direction) {
|
|
Jaroslav |
203cc8 |
case Qt::Key_Up:
|
|
Jaroslav |
203cc8 |
return CellPosition(-1, 0);
|
|
Jaroslav |
203cc8 |
case Qt::Key_Down:
|
|
Jaroslav |
203cc8 |
return CellPosition(1, 0);
|
|
Jaroslav |
203cc8 |
case Qt::Key_Left:
|
|
Jaroslav |
203cc8 |
return CellPosition(0, -1);
|
|
Jaroslav |
203cc8 |
case Qt::Key_Right:
|
|
Jaroslav |
203cc8 |
return CellPosition(0, 1);
|
|
Jaroslav |
203cc8 |
default:
|
|
Jaroslav |
203cc8 |
return CellPosition(0, 0);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
/// --------------------------------------------------------------------------------
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
LeftToRightOrientation::LeftToRightOrientation() {
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Ranges
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// Cell viewer
|
|
Jaroslav |
203cc8 |
QRect cellRect(0, 0, CELL_WIDTH, CELL_HEIGHT);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::CELL, cellRect);
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::DRAG_HANDLE_CORNER,
|
|
shun_iwasawa |
0cae24 |
QRect(0, 0, CELL_WIDTH, CELL_DRAG_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
QRect keyRect((CELL_WIDTH - KEY_ICON_WIDTH) / 2,
|
|
shun_iwasawa |
0cae24 |
CELL_HEIGHT - KEY_ICON_HEIGHT, KEY_ICON_WIDTH, KEY_ICON_HEIGHT);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::KEY_ICON, keyRect);
|
|
Jaroslav |
203cc8 |
QRect nameRect = cellRect.adjusted(4, 4, -6, 0);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::CELL_NAME, nameRect);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::CELL_NAME_WITH_KEYFRAME, nameRect);
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::END_EXTENDER,
|
|
shun_iwasawa |
0cae24 |
QRect(0, -EXTENDER_HEIGHT - 10, EXTENDER_WIDTH, EXTENDER_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::BEGIN_EXTENDER,
|
|
shun_iwasawa |
0cae24 |
QRect(-EXTENDER_WIDTH, -EXTENDER_HEIGHT - 10, EXTENDER_WIDTH,
|
|
shun_iwasawa |
0cae24 |
EXTENDER_HEIGHT));
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::KEYFRAME_AREA, keyRect);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::DRAG_AREA, QRect(0, 0, CELL_WIDTH, CELL_DRAG_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
QRect soundRect(0, CELL_DRAG_HEIGHT, CELL_WIDTH,
|
|
shun_iwasawa |
0cae24 |
CELL_HEIGHT - CELL_DRAG_HEIGHT - SOUND_PREVIEW_HEIGHT);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::SOUND_TRACK, soundRect);
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::PREVIEW_TRACK,
|
|
shun_iwasawa |
0cae24 |
QRect(0, CELL_HEIGHT - SOUND_PREVIEW_HEIGHT + 1, CELL_WIDTH,
|
|
shun_iwasawa |
0cae24 |
SOUND_PREVIEW_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::BEGIN_SOUND_EDIT,
|
|
shun_iwasawa |
0cae24 |
QRect(0, CELL_DRAG_HEIGHT, 2, CELL_HEIGHT - CELL_DRAG_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::END_SOUND_EDIT,
|
|
shun_iwasawa |
0cae24 |
QRect(CELL_WIDTH - 2, CELL_DRAG_HEIGHT, 2,
|
|
shun_iwasawa |
0cae24 |
CELL_HEIGHT - CELL_DRAG_HEIGHT));
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::LOOP_ICON, QRect(0, keyRect.top(), 10, 11));
|
|
manongjohn |
a21b06 |
QRect frameMarker((CELL_WIDTH - FRAME_MARKER_SIZE) / 2 - 1,
|
|
manongjohn |
a21b06 |
CELL_HEIGHT - FRAME_MARKER_SIZE - 6, FRAME_MARKER_SIZE,
|
|
manongjohn |
a21b06 |
FRAME_MARKER_SIZE);
|
|
manongjohn |
a21b06 |
addRect(PredefinedRect::FRAME_MARKER_AREA, frameMarker);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// Notes viewer
|
|
shun_iwasawa |
0cae24 |
addRect(
|
|
shun_iwasawa |
0cae24 |
PredefinedRect::NOTE_AREA,
|
|
shun_iwasawa |
0cae24 |
QRect(QPoint(0, 0), QSize(LAYER_HEADER_WIDTH - 1, FRAME_HEADER_HEIGHT)));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::NOTE_ICON,
|
|
shun_iwasawa |
0cae24 |
QRect(QPoint(0, 0), QSize(CELL_WIDTH - 2, CELL_HEIGHT - 2)));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::LAYER_HEADER_PANEL,
|
|
shun_iwasawa |
0cae24 |
QRect(0, FRAME_HEADER_HEIGHT - CELL_HEIGHT, LAYER_HEADER_WIDTH,
|
|
shun_iwasawa |
0cae24 |
CELL_HEIGHT));
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// Row viewer
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::FRAME_LABEL,
|
|
shun_iwasawa |
0cae24 |
QRect(CELL_WIDTH / 4, 1, CELL_WIDTH / 2, FRAME_HEADER_HEIGHT - 2));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::FRAME_HEADER,
|
|
manongjohn |
98ab1a |
QRect(0, 0, CELL_WIDTH, FRAME_HEADER_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::PLAY_RANGE,
|
|
shun_iwasawa |
0cae24 |
QRect(0, PLAY_RANGE_Y, CELL_WIDTH, PLAY_MARKER_SIZE));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION,
|
|
manongjohn |
f643b0 |
QRect(ONION_X + (CELL_WIDTH - ONION_SIZE) / 2 - 1,
|
|
manongjohn |
f643b0 |
ONION_Y + (3 * ONION_DOT_SIZE - ONION_SIZE) / 2, ONION_SIZE,
|
|
manongjohn |
f643b0 |
ONION_SIZE)
|
|
manongjohn |
1be264 |
.adjusted(1, 2, 1, 2));
|
|
Jaroslav |
203cc8 |
int adjustOnion = (ONION_SIZE - ONION_DOT_SIZE) / 2;
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION_DOT,
|
|
manongjohn |
f643b0 |
QRect(ONION_X + adjustOnion + (CELL_WIDTH - ONION_SIZE) / 2,
|
|
manongjohn |
f643b0 |
ONION_Y + ONION_DOT_SIZE, ONION_DOT_SIZE, ONION_DOT_SIZE)
|
|
manongjohn |
1be264 |
.adjusted(1, 1, 1, 1));
|
|
manongjohn |
1be264 |
addRect(PredefinedRect::ONION_DOT_FIXED,
|
|
manongjohn |
f643b0 |
QRect(ONION_X + adjustOnion + (CELL_WIDTH - ONION_SIZE) / 2, ONION_Y,
|
|
manongjohn |
f643b0 |
ONION_DOT_SIZE, ONION_DOT_SIZE)
|
|
manongjohn |
1be264 |
.adjusted(1, 1, 1, 1));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION_AREA,
|
|
shun_iwasawa |
0cae24 |
QRect(ONION_X, ONION_Y, CELL_WIDTH, ONION_SIZE));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION_FIXED_DOT_AREA,
|
|
shun_iwasawa |
0cae24 |
QRect(ONION_X, ONION_Y, CELL_WIDTH, ONION_DOT_SIZE));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::ONION_DOT_AREA,
|
|
shun_iwasawa |
0cae24 |
QRect(ONION_X, ONION_Y + ONION_DOT_SIZE, CELL_WIDTH, ONION_DOT_SIZE));
|
|
shun_iwasawa |
0cae24 |
addRect(
|
|
shun_iwasawa |
0cae24 |
PredefinedRect::PINNED_CENTER_KEY,
|
|
shun_iwasawa |
0cae24 |
QRect((CELL_WIDTH - PINNED_SIZE) / 2,
|
|
shun_iwasawa |
0cae24 |
(FRAME_HEADER_HEIGHT - PINNED_SIZE) / 2, PINNED_SIZE, PINNED_SIZE));
|
|
manongjohn |
a21b06 |
addRect(
|
|
manongjohn |
a21b06 |
PredefinedRect::PREVIEW_FRAME_AREA,
|
|
manongjohn |
a21b06 |
QRect(0, PLAY_RANGE_Y, CELL_WIDTH, (FRAME_HEADER_HEIGHT - PLAY_RANGE_Y)));
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
// Column viewer
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::LAYER_HEADER,
|
|
manongjohn |
dff49a |
QRect(1, 0, LAYER_HEADER_WIDTH - 2, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(
|
|
shun_iwasawa |
0cae24 |
PredefinedRect::FOLDED_LAYER_HEADER,
|
|
manongjohn |
dff49a |
QRect(1, 0, FOLDED_LAYER_HEADER_WIDTH - 2, FOLDED_LAYER_HEADER_HEIGHT));
|
|
manongjohn |
a21b06 |
QRect columnName(ICONS_WIDTH + 1, 0,
|
|
manongjohn |
a21b06 |
LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 4, CELL_HEIGHT);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::RENAME_COLUMN, columnName);
|
|
manongjohn |
399e7d |
QRect eye(1, 0, ICON_WIDTH, ICON_HEIGHT);
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::EYE_AREA, eye);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::EYE, eye.adjusted(1, 1, -1, -1));
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::PREVIEW_LAYER_AREA, eye.translated(ICON_OFFSET, 0));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::PREVIEW_LAYER,
|
|
manongjohn |
399e7d |
eye.translated(ICON_OFFSET, 0).adjusted(1, 1, -1, -1));
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::LOCK_AREA, eye.translated(2 * ICON_OFFSET, 0));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::LOCK,
|
|
manongjohn |
399e7d |
eye.translated(2 * ICON_OFFSET, 0).adjusted(1, 1, -1, -1));
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::CONFIG_AREA, eye.translated(3 * ICON_OFFSET, 0));
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::CONFIG,
|
|
manongjohn |
399e7d |
eye.translated(3 * ICON_OFFSET, 0).adjusted(1, 1, -1, -1));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::DRAG_LAYER,
|
|
shun_iwasawa |
0cae24 |
QRect(ICONS_WIDTH + 1, 0, LAYER_HEADER_WIDTH - ICONS_WIDTH - 3,
|
|
shun_iwasawa |
0cae24 |
CELL_DRAG_HEIGHT));
|
|
Jaroslav |
203cc8 |
addRect(PredefinedRect::LAYER_NAME, columnName);
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::LAYER_NUMBER,
|
|
shun_iwasawa |
0cae24 |
QRect(ICONS_WIDTH + 1, 0, LAYER_NUMBER_WIDTH, CELL_HEIGHT));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::THUMBNAIL_AREA, QRect(0, 0, -1, -1)); // hide
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::THUMBNAIL, QRect(0, 0, -1, -1)); // hide
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::FILTER_COLOR,
|
|
shun_iwasawa |
0cae24 |
QRect(LAYER_HEADER_WIDTH - 17, 6, 12, 12));
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::PEGBAR_NAME, QRect(0, 0, -1, -1)); // hide
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::PARENT_HANDLE_NAME, QRect(0, 0, -1, -1)); // hide
|
|
Jaroslav |
203cc8 |
|
|
shun_iwasawa |
0cae24 |
addRect(PredefinedRect::SOUND_ICON,
|
|
shun_iwasawa |
0cae24 |
QRect(columnName.topRight(), QSize(27, columnName.height()))
|
|
shun_iwasawa |
0cae24 |
.adjusted(-28, 0, -28, 0));
|
|
Jaroslav |
203cc8 |
|
|
manongjohn |
399e7d |
QRect volumeArea(QRect(columnName.topRight(), QSize(TRACKLEN + 8, 14))
|
|
manongjohn |
399e7d |
.adjusted(-97, 4, -97, 4));
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::VOLUME_AREA, volumeArea);
|
|
manongjohn |
399e7d |
QPoint soundTopLeft(volumeArea.left() + 4, volumeArea.bottom() - 6);
|
|
manongjohn |
399e7d |
addRect(PredefinedRect::VOLUME_TRACK,
|
|
manongjohn |
399e7d |
QRect(soundTopLeft, QSize(TRACKLEN, 3)));
|
|
manongjohn |
399e7d |
|
|
manongjohn |
e71b98 |
// Layer footer panel
|
|
manongjohn |
e71b98 |
QRect layerFooterPanel(QRect(0, 0, LAYER_HEADER_WIDTH + 2, 16));
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::LAYER_FOOTER_PANEL, layerFooterPanel);
|
|
manongjohn |
e71b98 |
|
|
manongjohn |
e71b98 |
QRect zoomSlider, zoomIn, zoomOut;
|
|
manongjohn |
e71b98 |
|
|
manongjohn |
e71b98 |
zoomSlider = QRect(layerFooterPanel.width() - 100, 0, 81, 16);
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_SLIDER_AREA, zoomSlider);
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_SLIDER, zoomSlider.adjusted(1, 0, 0, 0));
|
|
manongjohn |
e71b98 |
|
|
manongjohn |
e71b98 |
zoomIn = QRect(zoomSlider.right() + 1, 0, 16, 16);
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_IN_AREA, zoomIn);
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_IN, zoomIn.adjusted(1, 1, 0, 0));
|
|
manongjohn |
e71b98 |
|
|
manongjohn |
e71b98 |
zoomOut = QRect(zoomSlider.left() - 16, 0, 16, 16);
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_OUT_AREA, zoomOut);
|
|
manongjohn |
e71b98 |
addRect(PredefinedRect::ZOOM_OUT, zoomOut.adjusted(1, 1, 0, 0));
|
|
manongjohn |
e71b98 |
|
|
manongjohn |
e71b98 |
// Flags
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::DRAG_LAYER_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::DRAG_LAYER_VISIBLE, true);
|
|
manongjohn |
a21b06 |
addFlag(PredefinedFlag::LAYER_NAME_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NAME_VISIBLE, true);
|
|
manongjohn |
a21b06 |
addFlag(PredefinedFlag::LAYER_NUMBER_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LAYER_NUMBER_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::EYE_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::EYE_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LOCK_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::LOCK_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::CONFIG_AREA_BORDER, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PARENT_HANDLE_NAME_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, false);
|
|
manongjohn |
399e7d |
addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false);
|
|
manongjohn |
399e7d |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Lines
|
|
Jaroslav |
203cc8 |
//
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::LOCKED,
|
|
manongjohn |
a21b06 |
verticalLine((CELL_DRAG_HEIGHT + 1) / 2, NumberRange(0, CELL_WIDTH)));
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::SEE_MARKER_THROUGH,
|
|
shun_iwasawa |
0cae24 |
horizontalLine(0, NumberRange(0, CELL_DRAG_HEIGHT)));
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::CONTINUE_LEVEL,
|
|
shun_iwasawa |
0cae24 |
verticalLine(CELL_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::CONTINUE_LEVEL_WITH_NAME,
|
|
shun_iwasawa |
0cae24 |
verticalLine(CELL_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
|
|
shun_iwasawa |
0cae24 |
addLine(PredefinedLine::EXTENDER_LINE,
|
|
shun_iwasawa |
0cae24 |
horizontalLine(0, NumberRange(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0)));
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Dimensions
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::LAYER, CELL_HEIGHT);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::FRAME, CELL_WIDTH);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::INDEX, 1);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::SOUND_AMPLITUDE, soundRect.height() / 2);
|
|
shun_iwasawa |
0cae24 |
addDimension(PredefinedDimension::FRAME_LABEL_ALIGN,
|
|
shun_iwasawa |
0cae24 |
Qt::AlignHCenter | Qt::AlignBottom | Qt::TextWordWrap);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::ONION_TURN, 90);
|
|
shun_iwasawa |
0cae24 |
addDimension(PredefinedDimension::QBOXLAYOUT_DIRECTION,
|
|
shun_iwasawa |
0cae24 |
QBoxLayout::Direction::LeftToRight);
|
|
Jaroslav |
203cc8 |
addDimension(PredefinedDimension::CENTER_ALIGN, Qt::AlignVCenter);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Paths
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
QPainterPath corner(QPointF(CELL_WIDTH, 0));
|
|
Jaroslav |
203cc8 |
corner.lineTo(QPointF(CELL_WIDTH, CELL_DRAG_HEIGHT));
|
|
Jaroslav |
203cc8 |
corner.lineTo(QPointF(CELL_WIDTH - CELL_DRAG_HEIGHT, CELL_DRAG_HEIGHT));
|
|
Jaroslav |
203cc8 |
corner.lineTo(QPointF(CELL_WIDTH, 0));
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner);
|
|
Jaroslav |
203cc8 |
|
|
manongjohn |
a21b06 |
QPainterPath diamond(QPointF(0, -4));
|
|
manongjohn |
a21b06 |
diamond.lineTo(4, 0);
|
|
manongjohn |
a21b06 |
diamond.lineTo(0, 4);
|
|
manongjohn |
a21b06 |
diamond.lineTo(-4, 0);
|
|
manongjohn |
a21b06 |
diamond.lineTo(0, -4);
|
|
manongjohn |
a21b06 |
addPath(PredefinedPath::FRAME_MARKER_DIAMOND, diamond);
|
|
manongjohn |
a21b06 |
|
|
Jaroslav |
203cc8 |
QPainterPath fromTriangle(QPointF(EASE_TRIANGLE_SIZE / 2, 0));
|
|
Jaroslav |
203cc8 |
fromTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE / 2, EASE_TRIANGLE_SIZE));
|
|
Jaroslav |
203cc8 |
fromTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE / 2, -EASE_TRIANGLE_SIZE));
|
|
Jaroslav |
203cc8 |
fromTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE / 2, 0));
|
|
Jaroslav |
203cc8 |
fromTriangle.translate(keyRect.center());
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::BEGIN_EASE_TRIANGLE, fromTriangle);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath toTriangle(QPointF(-EASE_TRIANGLE_SIZE / 2, 0));
|
|
Jaroslav |
203cc8 |
toTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE / 2, EASE_TRIANGLE_SIZE));
|
|
Jaroslav |
203cc8 |
toTriangle.lineTo(QPointF(EASE_TRIANGLE_SIZE / 2, -EASE_TRIANGLE_SIZE));
|
|
Jaroslav |
203cc8 |
toTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE / 2, 0));
|
|
Jaroslav |
203cc8 |
toTriangle.translate(keyRect.center());
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::END_EASE_TRIANGLE, toTriangle);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath playFrom(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
playFrom.lineTo(QPointF(PLAY_MARKER_SIZE, 0));
|
|
Jaroslav |
203cc8 |
playFrom.lineTo(QPointF(0, PLAY_MARKER_SIZE));
|
|
Jaroslav |
203cc8 |
playFrom.lineTo(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
playFrom.translate(1, PLAY_RANGE_Y);
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::BEGIN_PLAY_RANGE, playFrom);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath playTo(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
playTo.lineTo(QPointF(-PLAY_MARKER_SIZE, 0));
|
|
Jaroslav |
203cc8 |
playTo.lineTo(QPointF(0, PLAY_MARKER_SIZE));
|
|
Jaroslav |
203cc8 |
playTo.lineTo(QPointF(0, 0));
|
|
manongjohn |
a21b06 |
playTo.translate(CELL_WIDTH - 2, PLAY_RANGE_Y);
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::END_PLAY_RANGE, playTo);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath track(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
track.lineTo(QPointF(1, 1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(TRACKLEN - 1, 1));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(TRACKLEN, 0));
|
|
manongjohn |
399e7d |
track.lineTo(QPointF(TRACKLEN - 1, -1));
|
|
Jaroslav |
203cc8 |
track.lineTo(QPointF(1, -1));
|
|
Jaroslav |
203cc8 |
track.lineTo(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
track.translate(soundTopLeft);
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::VOLUME_SLIDER_TRACK, track);
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
QPainterPath head(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
head.lineTo(QPointF(4, -4));
|
|
Jaroslav |
203cc8 |
head.lineTo(QPointF(4, -8));
|
|
Jaroslav |
203cc8 |
head.lineTo(QPointF(-4, -8));
|
|
Jaroslav |
203cc8 |
head.lineTo(QPointF(-4, -4));
|
|
Jaroslav |
203cc8 |
head.lineTo(QPointF(0, 0));
|
|
Jaroslav |
203cc8 |
addPath(PredefinedPath::VOLUME_SLIDER_HEAD, head);
|
|
Jaroslav |
203cc8 |
|
|
manongjohn |
1be264 |
QPainterPath timeIndicator(QPointF(0, 0));
|
|
manongjohn |
1be264 |
timeIndicator.lineTo(QPointF(-9, -5));
|
|
manongjohn |
1be264 |
timeIndicator.lineTo(QPointF(-9, -18));
|
|
manongjohn |
1be264 |
timeIndicator.lineTo(QPointF(9, -18));
|
|
manongjohn |
1be264 |
timeIndicator.lineTo(QPointF(9, -4));
|
|
manongjohn |
1be264 |
timeIndicator.lineTo(QPointF(0, 0));
|
|
manongjohn |
1be264 |
addPath(PredefinedPath::TIME_INDICATOR_HEAD, timeIndicator);
|
|
manongjohn |
1be264 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Points
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
addPoint(PredefinedPoint::KEY_HIDDEN, QPoint(0, 10));
|
|
Jaroslav |
203cc8 |
addPoint(PredefinedPoint::EXTENDER_XY_RADIUS, QPoint(75, 30));
|
|
shun_iwasawa |
0cae24 |
addPoint(PredefinedPoint::VOLUME_DIVISIONS_TOP_LEFT,
|
|
shun_iwasawa |
0cae24 |
soundTopLeft + QPoint(0, 3));
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
// Ranges
|
|
Jaroslav |
203cc8 |
//
|
|
Jaroslav |
203cc8 |
addRange(PredefinedRange::HEADER_LAYER, NumberRange(0, FRAME_HEADER_HEIGHT));
|
|
Jaroslav |
203cc8 |
addRange(PredefinedRange::HEADER_FRAME, NumberRange(0, LAYER_HEADER_WIDTH));
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
CellPosition LeftToRightOrientation::xyToPosition(const QPoint &xy,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const {
|
|
Jaroslav |
203cc8 |
int layer = fan->layerAxisToCol(xy.y());
|
|
Jaroslav |
203cc8 |
int frame = xy.x() / CELL_WIDTH;
|
|
Jaroslav |
203cc8 |
return CellPosition(frame, layer);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QPoint LeftToRightOrientation::positionToXY(const CellPosition &position,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const {
|
|
Jaroslav |
203cc8 |
int y = colToLayerAxis(position.layer(), fan);
|
|
Jaroslav |
203cc8 |
int x = rowToFrameAxis(position.frame());
|
|
Jaroslav |
203cc8 |
return QPoint(x, y);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
CellPositionRatio LeftToRightOrientation::xyToPositionRatio(
|
|
Jaroslav |
203cc8 |
const QPoint &xy) const {
|
|
Jaroslav |
203cc8 |
Ratio frame{xy.x(), CELL_WIDTH};
|
|
Jaroslav |
203cc8 |
Ratio layer{xy.y(), CELL_HEIGHT};
|
|
Jaroslav |
203cc8 |
return CellPositionRatio{frame, layer};
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QPoint LeftToRightOrientation::positionRatioToXY(
|
|
Jaroslav |
203cc8 |
const CellPositionRatio &ratio) const {
|
|
Jaroslav |
203cc8 |
int x = ratio.frame() * CELL_WIDTH;
|
|
Jaroslav |
203cc8 |
int y = ratio.layer() * CELL_HEIGHT;
|
|
Jaroslav |
203cc8 |
return QPoint(x, y);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
|
|
Jaroslav |
203cc8 |
int LeftToRightOrientation::colToLayerAxis(int layer,
|
|
Jaroslav |
203cc8 |
const ColumnFan *fan) const {
|
|
Jaroslav |
203cc8 |
return fan->colToLayerAxis(layer);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
int LeftToRightOrientation::rowToFrameAxis(int frame) const {
|
|
Jaroslav |
203cc8 |
return frame * CELL_WIDTH;
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QPoint LeftToRightOrientation::frameLayerToXY(int frameAxis,
|
|
Jaroslav |
203cc8 |
int layerAxis) const {
|
|
Jaroslav |
203cc8 |
return QPoint(frameAxis, layerAxis);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
int LeftToRightOrientation::layerAxis(const QPoint &xy) const { return xy.y(); }
|
|
Jaroslav |
203cc8 |
int LeftToRightOrientation::frameAxis(const QPoint &xy) const { return xy.x(); }
|
|
Jaroslav |
203cc8 |
NumberRange LeftToRightOrientation::layerSide(const QRect &area) const {
|
|
Jaroslav |
203cc8 |
return NumberRange(area.top(), area.bottom());
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
NumberRange LeftToRightOrientation::frameSide(const QRect &area) const {
|
|
Jaroslav |
203cc8 |
return NumberRange(area.left(), area.right());
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
QPoint LeftToRightOrientation::topRightCorner(const QRect &area) const {
|
|
Jaroslav |
203cc8 |
return area.bottomLeft();
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
CellPosition LeftToRightOrientation::arrowShift(int direction) const {
|
|
Jaroslav |
203cc8 |
switch (direction) {
|
|
Jaroslav |
203cc8 |
case Qt::Key_Up:
|
|
Jaroslav |
203cc8 |
return CellPosition(0, 1);
|
|
manongjohn |
2e094e |
case Qt::Key_Down:
|
|
manongjohn |
2e094e |
return CellPosition(0, -1);
|
|
Jaroslav |
203cc8 |
case Qt::Key_Left:
|
|
Jaroslav |
203cc8 |
return CellPosition(-1, 0);
|
|
Jaroslav |
203cc8 |
case Qt::Key_Right:
|
|
Jaroslav |
203cc8 |
return CellPosition(1, 0);
|
|
Jaroslav |
203cc8 |
default:
|
|
Jaroslav |
203cc8 |
return CellPosition(0, 0);
|
|
Jaroslav |
203cc8 |
}
|
|
Jaroslav |
203cc8 |
}
|