[Uml-devel] terminating objects
Jonathan Riddell
jri at jriddell.org
Wed Oct 24 16:00:06 UTC 2001
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've played around a wee bit and managed to hack together this patch which
allows objects to be terminated in sequence diagrams (with a cross at the
bottom).
Most of it seems to be tab <-> space problems for which I appologise but
don't know what to do about.
With the appropriate blessing maybe it's even suitable for CVS!
Jonathan Riddell
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (SunOS)
Comment: For info see http://www.gnupg.org
iD8DBQE71uXQpQbm1N1NUIgRAsc3AKDkDojxwaIojIC+pX0bp6AztEjVgwCg+qST
el2WkKW0UKP4kfme9nP6tJk=
=RBHx
-----END PGP SIGNATURE-----
-------------- next part --------------
Common subdirectories: uml-orig/CVS and uml/CVS
Only in uml: Makefile
diff -u uml-orig/classgenpage.cpp uml/classgenpage.cpp
--- uml-orig/classgenpage.cpp Thu Sep 13 04:29:06 2001
+++ uml/classgenpage.cpp Wed Oct 24 16:31:14 2001
@@ -24,7 +24,7 @@
propGB = new QGroupBox(this);
propGB -> setTitle(i18n("Properties"));
topLayout -> addWidget(propGB);
-
+
QVBoxLayout * mainLayout = new QVBoxLayout(propGB);
mainLayout -> setSpacing(10);
mainLayout -> setMargin(margin);
@@ -34,43 +34,43 @@
nameL = new QLabel(propGB);
nameL -> setText(name);
nameLayout -> addWidget(nameL, 0, 0);
-
+
classNameLE = new QLineEdit(propGB);
nameLayout -> addWidget(classNameLE, 0, 1);
-
+
stereoTypeLE = 0;
packageLE = 0;
if(t == CONCEPT)
{
stereoTypeL = new QLabel(i18n("StereoType name"), propGB);
nameLayout -> addWidget(stereoTypeL, 1, 0);
-
+
stereoTypeLE = new QLineEdit(propGB);
nameLayout -> addWidget(stereoTypeLE, 1, 1);
-
+
stereoTypeLE -> setText(o -> getStereotype());
-
+
packageL = new QLabel(i18n("Package name"), propGB);
nameLayout -> addWidget(packageL, 2, 0);
-
+
packageLE = new QLineEdit(propGB);
nameLayout -> addWidget(packageLE, 2, 1);
-
+
packageLE -> setText(o -> getPackage());
}
-
+
//setup scope
buttonBG = new QButtonGroup(i18n("Scope"), propGB);
QHBoxLayout * scopeLayout = new QHBoxLayout(buttonBG);
scopeLayout -> setMargin(margin);
buttonBG -> setExclusive(true);
-
+
publicRB = new QRadioButton(i18n("Public"), buttonBG);
scopeLayout -> addWidget(publicRB);
-
+
privateRB = new QRadioButton(i18n("Private"), buttonBG);
scopeLayout -> addWidget(privateRB);
-
+
protectedRB = new QRadioButton(i18n("Protected"), buttonBG);
scopeLayout -> addWidget(protectedRB);
mainLayout -> addWidget(buttonBG);
@@ -79,7 +79,7 @@
QHBoxLayout * docLayout = new QHBoxLayout(docGB);
docLayout -> setMargin(margin);
docGB -> setTitle(i18n("Documentation"));
-
+
doc = new QMultiLineEdit(docGB);
docLayout -> addWidget(doc);
mainLayout -> addWidget(docGB);
@@ -107,7 +107,7 @@
propGB = new QGroupBox(this);
propGB -> setTitle(i18n("Properties"));
topLayout -> addWidget(propGB);
-
+
QVBoxLayout * mainLayout = new QVBoxLayout(propGB);
mainLayout -> setSpacing(10);
mainLayout -> setMargin(margin);
@@ -117,15 +117,15 @@
nameL = new QLabel(propGB);
nameL -> setText(i18n("Class name"));
nameLayout -> addWidget(nameL, 0, 0);
-
+
classNameLE = new QLineEdit(propGB);
classNameLE -> setText(o -> name());
nameLayout -> addWidget(classNameLE, 0, 1);
-
+
instanceL = new QLabel(propGB);
instanceL -> setText(i18n("Instance name"));
nameLayout -> addWidget(instanceL, 1, 0);
-
+
instanceLE = new QLineEdit(propGB);
instanceLE -> setText(o -> getInstanceName());
nameLayout -> addWidget(instanceLE, 1, 1);
@@ -137,16 +137,23 @@
nameLayout -> addWidget(multiCB, 2,0);
}
else multiCB = 0;
+ if(view -> getType() == SEQDIAGRAM)
+ {
+ terminateCB = new QCheckBox(i18n("Terminated"), propGB);
+ terminateCB -> setChecked(o -> getTerminated());
+ nameLayout -> addWidget(terminateCB, 2,0);
+ }
+ else terminateCB = 0;
//setup documentation
docGB = new QGroupBox(propGB);
QHBoxLayout * docLayout = new QHBoxLayout(docGB);
docLayout -> setMargin(margin);
docGB -> setTitle(i18n("Documentation"));
-
+
doc = new QMultiLineEdit(docGB);
doc-> setText(o -> getDoc());
docLayout -> addWidget(doc);
- mainLayout -> addWidget(docGB);
+ mainLayout -> addWidget(docGB);
object = 0;//needs to be set to zero
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -178,7 +185,7 @@
s=PUBLIC;
else if(privateRB -> isChecked())
s=PRIVATE;
- else s = PROTECTED;
+ else s = PROTECTED;
object -> setScope(s);
}//end if object
else if(widget)
@@ -186,6 +193,8 @@
widget -> setInstanceName(instanceLE -> text());
if(multiCB)
widget -> setMultipleInstance(multiCB -> isChecked());
+ if(terminateCB)
+ widget -> setTerminated(terminateCB -> isChecked());
QString name = classNameLE -> text();
widget -> setDoc(doc -> text());
UMLObject * o = widget -> getUMLObject();
diff -u uml-orig/classgenpage.h uml/classgenpage.h
--- uml-orig/classgenpage.h Thu Sep 13 04:29:06 2001
+++ uml/classgenpage.h Wed Oct 24 16:31:14 2001
@@ -38,7 +38,7 @@
* @param o The UMLObject to display the properties of.
*/
ClassGenPage(UMLDoc *d, QWidget *parent, UMLObject * o);
-
+
/**
* Sets up the ClassGenPage.
*
@@ -47,12 +47,12 @@
* @param o The ObjectWidget to display the properties of.
*/
ClassGenPage(UMLDoc *d, QWidget *parent, ObjectWidget * o);
-
+
/**
* Standard deconstructor.
*/
~ClassGenPage();
-
+
/**
* Will move information from the dialog into the object.
* Call when the ok or apply button is pressed.
@@ -64,7 +64,7 @@
QLabel * nameL, * instanceL, * stereoTypeL, * packageL;
QLineEdit * classNameLE, *instanceLE, * stereoTypeLE, * packageLE;
QRadioButton * publicRB, * privateRB, * protectedRB;
- QCheckBox * multiCB;
+ QCheckBox * multiCB, * terminateCB;
QMultiLineEdit * doc;
UMLObject * object;
UMLDoc * umldoc;
diff -u uml-orig/objectwidget.cpp uml/objectwidget.cpp
--- uml-orig/objectwidget.cpp Thu Sep 13 04:29:14 2001
+++ uml/objectwidget.cpp Wed Oct 24 16:31:14 2001
@@ -24,6 +24,7 @@
type = OBJECT;
doc = "";
multipleInstance = false;
+ terminated = false;
oldID = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -80,18 +81,18 @@
update();
}
break;
-
+
case PROPERTIES:
view->getDocument() -> showProperties(this);
calculateSize();
update();
break;
-
+
default:
UMLWidget::slotMenuSelection(sel);
break;
}
-}
+}
////////////////////////////////////////////////////////////////////////////////////////////////////
bool ObjectWidget::serialize(QDataStream *s, bool archive, int fileVersion)
{
@@ -102,15 +103,19 @@
{
*s << localID
<< instanceName
- << multipleInstance;
+ << multipleInstance
+ << terminated;
}
else
{
int multi;
+ int terminate;
*s >> localID
>> instanceName
- >> multi;
- multipleInstance = multi;
+ >> multi
+ >> terminate;
+ multipleInstance = multi;
+ terminated = terminate;
}
calculateSize();
return status;
@@ -124,7 +129,7 @@
int textWidth = fm.width(t);
int width = textWidth > O_WIDTH?textWidth:O_WIDTH;
int height = fontHeight + O_MARGIN * 2;
-
+
width += O_MARGIN * 2;
if(multipleInstance)
{
@@ -144,12 +149,22 @@
update();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+void ObjectWidget::setTerminated(bool terminate)
+{
+ //make sure only calling this in relation to an object on a sequence diagram
+ if(view -> getType() != SEQDIAGRAM)
+ return;
+ terminated = terminate;
+ update();
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
void ObjectWidget::copy(ObjectWidget & rhs)
{
UMLWidget::copy(rhs);
doc = rhs.getDoc();
instanceName = rhs.getInstanceName();
multipleInstance = rhs.getMultipleInstance();
+ terminated = rhs.getTerminated();
oldID = rhs.getLocalID();
localID = oldID;
}
diff -u uml-orig/objectwidget.h uml/objectwidget.h
--- uml-orig/objectwidget.h Thu Sep 13 04:29:14 2001
+++ uml/objectwidget.h Wed Oct 24 16:31:14 2001
@@ -24,31 +24,31 @@
* @param lid The local id for the object.
*/
ObjectWidget(QWidget *parent, UMLObject *o, int lid);
-
+
/**
* Creates an ObjectWidget.
*
* @param parent The parent to this object.
*/
ObjectWidget(QWidget * parent, bool copying = false);
-
+
/**
* Copies the given ObjectWidget.
*
* @param rhs The ObjectWidget to copy.
*/
void copy(ObjectWidget & rhs);
-
+
/**
* Initializes the key attributes of the class.
*/
void init();
-
+
/**
* Standard deconstructor.
*/
~ObjectWidget();
-
+
/**
* Use to save or load this classes information
*
@@ -59,7 +59,7 @@
* @return Returns the status of the operation.
*/
bool serialize(QDataStream *s, bool archive, int fileVersion);
-
+
/**
* Returns the local ID for this object. This ID is used so that
* many objects of the same @ref UMLObject instance can be on the
@@ -68,56 +68,70 @@
* @return Returns the local ID.
*/
int getLocalID(){return localID;}
-
+
/**
* Returns the instance name.
*
* @return Returns the instance name.
*/
QString getInstanceName(){return instanceName;}
-
+
/**
* Sets the instance name.
*
* @param name The name to set the instance name to.
*/
void setInstanceName(QString name){instanceName = name;}
-
+
/**
* Returns the documentation for the object.
*
* @return Returns the documentation for the object.
*/
QString getDoc(){return doc;}
-
+
/**
* Sets the documentation.
*
* @param _doc The documentation to set to.
*/
void setDoc(QString _doc){doc = _doc;}
-
+
/**
* Returns whether object is representing a multi-object.
*
* @return Returns whether object is representing a multi-object.
*/
bool getMultipleInstance(){return multipleInstance;}
-
+
+ /**
+ * Returns whether object is terminated in the sequence diagram.
+ *
+ * @return Returns whether object is terminated in the sequence diagram.
+ */
+ bool getTerminated(){return terminated;}
+
/**
* Sets whether representing a multi-instance object.
*
* @param multiple Object state. true- multi, false - single.
*/
void setMultipleInstance(bool multiple);
-
+
+ /**
+ * Sets whether object is terminated in a sequence diagram.
+ *
+ * @param terminate Object state. true- terminate, false - don't.
+ */
+ void setTerminated(bool terminate);
+
/**
* Sets the local id of the object.
*
* @param id the local id of the object.
*/
void setLocalID(int id){localID = id;}
-
+
/**
* Returns the local id of the object.
*
@@ -128,6 +142,7 @@
QString instanceName, doc;
int localID, oldID;
bool multipleInstance;
+ bool terminated;
void paintEvent(QPaintEvent *pe);
void calculateSize();
public slots:
Common subdirectories: uml-orig/pics and uml/pics
Common subdirectories: uml-orig/pixmaps and uml/pixmaps
diff -u uml-orig/umlview.cpp uml/umlview.cpp
--- uml-orig/umlview.cpp Wed Sep 19 02:14:08 2001
+++ uml/umlview.cpp Wed Oct 24 16:31:14 2001
@@ -89,13 +89,13 @@
if(pPrinter -> orientation() == KPrinter::Portrait)
{
width = metrics.width() - marginX * 2;
- height = metrics.height() - fontHeight - 4 - marginY * 3;
+ height = metrics.height() - fontHeight - 4 - marginY * 3;
}
else
{
marginX *= 2;
width = metrics.width() - marginX * 2;
- height = metrics.height() - fontHeight - 4 - marginY * 2;
+ height = metrics.height() - fontHeight - 4 - marginY * 2;
}
//get the smallest rect holding the diagram
QRect rect = getDiagramRect();
@@ -111,7 +111,7 @@
if(!finishX)
offsetX = page * width;
else if(!finishY)
- {
+ {
offsetY = pageY * height;
offsetX = 0;
pageY++;
@@ -132,7 +132,7 @@
{
finishY = true;
heightY = diagram.height() - offsetY;
- }
+ }
else heightY = height;
if(diagram.height() < height)
{
@@ -163,7 +163,7 @@
//if we are drawing the selection rectangle
//get point and do selection
if(drawRect)
- {
+ {
lineToPos.setX(x);
lineToPos.setY(y);
selectWidgets();
@@ -202,7 +202,7 @@
else
{
addChild(ft, pos.x(), pos.y());
- showChild(ft);
+ showChild(ft);
ft -> setID(getDocument() -> getUniqueID());
}
emit sigResetToolBar();
@@ -251,7 +251,7 @@
}
setTracking(false);
createObject = true;
- getDocument()->createUMLObject(currentCursor);
+ getDocument()->createUMLObject(currentCursor);
emit sigResetToolBar();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -308,14 +308,14 @@
{
rect.setLeft(lineToPos.x());
rect.setRight(pos.x());
- }
+ }
if(pos.y() <= lineToPos.y())
{
rect.setTop(pos.y());
rect.setBottom(lineToPos.y());
}
else
- {
+ {
rect.setTop(lineToPos.y());
rect.setBottom(pos.y());
}
@@ -339,10 +339,10 @@
int totalCount = a -> getTotalCount();
float countOffset = (float)count / (float)(totalCount + 1);
xa = childX(wa) + wa->width() * countOffset;
- xb = childX(wb) + wb->width() * countOffset;
+ xb = childX(wb) + wb->width() * countOffset;
ya = childY(wa) + wa->height() * countOffset;
yb = childY(wb) + wb->height() * countOffset;
-
+
//calculate all the values needed to draw the lines, arrow & diamond heads
QPoint point = widgetIntersectPoint(xa, ya, xb, yb, wb);
int halfLength = 10;
@@ -353,7 +353,7 @@
QPoint arrowPointA(point.x() - halfLength * cos(arrowSlope), point.y() - halfLength * sin(arrowSlope));
arrowSlope = slope - atan(1);
QPoint arrowPointB(point.x() - halfLength * cos(arrowSlope), point.y() - halfLength * sin(arrowSlope));
-
+
if(xa > xb)
cosx = cosx > 0 ? cosx : cosx * -1;
else
@@ -364,7 +364,7 @@
siny = siny > 0 ? siny * -1 : siny;
QPoint midPoint(point.x() + cosx, point.y() + siny);
QPoint fullPoint(point.x() + cosx * 2 , point.y() + siny * 2);
-
+
//update floating text display position
a -> setLinePos(xa, ya, xb, yb);
//draw what we need for each type of association
@@ -389,7 +389,7 @@
{
//message to another widget on collab diagram
p->drawLine(xa,ya, point.x(), point.y());
- drawParallelLine(p, xa, ya, point.x(), point.y());
+ drawParallelLine(p, xa, ya, point.x(), point.y());
}//end if message to another widget
}
else if(aType == ASSOC || aType == MESSAGE)
@@ -432,7 +432,7 @@
{
QPen pen(lineColor, 0, DashLine);
p->setPen(pen);
- p->drawLine(xa,ya,xb,yb);
+ p->drawLine(xa,ya,xb,yb);
}
else if(aType == IMPLEMENTS)
{
@@ -468,14 +468,14 @@
}//end dependency
else if(aType == REALIZE)
{
- p->setPen(QPen(lineColor, 0, DashLine));
+ p->setPen(QPen(lineColor, 0, DashLine));
p -> drawLine(xa, ya, midPoint.x(), midPoint.y());
p->setPen(lineColor);
p -> drawLine(point.x(), point.y(), arrowPointA.x(), arrowPointA.y());
p -> drawLine(point.x(), point.y(), arrowPointB.x(), arrowPointB.y());
p -> drawLine(arrowPointA.x(), arrowPointA.y(), arrowPointB.x(), arrowPointB.y());
}
-
+
}//end if draw onlyselected and selected
}//end while
}
@@ -547,7 +547,7 @@
slotObjectRemoved(o);
return;
}
- }
+ }
delete l;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -593,14 +593,14 @@
}
if(type == SEQDIAGRAM || type == CONDIAGRAM || type == COLLDIAGRAM)
if(ot != CONCEPT)
- status = false;
+ status = false;
if(type == UCDIAGRAM || type == CONDIAGRAM)
{
if(widgetOnDiagram(id))
status = false;
}
}
-
+
e->accept(status);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -620,7 +620,7 @@
if(status)
{
//don't allow dragging of diagrams
-
+
s = "";
i++;//skip over colon
while(i < t.length())
@@ -680,6 +680,12 @@
{
x = childX(obj) + (obj -> width() / 2);
p -> drawLine(x, y, x, y + lineLength);
+ if(obj -> getTerminated()) {
+ p -> drawLine(x - CROSS_LENGTH, y + lineLength - CROSS_LENGTH,
+ x + CROSS_LENGTH, y + lineLength + CROSS_LENGTH);
+ p -> drawLine(x - CROSS_LENGTH, y + lineLength + CROSS_LENGTH,
+ x + CROSS_LENGTH, y + lineLength - CROSS_LENGTH);
+ }
}
}//end while
delete l;
@@ -746,7 +752,7 @@
updateView();
}
if(drawRect)
- {
+ {
selectWidgets();
updateView();
}
@@ -834,27 +840,27 @@
case ACTOR:
stype = "ACTOR";
break;
-
- case USECASE:
+
+ case USECASE:
stype = "USECASE";
break;
-
- case CONCEPT:
- stype = "CONCEPT";
+
+ case CONCEPT:
+ stype = "CONCEPT";
break;
-
- case OBJECT:
- stype = "OBJECT";
+
+ case OBJECT:
+ stype = "OBJECT";
break;
-
- case NOTE:
+
+ case NOTE:
stype = "NOTE";
break;
-
+
case FLOATTEXT:
stype = "FLOATTEXT";
break;
-
+
default:
save = false;
break;
@@ -926,7 +932,7 @@
connect(this, SIGNAL(sigColorChanged(int)), o, SLOT(slotColorChanged(int)));
*s >> stype;
}//end while
- }//end else
+ }//end else
return status;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -997,10 +1003,10 @@
float b1, b2;
int a1, a2;
int x, y;
-
+
b1 = getSlope(p1, p2);
b2 = getSlope(q1, q2);
-
+
a1 = p1.y() - b1 * p1.x();
a2 = q1.y() - b2 * q1.x();
x = ( -1 * (a1 - a2) ) / (b1- b2);
@@ -1018,7 +1024,7 @@
return 0;
if(p1.x() - p2.x() == 0)
return 1000;//should be infinite
-
+
slope = (float)(p1.y() - p2.y()) / (p1.x() - p2.x());
return slope;
}
@@ -1052,7 +1058,7 @@
point.setY(wy + wb -> height());
return point;
}
-
+
//if we are on left or right swap x,y around
//do this as algorithm bums out as it can't handle infinite slope well.
@@ -1147,12 +1153,12 @@
case ACTOR:
case USECASE:
case CONCEPT:
- case OBJECT:
+ case OBJECT:
case NOTE:
disconnect(this, SIGNAL(sigColorChanged(int)), o, SLOT(slotColorChanged(int)));
disconnect(getDocument(), SIGNAL(sigWidgetUpdated(UMLObject *)), o, SLOT(slotChangeWidget(UMLObject *)));
break;
-
+
case MESSAGEW:
((MessageWidget *)o) -> cleanup();
disconnect(this, SIGNAL(sigColorChanged(int)), o, SLOT(slotColorChanged(int)));
@@ -1168,8 +1174,8 @@
}
o->hide();
if(!o -> isText() || t == FLOATTEXT)
- o->close(true);
- updateView();
+ o->close(true);
+ updateView();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void UMLView::setBGColor(QColor color)
@@ -1193,7 +1199,7 @@
viewportToContents( me->x(), me->y(), x, y );
pos.setX(x);
pos.setY(y);
-
+
Association *temp;
QObjectList * l = queryList("Association");
QObjectListIt it( *l );
@@ -1292,13 +1298,13 @@
if(endy == 0)
endy = objEndY;
else if(endy < objEndY)
- endy = objEndY;
- ++it;
+ endy = objEndY;
+ ++it;
}
//if seq. diagram, make sure print all of the lines
if(type == SEQDIAGRAM && (lineLength + OFFSET) > endy)
endy = lineLength + OFFSET;
-
+
delete l;
return QRect(startx, starty, endx, endy );
}
@@ -1312,7 +1318,7 @@
selectedList.append(w);
getDocument() -> enableCutCopy( (selectedList.count() > 0) );
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
void UMLView::clearSelected()
{
UMLWidget * temp = 0;
@@ -1337,7 +1343,7 @@
{
UMLWidget * temp = 0;
for(temp=(UMLWidget *)selectedList.first();temp;temp=(UMLWidget *)selectedList.next())
- temp -> setUseFillColor(useFC);
+ temp -> setUseFillColor(useFC);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void UMLView::deleteSelection(bool enableCutCopy)
@@ -1353,8 +1359,8 @@
{
type = temp -> getBaseType();
if(!temp -> isText() || type == FLOATTEXT)
- {
- removeWidget(temp);
+ {
+ removeWidget(temp);
deleteSelection(enableCutCopy);
return;
}
@@ -1378,7 +1384,7 @@
clipboard -> paste(this, pos);
setTracking(false);
setCursor(KCursor::arrowCursor());
- }
+ }
clearSelected();
if(menu)
{
@@ -1386,7 +1392,7 @@
delete menu;
menu = 0;
}
- getDocument() -> setModified(true);
+ getDocument() -> setModified(true);
drawRect = true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1401,7 +1407,7 @@
py = pos.y();
qx = lineToPos.x();
qy = lineToPos.y();
-
+
if(px <= qx)
{
rect.setLeft(px);
@@ -1411,7 +1417,7 @@
{
rect.setLeft(qx);
rect.setRight(px);
- }
+ }
if(py <= qy)
{
rect.setTop(py);
@@ -1422,7 +1428,7 @@
rect.setTop(qy);
rect.setBottom(py);
}
-
+
QObjectList * l = viewport() -> queryList( "UMLWidget");
QObjectListIt it( *l );
@@ -1449,17 +1455,17 @@
mw -> setSelected(true);
selectedList.remove(mw);//make sure not in there
selectedList.append(mw);
-
+
UMLWidget * ow = mw -> getWidgetA();
ow -> setSelected(true);
selectedList.remove(ow);//make sure not in there
selectedList.append(ow);
-
+
ow = mw -> getWidgetB();
ow -> setSelected(true);
selectedList.remove(ow);//make sure not in there
selectedList.append(ow);
-
+
}
else
{
@@ -1474,14 +1480,14 @@
selectedList.remove(uw);//make sure not in there
selectedList.append(uw);
}
- }
+ }
else if(temp -> getBaseType() == MESSAGEW)
{
UMLWidget * ow = ((MessageWidget *)temp) -> getWidgetA();
ow -> setSelected(true);
selectedList.remove(ow);//make sure not in there
selectedList.append(ow);
-
+
ow = ((MessageWidget *)temp) -> getWidgetB();
ow -> setSelected(true);
selectedList.remove(ow);//make sure not in there
@@ -1500,10 +1506,10 @@
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void UMLView::getDiagram(QPixmap & diagram)
-{
+{
QPainter painter;
- painter.begin(&diagram, viewport());
- painter.fillRect(diagram.rect(), white);
+ painter.begin(&diagram, viewport());
+ painter.fillRect(diagram.rect(), white);
drawContents(&painter);
//now draw the widgets
QObjectList * l = viewport() -> queryList( "UMLWidget");
@@ -1515,18 +1521,18 @@
{
++it;
if(obj -> isText())
- {
- FloatingText * t = (FloatingText *)obj;
+ {
+ FloatingText * t = (FloatingText *)obj;
QString text = t -> getText();
if(drawSelectedOnly)
{
if( t -> getSelected() ||
( t -> getAssoc() && ((Association *)t -> getAssoc())-> isSelected() ) ||
(t -> getMessage() && t -> getMessage() -> getSelected()) )
- painter.drawText(childX(obj), childY(obj), obj -> width(), obj -> height(), AlignCenter, text);
+ painter.drawText(childX(obj), childY(obj), obj -> width(), obj -> height(), AlignCenter, text);
}
- else
- painter.drawText(childX(obj), childY(obj), obj -> width(), obj -> height(), AlignCenter, text);
+ else
+ painter.drawText(childX(obj), childY(obj), obj -> width(), obj -> height(), AlignCenter, text);
}
else
{
@@ -1562,7 +1568,7 @@
drawSelectedOnly = true;
assocContainer -> selectAssociations(true);
getDiagram(diagram);
-
+
//now get the selection cut
//first get the smallest rect holding the widgets
px = py = qx = qy = -1;
@@ -1577,7 +1583,7 @@
px = x;
if(py == -1 || y < py)
py = y;
-
+
if(qx == -1 || x1 > qx)
qx = x1;
if(qy == -1 || y1 > qy)
@@ -1603,7 +1609,7 @@
px = x;
if(py == -1 || y < py)
py = y;
-
+
if(qx == -1 || x1 > qx)
qx = x1;
if(qy == -1 || y1 > qy)
@@ -1620,7 +1626,7 @@
px = x;
if(py == -1 || y < py)
py = y;
-
+
if(qx == -1 || x1 > qx)
qx = x1;
if(qy == -1 || y1 > qy)
@@ -1637,7 +1643,7 @@
px = x;
if(py == -1 || y < py)
py = y;
-
+
if(qx == -1 || x1 > qx)
qx = x1;
if(qy == -1 || y1 > qy)
@@ -1649,13 +1655,13 @@
rect.setTop(py);
rect.setRight(qx);
rect.setBottom(qy);
- //now add widget to clipboard
+ //now add widget to clipboard
for(temp=(UMLWidget *)selectedList.first();temp;temp=(UMLWidget *)selectedList.next())
{
- clipboard -> addWidget(temp, QPoint(rect.x(), rect.y()));
+ clipboard -> addWidget(temp, QPoint(rect.x(), rect.y()));
}
QPixmap * pix = new QPixmap(rect.width(), rect.height());
- bitBlt(pix, QPoint(0, 0), &diagram, rect);
+ bitBlt(pix, QPoint(0, 0), &diagram, rect);
clipboard -> setPixmap(pix);
drawSelectedOnly = false;
assocContainer -> selectAssociations(false);
@@ -1678,7 +1684,7 @@
menu = 0;
}
menu = _menu;
- connect(menu, SIGNAL(activated(int)), this, SLOT(slotMenuSelection(int)));
+ connect(menu, SIGNAL(activated(int)), this, SLOT(slotMenuSelection(int)));
}
diff -u uml-orig/umlview.h uml/umlview.h
--- uml-orig/umlview.h Wed Sep 19 02:14:08 2001
+++ uml/umlview.h Wed Oct 24 16:31:14 2001
@@ -14,15 +14,16 @@
#include "widgetassoccontainer.h"
#define OFFSET 50
+#define CROSS_LENGTH 10
class UMLDoc;
class UMLWidget;
class Association;
-/** The UMLView class provides the view widget for the UMLApp instance.
+/** The UMLView class provides the view widget for the UMLApp instance.
* The View instance inherits QWidget as a base class and represents the view object of a KTMainWindow. As UMLView is part of the
* docuement-view model, it needs a reference to the document object connected with it by the UMLApp class to manipulate and display
* the document structure provided by the UMLDoc class.
- *
+ *
* @author Paul Hensgen <phensgen at techie.com>
* @version 1.0
*/
@@ -61,37 +62,37 @@
/**
* Returns the type of diagram this is.
*
- * @return Returns the type of diagram this is.
+ * @return Returns the type of diagram this is.
*/
int getType(){return type;}
-
+
/**
- * Returns the ID of thios diagram.
+ * Returns the ID of thios diagram.
*
* @return Returns the ID of thios diagram.
*/
int getID(){return id;}
-
+
/**
* Overrides the standard operation.
*/
void viewportMouseReleaseEvent(QMouseEvent *me);
-
+
/**
* Overrides the standard operation.
*/
void viewportMouseMoveEvent(QMouseEvent *me);
-
+
/**
* Overrides the standard operation.
*/
void hideEvent(QHideEvent *he);
-
+
/**
* Overrides the standard operation.
*/
void showEvent(QShowEvent *se);
-
+
/**
* Overrides the standard operation.
*/
@@ -99,7 +100,7 @@
/**
* Returns a reference to the @ref UMLView class.
- *
+ *
* @return Returns a reference to the @ref UMLView class.
*/
MyListView * getListView();
@@ -113,7 +114,7 @@
void setAssoc(UMLWidget *w){assocContainer -> setAssoc(w, currentCursor);}
/**
- * Sees if an association is relevant to the given widget. If it does delete it.
+ * Sees if an association is relevant to the given widget. If it does delete it.
*
* @param w The widget to check associations against.
*/
@@ -121,17 +122,17 @@
/**
* Sees if a message is relevant to the given widget. If it does delete it.
- * @param w The widget to check messages against.
+ * @param w The widget to check messages against.
*/
void checkMessages(UMLWidget * w);
/**
- * Returns the line length used on a sequence diagram.
+ * Returns the line length used on a sequence diagram.
*
- * @return Returns the line length used on a sequence diagram.
+ * @return Returns the line length used on a sequence diagram.
*/
int getLineLength(){return lineLength + OFFSET;}
-
+
/**
* Use to save or load this classes information
*
@@ -140,7 +141,7 @@
* load the information.
*/
bool serialize(QDataStream *s, bool archive, int fileVersion);
-
+
/**
* Finds a widget with the given ID.
*
@@ -149,7 +150,7 @@
* @return Returns the widget found, returns 0 if no widget found.
*/
UMLWidget * findWidget(int id);
-
+
/**
* Used to find the intersection point on a widget between two widgets.
*
@@ -162,47 +163,47 @@
* @returns Returns the point of intersect between two widgets.
*/
QPoint widgetIntersectPoint(int xa, int ya, int xb, int yb, UMLWidget *wb);
-
+
/**
* Remove a widget from view.
*
* @param o The widget to remove.
*/
void removeWidget(UMLWidget * o);
-
+
/**
* Set the background color.
*
* @param color The color to use.
*/
void setBGColor(QColor color);
-
+
/**
* Sets the line color.
*
* @param color The color to use.
*/
void setLineColor(QColor color);
-
+
/**
* Returns the background color.
*
* @return Returns the background color.
*/
QColor getBGColor(){return bgColor;}
-
+
/**
* Returns the line color.
*
* @return Returns the line color.
*/
QColor getLineColor(){return lineColor;}
-
+
/**
* Refreshes the view on screen.
*/
void updateView();
-
+
/**
* Sets a widget to a selected state and adds it to a list of selected widgets.
*
@@ -210,35 +211,35 @@
* @param me The mouse event containing the information about the selection.
*/
void setSelected(UMLWidget * w, QMouseEvent * me);
-
+
/**
* Clear the selected widgets list.
*/
void clearSelected();
-
+
/**
* Move all the selected widgets.
*
* @param w The widget in the selected list to move in reference to.
* @param x The distance to move horizontally.
- * @param y The distance to move vertically.
+ * @param y The distance to move vertically.
*/
void moveSelected(UMLWidget * w, int x, int y);
-
+
/**
* Return the amount of widgets selected.
*
* @return Return the amount of widgets selected.
*/
int getSelectCount(){return selectedList.count();}
-
+
/**
* Set the useFillColor variable to all selected widgets
*
* @param useFC The state to set the widget to.
*/
void selectionUseFillColor(bool useFC);
-
+
/**
* Delete the selected widgets list and the widgets in it.
*
@@ -276,13 +277,13 @@
/**
* Returns whether a widget is already on the diagram.
- *
+ *
* @param id The id of the widget to check for.
*
* @return Returns true if the widget is already on the diagram, false if not.
*/
bool widgetOnDiagram(int id);
-
+
/**
* Set the pos variable. Used internally to keep track of the cursor.
*
@@ -339,7 +340,7 @@
*
* @param x X co-ordinate of mouse click.
* @param y Y co-ordinate of mouse click.
- *
+ *
* @returns Returns the widget thats line was clicked on. Returns 0 if no line was clicked on.
*/
UMLWidget * onWidgetLine(int x, int y);
More information about the umbrello-devel
mailing list