[Uml-devel] kdesdk/umbrello/umbrello
Jonathan Riddell
jri at jriddell.org
Fri May 16 11:14:09 UTC 2003
CVS commit by jriddell:
A friendlier right click menu for moving sequence diagram objects up or down
M +9 -5 listpopupmenu.cpp 1.22
M +6 -2 objectwidget.cpp 1.10
M +5 -0 objectwidget.h 1.5
--- kdesdk/umbrello/umbrello/listpopupmenu.cpp #1.21:1.22
@@ -24,4 +24,5 @@
#include "statewidget.h"
#include "activitywidget.h"
+#include "objectwidget.h"
ListPopupMenu::ListPopupMenu(QWidget *parent, Menu_Type type, UMLView * view) : KPopupMenu(parent) {
@@ -282,11 +283,14 @@ ListPopupMenu::ListPopupMenu(QWidget * p
case Uml::wt_Object:
+ setupColor(object -> getUseFillColor());
+ insertSeparator();
if( pView -> getType() == Uml::dt_Sequence ) {
- m_pShow = new KPopupMenu( this, "Tab" );
- m_pShow -> insertItem( SmallIcon( "1uparrow"), i18n("Up"), mt_Up);
- m_pShow -> insertItem( SmallIcon( "1downarrow"), i18n("Down"), mt_Down);
- insertItem(SmallIcon( "misc"),i18n("Tab"), m_pShow);
+ //FIXME
+ int tabUp = insertItem( SmallIcon( "1uparrow"), i18n("Move Up"), mt_Up);
+ insertItem( SmallIcon( "1downarrow"), i18n("Move Down"), mt_Down);
+ if ( !(static_cast<ObjectWidget*>(object))->canTabUp() ) {
+ setItemEnabled(tabUp, false);
+ }
}
- setupColor(object -> getUseFillColor());
insertSeparator();
insertItem( SmallIcon( "editcut"), i18n("Cut"), mt_Cut);
--- kdesdk/umbrello/umbrello/objectwidget.cpp #1.9:1.10
@@ -277,5 +277,5 @@ void ObjectWidget::mouseMoveEvent(QMouse
void ObjectWidget::tabUp() {
int newY = (int)y() - height();
- newY = newY + height() < 80?80 - height():newY;
+ newY = ( newY + height() ) < 80?80 - height():newY;
setY( newY );
moveEvent( 0 );
@@ -290,4 +290,8 @@ void ObjectWidget::tabDown() {
}
+bool ObjectWidget::canTabUp() {
+ return (int)y() >= 80;
+}
+
void ObjectWidget::setShowDeconstruction( bool bShow ) {
( ( ObjectWidgetData *)m_pData ) -> setShowDeconstruction( bShow );
@@ -319,5 +323,5 @@ void ObjectWidget::slotMessageMoved() {
while ( (message = iterator.current()) != 0 ) {
++iterator;
- int messageHeight = message->y() + message->height();
+ int messageHeight = (int)message->y() + message->height();
if (lowestMessage < messageHeight) {
lowestMessage = messageHeight;
--- kdesdk/umbrello/umbrello/objectwidget.h #1.4:1.5
@@ -223,4 +223,9 @@ public:
void messageRemoved(MessageWidget* message);
+ /**
+ * returns whether or not the widget can be moved vertically up
+ */
+ bool canTabUp();
+
protected:
QString m_Doc;
More information about the umbrello-devel
mailing list