1 #pragma once 2 3 #ifndef TCELLSELECTION_H 4 #define TCELLSELECTION_H 5 6 #include "toonzqt/selection.h" 7 #include "tgeometry.h" 8 #include <set> 9 10 class TimeStretchPopup; 11 class ReframePopup; 12 class TXshCell; 13 class TXshSimpleLevel; 14 15 //============================================================================= 16 // TCellSelection 17 //----------------------------------------------------------------------------- 18 19 class TCellSelection final : public TSelection { 20 TimeStretchPopup *m_timeStretchPopup; 21 ReframePopup *m_reframePopup; 22 23 public: 24 class Range { 25 public: 26 int m_c0, m_r0, m_c1, m_r1; 27 Range(); 28 bool isEmpty() const; 29 bool contains(int r, int c) const; 30 int getRowCount() const; 31 int getColCount() const; 32 }; 33 34 private: 35 Range m_range; 36 37 public: 38 TCellSelection(); TCellSelection(Range range)39 TCellSelection(Range range) : m_range(range) {} 40 ~TCellSelection(); 41 42 void enableCommands() override; 43 44 bool isEmpty() const override; 45 46 void copyCells(); 47 void pasteCells(); 48 void pasteDuplicateCells(); 49 void deleteCells(); 50 void cutCells(); 51 void cutCells(bool withoutCopy); 52 53 /*- セルの上書きペースト -*/ 54 void overWritePasteCells(); 55 // paste cell numbers only 56 void overwritePasteNumbers(); 57 58 //! \note: puo' anche essere r0>r1 o c0>c1 59 void selectCells(int r0, int c0, int r1, int c1); 60 void selectCell(int row, int col); 61 void selectNone() override; 62 63 void getSelectedCells(int &r0, int &c0, int &r1, int &c1) const; 64 Range getSelectedCells() const; 65 66 bool isCellSelected(int r, int c) const; 67 bool isRowSelected(int row) const; 68 bool isColSelected(int col) const; 69 70 bool areAllColSelectedLocked() const; 71 bool areOnlyVectorCellsSelected(); 72 TXshSimpleLevel *getNewToonzRasterLevel(TXshSimpleLevel *sl); 73 74 // commands 75 void reverseCells(); 76 void swingCells(); 77 void incrementCells(); 78 void randomCells(); 79 void stepCells(int count); 80 void eachCells(int count); 81 void resetStepCells(); 82 void increaseStepCells(); 83 void decreaseStepCells(); step2Cells()84 void step2Cells() { stepCells(2); } step3Cells()85 void step3Cells() { stepCells(3); } step4Cells()86 void step4Cells() { stepCells(4); } each2Cells()87 void each2Cells() { eachCells(2); } each3Cells()88 void each3Cells() { eachCells(3); } each4Cells()89 void each4Cells() { eachCells(4); } 90 void rollupCells(); 91 void rolldownCells(); 92 93 void setKeyframes(); 94 void pasteKeyframesInto(); 95 96 void shiftKeyframes(int direction); shiftKeyframesUp()97 void shiftKeyframesUp() { shiftKeyframes(-1); } shiftKeyframesDown()98 void shiftKeyframesDown() { shiftKeyframes(1); } 99 100 void cloneLevel(); 101 void insertCells(); 102 103 void openTimeStretchPopup(); 104 105 void dRenumberCells(); 106 void dPasteCells(); 107 108 void reframeCells(int count); reframe1Cells()109 void reframe1Cells() { reframeCells(1); } reframe2Cells()110 void reframe2Cells() { reframeCells(2); } reframe3Cells()111 void reframe3Cells() { reframeCells(3); } reframe4Cells()112 void reframe4Cells() { reframeCells(4); } 113 void convertToToonzRaster(); 114 void convertVectortoVector(); 115 116 void reframeWithEmptyInbetweens(); 117 void duplicateFrame(int row, int col, bool multiple); 118 void duplicateFrames(); 119 120 void renameCells(TXshCell &cell); 121 // rename cells for each columns with correspondent item in the list 122 void renameMultiCells(QList<TXshCell> &cells); 123 124 static bool isEnabledCommand(std::string commandId); 125 126 void createBlankDrawing(int row, int col, bool inRange); 127 void createBlankDrawings(); 128 void fillEmptyCell(); 129 }; 130 131 #endif // TCELLSELECTION_H 132