[Uml-devel] CVS: kdesdk/umbrello/umbrello objectwidget.cpp,1.3,1.4 umlview.cpp,1.5,1.6 umlview.h,1.2,1.3 umlwidget.cpp,1.2,1.3
kde at office.kde.org
kde at office.kde.org
Thu Jan 30 15:18:02 UTC 2003
Update of /home/kde/kdesdk/umbrello/umbrello
In directory office:/tmp/cvs-serv11963/umbrello
Modified Files:
objectwidget.cpp umlview.cpp umlview.h umlwidget.cpp
Log Message:
Add feature: resize canvas via Diagram Properties dialog
Index: objectwidget.cpp
===================================================================
RCS file: /home/kde/kdesdk/umbrello/umbrello/objectwidget.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- objectwidget.cpp 25 Jan 2003 19:00:40 -0000 1.3
+++ objectwidget.cpp 30 Jan 2003 23:16:39 -0000 1.4
@@ -252,7 +252,8 @@
void ObjectWidget::mouseMoveEvent(QMouseEvent *me) {
int newX = 0, newY = 0, count;
int moveX, moveY;
- int canvasSize = UMLView::getCanvasSize();
+ int maxX = m_pView->canvas()->width();
+ int maxY = m_pView->canvas()->height();
if( !m_bSelected ) {
m_pView->setSelected( this, me );
@@ -281,11 +282,11 @@
if( ((int)y() + moveY) < 0 ) {
moveY = moveY - (int)y();
}
- if( ((int)x() + moveX) > (canvasSize - width()) ) {
- moveX = canvasSize - (int)x() - width();
+ if( ((int)x() + moveX) > (maxX - width()) ) {
+ moveX = maxX - (int)x() - width();
}
- if( ((int)y() + moveY) > (canvasSize - height()) ) {
- moveY = canvasSize - (int)y() - height();
+ if( ((int)y() + moveY) > (maxY - height()) ) {
+ moveY = maxY - (int)y() - height();
}
if( count > 1 ) {
@@ -301,8 +302,8 @@
newX = newX<0 ? 0 : newX;
newY = newY<0 ? 0 : newY;
- newX = newX>canvasSize ? canvasSize : newX;
- newY = newY>canvasSize ? canvasSize : newY;
+ newX = newX>maxX ? maxX : newX;
+ newY = newY>maxY ? maxY : newY;
//implement rule for sequence diagram
if( m_pView -> getType() == dt_Sequence ) {
Index: umlview.cpp
===================================================================
RCS file: /home/kde/kdesdk/umbrello/umbrello/umlview.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- umlview.cpp 30 Jan 2003 16:47:26 -0000 1.5
+++ umlview.cpp 30 Jan 2003 23:16:39 -0000 1.6
@@ -21,6 +21,7 @@
#include <qlist.h>
#include <qpixmap.h>
#include <qcolor.h>
+#include <qwmatrix.h>
//kde include files
#include <ktempfile.h>
@@ -66,6 +67,8 @@
#include "umlwidgetdata.h"
#include "floatingtextdata.h"
+static const int defaultCanvasSize = 1300;
+
UMLView::UMLView( QWidget * parent, UMLViewData * pData ) : QCanvasView( parent, "AnUMLView" ) {
m_pData = pData;
init();
@@ -92,8 +95,8 @@
viewport() -> setBackgroundMode( NoBackground );
setCanvas( new UMLViewCanvas( this ) );
canvas() -> setUpdatePeriod( 20 );
- resizeContents(canvasSize, canvasSize);
- canvas() -> resize(canvasSize, canvasSize);
+ resizeContents(defaultCanvasSize, defaultCanvasSize);
+ canvas() -> resize(defaultCanvasSize, defaultCanvasSize);
setAcceptDrops(TRUE);
viewport() -> setAcceptDrops(TRUE);
setDragAutoScroll(false);
@@ -908,8 +911,8 @@
void UMLView::selectAll() {
m_Pos.setX(0);
m_Pos.setY(0);
- m_LineToPos.setX(canvasSize);
- m_LineToPos.setY(canvasSize);
+ m_LineToPos.setX(canvas()->width());
+ m_LineToPos.setY(canvas()->height());
selectWidgets();
}
Index: umlview.h
===================================================================
RCS file: /home/kde/kdesdk/umbrello/umbrello/umlview.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- umlview.h 27 Jan 2003 21:37:14 -0000 1.2
+++ umlview.h 30 Jan 2003 23:16:39 -0000 1.3
@@ -643,13 +643,6 @@
QPtrList<MessageWidget> getMessageWidgetList();
/**
- * static method to return the width/height of canvas in pixels
- */
- static int getCanvasSize() {
- return canvasSize;
- }
-
- /**
* Asks for confirmation and clears everything on the diagram.
* Called from menus.
*/
@@ -864,10 +857,6 @@
*/
QPtrList<SeqLineWidget> m_SeqLineList;
- /**
- * the width and height of a diagram canvas in pixels
- */
- static const int canvasSize = 1300;
public slots:
void slotToolBarChanged(int c);
void slotObjectCreated(UMLObject * o);
Index: umlwidget.cpp
===================================================================
RCS file: /home/kde/kdesdk/umbrello/umbrello/umlwidget.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- umlwidget.cpp 24 Jan 2003 07:19:01 -0000 1.2
+++ umlwidget.cpp 30 Jan 2003 23:16:39 -0000 1.3
@@ -61,7 +61,8 @@
void UMLWidget::mouseMoveEvent(QMouseEvent *me) {
int newX = 0, newY = 0, count;
int moveX, moveY;
- int canvasSize = UMLView::getCanvasSize();
+ int maxX = m_pView->canvas()->width();
+ int maxY = m_pView->canvas()->height();
if( !m_bSelected ) {
m_pView->setSelected( this, me );
@@ -90,11 +91,11 @@
if( ((int)y() + moveY) < 0 ) {
moveY = moveY - (int)y();
}
- if( ((int)x() + moveX) > (canvasSize - width()) ) {
- moveX = canvasSize - (int)x() - width();
+ if( ((int)x() + moveX) > (maxX - width()) ) {
+ moveX = maxX - (int)x() - width();
}
- if( ((int)y() + moveY) > (canvasSize - height()) ) {
- moveY = canvasSize - (int)y() - height();
+ if( ((int)y() + moveY) > (maxY - height()) ) {
+ moveY = maxY - (int)y() - height();
}
if( count > 1 ) {
@@ -110,8 +111,8 @@
newX = newX<0 ? 0 : newX;
newY = newY<0 ? 0 : newY;
- newX = newX>canvasSize ? canvasSize : newX;
- newY = newY>canvasSize ? canvasSize : newY;
+ newX = newX>maxX ? maxX : newX;
+ newY = newY>maxY ? maxY : newY;
//implement rule for sequence diagram
if (m_pView->getType() == dt_Sequence) {
More information about the umbrello-devel
mailing list