[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Wed Jul 7 19:47:00 UTC 2004
CVS commit by okellogg:
slotMenuSelection(mt_Operation): Don't crash when user canceled the
operation dialog.
mouseMoveEvent(): Suppress updates when m_Role is tr_Seq_Message_Self.
M +23 -9 floatingtext.cpp 1.49
--- kdesdk/umbrello/umbrello/floatingtext.cpp #1.48:1.49
@@ -166,8 +166,10 @@ void FloatingText::slotMenuSelection(int
UMLClassifier* c = m_pLink->getOperationOwner(this);
UMLObject* umlObj = m_pView->getDocument()->createChildObject(c, Uml::ot_Operation);
+ if (umlObj) {
UMLOperation* newOperation = static_cast<UMLOperation*>( umlObj );
QString opText = newOperation->toString(st_SigNoScope);
m_pLink->setOperationText(this, opText);
}
+ }
break;
@@ -328,6 +330,7 @@ void FloatingText::showOpDlg() {
void FloatingText::mouseMoveEvent(QMouseEvent* me) {
- if (m_Role == tr_Seq_Message_Self ||
- (!m_bMouseDown && me->button() != LeftButton) )
+ if (!m_bMouseDown && me->button() != LeftButton)
+ return;
+ if (m_Role == tr_Seq_Message_Self)
return;
QPoint newPosition = doMouseMove(me);
@@ -335,10 +338,21 @@ void FloatingText::mouseMoveEvent(QMouse
int newY = newPosition.y();
+ //implement specific rules for a sequence diagram
+ if (m_Role == tr_Seq_Message) {
+ MessageWidget *pMessage = static_cast<MessageWidget*>(m_pLink);
+ if (m_Role == tr_Seq_Message_Self) {
+ newX = pMessage->getX() + 5;
+ pMessage->setX( newX - 5 );
+ }
+ const int minHeight = pMessage->getMinHeight();
+ newY = newY < minHeight ? minHeight : newY;
+ const int maxHeight = pMessage->getMaxHeight() - height() - 5;
+ newY = newY < maxHeight ? newY : maxHeight;
+ pMessage->setY( newY + height() );
+ }
m_nOldX = newX;
- setX( newX );
- if (m_Role != tr_Seq_Message) {
m_nOldY = newY;
+ setX( newX );
setY( newY );
- }
if (m_pLink)
m_pLink->calculateNameTextSegment();
More information about the umbrello-devel
mailing list