00001 /* 00002 Copyright (C) 2000,2001 Stefan Duffner 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License 00006 as published by the Free Software Foundation; either version 2 00007 of the License, or any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef SCROLLVIEW_H 00020 #define SCROLLVIEW_H 00021 00022 #include <qscrollview.h> 00023 #include "DRect.h" 00024 #include "GState.h" 00025 #include "GITransition.h" 00026 #include "Selection.h" 00027 00028 class Zoom; 00029 class Draw; 00030 class GTransition; 00031 class MainWindow; 00032 class Grid; 00033 class ToolTipSV; 00034 class Selection; 00035 00041 class ScrollView : public QScrollView 00042 { 00043 Q_OBJECT 00044 public: 00045 ScrollView(QWidget* parent=0, const char* name=0); 00046 ~ScrollView(); 00047 00048 void resetState(); 00049 void reset(); 00050 void updateBackground(); 00052 void setDragMultiple(bool dm=TRUE) { dragMultiple=dm; }; 00054 bool getDragMultiple() { return dragMultiple; }; 00056 Selection* getSelection() { return selection; }; 00057 double getScale(); 00059 DRect getSelectionRect() { return selectionRect; }; 00061 void setSelectionRect(DRect r) { selectionRect=r; }; 00062 00063 void drawTransition(GTransition* , bool clear=FALSE); 00064 void drawInitialTransition(GITransition* , bool clear=FALSE); 00065 00066 QRect tooltipRect(const QPoint& p, QString& info ); 00067 00068 void showContext(QPoint p); 00069 GObject* getContextObject(int& type); 00070 void resetContext(); 00071 00072 private: 00074 QPoint lastLClicked; 00076 bool left_down; 00078 bool drag; 00080 double dragStartX; 00082 double dragStartY; 00084 double lastMovePosX; 00086 double lastMovePosY; 00088 double lastMousePosX; 00090 double lastMousePosY; 00092 double lastMovePosCont1X; 00094 double lastMovePosCont1Y; 00096 double lastMovePosCont2X; 00098 double lastMovePosCont2Y; 00100 GState* lastStateClicked; 00102 GObject* lastObjectRClicked; 00104 GTransition* lastTransitionDragged; 00106 GTransition* lastTransitionClicked; 00108 GTransition* dragTransition; 00110 GITransition* dragITransition; 00112 GState savedState; 00114 GITransition savedITrans; 00116 int lastTransitionControl; 00118 bool firstTransitionDraw; 00120 bool drawControlLines; 00122 bool dragRect; 00124 bool dragMultiple; 00126 bool onSelection; 00128 DRect selectionRect; 00129 00131 MainWindow* main; 00133 Zoom* zoom; 00135 Selection* selection; 00137 Draw* draw; 00139 Grid* grid; 00141 ToolTipSV* tooltip; 00142 00143 void contentsMousePressEvent(QMouseEvent* ); 00144 void contentsMouseMoveEvent(QMouseEvent* ); 00145 void contentsMouseReleaseEvent(QMouseEvent* ); 00146 void contentsMouseDoubleClickEvent(QMouseEvent* ); 00147 void viewportPaintEvent(QPaintEvent* ); 00148 00149 signals: 00151 void setMode(int ); 00153 void updateCanvasSize(int,int, double); 00155 void zoomedToPercentage(int); 00156 00157 public slots: 00158 void zoomIn(QPoint = QPoint(-1,-1)); 00159 void zoomOut(QPoint = QPoint(-1,-1)); 00160 void zoomReset(); 00161 void updateCanvasSize(); 00162 void objectsPasted(); 00163 void allSelected(); 00164 void contextMenuHiding(); 00165 }; 00166 00167 00168 #endif 00169 00170