From: Darius S. <dst...@us...> - 2001-07-25 12:56:11
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views In directory usw-pr-cvs1:/tmp/cvs-serv3228/common/views Modified Files: AbstractView.cpp AbstractView.h Layoutable.h LineView.cpp SelectableView.cpp SelectableView.h SimpleLineView.cpp SimpleLineView.h View.h ViewDecorator.h ViewFactory.cpp ViewFactory.h Log Message: Added chained line support Index: AbstractView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/AbstractView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** AbstractView.cpp 2001/07/24 11:34:49 1.3 --- AbstractView.cpp 2001/07/25 12:56:08 1.4 *************** *** 44,52 **** AbstractView::~AbstractView(){ } - void AbstractView::update(){ - } - void AbstractView::changed() { - // DefaultLayouter::getInstance()->layoutSubViews(this); - } AbstractView::AbstractView(Viewer* viewer, View * parent){ --- 44,47 ---- *************** *** 69,78 **** } void AbstractView::remove(View * v){ - } - void AbstractView::add(View * v){ } ! bool AbstractView::intersects(const QPoint &p){ ! } ! QRect AbstractView::bounds() { ! return boundingRect; ! } --- 64,68 ---- } void AbstractView::remove(View * v){ } ! void AbstractView::update(){ ! } Index: AbstractView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/AbstractView.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** AbstractView.h 2001/07/24 11:34:49 1.3 --- AbstractView.h 2001/07/25 12:56:08 1.4 *************** *** 23,37 **** #include "ige/common/Paintable.h" #include "PaintAttributes.h" - #include "View.h" #include <qrect.h> - #include <vector.h> class Editor; - class QPopupMenu; class ViewLayouter; ! class AbstractView : public View { public: --- 23,36 ---- #include "ige/common/Paintable.h" #include "PaintAttributes.h" #include <qrect.h> + #include "View.h" + //#include <vector.h> class Editor; class QPopupMenu; class ViewLayouter; ! class AbstractView : public View{ public: *************** *** 40,51 **** virtual ~AbstractView(); - virtual QRect bounds(); - - virtual bool intersects(const QPoint & p); - virtual void remove(View * v); - virtual void add(View * v); - virtual View* getParent(); --- 39,44 ---- *************** *** 64,71 **** virtual void setCenter(const QPoint& p); - virtual void changed(); - - virtual void update(); - /** * This implementation sets the paint attributes and call paintContents() --- 57,60 ---- *************** *** 81,90 **** viewer = v; } - - - private: ! /** @link aggregation */ ! vector < View * > childs; QRect boundingRect; ViewLayouter * lnkLayouter; --- 70,75 ---- viewer = v; } ! private: QRect boundingRect; ViewLayouter * lnkLayouter; *************** *** 120,123 **** --- 105,110 ---- virtual void move(const QPoint& delta); + + virtual void update(); }; #endif //ABSTRACTVIEW_H Index: Layoutable.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Layoutable.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** Layoutable.h 2001/06/20 19:21:29 1.1.1.1 --- Layoutable.h 2001/07/25 12:56:08 1.2 *************** *** 30,34 **** public: ! virtual void layoutChilds() = 0; virtual ViewLayouter * getLayouter() = 0; --- 30,34 ---- public: ! virtual void layout() = 0; virtual ViewLayouter * getLayouter() = 0; Index: LineView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/LineView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** LineView.cpp 2001/07/24 11:34:49 1.3 --- LineView.cpp 2001/07/25 12:56:08 1.4 *************** *** 1,2 **** --- 1,4 ---- + + /*************************************************************************** LineView.cpp - description *************** *** 7,20 **** email : sta...@in... ***************************************************************************/ - - /*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - #include "LineView.h" --- 9,12 ---- Index: SelectableView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectableView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** SelectableView.cpp 2001/07/24 11:34:49 1.3 --- SelectableView.cpp 2001/07/25 12:56:08 1.4 *************** *** 19,27 **** void SelectableView::mouseRMBPress(QMouseEvent * e){ if(isSelected() == false) { select(); - /* Viewer *v = getViewer(); - Editor *ed = v->getEditor(); - - selector = (ViewSelector*) ed->addManipulator(this);*/ } --- 19,24 ---- void SelectableView::mouseRMBPress(QMouseEvent * e){ if(isSelected() == false) { + getViewer()->getEditor()->unselectAll(); select(); } *************** *** 38,55 **** // A left mouse button click on the view selects it if(isSelected() == false) { select(); - /* Viewer *v = getViewer(); - Editor *ed = v->getEditor(); - - selector = (ViewSelector*) ed->addManipulator(this); - */ } - // Hier morgen weitermachen !!!! - /* ViewManipulator *m = createManipulator(); - CHECK_PTR(m); - ed->addManipulator(m); - selector = (ViewSelector*)m;*/ - } QPopupMenu* SelectableView::createPopupMenu() { --- 35,42 ---- // A left mouse button click on the view selects it if(isSelected() == false) { + getViewer()->getEditor()->unselectAll(); select(); } } QPopupMenu* SelectableView::createPopupMenu() { *************** *** 108,112 **** } SelectableView::~SelectableView(){} ! SelectableView::SelectableView(Viewer* viewer, View * parent) : AbstractView(viewer, parent) { manipulator = 0; selected = false; --- 95,99 ---- } SelectableView::~SelectableView(){} ! SelectableView::SelectableView(Viewer * viewer, View * parent) : CompositeView(viewer, parent) { manipulator = 0; selected = false; Index: SelectableView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectableView.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** SelectableView.h 2001/07/24 11:34:49 1.3 --- SelectableView.h 2001/07/25 12:56:08 1.4 *************** *** 19,23 **** #ifndef SELECTABLEVIEW_H #define SELECTABLEVIEW_H ! #include "AbstractView.h" #include "Selectable.h" #include "ige/common/GuiProvider.h" --- 19,23 ---- #ifndef SELECTABLEVIEW_H #define SELECTABLEVIEW_H ! #include "CompositeView.h" #include "Selectable.h" #include "ige/common/GuiProvider.h" *************** *** 27,34 **** class View; ! class SelectableView : public AbstractView, public Selectable , public GuiProvider, public Clonable{ public: ! SelectableView(Viewer* viewer = 0, View * parent = 0); virtual ~SelectableView(); --- 27,34 ---- class View; ! class SelectableView : public CompositeView, public Selectable , public GuiProvider, public Clonable{ public: ! SelectableView(Viewer * viewer, View * parent); virtual ~SelectableView(); Index: SimpleLineView.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SimpleLineView.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** SimpleLineView.cpp 2001/07/24 11:29:07 1.1 --- SimpleLineView.cpp 2001/07/25 12:56:08 1.2 *************** *** 24,41 **** #include <qpainter.h> - void SimpleLineView::move(const QPoint& delta){ - setStartPoint(getStartPoint() + delta); - setEndPoint(getEndPoint() + delta); - } - void SimpleLineView::setCenter(const QPoint& p){ - qDebug("SimpleLineView::setCenter() not implemented!"); - // rectangle.moveCenter(p); - } - QPoint SimpleLineView::getCenter(){ - QRect rect(getStartPoint(), getEndPoint()); - rect = rect.normalize(); - - return rect.center(); - } bool SimpleLineView::intersects(const QPoint &mousePos){ double r; --- 24,27 ---- *************** *** 78,81 **** --- 64,82 ---- return boundingRect; } + void SimpleLineView::move(const QPoint& delta){ + setStartPoint(getStartPoint() + delta); + setEndPoint(getEndPoint() + delta); + } + void SimpleLineView::setCenter(const QPoint& p){ + qDebug("SimpleLineView::setCenter() not implemented!"); + // rectangle.moveCenter(p); + } + QPoint SimpleLineView::getCenter(){ + QRect rect(getStartPoint(), getEndPoint()); + rect = rect.normalize(); + + return rect.center(); + } + void SimpleLineView::paintContents(QPainter * painter) { painter->drawLine(getStartPoint(), getEndPoint()); Index: SimpleLineView.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SimpleLineView.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** SimpleLineView.h 2001/07/24 11:29:07 1.1 --- SimpleLineView.h 2001/07/25 12:56:08 1.2 *************** *** 36,45 **** virtual QPoint& getEndPoint(); ! virtual void setEndPoint(const QPoint& endPoint); - virtual QRect bounds(); - - virtual bool intersects(const QPoint & mousePos); - virtual QPoint getCenter(); --- 36,41 ---- virtual QPoint& getEndPoint(); ! virtual void setEndPoint(const QPoint& endPoint); virtual QPoint getCenter(); *************** *** 47,52 **** virtual void move(const QPoint& delta); ! virtual ViewManipulator* createManipulator(); protected: --- 43,52 ---- virtual void move(const QPoint& delta); + + virtual ViewManipulator* createManipulator(); + + virtual QRect bounds(); ! virtual bool intersects(const QPoint & mousePos); protected: Index: View.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/View.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** View.h 2001/07/24 11:34:49 1.3 --- View.h 2001/07/25 12:56:08 1.4 *************** *** 49,58 **** * Remove sub view */ ! virtual void remove(View* g) = 0; /** * Add sub view */ ! virtual void add(View* g) = 0; virtual View* getParent() = 0; --- 49,58 ---- * Remove sub view */ ! virtual void removeChild(int i) = 0; /** * Add sub view */ ! virtual void addChild(View * g) = 0; virtual View* getParent() = 0; *************** *** 71,74 **** --- 71,78 ---- */ virtual void move(const QPoint& delta) = 0; + + virtual View* getChild(int at) = 0; + + virtual int getChildCount() = 0; }; #endif //VIEW_H Index: ViewDecorator.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ViewDecorator.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** ViewDecorator.h 2001/06/20 19:21:29 1.1.1.1 --- ViewDecorator.h 2001/07/25 12:56:08 1.2 *************** *** 21,24 **** --- 21,25 ---- #include "AbstractView.h" #include "View.h" + #include "CompositeView.h" /** * ViewDecorator can be used to decorate other graphics with *************** *** 26,30 **** * methods to their contained graphic. Subclasses can * override these methods to extend and filter their behavior.*/ ! class ViewDecorator : public AbstractView { }; #endif //VIEWDECORATOR_H --- 27,31 ---- * methods to their contained graphic. Subclasses can * override these methods to extend and filter their behavior.*/ ! class ViewDecorator : CompositeView { }; #endif //VIEWDECORATOR_H Index: ViewFactory.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ViewFactory.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** ViewFactory.cpp 2001/07/24 11:34:49 1.3 --- ViewFactory.cpp 2001/07/25 12:56:08 1.4 *************** *** 20,23 **** --- 20,24 ---- #include "TextView.h" #include "SimpleLineView.h" + #include "ChainedLineView.h" #include "ige/common/documents/Document.h" *************** *** 25,32 **** void ViewFactory::setDocument(Document* document){ this->document = document; ! } Document* ViewFactory::getDocument(){ return document; ! } SimpleLineView* ViewFactory::createSimpleLine(){ SimpleLineView *v = new SimpleLineView(getDocument()->getViewer()); --- 26,38 ---- void ViewFactory::setDocument(Document* document){ this->document = document; ! } Document* ViewFactory::getDocument(){ return document; ! } ! ChainedLineView* ViewFactory::createChainedLine(){ ! ChainedLineView *v = new ChainedLineView(getDocument()->getViewer()); ! getDocument()->addView(v); ! return v; ! } SimpleLineView* ViewFactory::createSimpleLine(){ SimpleLineView *v = new SimpleLineView(getDocument()->getViewer()); Index: ViewFactory.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ViewFactory.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ViewFactory.h 2001/07/24 11:34:49 1.2 --- ViewFactory.h 2001/07/25 12:56:08 1.3 *************** *** 19,22 **** --- 19,23 ---- #ifndef VIEWFACTORY_H #define VIEWFACTORY_H + class ChainedLineView; class Document; class SimpleLineView; *************** *** 44,47 **** --- 45,50 ---- void setDocument(Document* document); + + ChainedLineView* createChainedLine(); private: |