Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef SPREADSHEETVIEWER_H
Toshihiro Shimizu 890ddd
#define SPREADSHEETVIEWER_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tcommon.h"
Jaroslav 203cc8
#include "cellposition.h"
Jaroslav 203cc8
#include "toonz/cellpositionratio.h"
Jaroslav 203cc8
// #include "orientation.h"
Jeremy Bullock 4ce953
Jeremy Bullock 4ce953
#include <qdialog></qdialog>
Toshihiro Shimizu 890ddd
#include <qscrollarea></qscrollarea>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// forward declaration
Toshihiro Shimizu 890ddd
class TFrameHandle;
Toshihiro Shimizu 890ddd
class SpreadsheetViewer;
Jaroslav 203cc8
class Orientation;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace Spreadsheet {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// forward declaration
Toshihiro Shimizu 890ddd
class GenericPanel;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Jaroslav 203cc8
// Use composition rather than inheritance.
Jaroslav 203cc8
// How this works:
Jaroslav 203cc8
// * scroll area scrollbars sends event to this;
Jaroslav 203cc8
// * it notifies every other FrameScroller with difference;
Jaroslav 203cc8
// * they handle it by adjusting their scrollbars
Jaroslav 203cc8
class DVAPI FrameScroller final : public QObject {
Jaroslav 203cc8
  Q_OBJECT
Jaroslav 203cc8
Jaroslav 203cc8
  const Orientation *m_orientation;
Jaroslav 203cc8
  QScrollArea *m_scrollArea;
Jaroslav 203cc8
  int m_lastX, m_lastY;
Jaroslav 203cc8
  bool m_syncing;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FrameScroller();
Shinya Kitaoka 120a6e
  virtual ~FrameScroller();
Toshihiro Shimizu 890ddd
Jaroslav 203cc8
  void setFrameScrollArea(QScrollArea *scrollArea);
Jaroslav 203cc8
  QScrollArea *getFrameScrollArea() const { return m_scrollArea; }
Jaroslav 203cc8
Jaroslav 203cc8
  void setOrientation(const Orientation *o) { m_orientation = o; }
Jaroslav 203cc8
  const Orientation *orientation() const { return m_orientation; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void registerFrameScroller();
Shinya Kitaoka 120a6e
  void unregisterFrameScroller();
Toshihiro Shimizu 890ddd
shun-iwasawa 692990
  void prepareToScrollOthers(const QPointF &offset);
Jaroslav 203cc8
Jaroslav 203cc8
  void setSyncing(bool s) { m_syncing = s; }
Jaroslav 203cc8
  bool isSyncing() { return m_syncing; }
Jaroslav 203cc8
Jaroslav 203cc8
private:
Jaroslav 203cc8
  void connectScrollbars();
Jaroslav 203cc8
  void disconnectScrollbars();
Jaroslav 203cc8
shun-iwasawa 6ca609
  void handleScroll(QPoint &offset, int senderMaximum, int senderValue);
Jaroslav 203cc8
  void onScroll(const CellPositionRatio &offset);
shun-iwasawa 6ca609
  bool exactScroll(const int senderMaximum, const int senderValue);
Jaroslav 203cc8
Jaroslav 203cc8
  void prepareToScrollRatio(const CellPositionRatio &offset);
Jaroslav 203cc8
Jaroslav 203cc8
private slots:
Jaroslav 203cc8
  void onVScroll(int value);
Jaroslav 203cc8
  void onHScroll(int value);
Jaroslav 203cc8
signals:
shun-iwasawa 692990
  void prepareToScrollOffset(const QPointF &offset);
shun-iwasawa 692990
  void zoomScrollAdjust(QPointF &offset, bool toZoom);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI DragTool {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  DragTool() {}
Shinya Kitaoka 120a6e
  virtual ~DragTool() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void click(int row, int col, QMouseEvent *e) {}
Shinya Kitaoka 120a6e
  virtual void drag(int row, int col, QMouseEvent *e) {}
Shinya Kitaoka 120a6e
  virtual void release(int row, int col, QMouseEvent *e) {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI SetFrameDragTool final : public DragTool {
Shinya Kitaoka 120a6e
  TFrameHandle *m_frameHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SetFrameDragTool(TFrameHandle *frameHandle) : m_frameHandle(frameHandle) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void click(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void drag(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void release(int row, int col, QMouseEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI SelectionDragTool final : public DragTool {
Shinya Kitaoka 120a6e
  SpreadsheetViewer *m_viewer;
Shinya Kitaoka 120a6e
  int m_firstRow, m_firstCol;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SelectionDragTool(SpreadsheetViewer *viewer);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void click(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void drag(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void release(int row, int col, QMouseEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI PanTool final : public DragTool {
Shinya Kitaoka 120a6e
  SpreadsheetViewer *m_viewer;
Shinya Kitaoka 120a6e
  GenericPanel *m_panel;
Shinya Kitaoka 120a6e
  QPoint m_lastPos;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PanTool(GenericPanel *panel);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void click(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void drag(int row, int col, QMouseEvent *e) override;
Shinya Kitaoka 473e70
  void release(int row, int col, QMouseEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI ScrollArea final : public QScrollArea {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
#if QT_VERSION >= 0x050500
Shinya Kitaoka 120a6e
  ScrollArea(QWidget *parent = 0, Qt::WindowFlags flags = 0);
Toshihiro Shimizu 890ddd
#else
Shinya Kitaoka 120a6e
  ScrollArea(QWidget *parent = 0, Qt::WFlags flags = 0);
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
  virtual ~ScrollArea();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  // keyPressEvent and wheelEvent are ignored by the ScrollArea
Shinya Kitaoka 120a6e
  // and therefore they are handled by the parent (Viewer)
Shinya Kitaoka 473e70
  void keyPressEvent(QKeyEvent *e) override;
Shinya Kitaoka 473e70
  void wheelEvent(QWheelEvent *e) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI GenericPanel : public QWidget {
Shinya Kitaoka 120a6e
  Q_OBJECT
Shinya Kitaoka 120a6e
  SpreadsheetViewer *m_viewer;
Shinya Kitaoka 120a6e
  DragTool *m_dragTool;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  GenericPanel(SpreadsheetViewer *viewer);
Shinya Kitaoka 120a6e
  virtual ~GenericPanel();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  SpreadsheetViewer *getViewer() const { return m_viewer; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual DragTool *createDragTool(QMouseEvent *) { return 0; };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void paintEvent(QPaintEvent *) override;
Shinya Kitaoka 473e70
  void mousePressEvent(QMouseEvent *) override;
Shinya Kitaoka 473e70
  void mouseReleaseEvent(QMouseEvent *) override;
Shinya Kitaoka 473e70
  void mouseMoveEvent(QMouseEvent *) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI RowPanel : public GenericPanel {
Shinya Kitaoka 120a6e
  Q_OBJECT
Shinya Kitaoka 120a6e
  const int m_xa;  // frame cells start at m_xa
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  RowPanel(SpreadsheetViewer *viewer);
Shinya Kitaoka 120a6e
  virtual ~RowPanel() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  DragTool *createDragTool(QMouseEvent *) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void paintEvent(QPaintEvent *) override;
Shinya Kitaoka 120a6e
  void drawRows(QPainter &p, int r0, int r1);
Shinya Kitaoka 120a6e
  void drawCurrentRowGadget(QPainter &p, int r0, int r1);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI ColumnPanel : public GenericPanel {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ColumnPanel(SpreadsheetViewer *viewer);
Shinya Kitaoka 120a6e
  virtual ~ColumnPanel() {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI CellPanel : public GenericPanel {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  CellPanel(SpreadsheetViewer *viewer);
Shinya Kitaoka 120a6e
  virtual ~CellPanel() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  DragTool *createDragTool(QMouseEvent *) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void paintEvent(QPaintEvent *) override;
Shinya Kitaoka 120a6e
  virtual void drawCells(QPainter &p, int r0, int c0, int r1, int c1) {}
Toshihiro Shimizu 890ddd
};
shun-iwasawa 2ce475
}  // namespace Spreadsheet
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Jeremy Bullock 4ce953
class DVAPI SpreadsheetViewer : public QDialog {
Shinya Kitaoka 120a6e
  Q_OBJECT
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  QColor m_lightLightBgColor;  // RowPanel background (124,124,124)
Shinya Kitaoka 120a6e
  QColor m_bgColor;         // RowPanel background in scene range(164,164,164)
Shinya Kitaoka 120a6e
  QColor m_lightLineColor;  // horizontal line (146,144,146)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor LightLightBGColor READ getLightLightBGColor WRITE
Shinya Kitaoka 120a6e
                 setLightLightBGColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor BGColor READ getBGColor WRITE setBGColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(
Shinya Kitaoka 120a6e
      QColor LightLineColor READ getLightLineColor WRITE setLightLineColor)
Shinya Kitaoka 120a6e
shun-iwasawa aebc0b
  QColor m_currentRowBgColor;    // current frame, column
shun-iwasawa aebc0b
  QColor m_markerLineColor;      // marker interval (0, 255, 246)
shun-iwasawa aebc0b
  QColor m_secMarkerLineColor;   // second marker lines
shun-iwasawa aebc0b
  QColor m_textColor;            // text (black)
shun-iwasawa aebc0b
  QColor m_currentRowTextColor;  // text color for the current row
shun-iwasawa aebc0b
  QColor m_verticalLineColor;    // vertical line (black)
shun-iwasawa aebc0b
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor CurrentRowBgColor READ getCurrentRowBgColor WRITE
Shinya Kitaoka 120a6e
                 setCurrentRowBgColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(
Shinya Kitaoka 120a6e
      QColor MarkerLineColor READ getMarkerLineColor WRITE setMarkerLineColor)
shun-iwasawa aebc0b
  Q_PROPERTY(QColor SecMarkerLineColor READ getSecMarkerLineColor WRITE
shun-iwasawa aebc0b
                 setSecMarkerLineColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor TextColor READ getTextColor WRITE setTextColor)
shun-iwasawa aebc0b
  Q_PROPERTY(QColor CurrentRowTextColor READ getCurrentRowTextColor WRITE
shun-iwasawa aebc0b
                 setCurrentRowTextColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor VerticalLineColor READ getVerticalLineColor WRITE
Shinya Kitaoka 120a6e
                 setVerticalLineColor)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // key frame
Shinya Kitaoka 120a6e
  QColor m_keyFrameColor;          // (219,139,54)
Shinya Kitaoka 120a6e
  QColor m_keyFrameBorderColor;    // (82,51,20)
Shinya Kitaoka 120a6e
  QColor m_selectedKeyFrameColor;  // (237,197,155)
shun-iwasawa 4a3868
  QColor m_ignoredKeyFrameColor;
shun-iwasawa 4a3868
  QColor m_selectedIgnoredKeyFrameColor;
Shinya Kitaoka 120a6e
  // key frame inbetween
Shinya Kitaoka 120a6e
  QColor m_inBetweenColor;          // (194,194,176)
Shinya Kitaoka 120a6e
  QColor m_inBetweenBorderColor;    // (72,72,65)
Shinya Kitaoka 120a6e
  QColor m_selectedInBetweenColor;  // (225,225,216)
shun-iwasawa 4a3868
  QColor m_ignoredInBetweenColor;
shun-iwasawa 4a3868
  QColor m_selectedIgnoredInBetweenColor;
Shinya Kitaoka 120a6e
  // empty cell
Shinya Kitaoka 120a6e
  QColor m_selectedEmptyColor;  // (190,190,190)
Shinya Kitaoka 120a6e
  // empty cell in the scene range
Shinya Kitaoka 120a6e
  QColor m_selectedSceneRangeEmptyColor;  // (210,210,210)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor KeyFrameColor READ getKeyFrameColor WRITE setKeyFrameColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor KeyFrameBorderColor READ getKeyFrameBorderColor WRITE
Shinya Kitaoka 120a6e
                 setKeyFrameBorderColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor SelectedKeyFrameColor READ getSelectedKeyFrameColor WRITE
Shinya Kitaoka 120a6e
                 setSelectedKeyFrameColor)
shun-iwasawa 4a3868
  Q_PROPERTY(QColor IgnoredKeyFrameColor READ getIgnoredKeyFrameColor WRITE
shun-iwasawa 4a3868
                 setIgnoredKeyFrameColor)
shun-iwasawa 4a3868
  Q_PROPERTY(
shun-iwasawa 4a3868
      QColor SelectedIgnoredKeyFrameColor READ getSelectedIgnoredKeyFrameColor
shun-iwasawa 4a3868
          WRITE setSelectedIgnoredKeyFrameColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(
Shinya Kitaoka 120a6e
      QColor InBetweenColor READ getInBetweenColor WRITE setInBetweenColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor InBetweenBorderColor READ getInBetweenBorderColor WRITE
Shinya Kitaoka 120a6e
                 setInBetweenBorderColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor SelectedInBetweenColor READ getSelectedInBetweenColor WRITE
Shinya Kitaoka 120a6e
                 setSelectedInBetweenColor)
shun-iwasawa 4a3868
  Q_PROPERTY(QColor IgnoredInBetweenColor READ getIgnoredInBetweenColor WRITE
shun-iwasawa 4a3868
                 setIgnoredInBetweenColor)
shun-iwasawa 4a3868
  Q_PROPERTY(
shun-iwasawa 4a3868
      QColor SelectedIgnoredInBetweenColor READ getSelectedIgnoredInBetweenColor
shun-iwasawa 4a3868
          WRITE setSelectedIgnoredInBetweenColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor SelectedEmptyColor READ getSelectedEmptyColor WRITE
Shinya Kitaoka 120a6e
                 setSelectedEmptyColor)
Shinya Kitaoka 120a6e
  Q_PROPERTY(
Shinya Kitaoka 120a6e
      QColor SelectedSceneRangeEmptyColor READ getSelectedSceneRangeEmptyColor
Shinya Kitaoka 120a6e
          WRITE setSelectedSceneRangeEmptyColor)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  QColor m_columnHeaderBorderColor;  // column header border lines (46,47,46)
Shinya Kitaoka 120a6e
  Q_PROPERTY(QColor ColumnHeaderBorderColor READ getColumnHeaderBorderColor
Shinya Kitaoka 120a6e
                 WRITE setColumnHeaderBorderColor)
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  Spreadsheet::ScrollArea *m_columnScrollArea;
Shinya Kitaoka 120a6e
  Spreadsheet::ScrollArea *m_rowScrollArea;
Shinya Kitaoka 120a6e
  Spreadsheet::ScrollArea *m_cellScrollArea;
Shinya Kitaoka 120a6e
  TFrameHandle *m_frameHandle;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int m_columnWidth;
Shinya Kitaoka 120a6e
  int m_rowHeight;
shun-iwasawa 692990
  int m_scaleFactor;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // QPoint m_delta;
Shinya Kitaoka 120a6e
  int m_timerId;
Shinya Kitaoka 120a6e
  QPoint m_autoPanSpeed;
Shinya Kitaoka 120a6e
  QPoint m_lastAutoPanPos;
Shinya Kitaoka 120a6e
  int m_rowCount, m_columnCount;
Shinya Kitaoka 120a6e
  int m_currentRow;
shun-iwasawa fe3506
  int m_markRowDistance, m_markRowOffset, m_markSecRowDistance;
Shinya Kitaoka 120a6e
  // QRect m_selectedCells; // x=col, y=row
Shinya Kitaoka 120a6e
  bool m_isComputingSize;
Jaroslav 203cc8
  // const Orientation *m_orientation;
Jaroslav 203cc8
Jaroslav 203cc8
protected:
Jaroslav 203cc8
  Spreadsheet::FrameScroller m_frameScroller;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SpreadsheetViewer(QWidget *parent);
Shinya Kitaoka 120a6e
  virtual ~SpreadsheetViewer();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getColumnWidth() const { return m_columnWidth; }
Shinya Kitaoka 120a6e
  void setColumnWidth(int width) { m_columnWidth = width; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getRowHeight() const { return m_rowHeight; }
Shinya Kitaoka 120a6e
  void setRowHeight(int height) { m_rowHeight = height; }
Shinya Kitaoka 120a6e
shun-iwasawa 692990
  void setScaleFactor(int factor) { m_scaleFactor = factor; }
shun-iwasawa 692990
Shinya Kitaoka 120a6e
  void setRowsPanel(Spreadsheet::RowPanel *rows);
Shinya Kitaoka 120a6e
  void setColumnsPanel(Spreadsheet::ColumnPanel *columns);
Shinya Kitaoka 120a6e
  void setCellsPanel(Spreadsheet::CellPanel *cells);
shun-iwasawa 692990
  void setButtonAreaWidget(QWidget *widget);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getRowCount() const { return m_rowCount; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // QProperty
Shinya Kitaoka 120a6e
  void setLightLightBGColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_lightLightBgColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getLightLightBGColor() const { return m_lightLightBgColor; }
Shinya Kitaoka 120a6e
  void setBGColor(const QColor &color) { m_bgColor = color; }
Shinya Kitaoka 120a6e
  QColor getBGColor() const { return m_bgColor; }
Shinya Kitaoka 120a6e
  void setLightLineColor(const QColor &color) { m_lightLineColor = color; }
Shinya Kitaoka 120a6e
  QColor getLightLineColor() const { return m_lightLineColor; }
Shinya Kitaoka 120a6e
  void setCurrentRowBgColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_currentRowBgColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getCurrentRowBgColor() const { return m_currentRowBgColor; }
Shinya Kitaoka 120a6e
  void setMarkerLineColor(const QColor &color) { m_markerLineColor = color; }
Shinya Kitaoka 120a6e
  QColor getMarkerLineColor() const { return m_markerLineColor; }
shun-iwasawa aebc0b
  void setSecMarkerLineColor(const QColor &color) {
shun-iwasawa aebc0b
    m_secMarkerLineColor = color;
shun-iwasawa aebc0b
  }
shun-iwasawa aebc0b
  QColor getSecMarkerLineColor() const { return m_secMarkerLineColor; }
Shinya Kitaoka 120a6e
  void setTextColor(const QColor &color) { m_textColor = color; }
Shinya Kitaoka 120a6e
  QColor getTextColor() const { return m_textColor; }
shun-iwasawa aebc0b
  void setCurrentRowTextColor(const QColor &color) {
shun-iwasawa aebc0b
    m_currentRowTextColor = color;
shun-iwasawa aebc0b
  }
shun-iwasawa aebc0b
  QColor getCurrentRowTextColor() const { return m_currentRowTextColor; }
Shinya Kitaoka 120a6e
  void setVerticalLineColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_verticalLineColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getVerticalLineColor() const { return m_verticalLineColor; }
Shinya Kitaoka 120a6e
  void setKeyFrameColor(const QColor &color) { m_keyFrameColor = color; }
Shinya Kitaoka 120a6e
  QColor getKeyFrameColor() const { return m_keyFrameColor; }
Shinya Kitaoka 120a6e
  void setKeyFrameBorderColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_keyFrameBorderColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getKeyFrameBorderColor() const { return m_keyFrameBorderColor; }
Shinya Kitaoka 120a6e
  void setSelectedKeyFrameColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedKeyFrameColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedKeyFrameColor() const { return m_selectedKeyFrameColor; }
shun-iwasawa 4a3868
shun-iwasawa 4a3868
  void setIgnoredKeyFrameColor(const QColor &color) {
shun-iwasawa 4a3868
    m_ignoredKeyFrameColor = color;
shun-iwasawa 4a3868
  }
shun-iwasawa 4a3868
  QColor getIgnoredKeyFrameColor() const { return m_ignoredKeyFrameColor; }
shun-iwasawa 4a3868
  void setSelectedIgnoredKeyFrameColor(const QColor &color) {
shun-iwasawa 4a3868
    m_selectedIgnoredKeyFrameColor = color;
shun-iwasawa 4a3868
  }
shun-iwasawa 4a3868
  QColor getSelectedIgnoredKeyFrameColor() const {
shun-iwasawa 4a3868
    return m_selectedIgnoredKeyFrameColor;
shun-iwasawa 4a3868
  }
shun-iwasawa 4a3868
Shinya Kitaoka 120a6e
  void setInBetweenColor(const QColor &color) { m_inBetweenColor = color; }
Shinya Kitaoka 120a6e
  QColor getInBetweenColor() const { return m_inBetweenColor; }
Shinya Kitaoka 120a6e
  void setInBetweenBorderColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_inBetweenBorderColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getInBetweenBorderColor() const { return m_inBetweenBorderColor; }
Shinya Kitaoka 120a6e
  void setSelectedInBetweenColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedInBetweenColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedInBetweenColor() const { return m_selectedInBetweenColor; }
shun-iwasawa 4a3868
shun-iwasawa 4a3868
  void setIgnoredInBetweenColor(const QColor &color) {
shun-iwasawa 4a3868
    m_ignoredInBetweenColor = color;
shun-iwasawa 4a3868
  }
shun-iwasawa 4a3868
  QColor getIgnoredInBetweenColor() const { return m_ignoredInBetweenColor; }
shun-iwasawa 4a3868
  void setSelectedIgnoredInBetweenColor(const QColor &color) {
shun-iwasawa 4a3868
    m_selectedIgnoredInBetweenColor = color;
shun-iwasawa 4a3868
  }
shun-iwasawa 4a3868
  QColor getSelectedIgnoredInBetweenColor() const {
shun-iwasawa 4a3868
    return m_selectedIgnoredInBetweenColor;
shun-iwasawa 4a3868
  }
shun-iwasawa 4a3868
Shinya Kitaoka 120a6e
  void setSelectedEmptyColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedEmptyColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedEmptyColor() const { return m_selectedEmptyColor; }
Shinya Kitaoka 120a6e
  void setSelectedSceneRangeEmptyColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_selectedSceneRangeEmptyColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getSelectedSceneRangeEmptyColor() const {
Shinya Kitaoka 120a6e
    return m_selectedSceneRangeEmptyColor;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void setColumnHeaderBorderColor(const QColor &color) {
Shinya Kitaoka 120a6e
    m_columnHeaderBorderColor = color;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  QColor getColumnHeaderBorderColor() const {
Shinya Kitaoka 120a6e
    return m_columnHeaderBorderColor;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void scroll(QPoint delta);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setAutoPanSpeed(const QPoint &speed);
Shinya Kitaoka 120a6e
  void setAutoPanSpeed(const QRect &widgetBounds, const QPoint &mousePos);
Shinya Kitaoka 120a6e
  void stopAutoPan() { setAutoPanSpeed(QPoint()); }
Shinya Kitaoka 120a6e
  bool isAutoPanning() const {
Shinya Kitaoka 120a6e
    return m_autoPanSpeed.x() != 0 || m_autoPanSpeed.y() != 0;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int xToColumn(int x) const;
Shinya Kitaoka 120a6e
  int yToRow(int y) const;
Shinya Kitaoka 120a6e
  int columnToX(int col) const;
Shinya Kitaoka 120a6e
  int rowToY(int row) const;
Shinya Kitaoka 120a6e
Jaroslav 203cc8
  CellPosition xyToPosition(const QPoint &point) const;
Jaroslav 203cc8
  QPoint positionToXY(const CellPosition &pos) const;
Jaroslav 203cc8
Jaroslav 203cc8
  CellRange xyRectToRange(const QRect &rect) const;
Jaroslav 203cc8
Jaroslav 203cc8
  // const Orientation *orientation () const { return m_orientation; }
Jaroslav 203cc8
Shinya Kitaoka 120a6e
  bool refreshContentSize(int scrollDx, int scrollDy);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int getCurrentRow() const { return m_currentRow; }
Shinya Kitaoka 120a6e
  void setCurrentRow(int row) { m_currentRow = row; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  virtual QRect getSelectedCells() const               = 0;
Shinya Kitaoka 120a6e
  virtual void selectCells(const QRect &selectedCells) = 0;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  bool isSelectedCell(int row, int col) const {
Shinya Kitaoka 120a6e
    return getSelectedCells().contains(QPoint(col, row));
Shinya Kitaoka 120a6e
  }
shun-iwasawa fe3506
  void setMarkRow(int distance, int offset, int secDistance) {
shun-iwasawa fe3506
    m_markRowDistance    = distance;  // distance > 0 ? distance : 6;
shun-iwasawa fe3506
    m_markRowOffset      = offset;
shun-iwasawa fe3506
    m_markSecRowDistance = secDistance;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  void getMarkRow(int &distance, int &offset) const {
Shinya Kitaoka 120a6e
    distance = m_markRowDistance;
Shinya Kitaoka 120a6e
    offset   = m_markRowOffset;
Shinya Kitaoka 120a6e
  }
shun-iwasawa fe3506
  bool isMarkRow(int row) const {
manongjohn a21b06
    return m_markRowDistance > 0 &&
shun-iwasawa fe3506
           ((row - m_markRowOffset) % m_markRowDistance) == 0 && row > 0;
shun-iwasawa fe3506
  }
shun-iwasawa fe3506
  bool isMarkSecRow(int row) const {
shun-iwasawa fe3506
    return m_markSecRowDistance > 0 &&
shun-iwasawa fe3506
           ((row - m_markRowOffset) % m_markSecRowDistance) == 0 && row > 0;
Shinya Kitaoka 120a6e
  }
shun-iwasawa aebc0b
  bool isSecMarkerActive() const { return m_markSecRowDistance > 0; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setFrameHandle(TFrameHandle *frameHandle);
Shinya Kitaoka 120a6e
  TFrameHandle *getFrameHandle() const { return m_frameHandle; }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void ensureVisibleCol(int col);
Toshihiro Shimizu 890ddd
shun-iwasawa 692990
  virtual int getFrameZoomFactor() const { return 100; }
shun-iwasawa 692990
shun-iwasawa 855b12
  bool isSmallHeader();
shun-iwasawa 855b12
  void updateHeaderHeight();
shun-iwasawa 855b12
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 473e70
  void showEvent(QShowEvent *) override;
Shinya Kitaoka 473e70
  void hideEvent(QHideEvent *) override;
Shinya Kitaoka 473e70
  void resizeEvent(QResizeEvent *event) override;
Shinya Kitaoka 473e70
  void keyPressEvent(QKeyEvent *event) override;
Shinya Kitaoka 473e70
  void wheelEvent(QWheelEvent *event) override;
Shinya Kitaoka 473e70
  void timerEvent(QTimerEvent *) override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Shinya Kitaoka 120a6e
  void setRowCount(int rowCount);
Shinya Kitaoka 120a6e
  void setColumnCount(int columnCount);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void frameSwitched();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void updateAreas();
Shinya Kitaoka 120a6e
  void onVSliderChanged(int);
Shinya Kitaoka 120a6e
  void onHSliderChanged(int);
Jaroslav 203cc8
shun-iwasawa 692990
  void onPrepareToScrollOffset(const QPointF &offset);
shun-iwasawa 692990
  void onZoomScrollAdjust(QPointF &offset, bool toZoom);
shun-iwasawa 692990
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
void updateAllAree();
Shinya Kitaoka 120a6e
void updateCellColumnAree();
Shinya Kitaoka 120a6e
void updateCellRowAree();
Shinya Kitaoka 120a6e
*/
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif