From: Darius S. <dst...@us...> - 2001-07-22 23:21:40
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands In directory usw-pr-cvs1:/tmp/cvs-serv2714/common/commands Modified Files: MoveCmd.cpp MoveCmd.h NewTextCmd.cpp NewTextCmd.h NewViewCmd.cpp NewViewCmd.h Log Message: Added more basic implementation for user interaction Index: MoveCmd.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/MoveCmd.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** MoveCmd.cpp 2001/07/20 15:57:28 1.2 --- MoveCmd.cpp 2001/07/22 23:21:38 1.3 *************** *** 19,22 **** --- 19,23 ---- #include "MoveCmd.h" + #include "ige/common/views/View.h" #include <qglobal.h> // debug(const char*, ...) *************** *** 24,28 **** void MoveCmd::execute(Editor* editor){ ! qDebug("MoveCmd->Execute called (Not yet implemented!)"); } void MoveCmd::undo(){ --- 25,30 ---- void MoveCmd::execute(Editor* editor){ ! // qDebug("MoveCmd->Execute called (Not yet implemented!)"); ! view->setCenter(view->getCenter() + delta); } void MoveCmd::undo(){ *************** *** 30,34 **** } MoveCmd::~MoveCmd(){} ! MoveCmd::MoveCmd(View * v, int dx, int dy){} --- 32,38 ---- } MoveCmd::~MoveCmd(){} ! MoveCmd::MoveCmd(View * v, int dx, int dy) : delta(dx, dy) { ! view = v; ! } Index: MoveCmd.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/MoveCmd.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** MoveCmd.h 2001/06/20 19:21:23 1.1.1.1 --- MoveCmd.h 2001/07/22 23:21:38 1.2 *************** *** 21,24 **** --- 21,27 ---- #include "EditorCommand.h" #include "AbstractCommand.h" + + #include <qpoint.h> + class Editor; class View; *************** *** 38,41 **** --- 41,48 ---- return "Move"; } + + private: + View *view; + QPoint delta; }; #endif //MOVECMD_H Index: NewTextCmd.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/NewTextCmd.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** NewTextCmd.cpp 2001/07/20 15:57:28 1.2 --- NewTextCmd.cpp 2001/07/22 23:21:38 1.3 *************** *** 18,33 **** #include "NewTextCmd.h" #include <qglobal.h>// debug(const char*, ...) void NewTextCmd::execute(Editor* editor){ ! qDebug("CreateTextCmd->Execute called (Not yet implemented!)"); } void NewTextCmd::undo(){ qDebug("CreateTextCmd->Undo called (Not yet implemented!)"); } ! View * NewTextCmd::createView(){} ! NewTextCmd::~NewTextCmd(){} ! NewTextCmd::NewTextCmd(){} --- 18,46 ---- #include "NewTextCmd.h" + #include "ige/common/views/TextView.h" + #include "ige/common/views/ViewFactory.h" + #include "ige/common/models/TextModel.h" + #include "ige/common/documents/Document.h" #include <qglobal.h>// debug(const char*, ...) void NewTextCmd::execute(Editor* editor){ ! NewViewCmd::execute(editor); ! // qDebug("CreateTextCmd->Execute called (Not yet implemented!)"); } void NewTextCmd::undo(){ qDebug("CreateTextCmd->Undo called (Not yet implemented!)"); } ! View * NewTextCmd::createView(Document *doc){ ! TextModel *tm = new TextModel(); ! ! TextView *tv = ViewFactory::getInstance()->create(tm); ! tv->setViewer(doc->getViewer()); ! return tv; ! } ! NewTextCmd::~NewTextCmd(){ ! } ! NewTextCmd::NewTextCmd(){ ! } Index: NewTextCmd.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/NewTextCmd.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** NewTextCmd.h 2001/06/20 19:21:25 1.1.1.1 --- NewTextCmd.h 2001/07/22 23:21:38 1.2 *************** *** 42,46 **** protected: ! virtual View * createView(); }; #endif //NEWTEXTCMD_H --- 42,46 ---- protected: ! virtual View * createView(Document *doc); }; #endif //NEWTEXTCMD_H Index: NewViewCmd.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/NewViewCmd.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** NewViewCmd.cpp 2001/06/20 19:21:25 1.1.1.1 --- NewViewCmd.cpp 2001/07/22 23:21:38 1.2 *************** *** 18,24 **** #include "NewViewCmd.h" NewViewCmd::~NewViewCmd(){} ! NewViewCmd::NewViewCmd(){} --- 18,33 ---- #include "NewViewCmd.h" + #include "ige/common/documents/Document.h" + #include "ige/common/editors/Editor.h" + void NewViewCmd::execute(Editor* editor) { + Document *doc = editor->getDocument(); + createdView = createView(doc); + doc->addView(createdView); + } NewViewCmd::~NewViewCmd(){} ! NewViewCmd::NewViewCmd(){ ! createdView = 0; ! } Index: NewViewCmd.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/NewViewCmd.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** NewViewCmd.h 2001/06/20 19:21:25 1.1.1.1 --- NewViewCmd.h 2001/07/22 23:21:38 1.2 *************** *** 22,25 **** --- 22,26 ---- #include "AbstractCommand.h" class View; + class Document; class NewViewCmd : public AbstractCommand { *************** *** 30,39 **** virtual ~NewViewCmd(); protected: /** Factory method. Implement this your subclasses to create the desired object. */ ! virtual View * createView() = 0; ! protected: }; #endif //NEWVIEWCMD_H --- 31,47 ---- virtual ~NewViewCmd(); + virtual void execute(Editor* editor); + + View* getCreated() { + return createdView; + } + protected: /** Factory method. Implement this your subclasses to create the desired object. */ ! virtual View * createView(Document *doc) = 0; ! private: ! View *createdView; }; #endif //NEWVIEWCMD_H |