[Uml-devel] KDE/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Fri Dec 23 09:21:03 UTC 2005
SVN commit 490912 by okellogg:
apply commit 490911 from branches/KDE/3.5
M +3 -2 activitywidget.cpp
M +1 -0 floatingtext.cpp
M +1 -5 forkjoinwidget.cpp
M +1 -1 forkjoinwidget.h
M +6 -3 messagewidget.cpp
M +7 -4 umlwidget.cpp
M +2 -2 umlwidget.h
--- trunk/KDE/kdesdk/umbrello/umbrello/activitywidget.cpp #490911:490912
@@ -31,8 +31,8 @@
ActivityWidget::ActivityWidget(UMLView * view, ActivityType activityType, Uml::IDType id )
: UMLWidget(view, id)
{
- m_ActivityType = activityType;
UMLWidget::setBaseType( Uml::wt_Activity );
+ setActivityType( activityType );
updateComponentSize();
}
@@ -119,6 +119,7 @@
void ActivityWidget::setActivityType( ActivityType activityType ) {
m_ActivityType = activityType;
+ UMLWidget::m_bResizable = (m_ActivityType == Normal);
}
void ActivityWidget::slotMenuSelection(int sel) {
@@ -199,7 +200,7 @@
m_Text = qElement.attribute( "activityname", "" );
m_Doc = qElement.attribute( "documentation", "" );
QString type = qElement.attribute( "activitytype", "1" );
- m_ActivityType = (ActivityType)type.toInt();
+ setActivityType( (ActivityType)type.toInt() );
return true;
}
--- trunk/KDE/kdesdk/umbrello/umbrello/floatingtext.cpp #490911:490912
@@ -57,6 +57,7 @@
m_Type = Uml::wt_Text;
// initialize non-saved (i.e. volatile) data
m_pLink = NULL;
+ UMLWidget::m_bResizable = false;
}
FloatingText::~FloatingText() {
--- trunk/KDE/kdesdk/umbrello/umbrello/forkjoinwidget.cpp #490911:490912
@@ -52,11 +52,7 @@
}
}
-void ForkJoinWidget::drawSelected(QPainter * p, int offsetX, int offsetY, bool resizeable) {
- if (! resizeable) {
- UMLWidget::drawSelected(p, offsetX, offsetY, false);
- return;
- }
+void ForkJoinWidget::drawSelected(QPainter *, int /*offsetX*/, int /*offsetY*/) {
}
void ForkJoinWidget::constrain(int& width, int& height) {
--- trunk/KDE/kdesdk/umbrello/umbrello/forkjoinwidget.h #490911:490912
@@ -79,7 +79,7 @@
* Although the ForkJoinWidget supports resizing, we suppress the
* resize corner because it is too large for this very slim widget.
*/
- void drawSelected(QPainter * p, int offsetX, int offsetY, bool resizeable = true);
+ void drawSelected(QPainter * p, int offsetX, int offsetY);
/**
* Overrides the function from UMLWidget.
--- trunk/KDE/kdesdk/umbrello/umbrello/messagewidget.cpp #490911:490912
@@ -46,6 +46,7 @@
y -= m_pOw[Uml::B]->getHeight() / 2;
m_pOw[Uml::B]->setY(y);
}
+ UMLWidget::m_bResizable = (m_pOw[Uml::A] == m_pOw[Uml::B]);
calculateWidget();
y = y < getMinHeight() ? getMinHeight() : y;
@@ -218,7 +219,7 @@
}
if (m_bSelected)
- drawSelected(&p, offsetX, offsetY, m_pOw[Uml::A] == m_pOw[Uml::B]);
+ drawSelected(&p, offsetX, offsetY);
}
void MessageWidget::drawCreation(QPainter& p, int offsetX, int offsetY) {
@@ -247,7 +248,7 @@
}
if (m_bSelected)
- drawSelected(&p, offsetX, offsetY, false);
+ drawSelected(&p, offsetX, offsetY);
}
int MessageWidget::onWidget(const QPoint & p) {
@@ -340,7 +341,7 @@
emit sigMessageMoved();
}
-void MessageWidget::resizeEvent(QResizeEvent */*re*/) {
+void MessageWidget::resizeEvent(QResizeEvent* /*re*/) {
}
void MessageWidget::calculateWidget() {
@@ -741,6 +742,7 @@
void MessageWidget::setWidget(ObjectWidget * ow, Uml::Role_Type role) {
m_pOw[role] = ow;
+ UMLWidget::m_bResizable = (m_pOw[Uml::A] == m_pOw[Uml::B]);
}
ObjectWidget* MessageWidget::getWidget(Uml::Role_Type role) {
@@ -808,6 +810,7 @@
<< ID2STR(bId) << " is not an ObjectWidget" << endl;
return false;
}
+ UMLWidget::m_bResizable = (m_pOw[Uml::A] == m_pOw[Uml::B]);
UMLClassifier *c = dynamic_cast<UMLClassifier*>( pWB->getUMLObject() );
if (c) {
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidget.cpp #490911:490912
@@ -105,6 +105,7 @@
m_pObject = other.m_pObject;
m_pView = other.m_pView;
m_pMenu = other.m_pMenu;
+ m_bResizable = other.m_bResizable;
m_bResizing = other.m_bResizing;
m_nPressOffsetX = other.m_nPressOffsetX;
m_nPressOffsetY = other.m_nPressOffsetY;
@@ -346,8 +347,9 @@
m_nOldH = height();
const int m = 10;
//see if clicked on bottom right corner
- if( (m_nOldX + m_nPressOffsetX) >= (getX() + width() - m) &&
- (m_nOldY + m_nPressOffsetY) >= (getY() + height() - m) && me->button() == Qt::LeftButton) {
+ if( m_bResizable && me->button() == Qt::LeftButton &&
+ (m_nOldX + m_nPressOffsetX) >= (getX() + width() - m) &&
+ (m_nOldY + m_nPressOffsetY) >= (getY() + height() - m)) {
m_bResizing = true;
m_pView->setCursor(WidgetBase::m_Type == Uml::wt_Message ?
KCursor::sizeVerCursor() : KCursor::sizeFDiagCursor());
@@ -448,6 +450,7 @@
for (int i = 0; i < (int)FT_INVALID; ++i)
m_pFontMetrics[(UMLWidget::FontType)i] = 0;
+ m_bResizable = true;
m_bResizing = false;
m_bMouseOver = false;
@@ -677,7 +680,7 @@
update();
}
-void UMLWidget::drawSelected(QPainter * p, int offsetX, int offsetY, bool resizeable) {
+void UMLWidget::drawSelected(QPainter * p, int offsetX, int offsetY) {
int w = width();
int h = height();
int s = 4;
@@ -687,7 +690,7 @@
p -> fillRect(offsetX + w - s, offsetY, s, s, brush);
// Draw the resize anchor in the lower right corner.
- if (resizeable) {
+ if (m_bResizable) {
brush.setColor(Qt::red);
const int right = offsetX + w;
const int bottom = offsetY + h;
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidget.h #490911:490912
@@ -536,7 +536,7 @@
* @param offsetX The x-coordinate for drawing.
* @param offsetY The y-coordinate for drawing.
*/
- virtual void drawSelected(QPainter * p, int offsetX, int offsetY, bool resizeable = true);
+ virtual void drawSelected(QPainter * p, int offsetX, int offsetY);
/**
* Overrides default method.
@@ -657,7 +657,7 @@
int m_nOldX, m_nOldY, m_nPosX, m_origZ;
ListPopupMenu *m_pMenu;
UMLDoc *m_pDoc; ///< shortcut for UMLApp::app()->getDocument()
- bool m_bResizing;
+ bool m_bResizable, m_bResizing;
int m_nPressOffsetX, m_nPressOffsetY;
int m_nOldH, m_nOldW;
QFontMetrics *m_pFontMetrics[FT_INVALID];
More information about the umbrello-devel
mailing list