[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello
Pierre Pettera
ppmakusu at gmail.com
Mon Feb 12 23:30:19 UTC 2007
SVN commit 633041 by pettera:
Undo / Redo commit:
-Undo Rename
-Undo textChange
-Undo visibility
-Undo stereotype (just a try )
- somes comments on last undo files.
/!\ There is a bug with undo redo: don't redo/undo/redo the TextRename on FloatingTextWidget else Kcrash says hello ;)
M +5 -0 CMakeLists.txt
M +1 -1 associationwidget.cpp
M +5 -0 cmds.h
A cmds/cmd_handle_rename.cpp [License: GPL (v2+)]
A cmds/cmd_handle_rename.h [License: GPL (v2+)]
M +2 -2 cmds/cmd_resizeWidget.cpp
M +10 -7 cmds/cmd_resizeWidget.h
A cmds/cmd_set_stereotype.cpp [License: GPL (v2+)]
A cmds/cmd_set_stereotype.h [License: GPL (v2+)]
A cmds/cmd_set_visibility.cpp [License: GPL (v2+)]
A cmds/cmd_set_visibility.h [License: GPL (v2+)]
A cmds/widget/cmd_set_name.cpp [License: GPL (v2+)]
A cmds/widget/cmd_set_name.h [License: GPL (v2+)]
A cmds/widget/cmd_set_txt.cpp [License: GPL (v2+)]
A cmds/widget/cmd_set_txt.h [License: GPL (v2+)]
M +9 -0 floatingtextwidget.cpp
M +7 -0 floatingtextwidget.h
M +24 -0 umlobject.cpp
M +16 -0 umlobject.h
M +8 -2 umlwidgetcontroller.h
--- branches/work/isi-umbrello/umbrello/umbrello/CMakeLists.txt #633040:633041
@@ -229,6 +229,11 @@
cmds/cmd_moveWidget.cpp
cmds/cmd_resizeWidget.cpp
+ cmds/cmd_set_visibility.cpp
+ cmds/cmd_set_stereotype.cpp
+ cmds/widget/cmd_set_name.cpp
+ cmds/widget/cmd_set_txt.cpp
+ cmds/cmd_handle_rename.cpp
)
kde4_automoc(${libclipboard_SRCS})
--- branches/work/isi-umbrello/umbrello/umbrello/associationwidget.cpp #633040:633041
@@ -329,7 +329,7 @@
if (m_role[B].m_pWidget)
m_pName->setUMLObject(m_role[B].m_pWidget->getUMLObject());
} else {
- m_pName->setText(strName);
+ m_pName->setTextcmd(strName);
if (strName.isEmpty()) {
m_pName->hide();
m_pName = NULL;
--- branches/work/isi-umbrello/umbrello/umbrello/cmds.h #633040:633041
@@ -28,6 +28,11 @@
#include "cmds/cmd_create_usecasediag.h"
#include "cmds/cmd_moveWidget.h"
#include "cmds/cmd_resizeWidget.h"
+#include "cmds/cmd_set_visibility.h"
+#include "cmds/cmd_set_stereotype.h"
+#include "cmds/widget/cmd_set_name.h"
+#include "cmds/widget/cmd_set_txt.h"
+#include "cmds/cmd_handle_rename.h"
/************************************************************
* Class Diagram
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_resizeWidget.cpp #633040:633041
@@ -35,8 +35,8 @@
cmdResizeWidget::cmdResizeWidget(UMLWidgetController* _UMLwc):UMLwc(_UMLwc),already(false)
{
UMLWidget * w = _UMLwc->getWidget();
- H = w->width();
- W = w->height();
+ W = w->width();
+ H = w->height();
oldH = _UMLwc->getOldH();
oldW = _UMLwc->getOldW();
}
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_resizeWidget.h #633040:633041
@@ -22,19 +22,22 @@
class cmdResizeWidget : public QUndoCommand
{
public:
+ /*Constructor */
cmdResizeWidget(UMLWidgetController* _UMLwc);
+ /*Destructor */
~cmdResizeWidget();
-
+ /*Redo method */
void redo();
+ /*Undo method */
void undo();
private:
- UMLWidgetController* UMLwc;
- int H;
- int W;
- int oldH;
- int oldW;
- bool already;
+ UMLWidgetController* UMLwc; // Attribute used to find which widget moved
+ int H; // new H value (used in redo method )
+ int W; // new W value (used in redo method )
+ int oldH; // old H value (used in undo method )
+ int oldW; // old W value (used in undo method )
+ bool already;
};
};
--- branches/work/isi-umbrello/umbrello/umbrello/floatingtextwidget.cpp #633040:633041
@@ -36,6 +36,9 @@
#include "dialogs/assocpropdlg.h"
#include "dialogs/selectopdlg.h"
+#include "cmds.h"
+
+using namespace Uml;
FloatingTextWidget::FloatingTextWidget(UMLView * view, Uml::Text_Role role,
const QString& text, Uml::IDType id)
: UMLWidget(view, id, new FloatingTextWidgetController(this))
@@ -225,6 +228,11 @@
}
void FloatingTextWidget::setText(const QString &t) {
+ UMLDoc* m_doc = UMLApp::app()->getDocument();
+ m_doc->executeCommand(new cmdSetTxt(this,t));
+}
+
+void FloatingTextWidget::setTextcmd(const QString &t) {
if (m_Role == Uml::tr_Seq_Message || m_Role == Uml::tr_Seq_Message_Self) {
QString seqNum, op;
m_pLink->getSeqNumAndOp(seqNum, op);
@@ -240,6 +248,7 @@
update();
}
+
void FloatingTextWidget::setPreText (const QString &t)
{
m_PreText = t;
--- branches/work/isi-umbrello/umbrello/umbrello/floatingtextwidget.h #633040:633041
@@ -74,6 +74,13 @@
void setText(const QString &t);
/**
+ * Method used by setText: its called by cmdsetTxt, Don't use it!
+ *
+ * @param t The text to display.
+ */
+ void setTextcmd(const QString &t);
+
+ /**
* Set some text to be prepended to the main body of text.
* @param t The text to prepend to main body which is displayed.
*/
--- branches/work/isi-umbrello/umbrello/umbrello/umlobject.cpp #633040:633041
@@ -30,6 +30,10 @@
#include "docwindow.h"
#include "dialogs/classpropdlg.h"
+#include "cmds.h"
+
+using namespace Uml;
+
UMLObject::UMLObject(const UMLObject * parent, const QString &name, Uml::IDType id)
: QObject(const_cast<UMLObject*>(parent), "UMLObject" ) {
init();
@@ -98,10 +102,17 @@
}
void UMLObject::setName(const QString &strName) {
+ UMLDoc* m_doc = UMLApp::app()->getDocument();
+ m_doc->executeCommand(new cmdSetName(this,strName));
+}
+
+void UMLObject::setNamecmd(const QString &strName) {
m_Name = strName;
emit modified();
}
+
+
QString UMLObject::getName() const {
return m_Name;
}
@@ -261,10 +272,17 @@
}
void UMLObject::setVisibility(Uml::Visibility s) {
+ UMLDoc* m_doc = UMLApp::app()->getDocument();
+ m_doc->executeCommand(new cmdSetVisibility(this,s));
+}
+
+void UMLObject::setVisibilitycmd(Uml::Visibility s) {
m_Vis = s;
emit modified();
}
+
+
void UMLObject::setUMLStereotype(UMLStereotype *stereo) {
if (stereo == m_pStereotype)
return;
@@ -285,6 +303,8 @@
}
void UMLObject::setStereotype(const QString &_name) {
+ // UMLDoc* m_doc = UMLApp::app()->getDocument();
+ //m_doc->executeCommand(new cmdSetStereotype(this,_name));
if (_name.isEmpty()) {
setUMLStereotype(NULL);
return;
@@ -294,6 +314,10 @@
setUMLStereotype(s);
}
+void UMLObject::setStereotypecmd(const QString &_name) {
+//TODO: put SetStereotype into QundoStack
+}
+
void UMLObject::setPackage(const QString &_name) {
UMLObject *pkgObj = NULL;
if (!_name.isEmpty()) {
--- branches/work/isi-umbrello/umbrello/umbrello/umlobject.h #633040:633041
@@ -134,6 +134,11 @@
void setVisibility(Uml::Visibility s);
/**
+ * Method used by setVisibility: its called by cmdSetVisibility, Don't use it!
+ */
+ void setVisibilitycmd(Uml::Visibility s);
+
+ /**
* Sets the classes stereotype name.
* Internally uses setUMLStereotype().
*
@@ -142,6 +147,11 @@
void setStereotype(const QString &_name);
/**
+ * Method used by setStereotype: its called by cmdSetStereotype, Don't use it!
+ */
+ void setStereotypecmd(const QString &_name);
+
+ /**
* Sets the class' UMLStereotype. Adjusts the reference counts
* at the previously set stereotype and at the new stereotype.
* If the previously set UMLStereotype's reference count drops
@@ -232,6 +242,12 @@
void setName(const QString &strName);
/**
+ * Method used by setName: its called by cmdSetName, Don't use it!
+ */
+ void setNamecmd(const QString &strName) ;
+
+
+ /**
* Returns the fully qualified name, i.e. all package prefixes and then m_Name.
*
* @param separator The separator string to use (optional.)
--- branches/work/isi-umbrello/umbrello/umbrello/umlwidgetcontroller.h #633040:633041
@@ -179,10 +179,15 @@
virtual void mouseDoubleClickEvent(QMouseEvent *me);
virtual void widgetMoved();
+
int getOldX();
+
int getOldY();
+
int getOldH();
+
int getOldW();
+
void insertSaveValues(int _oldX, int _oldY, int X, int Y);
//avant c'estait protected?
/**
@@ -216,10 +221,11 @@
* @param newH The new height for the widget.
*/
virtual void resizeWidget(int newW, int newH);
-//plus de modif dans les droits acces
-virtual UMLWidget* getWidget();
+ virtual UMLWidget* getWidget();
+
+
protected:
/**
More information about the umbrello-devel
mailing list