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>
d63d61
#include <stdexcept></stdexcept>
Jaroslav 203cc8
Jaroslav 203cc8
namespace {
shun-iwasawa 2b24e8
const int KEY_ICON_WIDTH      = 11;
shun-iwasawa 2b24e8
const int KEY_ICON_HEIGHT     = 13;
shun-iwasawa 2b24e8
const int EASE_TRIANGLE_SIZE  = 4;
shun-iwasawa 2b24e8
const int PLAY_MARKER_SIZE    = 10;
shun-iwasawa 2b24e8
const int PINNED_SIZE         = 10;
shun-iwasawa 2b24e8
const int FRAME_MARKER_SIZE   = 4;
shun-iwasawa 2b24e8
const int FOLDED_CELL_SIZE    = 9;
shun-iwasawa 2b24e8
const int SHIFTTRACE_DOT_SIZE = 12;
shun-iwasawa 52004d
shun-iwasawa 52004d
QRect iconRect(const QRect &areaRect, const int iconWidth, const int iconHeight,
shun-iwasawa 52004d
               const int xOffset = 0) {
shun-iwasawa 52004d
  return QRect(
shun-iwasawa 52004d
      areaRect.left() + xOffset + ((areaRect.width() / 2) - (iconWidth / 2)),
shun-iwasawa 52004d
      areaRect.top() + ((areaRect.height() / 2) - (iconHeight / 2)), iconWidth,
shun-iwasawa 52004d
      iconHeight);
Jaroslav 203cc8
}
Jaroslav 203cc8
shun-iwasawa 52004d
}  // namespace
shun-iwasawa 52004d
Jaroslav 203cc8
class TopToBottomOrientation : public Orientation {
shun-iwasawa 855b12
  int CELL_WIDTH = 74;
shun-iwasawa 855b12
  // 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 855b12
  int FRAME_HEADER_WIDTH               = CELL_WIDTH;
shun-iwasawa 855b12
  int PLAY_RANGE_X  = FRAME_HEADER_WIDTH / 2 - PLAY_MARKER_SIZE;
shun-iwasawa 855b12
  const int ONION_X = 0;
shun-iwasawa 855b12
  int ONION_Y       = 0;
shun-iwasawa 855b12
  // const int ICON_WIDTH               = 18;
shun-iwasawa 855b12
  // const int ICON_HEIGHT              = 18;
shun-iwasawa 855b12
  int ICON_WIDTH                     = 18;
shun-iwasawa 855b12
  int ICON_HEIGHT                    = 18;
shun-iwasawa 692990
  const int TRACKLEN                 = 60;
shun-iwasawa 692990
  const int SHIFTTRACE_DOT_OFFSET    = 3;
shun-iwasawa 692990
  const int CAMERA_CELL_WIDTH        = 22;
shun-iwasawa 692990
  const int LAYER_FOOTER_PANEL_WIDTH = 16;
shun-iwasawa 855b12
  int ONION_SIZE                     = 19;
shun-iwasawa 855b12
  int ONION_DOT_SIZE                 = 8;
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;
shun-iwasawa 692990
  virtual CellPositionRatio xyToPositionRatio(const QPointF &xy) const override;
shun-iwasawa 692990
  virtual QPointF 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;
manongjohn 9b62c5
  const int CELL_HEIGHT          = 24;
manongjohn 9b62c5
  const int CELL_DRAG_HEIGHT     = 7;
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;
shun-iwasawa 855b12
  const int ONION_SIZE         = 19;
shun-iwasawa 855b12
  const int ONION_DOT_SIZE     = 8;
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
manongjohn 9b62c5
  const int THUMBNAIL_WIDTH    = 43;
Jaroslav 203cc8
  const int LAYER_NUMBER_WIDTH = 20;
manongjohn 399e7d
  const int LAYER_NAME_WIDTH   = 150;
Jaroslav 203cc8
  const int LAYER_HEADER_WIDTH =
manongjohn 9b62c5
      ICONS_WIDTH + THUMBNAIL_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;
shun-iwasawa 2b24e8
  const int SHIFTTRACE_DOT_OFFSET      = 5;
manongjohn 9b62c5
  const int LAYER_HEADER_PANEL_HEIGHT  = 20;
manongjohn 9b62c5
  const int LAYER_FOOTER_PANEL_HEIGHT  = 16;
shun-iwasawa 52004d
  const int CAMERA_CELL_HEIGHT         = CELL_HEIGHT;
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;
shun-iwasawa 692990
  virtual CellPositionRatio xyToPositionRatio(const QPointF &xy) const override;
shun-iwasawa 692990
  virtual QPointF 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 {
shun-iwasawa 52004d
  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
}
otakuto 158f9f
const std::vector<const *="" orientation=""> &Orientations::all() {</const>
Jaroslav 203cc8
  return instance()._all;
Jaroslav 203cc8
}
Jaroslav 203cc8
const Orientation *Orientations::byName(const QString &name) {
otakuto 158f9f
  std::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);
otakuto 158f9f
  _rects.emplace(which, rect);
Jaroslav 203cc8
}
Jaroslav 203cc8
void Orientation::addLine(PredefinedLine which, const QLine &line) {
manongjohn 399e7d
  _lines.erase(which);
otakuto 158f9f
  _lines.emplace(which, line);
Jaroslav 203cc8
}
Jaroslav 203cc8
void Orientation::addDimension(PredefinedDimension which, int dimension) {
manongjohn 399e7d
  _dimensions.erase(which);
otakuto 158f9f
  _dimensions.emplace(which, dimension);
Jaroslav 203cc8
}
Jaroslav 203cc8
void Orientation::addPath(PredefinedPath which, const QPainterPath &path) {
manongjohn 399e7d
  _paths.erase(which);
otakuto 158f9f
  _paths.emplace(which, path);
Jaroslav 203cc8
}
Jaroslav 203cc8
void Orientation::addPoint(PredefinedPoint which, const QPoint &point) {
manongjohn 399e7d
  _points.erase(which);
otakuto 158f9f
  _points.emplace(which, point);
Jaroslav 203cc8
}
Jaroslav 203cc8
void Orientation::addRange(PredefinedRange which, const NumberRange &range) {
manongjohn 399e7d
  _ranges.erase(which);
otakuto 158f9f
  _ranges.emplace(which, range);
Jaroslav 203cc8
}
manongjohn 399e7d
void Orientation::addFlag(PredefinedFlag which, const bool &flag) {
manongjohn 399e7d
  _flags.erase(which);
otakuto 158f9f
  _flags.emplace(which, flag);
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
shun-iwasawa 855b12
  if (layout == QString("Compact"))
shun-iwasawa 855b12
    use_header_height -= 18;
shun-iwasawa 855b12
  else if (layout == QString("Minimum"))
shun-iwasawa 855b12
    use_header_height = CELL_HEIGHT * 2;
manongjohn 399e7d
manongjohn 399e7d
  int user_folded_header_height = use_header_height;
manongjohn 399e7d
shun-iwasawa 855b12
  if (layout == QString("Minimum")) {
shun-iwasawa 855b12
    CELL_WIDTH         = 50;
shun-iwasawa 855b12
    ICON_WIDTH         = 16;
shun-iwasawa 855b12
    ICON_HEIGHT        = 16;
shun-iwasawa 855b12
    FRAME_HEADER_WIDTH = 45;
shun-iwasawa 855b12
    ONION_SIZE         = 15;
shun-iwasawa 855b12
    ONION_DOT_SIZE     = 6;
shun-iwasawa 855b12
    PLAY_RANGE_X       = ONION_SIZE;
shun-iwasawa 855b12
    ONION_Y            = (CELL_HEIGHT - ONION_SIZE) / 2;
shun-iwasawa 855b12
  }
shun-iwasawa 855b12
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 52004d
  addRect(PredefinedRect::CAMERA_CELL,
shun-iwasawa 52004d
          QRect(0, 0, CAMERA_CELL_WIDTH, CELL_HEIGHT));
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);
shun-iwasawa 52004d
  QRect cameraKeyRect((CAMERA_CELL_WIDTH - KEY_ICON_WIDTH) / 2 + 1,
shun-iwasawa 52004d
                      (CELL_HEIGHT - KEY_ICON_HEIGHT) / 2, KEY_ICON_WIDTH,
shun-iwasawa 52004d
                      KEY_ICON_HEIGHT);
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_KEY_ICON, cameraKeyRect);
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 f84c65
  int markSize = CELL_HEIGHT * 8 / 10;  // 80% size
shun-iwasawa f84c65
  addRect(PredefinedRect::CELL_MARK_AREA,
shun-iwasawa f84c65
          QRect(CELL_DRAG_WIDTH - 3, 2, markSize, markSize));
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));
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_LOOP_ICON,
shun-iwasawa 52004d
          QRect(cameraKeyRect.left(), 0, 10, 11));
shun-iwasawa 692990
  QRect frameMarker(CELL_WIDTH - FRAME_MARKER_SIZE - 4,
shun-iwasawa 692990
                    (CELL_HEIGHT - FRAME_MARKER_SIZE) / 2, FRAME_MARKER_SIZE,
shun-iwasawa 692990
                    FRAME_MARKER_SIZE);
shun-iwasawa 692990
  addRect(PredefinedRect::FRAME_MARKER_AREA, frameMarker);
shun-iwasawa 692990
  addRect(PredefinedRect::CAMERA_FRAME_MARKER_AREA,
shun-iwasawa 692990
          cameraKeyRect.translated(-1, 0));
Jaroslav 203cc8
Jaroslav 203cc8
  // Note viewer
shun-iwasawa 855b12
  addRect(PredefinedRect::NOTE_AREA,
shun-iwasawa 855b12
          QRect(QPoint(0, 0), QSize(FRAME_HEADER_WIDTH, use_header_height)));
shun_iwasawa 0cae24
  addRect(PredefinedRect::NOTE_ICON,
shun_iwasawa 0cae24
          QRect(QPoint(0, 0), QSize(CELL_WIDTH - 2, CELL_HEIGHT - 2)));
manongjohn 9b62c5
manongjohn 9b62c5
  // Layer header panel
manongjohn 9b62c5
  addRect(PredefinedRect::LAYER_HEADER_PANEL, QRect(0, 0, -1, -1));   // hide
manongjohn 9b62c5
  addRect(PredefinedRect::PANEL_EYE, QRect(0, 0, -1, -1));            // hide
manongjohn 9b62c5
  addRect(PredefinedRect::PANEL_PREVIEW_LAYER, QRect(0, 0, -1, -1));  // hide
manongjohn 9b62c5
  addRect(PredefinedRect::PANEL_LOCK, QRect(0, 0, -1, -1));           // hide
manongjohn 9b62c5
  addRect(PredefinedRect::PANEL_LAYER_NAME, QRect(0, 0, -1, -1));     // hide
Jaroslav 203cc8
Jaroslav 203cc8
  // Row viewer
shun-iwasawa 855b12
  if (layout == QString("Minimum"))
shun-iwasawa 855b12
    addRect(PredefinedRect::FRAME_LABEL,
shun-iwasawa 855b12
            QRect(0, 0, FRAME_HEADER_WIDTH - 2, CELL_HEIGHT));
shun-iwasawa 855b12
  else
shun-iwasawa 855b12
    addRect(PredefinedRect::FRAME_LABEL,
shun-iwasawa 855b12
            QRect(0, 0, CELL_WIDTH - 4, CELL_HEIGHT));
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,
manongjohn d44297
          QRect(ONION_X, ONION_Y, ONION_DOT_SIZE + 1, CELL_HEIGHT));
manongjohn d44297
  addRect(PredefinedRect::ONION_DOT_AREA,
manongjohn d44297
          QRect(ONION_X + ONION_DOT_SIZE + 1, ONION_Y, ONION_DOT_SIZE + 1,
manongjohn d44297
                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
shun-iwasawa 2b24e8
  addRect(PredefinedRect::SHIFTTRACE_DOT,
shun-iwasawa 2b24e8
          QRect(SHIFTTRACE_DOT_OFFSET, (CELL_HEIGHT - SHIFTTRACE_DOT_SIZE) / 2,
shun-iwasawa 2b24e8
                SHIFTTRACE_DOT_SIZE, SHIFTTRACE_DOT_SIZE));
shun-iwasawa 2b24e8
  addRect(PredefinedRect::SHIFTTRACE_DOT_AREA,
shun-iwasawa 2b24e8
          QRect(SHIFTTRACE_DOT_OFFSET, 0, SHIFTTRACE_DOT_SIZE, CELL_HEIGHT));
shun-iwasawa 2b24e8
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));
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_LAYER_HEADER,
shun-iwasawa 52004d
          QRect(0, 1, CAMERA_CELL_WIDTH, use_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;
shun-iwasawa 52004d
  QRect layername, eyeArea, previewArea, lockArea, cameraLockArea, configArea,
shun-iwasawa 52004d
      cameraConfigArea, thumbnailArea, thumbnail, cameraIconArea, pegbarname,
shun-iwasawa 52004d
      volumeArea;
manongjohn 399e7d
  QPoint soundTopLeft;
manongjohn 399e7d
shun-iwasawa 855b12
  if (layout == QString("Minimum")) {
shun-iwasawa 855b12
    THUMBNAIL_HEIGHT = -1;
shun-iwasawa 855b12
    HDRROW_HEIGHT    = CELL_HEIGHT - 1;
shun-iwasawa 855b12
    INDENT           = 0;
shun-iwasawa 855b12
    HDRROW1          = 1;                        // Name, number
shun-iwasawa 855b12
    HDRROW2          = HDRROW1 + HDRROW_HEIGHT;  // eye, preview, config
shun-iwasawa 855b12
shun-iwasawa 855b12
    addRect(PredefinedRect::DRAG_LAYER, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
shun-iwasawa 855b12
    addRect(PredefinedRect::RENAME_COLUMN,
shun-iwasawa 855b12
            QRect(0, HDRROW1, CELL_WIDTH, HDRROW_HEIGHT));
shun-iwasawa 855b12
shun-iwasawa 855b12
    layername =
shun-iwasawa 855b12
        QRect(INDENT + 1, HDRROW1 + 1, CELL_WIDTH - 1, HDRROW_HEIGHT - 1);
shun-iwasawa 855b12
    addRect(PredefinedRect::LAYER_NAME, layername);
shun-iwasawa 855b12
    addRect(PredefinedRect::CAMERA_LAYER_NAME, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    addRect(PredefinedRect::LAYER_NUMBER,
shun-iwasawa 855b12
            QRect(INDENT + layername.width() - 20, HDRROW1, 20, HDRROW_HEIGHT));
shun-iwasawa 855b12
shun-iwasawa 855b12
    eyeArea = QRect(INDENT, HDRROW2, ICON_WIDTH + 1, HDRROW_HEIGHT);  // Compact
shun-iwasawa 855b12
    addRect(PredefinedRect::EYE_AREA, eyeArea);
shun-iwasawa 855b12
    addRect(PredefinedRect::EYE,
shun-iwasawa 855b12
            iconRect(eyeArea, ICON_WIDTH, ICON_HEIGHT - 1, 1));
shun-iwasawa 855b12
shun-iwasawa 855b12
    previewArea =
shun-iwasawa 855b12
        QRect(INDENT + eyeArea.width(), HDRROW2, ICON_WIDTH + 1, HDRROW_HEIGHT);
shun-iwasawa 855b12
    addRect(PredefinedRect::PREVIEW_LAYER_AREA, previewArea);
shun-iwasawa 855b12
    addRect(PredefinedRect::PREVIEW_LAYER,
shun-iwasawa 855b12
            iconRect(previewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1));
shun-iwasawa 855b12
shun-iwasawa 855b12
    addRect(PredefinedRect::LOCK_AREA, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    addRect(PredefinedRect::LOCK, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    addRect(PredefinedRect::CAMERA_LOCK_AREA, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    addRect(PredefinedRect::CAMERA_LOCK, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
shun-iwasawa 855b12
    configArea = QRect(INDENT + eyeArea.width() + previewArea.width(), HDRROW2,
shun-iwasawa 855b12
                       ICON_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 855b12
    addRect(PredefinedRect::CONFIG_AREA, configArea);
shun-iwasawa 855b12
    addRect(PredefinedRect::CONFIG,
shun-iwasawa 855b12
            iconRect(configArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
shun-iwasawa 855b12
    cameraConfigArea = QRect(INDENT, HDRROW2, CAMERA_CELL_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 855b12
    addRect(PredefinedRect::CAMERA_CONFIG_AREA, cameraConfigArea);
shun-iwasawa 855b12
    addRect(PredefinedRect::CAMERA_CONFIG,
shun-iwasawa 855b12
            iconRect(cameraConfigArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
shun-iwasawa 855b12
    addRect(PredefinedRect::THUMBNAIL_AREA, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    addRect(PredefinedRect::THUMBNAIL, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    cameraIconArea = QRect(INDENT, HDRROW1, CAMERA_CELL_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 855b12
    addRect(PredefinedRect::CAMERA_ICON_AREA, cameraIconArea);
shun-iwasawa 855b12
    addRect(PredefinedRect::CAMERA_ICON,
shun-iwasawa 855b12
            iconRect(cameraIconArea, ICON_WIDTH, ICON_HEIGHT));
shun-iwasawa 855b12
shun-iwasawa 855b12
    addRect(PredefinedRect::FILTER_COLOR, rect(PredefinedRect::CONFIG));
shun-iwasawa 855b12
    addRect(PredefinedRect::SOUND_ICON, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    addRect(PredefinedRect::VOLUME_AREA, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    addRect(PredefinedRect::PEGBAR_NAME, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
    addRect(PredefinedRect::PARENT_HANDLE_NAME, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
shun-iwasawa 855b12
    addFlag(PredefinedFlag::DRAG_LAYER_BORDER, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::DRAG_LAYER_VISIBLE, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::LAYER_NAME_BORDER, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::LAYER_NAME_VISIBLE, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::LAYER_NUMBER_BORDER, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::LAYER_NUMBER_VISIBLE, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::EYE_AREA_BORDER, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::EYE_AREA_VISIBLE, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::LOCK_AREA_BORDER, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::LOCK_AREA_VISIBLE, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::CONFIG_AREA_BORDER, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_VISIBLE, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::PEGBAR_NAME_BORDER, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::PEGBAR_NAME_VISIBLE, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::PARENT_HANDLE_NAME_BORDER, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::PARENT_HANDLE_NAME_VISIBILE, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::NOTE_AREA_IN_POPUP, true);
shun-iwasawa 855b12
  } else 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);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LAYER_NAME,
shun-iwasawa 52004d
            QRect(INDENT + 1, HDRROW3, CAMERA_CELL_WIDTH - 1,
shun-iwasawa 52004d
                  THUMBNAIL_HEIGHT + HDRROW_HEIGHT));
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);
shun-iwasawa 52004d
    addRect(PredefinedRect::EYE,
shun-iwasawa 52004d
            iconRect(eyeArea, ICON_WIDTH, ICON_HEIGHT - 1, 1));
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);
shun-iwasawa 52004d
    addRect(PredefinedRect::PREVIEW_LAYER,
shun-iwasawa 52004d
            iconRect(previewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1));
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);
shun-iwasawa 52004d
    addRect(PredefinedRect::LOCK,
shun-iwasawa 52004d
            iconRect(lockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
shun-iwasawa 52004d
    cameraLockArea = QRect(INDENT, HDRROW1, CAMERA_CELL_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LOCK_AREA, cameraLockArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LOCK,
shun-iwasawa 52004d
            iconRect(cameraLockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
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);
shun-iwasawa 52004d
    addRect(PredefinedRect::CONFIG,
shun-iwasawa 52004d
            iconRect(configArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
shun-iwasawa 52004d
    cameraConfigArea = QRect(INDENT, HDRROW2, CAMERA_CELL_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_CONFIG_AREA, cameraConfigArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_CONFIG,
shun-iwasawa 52004d
            iconRect(cameraConfigArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
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);
shun-iwasawa 52004d
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_ICON_AREA, QRect(0, 0, -1, -1));
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_ICON, QRect(0, 0, -1, -1));
shun-iwasawa 52004d
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 9b62c5
            QRect(thumbnailArea.topLeft(), QSize(40, 30))
manongjohn 9b62c5
                .adjusted((thumbnailArea.width() / 2) - (40 / 2),
manongjohn 9b62c5
                          (thumbnailArea.height() / 2) - (30 / 2),
manongjohn 9b62c5
                          (thumbnailArea.width() / 2) - (40 / 2),
manongjohn 9b62c5
                          (thumbnailArea.height() / 2) - (30 / 2)));
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);
shun-iwasawa 52004d
    addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, false);
manongjohn 399e7d
    addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true);
shun-iwasawa dae7a4
    addFlag(PredefinedFlag::CAMERA_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);
shun-iwasawa 52004d
    addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, false);
manongjohn 399e7d
    addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::NOTE_AREA_IN_POPUP, 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);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LAYER_NAME,
shun-iwasawa 52004d
            QRect(INDENT + 1, HDRROW4, CAMERA_CELL_WIDTH - 1,
shun-iwasawa 52004d
                  THUMBNAIL_HEIGHT + HDRROW_HEIGHT));
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);
shun-iwasawa 52004d
    addRect(PredefinedRect::EYE,
shun-iwasawa 52004d
            iconRect(eyeArea, ICON_WIDTH, ICON_HEIGHT - 1, 1));
manongjohn 399e7d
manongjohn 399e7d
    previewArea =
manongjohn 399e7d
        QRect(INDENT, HDRROW3, CELL_WIDTH - ICON_WIDTH, HDRROW_HEIGHT);
manongjohn 399e7d
    addRect(PredefinedRect::PREVIEW_LAYER_AREA, previewArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::PREVIEW_LAYER,
shun-iwasawa 52004d
            iconRect(previewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1));
manongjohn 399e7d
manongjohn 399e7d
    lockArea =
manongjohn 399e7d
        QRect(INDENT + eyeArea.width(), HDRROW2, ICON_WIDTH, HDRROW_HEIGHT);
manongjohn 399e7d
    addRect(PredefinedRect::LOCK_AREA, lockArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::LOCK,
shun-iwasawa 52004d
            iconRect(lockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
shun-iwasawa 52004d
    cameraLockArea = QRect(INDENT, HDRROW2, CAMERA_CELL_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LOCK_AREA, cameraLockArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LOCK,
shun-iwasawa 52004d
            iconRect(cameraLockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
manongjohn 399e7d
manongjohn 399e7d
    configArea =
manongjohn 399e7d
        QRect(INDENT + previewArea.width(), HDRROW3, ICON_WIDTH, HDRROW_HEIGHT);
manongjohn 399e7d
    addRect(PredefinedRect::CONFIG_AREA, configArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::CONFIG,
shun-iwasawa 52004d
            iconRect(configArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
shun-iwasawa 52004d
    cameraConfigArea = QRect(INDENT, HDRROW3, CAMERA_CELL_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_CONFIG_AREA, cameraConfigArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_CONFIG,
shun-iwasawa 52004d
            iconRect(cameraConfigArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
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);
shun-iwasawa 52004d
shun-iwasawa 52004d
    cameraIconArea = QRect(INDENT, HDRROW1, CAMERA_CELL_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_ICON_AREA, cameraIconArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_ICON,
shun-iwasawa 52004d
            iconRect(cameraIconArea, ICON_WIDTH, ICON_HEIGHT));
shun-iwasawa 52004d
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 9b62c5
            QRect(thumbnailArea.topLeft(), QSize(40, 30))
manongjohn 9b62c5
                .adjusted((thumbnailArea.width() / 2) - (40 / 2),
manongjohn 9b62c5
                          (thumbnailArea.height() / 2) - (30 / 2),
manongjohn 9b62c5
                          (thumbnailArea.width() / 2) - (40 / 2),
manongjohn 9b62c5
                          (thumbnailArea.height() / 2) - (30 / 2)));
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);
shun-iwasawa 52004d
    addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, false);
manongjohn 399e7d
    addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true);
shun-iwasawa dae7a4
    addFlag(PredefinedFlag::CAMERA_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);
shun-iwasawa 52004d
    addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, true);
manongjohn 399e7d
    addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::NOTE_AREA_IN_POPUP, 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);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LAYER_NAME,
shun-iwasawa dae7a4
            QRect(1, HDRROW3 + HDRROW_HEIGHT - 8, CAMERA_CELL_WIDTH - 1,
shun-iwasawa 52004d
                  THUMBNAIL_HEIGHT + CELL_HEIGHT));
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
    addRect(PredefinedRect::LOCK, lockArea);
shun-iwasawa 52004d
    cameraLockArea = QRect(0, HDRROW2, CAMERA_CELL_WIDTH, HDRROW_HEIGHT - 1);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LOCK_AREA, cameraLockArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_LOCK,
shun-iwasawa 52004d
            iconRect(cameraLockArea, ICON_WIDTH - 1, ICON_HEIGHT - 1));
manongjohn 399e7d
manongjohn 399e7d
    addRect(PredefinedRect::CONFIG_AREA, QRect(0, 0, -1, -1));
manongjohn 399e7d
    addRect(PredefinedRect::CONFIG, QRect(0, 0, -1, -1));
shun-iwasawa dae7a4
    cameraConfigArea =
shun-iwasawa dae7a4
        QRect(0, HDRROW3 - 2, CAMERA_CELL_WIDTH, HDRROW_HEIGHT - 4);
shun-iwasawa dae7a4
    addRect(PredefinedRect::CAMERA_CONFIG_AREA, cameraConfigArea);
shun-iwasawa dae7a4
    addRect(PredefinedRect::CAMERA_CONFIG,
shun-iwasawa dae7a4
            iconRect(cameraConfigArea, ICON_WIDTH - 1, ICON_HEIGHT - 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);
shun-iwasawa 52004d
shun-iwasawa 52004d
    cameraIconArea = QRect(0, HDRROW1, CAMERA_CELL_WIDTH, HDRROW_HEIGHT);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_ICON_AREA, cameraIconArea);
shun-iwasawa 52004d
    addRect(PredefinedRect::CAMERA_ICON,
shun-iwasawa 52004d
            iconRect(cameraIconArea, ICON_WIDTH, ICON_HEIGHT));
shun-iwasawa 52004d
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);
shun-iwasawa 52004d
    addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, false);
manongjohn 399e7d
    addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, false);
shun-iwasawa dae7a4
    addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_VISIBLE, true);
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);
shun-iwasawa 52004d
    addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, true);
manongjohn 399e7d
    addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, true);
shun-iwasawa 855b12
    addFlag(PredefinedFlag::NOTE_AREA_IN_POPUP, false);
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
shun-iwasawa 692990
  QRect layerFooterPanel(
shun-iwasawa 692990
      QRect(0, 0, LAYER_FOOTER_PANEL_WIDTH + 2, use_header_height));
shun-iwasawa 692990
  addRect(PredefinedRect::LAYER_FOOTER_PANEL, layerFooterPanel);
shun-iwasawa 692990
shun-iwasawa 692990
  QRect zoomSlider, zoomIn, zoomOut;
shun-iwasawa 692990
shun-iwasawa 692990
  zoomSlider = QRect(0, 17, LAYER_FOOTER_PANEL_WIDTH, use_header_height - 34);
shun-iwasawa 692990
  addRect(PredefinedRect::ZOOM_SLIDER_AREA, zoomSlider);
shun-iwasawa 855b12
  if (layout == QString("Minimum"))
shun-iwasawa 855b12
    addRect(PredefinedRect::ZOOM_SLIDER, QRect(0, 0, -1, -1));
shun-iwasawa 855b12
  else
shun-iwasawa 855b12
    addRect(PredefinedRect::ZOOM_SLIDER, zoomSlider.adjusted(0, 1, 0, 0));
shun-iwasawa 692990
shun-iwasawa 692990
  zoomIn = QRect(0, zoomSlider.bottom() + 1, LAYER_FOOTER_PANEL_WIDTH, 16);
shun-iwasawa 692990
  addRect(PredefinedRect::ZOOM_IN_AREA, zoomIn);
shun-iwasawa 692990
  addRect(PredefinedRect::ZOOM_IN, zoomIn.adjusted(1, 1, 0, 0));
shun-iwasawa 692990
shun-iwasawa 692990
  zoomOut = QRect(0, zoomSlider.top() - 17, LAYER_FOOTER_PANEL_WIDTH, 16);
shun-iwasawa 692990
  addRect(PredefinedRect::ZOOM_OUT_AREA, zoomOut);
shun-iwasawa 692990
  addRect(PredefinedRect::ZOOM_OUT, zoomOut.adjusted(1, 1, 0, 0));
shun-iwasawa 855b12
shun-iwasawa 692990
  /*
shun-iwasawa 692990
  // 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));
shun-iwasawa 692990
  */
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 52004d
          verticalLine(CELL_WIDTH - 14, NumberRange(0, CELL_HEIGHT)));
shun_iwasawa 0cae24
  addLine(PredefinedLine::EXTENDER_LINE,
shun_iwasawa 0cae24
          horizontalLine(0, NumberRange(-EXTENDER_WIDTH - KEY_ICON_WIDTH, 0)));
shun-iwasawa 7c3c0a
  addLine(PredefinedLine::CURRENT_TIME_INDICATOR,
shun-iwasawa 7c3c0a
          horizontalLine(CELL_HEIGHT / 2, NumberRange(0, CELL_WIDTH)));
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));
shun-iwasawa 692990
  addDimension(PredefinedDimension::FRAME_LABEL_ALIGN,
shun-iwasawa 692990
               Qt::AlignVCenter | Qt::AlignRight);
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);
shun-iwasawa 52004d
  addDimension(PredefinedDimension::CAMERA_LAYER, CAMERA_CELL_WIDTH);
shun-iwasawa 692990
  addDimension(PredefinedDimension::SCALE_THRESHOLD, 57);
shun-iwasawa 95057d
  addDimension(PredefinedDimension::FRAME_AREA_EXPANSION, PLAY_RANGE_X);
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
shun-iwasawa 692990
  QPainterPath diamond(QPointF(0, -4));
shun-iwasawa 692990
  diamond.lineTo(4, 0);
shun-iwasawa 692990
  diamond.lineTo(0, 4);
shun-iwasawa 692990
  diamond.lineTo(-4, 0);
shun-iwasawa 692990
  diamond.lineTo(0, -4);
shun-iwasawa 692990
  addPath(PredefinedPath::FRAME_MARKER_DIAMOND, diamond);
shun-iwasawa 692990
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
  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
  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(
shun-iwasawa 692990
    const QPointF &xy) const {
shun-iwasawa 692990
  double frame = xy.y() / (double)CELL_HEIGHT;
shun-iwasawa 692990
  double layer = xy.x() / (double)CELL_WIDTH;
Jaroslav 203cc8
  return CellPositionRatio{frame, layer};
Jaroslav 203cc8
}
shun-iwasawa 692990
QPointF TopToBottomOrientation::positionRatioToXY(
Jaroslav 203cc8
    const CellPositionRatio &ratio) const {
shun-iwasawa 692990
  double x = ratio.layer() * (double)CELL_WIDTH;
shun-iwasawa 692990
  double y = ratio.frame() * (double)CELL_HEIGHT;
shun-iwasawa 692990
  return QPointF(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 52004d
  addRect(PredefinedRect::CAMERA_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,
manongjohn 9b62c5
                CELL_HEIGHT - KEY_ICON_HEIGHT - 2, KEY_ICON_WIDTH,
manongjohn 9b62c5
                KEY_ICON_HEIGHT);
Jaroslav 203cc8
  addRect(PredefinedRect::KEY_ICON, keyRect);
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_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,
manongjohn 9b62c5
          QRect(0, -EXTENDER_HEIGHT - 14, EXTENDER_WIDTH, EXTENDER_HEIGHT));
shun_iwasawa 0cae24
  addRect(PredefinedRect::BEGIN_EXTENDER,
manongjohn 9b62c5
          QRect(-EXTENDER_WIDTH, -EXTENDER_HEIGHT - 14, 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 f84c65
  int markSize = CELL_HEIGHT / 2;  // 50% size (12px)
shun-iwasawa f84c65
  addRect(PredefinedRect::CELL_MARK_AREA,
shun-iwasawa f84c65
          QRect(1, CELL_DRAG_HEIGHT + 1, markSize, markSize));
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));
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_LOOP_ICON, rect(PredefinedRect::LOOP_ICON));
manongjohn a21b06
  QRect frameMarker((CELL_WIDTH - FRAME_MARKER_SIZE) / 2 - 1,
manongjohn 9b62c5
                    CELL_HEIGHT - FRAME_MARKER_SIZE - 7, FRAME_MARKER_SIZE,
manongjohn a21b06
                    FRAME_MARKER_SIZE);
manongjohn a21b06
  addRect(PredefinedRect::FRAME_MARKER_AREA, frameMarker);
shun-iwasawa 692990
  addRect(PredefinedRect::CAMERA_FRAME_MARKER_AREA,
shun-iwasawa 692990
          rect(PredefinedRect::FRAME_MARKER_AREA));
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)));
manongjohn 9b62c5
manongjohn 9b62c5
  // Layer header panel
shun_iwasawa 0cae24
  addRect(PredefinedRect::LAYER_HEADER_PANEL,
shun_iwasawa 0cae24
          QRect(0, FRAME_HEADER_HEIGHT - CELL_HEIGHT, LAYER_HEADER_WIDTH,
manongjohn 9b62c5
                LAYER_HEADER_PANEL_HEIGHT));
manongjohn 9b62c5
  QRect panelEye(1, 0, ICON_WIDTH, ICON_HEIGHT);
manongjohn 9b62c5
  addRect(PredefinedRect::PANEL_EYE, panelEye.adjusted(1, 1, -1, -1));
manongjohn 9b62c5
  addRect(PredefinedRect::PANEL_PREVIEW_LAYER,
manongjohn 9b62c5
          panelEye.translated(ICON_OFFSET, 0).adjusted(1, 1, -1, -1));
manongjohn 9b62c5
  addRect(PredefinedRect::PANEL_LOCK,
manongjohn 9b62c5
          panelEye.translated(2 * ICON_OFFSET, 0).adjusted(1, 1, -1, -1));
manongjohn 9b62c5
  QRect panelName(ICONS_WIDTH + THUMBNAIL_WIDTH + 1, 0,
manongjohn 9b62c5
                  LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 4,
manongjohn 9b62c5
                  LAYER_HEADER_PANEL_HEIGHT);
manongjohn 9b62c5
  addRect(PredefinedRect::PANEL_LAYER_NAME, panelName);
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,
manongjohn d44297
          QRect(ONION_X, ONION_Y, CELL_WIDTH, ONION_DOT_SIZE + 1));
shun_iwasawa 0cae24
  addRect(PredefinedRect::ONION_DOT_AREA,
manongjohn d44297
          QRect(ONION_X, ONION_Y + ONION_DOT_SIZE + 1, CELL_WIDTH,
manongjohn d44297
                ONION_DOT_SIZE + 1));
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
shun-iwasawa 2b24e8
  addRect(PredefinedRect::SHIFTTRACE_DOT,
shun-iwasawa 2b24e8
          QRect((CELL_WIDTH - SHIFTTRACE_DOT_SIZE) / 2, SHIFTTRACE_DOT_OFFSET,
shun-iwasawa 2b24e8
                SHIFTTRACE_DOT_SIZE, SHIFTTRACE_DOT_SIZE)
shun-iwasawa 2b24e8
              .adjusted(-1, 0, -1, 0));
shun-iwasawa 2b24e8
  addRect(PredefinedRect::SHIFTTRACE_DOT_AREA,
shun-iwasawa 2b24e8
          QRect(0, SHIFTTRACE_DOT_OFFSET, CELL_WIDTH, SHIFTTRACE_DOT_SIZE));
shun-iwasawa 2b24e8
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));
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_LAYER_HEADER,
shun-iwasawa 52004d
          QRect(1, 0, LAYER_HEADER_WIDTH - 2, CAMERA_CELL_HEIGHT));
manongjohn 9b62c5
  QRect columnName(ICONS_WIDTH + THUMBNAIL_WIDTH + 1, 0,
manongjohn a21b06
                   LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 4, CELL_HEIGHT);
Jaroslav 203cc8
  addRect(PredefinedRect::RENAME_COLUMN, columnName);
manongjohn 9b62c5
  QRect eyeArea(1, 0, ICON_WIDTH, CELL_HEIGHT);
manongjohn 9b62c5
  QRect eye(1,
manongjohn 9b62c5
            eyeArea.top() + ((eyeArea.height() / 2) - ((ICON_HEIGHT - 1) / 2)),
manongjohn 9b62c5
            ICON_WIDTH, ICON_HEIGHT);
manongjohn 9b62c5
  addRect(PredefinedRect::EYE_AREA, eyeArea);
manongjohn 399e7d
  addRect(PredefinedRect::EYE, eye.adjusted(1, 1, -1, -1));
manongjohn 9b62c5
  addRect(PredefinedRect::PREVIEW_LAYER_AREA,
manongjohn 9b62c5
          eyeArea.translated(ICON_OFFSET, 0));
shun_iwasawa 0cae24
  addRect(PredefinedRect::PREVIEW_LAYER,
manongjohn 399e7d
          eye.translated(ICON_OFFSET, 0).adjusted(1, 1, -1, -1));
manongjohn 9b62c5
  addRect(PredefinedRect::LOCK_AREA, eyeArea.translated(2 * ICON_OFFSET, 0));
shun_iwasawa 0cae24
  addRect(PredefinedRect::LOCK,
manongjohn 399e7d
          eye.translated(2 * ICON_OFFSET, 0).adjusted(1, 1, -1, -1));
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_LOCK_AREA, rect(PredefinedRect::LOCK_AREA));
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_LOCK, rect(PredefinedRect::LOCK));
manongjohn 9b62c5
  addRect(PredefinedRect::CONFIG_AREA, eyeArea.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 52004d
  addRect(PredefinedRect::CAMERA_CONFIG_AREA,
shun-iwasawa 52004d
          rect(PredefinedRect::CONFIG_AREA));
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_CONFIG, rect(PredefinedRect::CONFIG));
shun_iwasawa 0cae24
  addRect(PredefinedRect::DRAG_LAYER,
manongjohn 9b62c5
          QRect(ICONS_WIDTH + THUMBNAIL_WIDTH + 1, 0,
manongjohn 9b62c5
                LAYER_HEADER_WIDTH - ICONS_WIDTH - THUMBNAIL_WIDTH - 3,
shun_iwasawa 0cae24
                CELL_DRAG_HEIGHT));
Jaroslav 203cc8
  addRect(PredefinedRect::LAYER_NAME, columnName);
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_LAYER_NAME, rect(PredefinedRect::LAYER_NAME));
shun_iwasawa 0cae24
  addRect(PredefinedRect::LAYER_NUMBER,
manongjohn 9b62c5
          QRect(ICONS_WIDTH + THUMBNAIL_WIDTH + 1, 0, LAYER_NUMBER_WIDTH,
manongjohn 9b62c5
                CELL_HEIGHT));
manongjohn 9b62c5
  QRect thumbnailArea = QRect(ICONS_WIDTH + 1, 0, THUMBNAIL_WIDTH, CELL_HEIGHT);
manongjohn 9b62c5
  addRect(PredefinedRect::THUMBNAIL_AREA, thumbnailArea);
manongjohn 9b62c5
  QRect thumbnail = thumbnailArea.adjusted(1, 1, 0, 0);
manongjohn 9b62c5
  addRect(PredefinedRect::THUMBNAIL, thumbnail);
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_ICON_AREA,
shun-iwasawa 52004d
          rect(PredefinedRect::THUMBNAIL_AREA));
shun-iwasawa 52004d
  addRect(PredefinedRect::CAMERA_ICON, rect(PredefinedRect::THUMBNAIL));
shun-iwasawa 52004d
shun_iwasawa 0cae24
  addRect(PredefinedRect::FILTER_COLOR,
manongjohn 9b62c5
          QRect(thumbnail.right() - 14, thumbnail.top() + 3, 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,
manongjohn 9b62c5
          QRect(thumbnailArea.topLeft(), QSize(27, thumbnailArea.height()))
manongjohn 9b62c5
              .adjusted((thumbnailArea.width() / 2) - (27 / 2), 0,
manongjohn 9b62c5
                        (thumbnailArea.width() / 2) - (27 / 2), 0));
Jaroslav 203cc8
manongjohn 9b62c5
  QRect volumeArea(
manongjohn 9b62c5
      QRect(columnName.topRight(), QSize(TRACKLEN + 8, 14))
manongjohn 9b62c5
          .adjusted(-77, CELL_DRAG_HEIGHT + 1, -77, CELL_DRAG_HEIGHT + 1));
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 9b62c5
  QRect layerFooterPanel(
manongjohn 9b62c5
      QRect(0, 0, LAYER_HEADER_WIDTH + 2, LAYER_FOOTER_PANEL_HEIGHT));
manongjohn e71b98
  addRect(PredefinedRect::LAYER_FOOTER_PANEL, layerFooterPanel);
manongjohn e71b98
manongjohn e71b98
  QRect zoomSlider, zoomIn, zoomOut;
manongjohn e71b98
manongjohn 9b62c5
  zoomSlider =
manongjohn 9b62c5
      QRect(layerFooterPanel.width() - 100, 0, 81, LAYER_FOOTER_PANEL_HEIGHT);
manongjohn e71b98
  addRect(PredefinedRect::ZOOM_SLIDER_AREA, zoomSlider);
manongjohn e71b98
  addRect(PredefinedRect::ZOOM_SLIDER, zoomSlider.adjusted(1, 0, 0, 0));
manongjohn e71b98
manongjohn 9b62c5
  zoomIn = QRect(zoomSlider.right() + 1, 0, 16, LAYER_FOOTER_PANEL_HEIGHT);
manongjohn e71b98
  addRect(PredefinedRect::ZOOM_IN_AREA, zoomIn);
manongjohn e71b98
  addRect(PredefinedRect::ZOOM_IN, zoomIn.adjusted(1, 1, 0, 0));
manongjohn e71b98
manongjohn 9b62c5
  zoomOut = QRect(zoomSlider.left() - 16, 0, 16, LAYER_FOOTER_PANEL_HEIGHT);
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);
shun-iwasawa 52004d
  addFlag(PredefinedFlag::CAMERA_CONFIG_AREA_BORDER, true);
manongjohn 399e7d
  addFlag(PredefinedFlag::CONFIG_AREA_VISIBLE, true);
shun-iwasawa dae7a4
  addFlag(PredefinedFlag::CAMERA_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 9b62c5
  addFlag(PredefinedFlag::THUMBNAIL_AREA_BORDER, true);
manongjohn 9b62c5
  addFlag(PredefinedFlag::THUMBNAIL_AREA_VISIBLE, true);
shun-iwasawa 52004d
  addFlag(PredefinedFlag::CAMERA_ICON_VISIBLE, true);
manongjohn 399e7d
  addFlag(PredefinedFlag::VOLUME_AREA_VERTICAL, false);
shun-iwasawa 855b12
  addFlag(PredefinedFlag::NOTE_AREA_IN_POPUP, 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)));
shun-iwasawa 7c3c0a
  addLine(PredefinedLine::CURRENT_TIME_INDICATOR,
shun-iwasawa 7c3c0a
          horizontalLine(CELL_WIDTH / 2 - 1, NumberRange(0, CELL_HEIGHT)));
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);
shun-iwasawa 52004d
  addDimension(PredefinedDimension::CAMERA_LAYER, CAMERA_CELL_HEIGHT);
shun-iwasawa 692990
  addDimension(PredefinedDimension::SCALE_THRESHOLD, 50);
shun-iwasawa 95057d
  addDimension(PredefinedDimension::FRAME_AREA_EXPANSION, 0);  // not used
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
  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
  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(
shun-iwasawa 692990
    const QPointF &xy) const {
shun-iwasawa 692990
  double frame = xy.x() / (double)CELL_WIDTH;
shun-iwasawa 692990
  double layer = xy.y() / (double)CELL_HEIGHT;
Jaroslav 203cc8
  return CellPositionRatio{frame, layer};
Jaroslav 203cc8
}
shun-iwasawa 692990
QPointF LeftToRightOrientation::positionRatioToXY(
Jaroslav 203cc8
    const CellPositionRatio &ratio) const {
shun-iwasawa 692990
  double x = ratio.frame() * (double)CELL_WIDTH;
shun-iwasawa 692990
  double y = ratio.layer() * (double)CELL_HEIGHT;
shun-iwasawa 692990
  return QPointF(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
}