[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello
Hassan Kouch
hkouch at hotmail.com
Fri Feb 16 01:17:01 UTC 2007
SVN commit 634010 by kouch:
finished the dev of the object flow widget (UML2.0)
M +2 -0 assocrules.cpp
M +39 -54 objectflowwidget.cpp
M +4 -4 objectflowwidget.h
M +4 -0 toolbarstateother.cpp
--- branches/work/isi-umbrello/umbrello/umbrello/assocrules.cpp #634009:634010
@@ -354,6 +354,8 @@
{ at_Activity, wt_Activity, wt_Activity, true, false, true, true },
{ at_Activity, wt_ForkJoin, wt_Activity, true, false, true, true },
{ at_Activity, wt_Activity, wt_ForkJoin, true, false, true, true },
+ { at_Activity, wt_Activity, wt_Object_Flow, true, false, true, true },
+ { at_Activity, wt_Object_Flow, wt_Activity, true, false, true, true },
{ at_Anchor, wt_Class, wt_Note, false, false, false, false },
{ at_Anchor, wt_Package, wt_Note, false, false, false, false },
{ at_Anchor, wt_Interface, wt_Note, false, false, false, false },
--- branches/work/isi-umbrello/umbrello/umbrello/objectflowwidget.cpp #634009:634010
@@ -35,7 +35,6 @@
ObjectFlowWidget::ObjectFlowWidget(UMLView * view, Uml::IDType id ): UMLWidget(view, id)
{
UMLWidget::setBaseType( Uml::wt_Object_Flow );
- //setObjectFlowType( objectflowType );
updateComponentSize();
}
@@ -43,7 +42,7 @@
void ObjectFlowWidget::draw(QPainter & p, int offsetX, int offsetY) {
int w = width();
- int h = height();
+ int h = height();
UMLWidget::setPen(p);
if ( UMLWidget::getUseFillColour() ) {
@@ -52,14 +51,12 @@
{
const QFontMetrics &fm = getFontMetrics(FT_NORMAL);
const int fontHeight = fm.lineSpacing();
- //int middleX = w / 2;
int textStartY = (h / 2) - (fontHeight / 2);
- p.drawRect(offsetX, offsetY, w, h /*,(h * 60) / w, 60*/);
+ p.drawRect(offsetX, offsetY, w, h);
p.drawLine(offsetX + 10, offsetY + (h/2), (offsetX + w)-10, offsetY + (h/2) );
p.setPen(Qt::black);
p.setFont( UMLWidget::getFont() );
- p.drawText(offsetX + OBJECTFLOW_MARGIN, offsetY + textStartY,
- w - OBJECTFLOW_MARGIN * 2, fontHeight, Qt::AlignCenter, getName());
+ p.drawText(offsetX + OBJECTFLOW_MARGIN, (offsetY + textStartY/2)-4, w - OBJECTFLOW_MARGIN * 2, fontHeight, Qt::AlignHCenter, getName());
}
UMLWidget::setPen(p);
if(m_bSelected)
@@ -68,7 +65,6 @@
QSize ObjectFlowWidget::calculateSize() {
int width = 10, height = 10;
-// if ( m_ObjectFlowType == Normal ) {
const QFontMetrics &fm = getFontMetrics(FT_NORMAL);
const int fontHeight = fm.lineSpacing();
const int textWidth = fm.width(getName());
@@ -77,59 +73,48 @@
height = height > OBJECTFLOW_HEIGHT ? height : OBJECTFLOW_HEIGHT;
width += OBJECTFLOW_MARGIN * 2;
height += OBJECTFLOW_MARGIN * 2;
-// } else if ( m_ObjectFlowType == Branch ) {
-// width = height = 20;
-// }
+
return QSize(width, height);
}
-// ObjectFlowWidget::ObjectFlowType ObjectFlowWidget::getObjectFlowType() const {
-// return m_ObjectFlowType;
-// }
-
-// void ObjectFlowWidget::setObjectFlowType( ObjectFlowType objectflowType ) {
-// m_ObjectFlowType = objectflowType;
-// UMLWidget::m_bResizable = (m_ObjectFlowType == Normal);
-// }
-
-void ObjectFlowWidget::slotMenuSelection(int sel) {
- bool done = false;
-
- bool ok = false;
- QString name = m_Text;
-
- switch( sel ) {
- case ListPopupMenu::mt_Rename:
- name = KInputDialog::getText( i18n("Enter Object Flow Name"), i18n("Enter the name of the new Object Flow:"), m_Text, &ok );
- if( ok && name.length() > 0 )
- m_Text = name;
- done = true;
- break;
-
- case ListPopupMenu::mt_Properties:
- showProperties();
- done = true;
- break;
- }
-
- if( !done )
- UMLWidget::slotMenuSelection( sel );
-}
-
- bool ObjectFlowWidget::showProperties() {
-// DocWindow *docwindow = UMLApp::app()->getDocWindow();
-// docwindow->updateDocumentation(false);
+// void ObjectFlowWidget::slotMenuSelection(int sel) {
+// bool done = false;
//
-// ObjectFlowDialog dialog(m_pView, this);
-// bool modified = false;
-// if (dialog.exec() && dialog.getChangesMade()) {
-// docwindow->showDocumentation(this, true);
-// UMLApp::app()->getDocument()->setModified(true);
-// modified = true;
+// bool ok = false;
+// QString name = m_Text;
+//
+// switch( sel ) {
+// case ListPopupMenu::mt_Rename:
+// name = KInputDialog::getText( i18n("Enter Object Flow Name"), i18n("Enter the name of the new Object Flow:"), m_Text, &ok );
+// if( ok && name.length() > 0 )
+// m_Text = name;
+// done = true;
+// break;
+//
+// case ListPopupMenu::mt_Properties:
+// showProperties();
+// done = true;
+// break;
// }
//
- return true;
- }
+// if( !done )
+// UMLWidget::slotMenuSelection( sel );
+// }
+
+// bool ObjectFlowWidget::showProperties() {
+// // DocWindow *docwindow = UMLApp::app()->getDocWindow();
+// // docwindow->updateDocumentation(false);
+// //
+// // ObjectFlowDialog dialog(m_pView, this);
+// // bool modified = false;
+// // if (dialog.exec() && dialog.getChangesMade()) {
+// // docwindow->showDocumentation(this, true);
+// // UMLApp::app()->getDocument()->setModified(true);
+// // modified = true;
+// // }
+// //
+// return true;
+ //}
//
// bool ObjectFlowWidget::isObjectFlow(WorkToolBar::ToolBar_Buttons tbb,
// ObjectFlowType& resultType)
--- branches/work/isi-umbrello/umbrello/umbrello/objectflowwidget.h #634009:634010
@@ -68,8 +68,8 @@
// * Show a properties dialog for an ObjectFlowWidget.
// *
// * @return True if we modified the ObjectFlow.
-// */
- bool showProperties();
+
+// bool showProperties();
//
// /**
// * Determines whether a toolbar button represents an ObjectFlow.
@@ -104,12 +104,12 @@
*/
// ObjectFlow m_ObjectFlowType;
-public slots:
+//public slots:
/**
* Captures any popup menu signals for menus it created.
*/
- void slotMenuSelection(int sel);
+ // void slotMenuSelection(int sel);
};
#endif
--- branches/work/isi-umbrello/umbrello/umbrello/toolbarstateother.cpp #634009:634010
@@ -190,6 +190,10 @@
// It is pretty invisible otherwise.
FloatingTextWidget* ft = (FloatingTextWidget*) umlWidget;
ft->changeTextDlg();
+ } else if (getButton() == WorkToolBar::tbb_Object_Flow) {
+ Dialog_Utils::askNameForWidget(
+ umlWidget, i18n("Enter Object Flow Name"),
+ i18n("Enter Object Flow"), i18n("new object flow"));
} /*else if (getButton() == WorkToolBar::tbb_Object_Flow) {
Dialog_Utils::askNameForWidgetType(umlWidget, i18n("Enter Object Flow Name"),
i18n("Enter the Object Flow"), i18n("new Object Flow"));
More information about the umbrello-devel
mailing list