1 #pragma once 2 3 #ifndef XSHEET_DRAG_TOOL_H 4 #define XSHEET_DRAG_TOOL_H 5 6 #include "tgeometry.h" 7 #include "cellposition.h" 8 9 // forward declaration 10 class QPainter; 11 class XsheetViewer; 12 class QMouseEvent; 13 class QDropEvent; 14 class TXshSoundColumn; 15 16 namespace XsheetGUI { 17 18 class DragTool { 19 XsheetViewer *m_viewer; 20 21 public: 22 DragTool(XsheetViewer *viewer); 23 virtual ~DragTool(); 24 getViewer()25 XsheetViewer *getViewer() const { return m_viewer; } 26 27 //! chiama l'update del QWidget relativo 28 void refreshCellsArea(); 29 void refreshRowsArea(); 30 void refreshColumnsArea(); 31 onClick(const CellPosition & pos)32 virtual void onClick(const CellPosition &pos) {} onDrag(const CellPosition & pos)33 virtual void onDrag(const CellPosition &pos) {} onRelease(const CellPosition & pos)34 virtual void onRelease(const CellPosition &pos) {} 35 36 virtual void onClick(const QMouseEvent *event); 37 virtual void onDrag(const QMouseEvent *event); 38 virtual void onRelease(const QMouseEvent *event); 39 onClick(const QDropEvent * event)40 virtual void onClick(const QDropEvent *event){}; onDrag(const QDropEvent * event)41 virtual void onDrag(const QDropEvent *event){}; onRelease(const QDropEvent * event)42 virtual void onRelease(const QDropEvent *event){}; 43 drawCellsArea(QPainter & p)44 virtual void drawCellsArea(QPainter &p) {} drawRowsArea(QPainter & p)45 virtual void drawRowsArea(QPainter &p) {} drawColumnsArea(QPainter & p)46 virtual void drawColumnsArea(QPainter &p) {} 47 48 static DragTool *makeSelectionTool(XsheetViewer *viewer); 49 static DragTool *makeLevelMoverTool(XsheetViewer *viewer); 50 static DragTool *makeLevelExtenderTool(XsheetViewer *viewer, 51 bool insert = true, 52 bool invert = false); 53 static DragTool *makeSoundLevelModifierTool(XsheetViewer *viewer); 54 static DragTool *makeKeyframeMoverTool(XsheetViewer *viewer); 55 static DragTool *makeCellKeyframeMoverTool(XsheetViewer *viewer); 56 static DragTool *makeKeyFrameHandleMoverTool(XsheetViewer *viewer, 57 bool isEaseOut, int keyRow); 58 static DragTool *makeNoteMoveTool(XsheetViewer *viewer); 59 60 static DragTool *makeKeyOnionSkinMaskModifierTool(XsheetViewer *viewer, 61 bool isFos); 62 static DragTool *makeCurrentFrameModifierTool(XsheetViewer *viewer); 63 static DragTool *makePlayRangeModifierTool(XsheetViewer *viewer); 64 static DragTool *makeSoundScrubTool(XsheetViewer *viewer, 65 TXshSoundColumn *sc); 66 static DragTool *makeDragAndDropDataTool(XsheetViewer *viewer); 67 68 static DragTool *makeColumnSelectionTool(XsheetViewer *viewer); 69 static DragTool *makeColumnLinkTool(XsheetViewer *viewer); 70 static DragTool *makeColumnMoveTool(XsheetViewer *viewer); 71 static DragTool *makeVolumeDragTool(XsheetViewer *viewer); 72 }; 73 74 void setPlayRange(int r0, int r1, int step, bool withUndo = true); 75 76 bool getPlayRange(int &r0, int &r1, int &step); 77 78 bool isPlayRangeEnabled(); 79 80 } // namespace XsheetGUI 81 82 #endif 83