You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(8) |
Nov
(8) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(12) |
Jun
(14) |
Jul
(56) |
Aug
(6) |
Sep
(24) |
Oct
(1) |
Nov
(3) |
Dec
(5) |
| 2002 |
Jan
(2) |
Feb
(6) |
Mar
(22) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Darius S. <dst...@us...> - 2001-07-25 12:56:11
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige In directory usw-pr-cvs1:/tmp/cvs-serv3228 Modified Files: Makefile ige.pro Log Message: Added chained line support Index: Makefile =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** Makefile 2001/07/24 11:34:49 1.5 --- Makefile 2001/07/25 12:56:08 1.6 *************** *** 1,5 **** ############################################################################# # Makefile for building libige.so.1.0.0 ! # Generated by tmake at 22:45, 2001/07/23 # Project: ige # Template: lib --- 1,5 ---- ############################################################################# # Makefile for building libige.so.1.0.0 ! # Generated by tmake at 21:58, 2001/07/24 # Project: ige # Template: lib *************** *** 42,45 **** --- 42,46 ---- common/commands/EditorCommand.h \ common/commands/MoveCmd.h \ + common/commands/NewChainedLineCmd.h \ common/commands/NewDocumentCmd.h \ common/commands/NewSimpleLineCmd.h \ *************** *** 80,83 **** --- 81,85 ---- common/editors/Viewer.h \ common/manipulators/AbstractViewManipulator.h \ + common/manipulators/ChainedLineViewResizer.h \ common/manipulators/LineViewResizer.h \ common/manipulators/RectangleViewResizer.h \ *************** *** 98,103 **** --- 100,107 ---- common/views/AbstractView.h \ common/views/ArrowDecoration.h \ + common/views/ChainedLineView.h \ common/views/CircleView.h \ common/views/Clonable.h \ + common/views/CompositeView.h \ common/views/DefaultViewLayouter.h \ common/views/Layoutable.h \ *************** *** 115,118 **** --- 119,123 ---- common/views/SelectionHandle.h \ common/views/SimpleLineView.h \ + common/views/TextLineView.h \ common/views/TextView.h \ common/views/View.h \ *************** *** 169,172 **** --- 174,178 ---- common/commands/CutCmd.cpp \ common/commands/MoveCmd.cpp \ + common/commands/NewChainedLineCmd.cpp \ common/commands/NewDocumentCmd.cpp \ common/commands/NewSimpleLineCmd.cpp \ *************** *** 197,200 **** --- 203,207 ---- common/editors/StandardSelectionLayer.cpp \ common/manipulators/AbstractViewManipulator.cpp \ + common/manipulators/ChainedLineViewResizer.cpp \ common/manipulators/LineViewResizer.cpp \ common/manipulators/RectangleViewResizer.cpp \ *************** *** 209,213 **** --- 216,222 ---- common/tools/TextCreationTool.cpp \ common/views/AbstractView.cpp \ + common/views/ChainedLineView.cpp \ common/views/CircleView.cpp \ + common/views/CompositeView.cpp \ common/views/DefaultViewLayouter.cpp \ common/views/LineView.cpp \ *************** *** 218,221 **** --- 227,231 ---- common/views/SelectionHandle.cpp \ common/views/SimpleLineView.cpp \ + common/views/TextLineView.cpp \ common/views/TextView.cpp \ common/views/ViewFactory.cpp \ *************** *** 262,265 **** --- 272,276 ---- common/commands/CutCmd.o \ common/commands/MoveCmd.o \ + common/commands/NewChainedLineCmd.o \ common/commands/NewDocumentCmd.o \ common/commands/NewSimpleLineCmd.o \ *************** *** 290,293 **** --- 301,305 ---- common/editors/StandardSelectionLayer.o \ common/manipulators/AbstractViewManipulator.o \ + common/manipulators/ChainedLineViewResizer.o \ common/manipulators/LineViewResizer.o \ common/manipulators/RectangleViewResizer.o \ *************** *** 302,306 **** --- 314,320 ---- common/tools/TextCreationTool.o \ common/views/AbstractView.o \ + common/views/ChainedLineView.o \ common/views/CircleView.o \ + common/views/CompositeView.o \ common/views/DefaultViewLayouter.o \ common/views/LineView.o \ *************** *** 311,314 **** --- 325,329 ---- common/views/SelectionHandle.o \ common/views/SimpleLineView.o \ + common/views/TextLineView.o \ common/views/TextView.o \ common/views/ViewFactory.o \ *************** *** 452,455 **** --- 467,476 ---- common/commands/AbstractCommand.h + common/commands/NewChainedLineCmd.o: common/commands/NewChainedLineCmd.cpp \ + common/commands/NewChainedLineCmd.h \ + common/commands/NewViewCmd.h \ + common/commands/EditorCommand.h \ + common/commands/AbstractCommand.h + common/commands/NewDocumentCmd.o: common/commands/NewDocumentCmd.cpp \ common/commands/NewDocumentCmd.h \ *************** *** 676,679 **** --- 697,708 ---- common/manipulators/ViewManipulator.h + common/manipulators/ChainedLineViewResizer.o: common/manipulators/ChainedLineViewResizer.cpp \ + common/manipulators/ChainedLineViewResizer.h \ + common/manipulators/LineViewResizer.h \ + common/manipulators/ViewResizer.h \ + common/manipulators/AbstractViewManipulator.h \ + common/manipulators/ViewManipulator.h \ + common/manipulators/ViewSelector.h + common/manipulators/LineViewResizer.o: common/manipulators/LineViewResizer.cpp \ common/manipulators/LineViewResizer.h \ *************** *** 745,751 **** --- 774,795 ---- common/views/View.h + common/views/ChainedLineView.o: common/views/ChainedLineView.cpp \ + common/views/ChainedLineView.h \ + common/views/SimpleLineView.h \ + common/views/LineView.h \ + common/views/SelectableView.h \ + common/views/CompositeView.h \ + common/views/AbstractView.h \ + common/views/Positionable.h \ + common/views/Selectable.h \ + common/views/PaintAttributes.h \ + common/views/View.h \ + common/views/Clonable.h \ + common/views/Line.h + common/views/CircleView.o: common/views/CircleView.cpp \ common/views/CircleView.h \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 755,758 **** --- 799,810 ---- common/views/Clonable.h + common/views/CompositeView.o: common/views/CompositeView.cpp \ + common/views/CompositeView.h \ + common/views/AbstractView.h \ + common/views/Positionable.h \ + common/views/Selectable.h \ + common/views/PaintAttributes.h \ + common/views/View.h + common/views/DefaultViewLayouter.o: common/views/DefaultViewLayouter.cpp \ common/views/DefaultViewLayouter.h \ *************** *** 762,765 **** --- 814,818 ---- common/views/LineView.h \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 776,779 **** --- 829,833 ---- common/views/PolygonView.h \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 786,789 **** --- 840,844 ---- common/views/RectangleView.h \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 796,799 **** --- 851,855 ---- common/views/SelectableView.o: common/views/SelectableView.cpp \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 807,810 **** --- 863,867 ---- common/views/RectangleView.h \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 820,823 **** --- 877,881 ---- common/views/LineView.h \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 828,835 **** --- 886,907 ---- common/views/Line.h + common/views/TextLineView.o: common/views/TextLineView.cpp \ + common/views/TextLineView.h \ + common/views/RectangleView.h \ + common/views/SelectableView.h \ + common/views/CompositeView.h \ + common/views/AbstractView.h \ + common/views/Positionable.h \ + common/views/Selectable.h \ + common/views/PaintAttributes.h \ + common/views/View.h \ + common/views/Clonable.h \ + common/views/Rectangle.h + common/views/TextView.o: common/views/TextView.cpp \ common/views/TextView.h \ common/views/RectangleView.h \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 845,848 **** --- 917,921 ---- common/views/RectangleView.h \ common/views/SelectableView.h \ + common/views/CompositeView.h \ common/views/AbstractView.h \ common/views/Positionable.h \ *************** *** 854,858 **** common/views/SimpleLineView.h \ common/views/LineView.h \ ! common/views/Line.h extensions/net/commands/NewEdgeCmd.o: extensions/net/commands/NewEdgeCmd.cpp \ --- 927,932 ---- common/views/SimpleLineView.h \ common/views/LineView.h \ ! common/views/Line.h \ ! common/views/ChainedLineView.h extensions/net/commands/NewEdgeCmd.o: extensions/net/commands/NewEdgeCmd.cpp \ Index: ige.pro =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/ige.pro,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** ige.pro 2001/07/24 11:34:49 1.5 --- ige.pro 2001/07/25 12:56:08 1.6 *************** *** 16,19 **** --- 16,20 ---- common/commands/EditorCommand.h \ common/commands/MoveCmd.h \ + common/commands/NewChainedLineCmd.h \ common/commands/NewDocumentCmd.h \ common/commands/NewSimpleLineCmd.h \ *************** *** 54,57 **** --- 55,59 ---- common/editors/Viewer.h \ common/manipulators/AbstractViewManipulator.h \ + common/manipulators/ChainedLineViewResizer.h \ common/manipulators/LineViewResizer.h \ common/manipulators/RectangleViewResizer.h \ *************** *** 72,77 **** --- 74,81 ---- common/views/AbstractView.h \ common/views/ArrowDecoration.h \ + common/views/ChainedLineView.h \ common/views/CircleView.h \ common/views/Clonable.h \ + common/views/CompositeView.h \ common/views/DefaultViewLayouter.h \ common/views/Layoutable.h \ *************** *** 89,92 **** --- 93,97 ---- common/views/SelectionHandle.h \ common/views/SimpleLineView.h \ + common/views/TextLineView.h \ common/views/TextView.h \ common/views/View.h \ *************** *** 143,146 **** --- 148,152 ---- common/commands/CutCmd.cpp \ common/commands/MoveCmd.cpp \ + common/commands/NewChainedLineCmd.cpp \ common/commands/NewDocumentCmd.cpp \ common/commands/NewSimpleLineCmd.cpp \ *************** *** 171,174 **** --- 177,181 ---- common/editors/StandardSelectionLayer.cpp \ common/manipulators/AbstractViewManipulator.cpp \ + common/manipulators/ChainedLineViewResizer.cpp \ common/manipulators/LineViewResizer.cpp \ common/manipulators/RectangleViewResizer.cpp \ *************** *** 183,187 **** --- 190,196 ---- common/tools/TextCreationTool.cpp \ common/views/AbstractView.cpp \ + common/views/ChainedLineView.cpp \ common/views/CircleView.cpp \ + common/views/CompositeView.cpp \ common/views/DefaultViewLayouter.cpp \ common/views/LineView.cpp \ *************** *** 192,195 **** --- 201,205 ---- common/views/SelectionHandle.cpp \ common/views/SimpleLineView.cpp \ + common/views/TextLineView.cpp \ common/views/TextView.cpp \ common/views/ViewFactory.cpp \ |
|
From: Darius S. <dst...@us...> - 2001-07-25 12:54:01
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/editorapp/editorapp In directory usw-pr-cvs1:/tmp/cvs-serv2844 Modified Files: editorappview.cpp Log Message: Adding execution of new chained line command Index: editorappview.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/editorapp/editorapp/editorappview.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** editorappview.cpp 2001/07/24 11:40:53 1.3 --- editorappview.cpp 2001/07/25 12:53:58 1.4 *************** *** 20,26 **** --- 20,28 ---- #include "ige/common/commands/NewTextCmd.h" #include "ige/common/commands/NewSimpleLineCmd.h" + #include "ige/common/commands/NewChainedLineCmd.h" #include "ige/common/commands/MoveCmd.h" #include "ige/common/commands/NewStdDocumentCmd.h" #include "ige/common/views/LineView.h" + #include "ige/common/views/ChainedLineView.h" EditorAppView::EditorAppView(QWidget *parent, EditorAppDoc *doc) : DoubleBufferViewer(parent) *************** *** 53,56 **** --- 55,64 ---- ((LineView*)cmd5->getCreated())->setStartPoint(QPoint(500,100)); ((LineView*)cmd5->getCreated())->setEndPoint(QPoint(580,350)); + + NewChainedLineCmd *cmd6 = new NewChainedLineCmd(); + editor->execute(cmd6); + ((ChainedLineView*)cmd6->getCreated())->setSegments(5); + ((ChainedLineView*)cmd6->getCreated())->setStartPoint(QPoint(100,150)); + ((ChainedLineView*)cmd6->getCreated())->setEndPoint(QPoint(480,400)); // editor->undo(); |
|
From: Darius S. <dst...@us...> - 2001-07-25 12:52:10
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views
In directory usw-pr-cvs1:/tmp/cvs-serv2470
Added Files:
TextLineView.h TextLineView.cpp ChainedLineView.h
ChainedLineView.cpp CompositeView.h CompositeView.cpp
Log Message:
Added file
--- NEW FILE ---
/***************************************************************************
TextLineView.h - description
-------------------
begin : Wed Jun 25 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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. *
* *
***************************************************************************/
#ifndef TEXTLINEVIEW_H
#define TEXTLINEVIEW_H
#include "RectangleView.h"
class TextLineView : public RectangleView {
public:
virtual ~TextLineView();
TextLineView(Viewer * viewer = 0, View * parent = 0);
protected:
virtual void paintContents(QPainter * painter);
};
#endif //TEXTLINEVIEW_H
--- NEW FILE ---
/***************************************************************************
TextLineView.cpp - description
-------------------
begin : Wed Jun 25 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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 "TextLineView.h"
#include <qpainter.h>
void TextLineView::paintContents(QPainter * painter) {
painter->drawRect(bounds());
}
TextLineView::~TextLineView(){
}
TextLineView::TextLineView(Viewer * viewer, View * parent) : RectangleView(viewer, parent) {
}
--- NEW FILE ---
/***************************************************************************
ChainedLineView.h - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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. *
* *
***************************************************************************/
#ifndef CHAINEDLINEVIEW_H
#define CHAINEDLINEVIEW_H
#include "LineView.h"
class ViewManipulator;
class ChainedLineView : public LineView {
public:
virtual QPoint& getStartPoint();
virtual void setStartPoint(const QPoint& startPoint);
virtual QPoint& getEndPoint();
virtual void setEndPoint(const QPoint& endPoint);
virtual ViewManipulator* createManipulator();
int getSegments();
void setSegments(int segments);
void addSegment();
void removeSegment(int at);
virtual ~ChainedLineView();
ChainedLineView(Viewer * viewer = 0, View * parent = 0);
private:
int segmentsCount;
};
#endif //CHAINEDLINEVIEW_H
--- NEW FILE ---
/***************************************************************************
ChainedLineView.cpp - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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 "ChainedLineView.h"
#include "SimpleLineView.h"
#include "ige/common/manipulators/ChainedLineViewResizer.h"
void ChainedLineView::removeSegment(int at){}
void ChainedLineView::addSegment(){}
void ChainedLineView::setSegments(int segments){
this->segmentsCount = segments;
}
int ChainedLineView::getSegments(){
return segmentsCount;
}
ViewManipulator* ChainedLineView::createManipulator() {
// qDebug("RectangleView::createManipulator() executed");
manipulator = new ChainedLineViewResizer(this);
return manipulator;
}
void ChainedLineView::setEndPoint(const QPoint& endPoint){
// this->endPoint = endPoint;
}
QPoint& ChainedLineView::getEndPoint(){
// return endPoint;
}
void ChainedLineView::setStartPoint(const QPoint& startPoint){
// this->startPoint = startPoint;
}
QPoint& ChainedLineView::getStartPoint(){
// return startPoint;
}
ChainedLineView::~ChainedLineView(){}
ChainedLineView::ChainedLineView(Viewer * viewer, View * parent) : LineView(viewer, parent) {
SimpleLineView *view = 0;
view = new SimpleLineView(viewer, this);
view->setStartPoint(QPoint(10,10));
view->setEndPoint(QPoint(100,100));
addChild(view);
view = new SimpleLineView(viewer, this);
view->setStartPoint(QPoint(100,100));
view->setEndPoint(QPoint(220,80));
addChild(view);
view = new SimpleLineView(viewer, this);
view->setStartPoint(QPoint(220,80));
view->setEndPoint(QPoint(420,420));
addChild(view);
}
--- NEW FILE ---
/* Generated by Together */
#ifndef COMPOSITEVIEW_H
#define COMPOSITEVIEW_H
#include "AbstractView.h"
#include "View.h"
#include <vector.h>
#include "Layoutable.h"
class ViewLayouter;
class CompositeView : public AbstractView , public Layoutable{
public:
CompositeView(Viewer * viewer = 0, View * parent = 0);
virtual ~CompositeView();
/**
* Returns the bounding rectangle
*/
virtual QRect bounds();
/**
* Returns true if the view collides with the given mouse position
*/
virtual bool intersects(const QPoint &p);
/**
* Remove sub view
*/
virtual void removeChild(int i);
/**
* Add sub view
*/
virtual void addChild(View * g);
/**
* Will be called when the view has been changed and needs to resize and repaint
*/
virtual void changed();
/**
* Moves the object by a delta
*/
virtual void move(const QPoint& delta);
virtual View* getChild(int at);
virtual int getChildCount();
virtual void layout();
virtual ViewLayouter * getLayouter();
virtual void setLayouter(ViewLayouter* l);
protected:
/**
* This operation will be called by paint() after the paint attributes has
* been set. Usually you can implement this operation instead of paint() if
* want to have initialized paint attributes.
*/
virtual void paintContents(QPainter* painter);
public:
private:
/** @link aggregation
* @clientCardinality 1
* @supplierCardinality 0..**/
vector < View * > childs;
};
#endif //COMPOSITEVIEW_H
--- NEW FILE ---
/* Generated by Together */
#include "CompositeView.h"
void CompositeView::setLayouter(ViewLayouter* l){
}
ViewLayouter * CompositeView::getLayouter(){
}
class View;
int CompositeView::getChildCount(){
return childs.size();
}
View* CompositeView::getChild(int at){
if(childs.empty()) {
return 0;
}
// Check for out of range
if(at > childs.size() - 1)
return 0;
return childs[at];
}
void CompositeView::paintContents(QPainter* painter){
if(childs.empty()) {
return;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
(*iter)->paint(painter);
++iter;
}
}
CompositeView::~CompositeView(){
}
CompositeView::CompositeView(Viewer * viewer, View * parent) : AbstractView(viewer, parent) {
}
void CompositeView::move(const QPoint& delta){
if(childs.empty()) {
return;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
(*iter)->move(delta);
++iter;
}
}
void CompositeView::changed(){
if(childs.empty()) {
return;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
(*iter)->changed();
++iter;
}
// DefaultLayouter::getInstance()->layoutSubViews(this);
}
void CompositeView::addChild(View * g){
CHECK_PTR(g);
childs.insert(childs.end(), g);
}
void CompositeView::removeChild(int i){
if(childs.empty()) {
qDebug("CompositeView::removeChild(): no childs to remove");
return;
}
childs.erase(childs.begin() + i);
}
bool CompositeView::intersects(const QPoint &p){
if(childs.empty()) {
return false;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
if( (*iter)->intersects(p) ) {
return true;
}
++iter;
}
return false;
}
QRect CompositeView::bounds(){
QRect boundingArea;
if(childs.empty()) {
return boundingArea;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
boundingArea = boundingArea.unite((*iter)->bounds());
++iter;
}
return boundingArea;
}
|
|
From: Darius S. <dst...@us...> - 2001-07-25 12:46:43
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators
In directory usw-pr-cvs1:/tmp/cvs-serv1242
Added Files:
ChainedLineViewResizer.h ChainedLineViewResizer.cpp
Log Message:
Added file
--- NEW FILE ---
/***************************************************************************
ChainedLineViewResizer.h - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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. *
* *
***************************************************************************/
#ifndef CHAINEDLINEVIEWRESIZER_H
#define CHAINEDLINEVIEWRESIZER_H
#include "LineViewResizer.h"
#include "ige/common/views/SelectionHandle.h"
class SelectionLayer;
class ChainedLineViewResizer : public LineViewResizer {
public:
virtual void createHandles(SelectionLayer *layer);
virtual void placeHandles();
protected:
virtual void resizeTarget(SelectionHandle *handle, int diffx, int diffy);
public:
virtual ~ChainedLineViewResizer();
ChainedLineViewResizer(View *target);
private:
/** @link aggregation */
vector < SelectionHandle * > handles;
};
#endif //CHAINEDLINEVIEWRESIZER_H
--- NEW FILE ---
/***************************************************************************
ChainedLineViewResizer.h - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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 "ChainedLineViewResizer.h"
#include "ige/common/views/ChainedLineView.h"
#include "ige/common/editors/SelectionLayer.h"
#include "ige/common/editors/Viewer.h"
void ChainedLineViewResizer::resizeTarget(SelectionHandle *handle, int diffx, int diffy) {
QRect damagedArea = getTarget()->bounds();
ChainedLineView *target = (ChainedLineView*)getTarget();
LineView *lineSegment = 0;
LineView *lineSegmentSuccessor = 0;
int id = handle->getId();
// Move start point
if(handle->getId() == 0) {
lineSegment = (ChainedLineView*)target->getChild(0);
if(lineSegment) {
lineSegment->setStartPoint(lineSegment->getStartPoint() + QPoint(diffx, diffy));
}
} else
if(handle->getId() >= 1) {
lineSegment = (ChainedLineView*)target->getChild(handle->getId() - 1);
lineSegmentSuccessor = (ChainedLineView*)target->getChild(handle->getId());
if(lineSegment) {
lineSegment->setEndPoint(lineSegment->getEndPoint() + QPoint(diffx, diffy));
}
if(lineSegmentSuccessor) {
lineSegmentSuccessor->setStartPoint(lineSegmentSuccessor->getStartPoint() + QPoint(diffx, diffy));
}
}
/* if(handle->getId() == 1) {
lineSegment = (ChainedLineView*)target->getChild(0);
lineSegment->setEndPoint(lineSegment->getEndPoint() + QPoint(diffx, diffy));
}
if(handle->getId() >= 2) {
lineSegment = (ChainedLineView*)target->getChild(handle->getId() - 1);
lineSegment->setEndPoint(lineSegment->getEndPoint() + QPoint(diffx, diffy));
} */
damagedArea = damagedArea.unite(target->bounds());
damagedArea = damagedArea.unite(this->bounds());
placeHandles();
target->getViewer()->refresh(damagedArea);
}
void ChainedLineViewResizer::placeHandles() {
ChainedLineView *v = (ChainedLineView*)getTarget();
CHECK_PTR(v);
// Place first handle at the start of the line
HandleVectorIter iter = getHandleIterator();
SelectionHandle *handle = *iter;
handle->setCenter(((LineView*)v->getChild(0))->getStartPoint());
// Place second handle at the end of the line
++iter;
handle = *iter;
handle->setCenter(((LineView*)v->getChild(0))->getEndPoint());
for(int i = 1; i < v->getChildCount(); i++) {
++iter;
handle = *iter;
handle->setCenter(((LineView*)v->getChild(i))->getEndPoint());
}
}
void ChainedLineViewResizer::createHandles(SelectionLayer *layer) {
SelectionHandle *handle = 0;
selectionLayer = layer;
ChainedLineView *view = (ChainedLineView*)getTarget();
for(int id = 0; id < view->getChildCount() + 1; id++) {
handle = new SelectionHandle(this, id);
addHandle(handle);
layer->addHandle(handle);
}
placeHandles();
}
ChainedLineViewResizer::~ChainedLineViewResizer(){}
ChainedLineViewResizer::ChainedLineViewResizer(View *target) : LineViewResizer(target) {
}
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:54:14
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/net/views
In directory usw-pr-cvs1:/tmp/cvs-serv20271
Added Files:
RectVertexView.cpp LineEdgeView.cpp
Log Message:
Added implementation file
--- NEW FILE ---
/* Generated by Together */
#include "RectVertexView.h"
RectVertexView::~RectVertexView(){
}
RectVertexView::RectVertexView(Viewer * viewer, View * parent) : RectangleView(viewer, parent) {
}
--- NEW FILE ---
/* Generated by Together */
#include "LineEdgeView.h"
LineEdgeView::~LineEdgeView(){
}
LineEdgeView::LineEdgeView(Viewer * viewer, View * parent) : LineView(viewer, parent) {
}
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:49:28
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views
In directory usw-pr-cvs1:/tmp/cvs-serv19107
Added Files:
CircleView.cpp PolygonView.cpp
Log Message:
Added implementation file
--- NEW FILE ---
/***************************************************************************
CircleView.cpp - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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 "CircleView.h"
CircleView::~CircleView(){}
CircleView::CircleView(Viewer * viewer, View * parent): SelectableView(viewer, parent){
}
--- NEW FILE ---
/***************************************************************************
PolygonView.cpp - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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 "PolygonView.h"
PolygonView::~PolygonView(){
}
PolygonView::PolygonView(Viewer * viewer, View * parent): SelectableView(viewer, parent) {
}
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:40:56
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/editorapp/editorapp In directory usw-pr-cvs1:/tmp/cvs-serv17133 Modified Files: editorappview.cpp Log Message: Added a simple line Index: editorappview.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/editorapp/editorapp/editorappview.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** editorappview.cpp 2001/07/22 23:15:55 1.2 --- editorappview.cpp 2001/07/24 11:40:53 1.3 *************** *** 19,24 **** --- 19,26 ---- #include "editorappview.h" #include "ige/common/commands/NewTextCmd.h" + #include "ige/common/commands/NewSimpleLineCmd.h" #include "ige/common/commands/MoveCmd.h" #include "ige/common/commands/NewStdDocumentCmd.h" + #include "ige/common/views/LineView.h" EditorAppView::EditorAppView(QWidget *parent, EditorAppDoc *doc) : DoubleBufferViewer(parent) *************** *** 46,49 **** --- 48,56 ---- editor->execute(cmd4); editor->execute(new MoveCmd(cmd4->getCreated(), 160,200)); + + NewSimpleLineCmd *cmd5 = new NewSimpleLineCmd(); + editor->execute(cmd5); + ((LineView*)cmd5->getCreated())->setStartPoint(QPoint(500,100)); + ((LineView*)cmd5->getCreated())->setEndPoint(QPoint(580,350)); // editor->undo(); |
|
From: Darius S. <dst...@us...> - 2001-07-24 11:38:44
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands
In directory usw-pr-cvs1:/tmp/cvs-serv16610
Added Files:
NewSimpleLineCmd.h NewSimpleLineCmd.cpp
Log Message:
Added file
--- NEW FILE ---
/***************************************************************************
NewSimpleLineCmd.cpp - description
-------------------
begin : Mon July 23 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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. *
* *
***************************************************************************/
#ifndef NEWSIMPLELINECMD_H
#define NEWSIMPLELINECMD_H
#include "NewViewCmd.h"
class Document;
class View;
class Editor;
class NewSimpleLineCmd : public NewViewCmd {
public:
virtual void undo();
virtual string getDescription() {
return "New Simple Line";
}
protected:
virtual View * createView(Document *doc);
public:
virtual ~NewSimpleLineCmd();
NewSimpleLineCmd();
};
#endif //NEWSIMPLELINECMD_H
--- NEW FILE ---
/***************************************************************************
NewSimpleLineCmd.h - description
-------------------
begin : Mon July 23 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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 "NewSimpleLineCmd.h"
#include "ige/common/views/ViewFactory.h"
#include "ige/common/views/View.h"
View * NewSimpleLineCmd::createView(Document *doc){
ViewFactory factory(doc);
SimpleLineView *slv = factory.createSimpleLine();
// View *v = ViewFactory::getInstance()->createSimpleLine();
// v->setViewer(doc->getViewer());
return (View*)slv;
}
void NewSimpleLineCmd::undo(){
qDebug("NewSimpleLineCmd->Undo called (Not yet implemented!)");
}
NewSimpleLineCmd::~NewSimpleLineCmd(){
}
NewSimpleLineCmd::NewSimpleLineCmd(){
}
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:53
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views
In directory usw-pr-cvs1:/tmp/cvs-serv15670/common/views
Modified Files:
AbstractView.cpp AbstractView.h CircleView.h Line.h
LineView.cpp LineView.h PolygonView.h RectangleView.cpp
RectangleView.h Selectable.h SelectableView.cpp
SelectableView.h SelectionHandle.cpp View.h ViewFactory.cpp
ViewFactory.h
Log Message:
Added more core implementation. Editor now supports simple line
Index: AbstractView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/AbstractView.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** AbstractView.cpp 2001/07/22 23:21:38 1.2
--- AbstractView.cpp 2001/07/24 11:34:49 1.3
***************
*** 13,16 ****
--- 13,18 ----
#include <qevent.h>
+ void AbstractView::move(const QPoint& delta){
+ }
void AbstractView::mouseRMBPress(QMouseEvent * e){
}
***************
*** 50,53 ****
--- 52,57 ----
AbstractView::AbstractView(Viewer* viewer, View * parent){
this->parent = parent;
+ this->viewer = viewer;
+ lnkLayouter = 0;
}
void AbstractView::setCenter(const QPoint& p){
***************
*** 70,74 ****
bool AbstractView::intersects(const QPoint &p){
}
! QRect & AbstractView::bounds() {
return boundingRect;
}
--- 74,78 ----
bool AbstractView::intersects(const QPoint &p){
}
! QRect AbstractView::bounds() {
return boundingRect;
}
Index: AbstractView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/AbstractView.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** AbstractView.h 2001/07/22 23:21:38 1.2
--- AbstractView.h 2001/07/24 11:34:49 1.3
***************
*** 40,44 ****
virtual ~AbstractView();
! virtual QRect & bounds();
virtual bool intersects(const QPoint & p);
--- 40,44 ----
virtual ~AbstractView();
! virtual QRect bounds();
virtual bool intersects(const QPoint & p);
***************
*** 119,122 ****
--- 119,123 ----
virtual void mousePress(QMouseEvent * e);
+ virtual void move(const QPoint& delta);
};
#endif //ABSTRACTVIEW_H
Index: CircleView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/CircleView.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** CircleView.h 2001/07/22 23:21:38 1.2
--- CircleView.h 2001/07/24 11:34:49 1.3
***************
*** 26,30 ****
virtual ~CircleView();
! CircleView(Viewer * viewer = 0, View * parent = 0): SelectableView(viewer, parent) {}
};
#endif //CIRCLEVIEW_H
--- 26,30 ----
virtual ~CircleView();
! CircleView(Viewer * viewer = 0, View * parent = 0);
};
#endif //CIRCLEVIEW_H
Index: Line.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Line.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Line.h 2001/06/20 19:21:29 1.1.1.1
--- Line.h 2001/07/24 11:34:49 1.2
***************
*** 20,31 ****
#define LINE_H
/** @interface */
class Line {
public:
! virtual void setStartPoint(QPoint& p) = 0;
virtual QPoint& getStartPoint() = 0;
! virtual void setEndPoint(QPoint& p) = 0;
virtual QPoint& getEndPoint() = 0;
};
--- 20,33 ----
#define LINE_H
+ class QPoint;
+
/** @interface */
class Line {
public:
! virtual void setStartPoint(const QPoint& p) = 0;
virtual QPoint& getStartPoint() = 0;
! virtual void setEndPoint(const QPoint& p) = 0;
virtual QPoint& getEndPoint() = 0;
};
Index: LineView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/LineView.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** LineView.cpp 2001/07/22 23:21:38 1.2
--- LineView.cpp 2001/07/24 11:34:49 1.3
***************
*** 22,23 ****
--- 22,24 ----
LineView::LineView(Viewer * viewer, View * parent) : SelectableView(viewer, parent) {
}
+
Index: LineView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/LineView.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** LineView.h 2001/07/22 23:21:38 1.2
--- LineView.h 2001/07/24 11:34:49 1.3
***************
*** 23,38 ****
#include "Line.h"
class LineView : public SelectableView , public Line{
public:
! LineView(Viewer * viewer = 0, View * parent = 0);
virtual ~LineView();
virtual QPoint& getStartPoint() {}
! virtual void setStartPoint(QPoint& p) {}
virtual QPoint& getEndPoint() {}
! virtual void setEndPoint(QPoint& p) {}
};
#endif //LINEVIEW_H
--- 23,40 ----
#include "Line.h"
+ class ViewManipulator;
+
class LineView : public SelectableView , public Line{
public:
! LineView(Viewer * viewer, View * parent = 0);
virtual ~LineView();
virtual QPoint& getStartPoint() {}
! virtual void setStartPoint(const QPoint& p) {}
virtual QPoint& getEndPoint() {}
! virtual void setEndPoint(const QPoint& p) {}
};
#endif //LINEVIEW_H
Index: PolygonView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/PolygonView.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** PolygonView.h 2001/07/22 23:21:38 1.2
--- PolygonView.h 2001/07/24 11:34:49 1.3
***************
*** 26,30 ****
virtual ~PolygonView();
! PolygonView(Viewer * viewer = 0, View * parent = 0): SelectableView(viewer, parent) {}
};
#endif //POLYGONVIEW_H
--- 26,30 ----
virtual ~PolygonView();
! PolygonView(Viewer * viewer = 0, View * parent = 0);
};
#endif //POLYGONVIEW_H
Index: RectangleView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/RectangleView.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** RectangleView.cpp 2001/07/22 23:21:38 1.2
--- RectangleView.cpp 2001/07/24 11:34:49 1.3
***************
*** 14,17 ****
--- 14,20 ----
#include <qpainter.h>
+ void RectangleView::move(const QPoint& delta){
+ rectangle.moveCenter(rectangle.center() + delta);
+ }
QPoint RectangleView::getCenter(){
return rectangle.center();
***************
*** 22,26 ****
ViewManipulator* RectangleView::createManipulator() {
// qDebug("RectangleView::createManipulator() executed");
! RectangleViewResizer *manipulator = new RectangleViewResizer(this);
return manipulator;
}
--- 25,29 ----
ViewManipulator* RectangleView::createManipulator() {
// qDebug("RectangleView::createManipulator() executed");
! manipulator = new RectangleViewResizer(this);
return manipulator;
}
***************
*** 36,40 ****
paintAttributes.setBackgroundColor(Qt::green);
}
! QRect& RectangleView::bounds() {
return getRectangle();
}
--- 39,43 ----
paintAttributes.setBackgroundColor(Qt::green);
}
! QRect RectangleView::bounds() {
return getRectangle();
}
Index: RectangleView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/RectangleView.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** RectangleView.h 2001/07/22 23:21:38 1.2
--- RectangleView.h 2001/07/24 11:34:49 1.3
***************
*** 25,29 ****
public:
! RectangleView(Viewer * viewer = 0, View * parent = 0);
virtual ~RectangleView();
--- 25,29 ----
public:
! RectangleView(Viewer * viewer, View * parent);
virtual ~RectangleView();
***************
*** 42,46 ****
virtual void setRectangle(const QRect& rectangle);
! virtual QRect& bounds();
/**
--- 42,46 ----
virtual void setRectangle(const QRect& rectangle);
! virtual QRect bounds();
/**
***************
*** 60,63 ****
--- 60,65 ----
virtual QPoint getCenter();
+
+ virtual void move(const QPoint& delta);
protected:
Index: Selectable.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Selectable.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Selectable.h 2001/07/22 23:21:38 1.2
--- Selectable.h 2001/07/24 11:34:49 1.3
***************
*** 35,41 ****
virtual bool isSelected() = 0;
! virtual void select() = 0;
! virtual void unselect() = 0;
};
#endif //SELECTABLE_H
--- 35,41 ----
virtual bool isSelected() = 0;
! virtual void select(bool repaint ) = 0;
! virtual void unselect(bool repaint ) = 0;
};
#endif //SELECTABLE_H
Index: SelectableView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectableView.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SelectableView.cpp 2001/07/22 23:21:38 1.2
--- SelectableView.cpp 2001/07/24 11:34:49 1.3
***************
*** 20,27 ****
if(isSelected() == false) {
select();
! Viewer *v = getViewer();
Editor *ed = v->getEditor();
! selector = (ViewSelector*) ed->addManipulator(this);
}
--- 20,27 ----
if(isSelected() == false) {
select();
! /* Viewer *v = getViewer();
Editor *ed = v->getEditor();
! selector = (ViewSelector*) ed->addManipulator(this);*/
}
***************
*** 39,46 ****
if(isSelected() == false) {
select();
! Viewer *v = getViewer();
Editor *ed = v->getEditor();
selector = (ViewSelector*) ed->addManipulator(this);
}
--- 39,47 ----
if(isSelected() == false) {
select();
! /* Viewer *v = getViewer();
Editor *ed = v->getEditor();
selector = (ViewSelector*) ed->addManipulator(this);
+ */
}
***************
*** 63,81 ****
return menu;
}
! void SelectableView::select(){
if(selected == false) {
selected = true;
}
}
! void SelectableView::unselect(){
if(selected == true) {
selected = false;
! if(selector)
! delete selector;
}
}
SelectableView::~SelectableView(){}
SelectableView::SelectableView(Viewer* viewer, View * parent) : AbstractView(viewer, parent) {
! selector = 0;
selected = false;
}
--- 64,113 ----
return menu;
}
! void SelectableView::select(bool repaint){
if(selected == false) {
selected = true;
+ Viewer *v = getViewer();
+ Editor *ed = v->getEditor();
+
+ manipulator = (ViewSelector*) ed->addManipulator(this);
+
+ if(repaint) {
+ QRect damagedArea = bounds();
+ if(manipulator)
+ damagedArea = damagedArea.unite(manipulator->bounds());
+
+ v->refresh(damagedArea);
+ }
}
}
! void SelectableView::unselect(bool repaint){
if(selected == true) {
selected = false;
! Viewer *v = getViewer();
! Editor *ed = v->getEditor();
!
! ViewSelector *m = (ViewSelector*)getManipulator();
! QRect damagedArea = bounds();
!
! if(repaint) {
! if(m)
! damagedArea = damagedArea.unite(m->bounds());
! }
!
! // Remove manipulator from editor's manipulation layer
! ed->removeManipulator(m);
!
! // BUG: Manipulator's destructor won't be called
! if(m)
! delete m;
!
! if(repaint)
! v->refresh(damagedArea);
!
}
}
SelectableView::~SelectableView(){}
SelectableView::SelectableView(Viewer* viewer, View * parent) : AbstractView(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.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SelectableView.h 2001/07/22 23:21:38 1.2
--- SelectableView.h 2001/07/24 11:34:49 1.3
***************
*** 53,61 ****
/** Factory method. Implement this your subclasses to create the desired object.
*/
virtual ViewManipulator* createManipulator() {
! qDebug("SelectableView::createManipulator() executed");
! return 0;
}
virtual bool isSelected() {
--- 53,70 ----
/** Factory method. Implement this your subclasses to create the desired object.
+ * You need to set the object's manipulator instance variable to the created manipulator object !
*/
virtual ViewManipulator* createManipulator() {
! manipulator = 0;
! return (ViewManipulator*)manipulator;
}
+
+ ViewManipulator *getManipulator() {
+ return (ViewManipulator*)manipulator;
+ }
+
+ void setManipulator(ViewManipulator *m) {
+ manipulator = (ViewSelector*)m;
+ }
virtual bool isSelected() {
***************
*** 67,73 ****
}
! virtual void unselect();
! virtual void select();
virtual QPopupMenu* createPopupMenu();
--- 76,82 ----
}
! virtual void unselect(bool repaint = true);
! virtual void select(bool repaint = true);
virtual QPopupMenu* createPopupMenu();
***************
*** 77,83 ****
virtual void mouseRMBPress(QMouseEvent * e);
private:
bool selected;
- ViewSelector *selector;
};
#endif //SELECTABLEVIEW_H
--- 86,94 ----
virtual void mouseRMBPress(QMouseEvent * e);
+ protected:
+ ViewSelector *manipulator;
+
private:
bool selected;
};
#endif //SELECTABLEVIEW_H
Index: SelectionHandle.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectionHandle.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SelectionHandle.cpp 2001/07/22 23:21:38 1.2
--- SelectionHandle.cpp 2001/07/24 11:34:49 1.3
***************
*** 44,47 ****
--- 44,48 ----
}
void SelectionHandle::mouseLMBPress(QMouseEvent * e) {
+ qDebug("Handle clicked");
getOwner()->handlePressEvent(this,e);
}
Index: View.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/View.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** View.h 2001/07/22 23:21:38 1.2
--- View.h 2001/07/24 11:34:49 1.3
***************
*** 39,43 ****
* Returns the bounding rectangle
*/
! virtual QRect& bounds() = 0;
/**
--- 39,43 ----
* Returns the bounding rectangle
*/
! virtual QRect bounds() = 0;
/**
***************
*** 66,69 ****
--- 66,74 ----
virtual void setViewer(Viewer* v) = 0;
+
+ /**
+ * Moves the object by a delta
+ */
+ virtual void move(const QPoint& delta) = 0;
};
#endif //VIEW_H
Index: ViewFactory.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ViewFactory.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ViewFactory.cpp 2001/07/22 23:21:38 1.2
--- ViewFactory.cpp 2001/07/24 11:34:49 1.3
***************
*** 19,39 ****
#include "ViewFactory.h"
#include "TextView.h"
- class TextView;
TextView* ViewFactory::createText(){
qDebug("ViewFactory::createText() not implemented!");
}
TextView* ViewFactory::create(TextModel * m){
! TextView *view = new TextView();
return view;
}
! ViewFactory * ViewFactory::instance= 0;
! ViewFactory * ViewFactory::getInstance(){
! if (instance == 0) {
! instance = new ViewFactory();
! }
! return instance;
! }
! ViewFactory::ViewFactory(){}
--- 19,47 ----
#include "ViewFactory.h"
#include "TextView.h"
+ #include "SimpleLineView.h"
+ #include "ige/common/documents/Document.h"
+ void ViewFactory::setDocument(Document* document){
+ this->document = document;
+ }
+ Document* ViewFactory::getDocument(){
+ return document;
+ }
+ SimpleLineView* ViewFactory::createSimpleLine(){
+ SimpleLineView *v = new SimpleLineView(getDocument()->getViewer());
+ getDocument()->addView(v);
+ return v;
+ }
TextView* ViewFactory::createText(){
qDebug("ViewFactory::createText() not implemented!");
}
TextView* ViewFactory::create(TextModel * m){
! TextView *view = new TextView(getDocument()->getViewer());
! getDocument()->addView(view);
return view;
}
! ViewFactory::ViewFactory(Document* doc){
! document = doc;
! }
Index: ViewFactory.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ViewFactory.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ViewFactory.h 2001/06/20 19:21:28 1.1.1.1
--- ViewFactory.h 2001/07/24 11:34:49 1.2
***************
*** 19,22 ****
--- 19,24 ----
#ifndef VIEWFACTORY_H
#define VIEWFACTORY_H
+ class Document;
+ class SimpleLineView;
class TextModel;
class TextView;
***************
*** 25,33 ****
- protected:
- ViewFactory();
public:
/**
--- 27,34 ----
public:
+ ViewFactory(Document* doc);
/**
***************
*** 36,53 ****
TextView* create(TextModel * m);
- static ViewFactory * getInstance();
-
TextView* createText();
! private:
! /**
! * @link
! * @shapeType PatternLink
! * @pattern Singleton
! * @supplierRole Singleton factory
! */
! /*# ViewFactory _viewFactory; */
! static ViewFactory * instance;
};
--- 37,50 ----
TextView* create(TextModel * m);
TextView* createText();
! SimpleLineView* createSimpleLine();
! Document* getDocument();
!
! void setDocument(Document* document);
!
! private:
! Document* document;
};
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:53
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core
In directory usw-pr-cvs1:/tmp/cvs-serv15670/extensions/uml/views/Foundation/Core
Modified Files:
AssociationView.cpp AssociationView.h AttributeView.cpp
AttributeView.h ClassView.cpp ClassView.h
GeneralizationView.cpp GeneralizationView.h OperationView.cpp
OperationView.h
Log Message:
Added more core implementation. Editor now supports simple line
Index: AssociationView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/AssociationView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AssociationView.cpp 2001/06/20 19:21:13 1.1.1.1
--- AssociationView.cpp 2001/07/24 11:34:49 1.2
***************
*** 19,22 ****
#include "AssociationView.h"
! AssociationView::~AssociationView(){}
! AssociationView::AssociationView(){}
--- 19,25 ----
#include "AssociationView.h"
! AssociationView::~AssociationView(){
! }
! AssociationView::AssociationView(Viewer * viewer, View * parent)
! : LineEdgeView(viewer, parent) {
! }
Index: AssociationView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/AssociationView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AssociationView.h 2001/06/20 19:21:12 1.1.1.1
--- AssociationView.h 2001/07/24 11:34:49 1.2
***************
*** 26,30 ****
virtual ~AssociationView();
! AssociationView();
private:
--- 26,30 ----
virtual ~AssociationView();
! AssociationView(Viewer * viewer, View * parent);
private:
Index: AttributeView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/AttributeView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AttributeView.cpp 2001/06/20 19:21:13 1.1.1.1
--- AttributeView.cpp 2001/07/24 11:34:49 1.2
***************
*** 19,22 ****
#include "AttributeView.h"
! AttributeView::~AttributeView(){}
! AttributeView::AttributeView(){}
--- 19,25 ----
#include "AttributeView.h"
! AttributeView::~AttributeView(){
! }
! AttributeView::AttributeView(Viewer * viewer, View * parent)
! : RectangleView(viewer, parent) {
! }
Index: AttributeView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/AttributeView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AttributeView.h 2001/06/20 19:21:12 1.1.1.1
--- AttributeView.h 2001/07/24 11:34:49 1.2
***************
*** 26,30 ****
virtual ~AttributeView();
! AttributeView();
};
--- 26,30 ----
virtual ~AttributeView();
! AttributeView(Viewer * viewer, View * parent);
};
Index: ClassView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/ClassView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ClassView.cpp 2001/06/20 19:21:13 1.1.1.1
--- ClassView.cpp 2001/07/24 11:34:49 1.2
***************
*** 19,22 ****
#include "ClassView.h"
! ClassView::~ClassView(){}
! ClassView::ClassView(){}
--- 19,25 ----
#include "ClassView.h"
! ClassView::~ClassView(){
! }
! ClassView::ClassView(Viewer * viewer, View * parent)
! : RectVertexView(viewer, parent) {
! }
Index: ClassView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/ClassView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ClassView.h 2001/06/20 19:21:12 1.1.1.1
--- ClassView.h 2001/07/24 11:34:49 1.2
***************
*** 30,34 ****
public:
! ClassView();
virtual ~ClassView();
--- 30,34 ----
public:
! ClassView(Viewer * viewer, View * parent);
virtual ~ClassView();
Index: GeneralizationView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/GeneralizationView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** GeneralizationView.cpp 2001/06/20 19:21:13 1.1.1.1
--- GeneralizationView.cpp 2001/07/24 11:34:49 1.2
***************
*** 19,22 ****
#include "GeneralizationView.h"
! GeneralizationView::~GeneralizationView(){}
! GeneralizationView::GeneralizationView(){}
--- 19,25 ----
#include "GeneralizationView.h"
! GeneralizationView::~GeneralizationView(){
! }
! GeneralizationView::GeneralizationView(Viewer * viewer, View * parent)
! : LineEdgeView(viewer, parent) {
! }
Index: GeneralizationView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/GeneralizationView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** GeneralizationView.h 2001/06/20 19:21:12 1.1.1.1
--- GeneralizationView.h 2001/07/24 11:34:49 1.2
***************
*** 26,30 ****
public:
! GeneralizationView();
virtual ~GeneralizationView();
--- 26,30 ----
public:
! GeneralizationView(Viewer * viewer, View * parent);
virtual ~GeneralizationView();
Index: OperationView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/OperationView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** OperationView.cpp 2001/06/20 19:21:13 1.1.1.1
--- OperationView.cpp 2001/07/24 11:34:49 1.2
***************
*** 19,22 ****
#include "OperationView.h"
! OperationView::~OperationView(){}
! OperationView::OperationView(){}
--- 19,25 ----
#include "OperationView.h"
! OperationView::~OperationView(){
! }
! OperationView::OperationView(Viewer * viewer, View * parent)
! : RectangleView(viewer, parent) {
! }
Index: OperationView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/uml/views/Foundation/Core/OperationView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** OperationView.h 2001/06/20 19:21:13 1.1.1.1
--- OperationView.h 2001/07/24 11:34:49 1.2
***************
*** 26,30 ****
virtual ~OperationView();
! OperationView();
};
--- 26,30 ----
virtual ~OperationView();
! OperationView(Viewer * viewer, View * parent);
};
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:53
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/net/views
In directory usw-pr-cvs1:/tmp/cvs-serv15670/extensions/net/views
Modified Files:
LineEdgeView.h RectVertexView.h
Log Message:
Added more core implementation. Editor now supports simple line
Index: LineEdgeView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/net/views/LineEdgeView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** LineEdgeView.h 2001/06/20 19:21:16 1.1.1.1
--- LineEdgeView.h 2001/07/24 11:34:49 1.2
***************
*** 23,26 ****
--- 23,31 ----
class LineEdgeView : public LineView, public Edge {
+ public:
+
+ virtual ~LineEdgeView();
+
+ LineEdgeView(Viewer * viewer, View * parent);
};
#endif //LINEEDGEVIEW_H
Index: RectVertexView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/net/views/RectVertexView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** RectVertexView.h 2001/06/20 19:21:15 1.1.1.1
--- RectVertexView.h 2001/07/24 11:34:49 1.2
***************
*** 23,26 ****
--- 23,31 ----
class RectVertexView : public RectangleView, public Vertex {
+ public:
+
+ virtual ~RectVertexView();
+
+ RectVertexView(Viewer * viewer, View * parent);
};
#endif //RECTVERTEXVIEW_H
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:53
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators
In directory usw-pr-cvs1:/tmp/cvs-serv15670/common/manipulators
Modified Files:
AbstractViewManipulator.cpp AbstractViewManipulator.h
RectangleViewResizer.cpp RectangleViewResizer.h
ViewResizer.cpp ViewResizer.h ViewSelector.cpp ViewSelector.h
Log Message:
Added more core implementation. Editor now supports simple line
Index: AbstractViewManipulator.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/AbstractViewManipulator.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** AbstractViewManipulator.cpp 2001/07/22 23:21:38 1.2
--- AbstractViewManipulator.cpp 2001/07/24 11:34:49 1.3
***************
*** 22,25 ****
--- 22,27 ----
#include "AbstractViewManipulator.h"
+ void AbstractViewManipulator::move(const QPoint& delta){
+ }
View* AbstractViewManipulator::getTarget(){
return target;
***************
*** 40,43 ****
--- 42,46 ----
void AbstractViewManipulator::mouseRMBPress(QMouseEvent * e){
oldMousePos = e->pos();
+ getTarget()->mouseRMBPress(e);
}
void AbstractViewManipulator::mouseLMBPress(QMouseEvent * e){
Index: AbstractViewManipulator.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/AbstractViewManipulator.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** AbstractViewManipulator.h 2001/07/22 23:21:38 1.2
--- AbstractViewManipulator.h 2001/07/24 11:34:49 1.3
***************
*** 52,56 ****
/** Implementation of interface View */
! virtual QRect & bounds() { }
/** Implementation of interface View */
--- 52,56 ----
/** Implementation of interface View */
! virtual QRect bounds() { }
/** Implementation of interface View */
***************
*** 111,114 ****
--- 111,116 ----
virtual View* getTarget();
+
+ virtual void move(const QPoint& delta);
protected:
Index: RectangleViewResizer.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/RectangleViewResizer.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** RectangleViewResizer.cpp 2001/07/22 23:21:38 1.2
--- RectangleViewResizer.cpp 2001/07/24 11:34:49 1.3
***************
*** 25,36 ****
class RectangleView;
- void RectangleViewResizer::handleMoveEvent(SelectionHandle * handle, QMouseEvent * event){
- int dx = event->x() - oldMousePos.x();
- int dy = event->y() - oldMousePos.y();
-
- resizeTarget(handle, dx, dy);
-
- oldMousePos = event->pos();
- }
void RectangleViewResizer::resizeTarget(SelectionHandle *handle, int diffx, int diffy) {
QRect damagedArea = getTarget()->bounds();
--- 25,28 ----
***************
*** 86,99 ****
}
RectangleViewResizer::RectangleViewResizer(RectangleView * target) : ViewResizer((View*)target) {
// this->target = target;
}
RectangleViewResizer::~RectangleViewResizer(){
}
! QRect & RectangleViewResizer::bounds() {
! return getTarget()->bounds();
! }
! bool RectangleViewResizer::intersects(const QPoint & p) {
! return getTarget()->intersects(p);
! }
void RectangleViewResizer::placeHandles() {
View *target = getTarget();
--- 78,88 ----
}
RectangleViewResizer::RectangleViewResizer(RectangleView * target) : ViewResizer((View*)target) {
+ selectionLayer = 0;
// this->target = target;
}
RectangleViewResizer::~RectangleViewResizer(){
+ qDebug("RectangleViewResizer deleted");
}
!
void RectangleViewResizer::placeHandles() {
View *target = getTarget();
***************
*** 151,154 ****
--- 140,145 ----
}
void RectangleViewResizer::createHandles(SelectionLayer *layer) {
+ CHECK_PTR(layer);
+ selectionLayer = layer;
SelectionHandle *handle = 0;
Index: RectangleViewResizer.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/RectangleViewResizer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** RectangleViewResizer.h 2001/07/22 23:21:38 1.2
--- RectangleViewResizer.h 2001/07/24 11:34:49 1.3
***************
*** 33,50 ****
virtual void placeHandles();
- /** Implementation of interface View */
- virtual QRect & bounds();
-
- /** Implementation of interface View */
- virtual bool intersects(const QPoint & p);
-
- /**
- * This method will be called when a handle has been moved
- *
- */
- virtual void handleMoveEvent(SelectionHandle * handle, QMouseEvent * event);
-
protected:
! void resizeTarget(SelectionHandle *handle, int diffx, int diffy);
enum Handles { enumTopLeft = 1,
--- 33,38 ----
virtual void placeHandles();
protected:
! virtual void resizeTarget(SelectionHandle *handle, int diffx, int diffy);
enum Handles { enumTopLeft = 1,
Index: ViewResizer.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/ViewResizer.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ViewResizer.cpp 2001/07/22 23:10:09 1.1
--- ViewResizer.cpp 2001/07/24 11:34:49 1.2
***************
*** 1,2 ****
--- 1,4 ----
+
+
/***************************************************************************
ViewResizer.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 "ViewResizer.h"
#include "ige/common/editors/Viewer.h"
--- 9,12 ----
***************
*** 23,26 ****
--- 15,33 ----
#include <qevent.h>
+ void ViewResizer::handleMoveEvent(SelectionHandle * handle, QMouseEvent * event){
+ int dx = event->x() - oldMousePos.x();
+ int dy = event->y() - oldMousePos.y();
+
+ resizeTarget(handle, dx, dy);
+
+ oldMousePos = event->pos();
+ }
+ bool ViewResizer::intersects(const QPoint & p) {
+ return getTarget()->intersects(p);
+ }
+ QRect ViewResizer::bounds() {
+ return ViewSelector::bounds();
+ // return getTarget()->bounds();
+ }
ViewResizer::ViewResizer(View * target) : ViewSelector(target) {
}
***************
*** 28,31 ****
--- 35,39 ----
}
void ViewResizer::mouseLMBPress(QMouseEvent * e) {
+ qDebug("Mover clicked");
oldMousePos = e->pos();
}
***************
*** 33,39 ****
QRect damagedArea = getTarget()->bounds();
SelectableView *view = (SelectableView *)getTarget();
! view->setCenter(QPoint(view->getCenter().x() + diffx, view->getCenter().y() + diffy));
placeHandles();
! damagedArea = damagedArea.unite(view->bounds());
view->getViewer()->refresh(damagedArea);
}
--- 41,51 ----
QRect damagedArea = getTarget()->bounds();
SelectableView *view = (SelectableView *)getTarget();
! damagedArea = damagedArea.unite(ViewSelector::bounds());
!
! view->move(QPoint(diffx, diffy));
! // view->setCenter(QPoint(view->getCenter().x() + diffx, view->getCenter().y() + diffy));
placeHandles();
! damagedArea = damagedArea.unite(view->bounds());
! damagedArea = damagedArea.unite(ViewSelector::bounds());
view->getViewer()->refresh(damagedArea);
}
Index: ViewResizer.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/ViewResizer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ViewResizer.h 2001/07/22 23:21:38 1.2
--- ViewResizer.h 2001/07/24 11:34:49 1.3
***************
*** 21,24 ****
--- 21,25 ----
#include "AbstractViewManipulator.h"
#include "ViewSelector.h"
+ class SelectionHandle;
class ViewResizer : public ViewSelector {
***************
*** 32,39 ****
/** Implementation of interface EventHandler */
! virtual void mouseMove(QMouseEvent* e);
protected:
void moveTarget(int diffx, int diffy);
};
#endif //VIEWRESIZER_H
--- 33,54 ----
/** Implementation of interface EventHandler */
! virtual void mouseMove(QMouseEvent* e);
+ /** Implementation of interface View */
+ virtual QRect bounds();
+
+ /** Implementation of interface View */
+ virtual bool intersects(const QPoint & p);
+
+ /**
+ * This method will be called when a handle has been moved
+ *
+ */
+ virtual void handleMoveEvent(SelectionHandle * handle, QMouseEvent * event);
+
protected:
void moveTarget(int diffx, int diffy);
+
+ virtual void resizeTarget(SelectionHandle *handle, int diffx, int diffy) =0;
};
#endif //VIEWRESIZER_H
Index: ViewSelector.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/ViewSelector.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ViewSelector.cpp 2001/07/23 12:50:54 1.1
--- ViewSelector.cpp 2001/07/24 11:34:49 1.2
***************
*** 2,23 ****
#include "ViewSelector.h"
#include <qevent.h>
void ViewSelector::mouseLMBPress(QMouseEvent * e) {
getTarget()->mouseLMBPress(e);
-
oldMousePos = e->pos();
}
ViewSelector::ViewSelector(View * target) : AbstractViewManipulator(target) {
}
ViewSelector::~ViewSelector() {
if(handles.empty() == false) {
! removeAllHandles();
}
}
! void ViewSelector::removeAllHandles() {
HandleVectorIter iter = handles.begin();
while ( iter != handles.end()) {
delete *iter;
++iter;
--- 2,26 ----
#include "ViewSelector.h"
+ #include "ige/common/editors/SelectionLayer.h"
#include <qevent.h>
void ViewSelector::mouseLMBPress(QMouseEvent * e) {
getTarget()->mouseLMBPress(e);
oldMousePos = e->pos();
}
ViewSelector::ViewSelector(View * target) : AbstractViewManipulator(target) {
+ selectionLayer = 0;
}
ViewSelector::~ViewSelector() {
if(handles.empty() == false) {
! deleteAllHandles();
}
}
! void ViewSelector::deleteAllHandles() {
HandleVectorIter iter = handles.begin();
+ CHECK_PTR(selectionLayer);
while ( iter != handles.end()) {
+ selectionLayer->removeHandle(*iter);
delete *iter;
++iter;
***************
*** 25,29 ****
--- 28,44 ----
handles.clear();
}
+ QRect ViewSelector::bounds() {
+ QRect boundingRect = getTarget()->bounds();
+
+ vector<SelectionHandle*>::iterator iter = handles.begin();
+
+ while( iter != handles.end()) {
+ boundingRect = boundingRect.unite((*iter)->bounds());
+ ++iter;
+ }
+ return boundingRect;
+ }
void ViewSelector::addHandle(SelectionHandle *handle) {
+ CHECK_PTR(handle);
handles.insert(handles.end(), handle);
}
Index: ViewSelector.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/ViewSelector.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ViewSelector.h 2001/07/22 23:21:38 1.2
--- ViewSelector.h 2001/07/24 11:34:49 1.3
***************
*** 30,36 ****
virtual ~ViewSelector();
! // virtual void createHandles(SelectionLayer *layer) = 0;
virtual void placeHandles() = 0;
HandleVectorIter getHandleIterator() {
return handles.begin();
--- 30,43 ----
virtual ~ViewSelector();
! /** Creates some selection handles to show the object has been selected
! * You need to store the given layer in the selectionLayer member variable !
! * This is needed later to delete the created handles.
! */
! virtual void createHandles(SelectionLayer *layer) = 0;
!
virtual void placeHandles() = 0;
+ virtual void deleteAllHandles();
+
HandleVectorIter getHandleIterator() {
return handles.begin();
***************
*** 41,47 ****
virtual void mouseLMBPress(QMouseEvent * e);
protected:
- void removeAllHandles();
void addHandle(SelectionHandle *handle);
private:
--- 48,63 ----
virtual void mouseLMBPress(QMouseEvent * e);
+ /** Implementation of interface View */
+ virtual QRect bounds();
+
+ SelectionLayer *getSelectionLayer() {
+ return selectionLayer;
+ }
+
protected:
void addHandle(SelectionHandle *handle);
+
+ /** This variable must be set in the createHandles() method */
+ SelectionLayer *selectionLayer;
private:
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:53
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools
In directory usw-pr-cvs1:/tmp/cvs-serv15670/common/tools
Modified Files:
SelectionTool.cpp SelectionTool.h
Log Message:
Added more core implementation. Editor now supports simple line
Index: SelectionTool.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools/SelectionTool.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SelectionTool.cpp 2001/07/22 23:21:38 1.2
--- SelectionTool.cpp 2001/07/24 11:34:49 1.3
***************
*** 25,29 ****
//#include "ige/common/editors/Viewer.h"
! class ViewManipulator;
#include <qcursor.h>
--- 25,29 ----
//#include "ige/common/editors/Viewer.h"
! //class ViewManipulator;
#include <qcursor.h>
***************
*** 35,38 ****
--- 35,46 ----
forwardEvents = 0;
}
+ void SelectionTool::startMultiSelection(const QPoint& mousePos) {
+ // not finished
+ multiSelection = true;
+ }
+ void SelectionTool::endMultiSelection(const QPoint& mousePos) {
+ // not finished
+ multiSelection = false;
+ }
void SelectionTool::mouseLMBPress(QMouseEvent* e, Editor *editor) {
_LMBPressed = true;
***************
*** 40,46 ****
Layer *layer = editor->getViewer()->getLayer();
View *view = 0;
- ViewManipulator *manipulator = 0;
view = layer->pick(e->pos());
forwardEvents = view;
--- 48,54 ----
Layer *layer = editor->getViewer()->getLayer();
View *view = 0;
view = layer->pick(e->pos());
+ // The clicked view (Handle, Manipulator or a graphical object) will grab events now
forwardEvents = view;
***************
*** 50,53 ****
--- 58,63 ----
} else {
editor->unselectAll();
+ editor->getSelectionLayer()->startMultiSelection(e->pos().x(), e->pos().y());
+ multiSelection = true;
}
***************
*** 72,82 ****
}
void SelectionTool::mouseMove(QMouseEvent* e, Editor *editor){
! qDebug("SelectionTool::mouseMoveEvent");
!
if(forwardEvents)
forwardEvents->mouseMove(e);
SelectionLayer *slayer = ((AbstractEditor*)editor)->getSelectionLayer();
! slayer->continueMultiSelection(e->pos().x(), e->pos().y());
}
void SelectionTool::mouseRelease(QMouseEvent* e, Editor *editor){
--- 82,94 ----
}
void SelectionTool::mouseMove(QMouseEvent* e, Editor *editor){
! // An alle selektierte view ein move schicken. Mach ich morgen
if(forwardEvents)
forwardEvents->mouseMove(e);
SelectionLayer *slayer = ((AbstractEditor*)editor)->getSelectionLayer();
!
! if(multiSelection) {
! slayer->continueMultiSelection(e->pos().x(), e->pos().y());
! }
}
void SelectionTool::mouseRelease(QMouseEvent* e, Editor *editor){
***************
*** 86,90 ****
SelectionLayer *slayer = ((AbstractEditor*)editor)->getSelectionLayer();
slayer->endMultiSelection();
! }
void SelectionTool::mouseRMBPress(QMouseEvent* e, Editor *editor) {
_RMBPressed = true;
--- 98,104 ----
SelectionLayer *slayer = ((AbstractEditor*)editor)->getSelectionLayer();
slayer->endMultiSelection();
! // editor->getSelectionLayer()->startMultiSelection(e->pos().x(), e->pos().y());
! multiSelection = false;
! }
void SelectionTool::mouseRMBPress(QMouseEvent* e, Editor *editor) {
_RMBPressed = true;
Index: SelectionTool.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools/SelectionTool.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SelectionTool.h 2001/07/22 23:21:38 1.2
--- SelectionTool.h 2001/07/24 11:34:49 1.3
***************
*** 22,26 ****
#include "AbstractTool.h"
class Editor;
! class ViewManipulator;
/**
* The SelectionTool
--- 22,26 ----
#include "AbstractTool.h"
class Editor;
! //class ViewManipulator;
/**
* The SelectionTool
***************
*** 62,66 ****
--- 62,72 ----
virtual void init();
+ protected:
+ void startMultiSelection(const QPoint& mousePos);
+ void endMultiSelection(const QPoint& mousePos);
+
private:
+ bool multiSelection;
+
static SelectionTool * instance;
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:52
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors
In directory usw-pr-cvs1:/tmp/cvs-serv15670/common/editors
Modified Files:
AbstractEditor.cpp AbstractEditor.h Editor.h
SelectionLayer.cpp SelectionLayer.h
StandardManipulationLayer.cpp StandardManipulationLayer.h
StandardSelectionLayer.cpp
Log Message:
Added more core implementation. Editor now supports simple line
Index: AbstractEditor.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors/AbstractEditor.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** AbstractEditor.cpp 2001/07/22 23:21:38 1.4
--- AbstractEditor.cpp 2001/07/24 11:34:49 1.5
***************
*** 33,50 ****
void AbstractEditor::select(SelectableView *view){
! QRect damagedArea;
if(view->isSelected()) {
view->select();
! damagedArea = damagedArea.unite(view->bounds());
}
! getViewer()->refresh(damagedArea);
}
void AbstractEditor::unselect(SelectableView *view) {
! QRect damagedArea;
if(view->isSelected()) {
view->unselect();
! damagedArea = damagedArea.unite(view->bounds());
}
! getViewer()->refresh(damagedArea);
}
void AbstractEditor::unselectAll() {
--- 33,50 ----
void AbstractEditor::select(SelectableView *view){
! // QRect damagedArea;
if(view->isSelected()) {
view->select();
! // damagedArea = damagedArea.unite(view->bounds());
}
! // getViewer()->refresh(damagedArea);
}
void AbstractEditor::unselect(SelectableView *view) {
! // QRect damagedArea;
if(view->isSelected()) {
view->unselect();
! // damagedArea = damagedArea.unite(view->bounds());
}
! // getViewer()->refresh(damagedArea);
}
void AbstractEditor::unselectAll() {
***************
*** 54,68 ****
QRect damagedArea;
! while ( iter != iterEnd ) {
SelectableView *view =(SelectableView*) *iter;
if(view->isSelected()) {
- view->unselect();
damagedArea = damagedArea.unite(view->bounds());
}
++iter;
}
! getManipulationLayer()->removeAllManipulator();
! getSelectionLayer()->removeAllHandles();
getViewer()->refresh(damagedArea);
--- 54,69 ----
QRect damagedArea;
! while ( iter != iterEnd ) {
SelectableView *view =(SelectableView*) *iter;
if(view->isSelected()) {
damagedArea = damagedArea.unite(view->bounds());
+ damagedArea = damagedArea.unite(view->getManipulator()->bounds());
+ view->unselect(false);
}
++iter;
}
! // getManipulationLayer()->removeAllManipulator();
! // getSelectionLayer()->removeAllHandles();
getViewer()->refresh(damagedArea);
***************
*** 92,99 ****
--- 93,121 ----
}
+ void AbstractEditor::removeManipulator(ViewManipulator *m) {
+ StandardManipulationLayer *ml = (StandardManipulationLayer*)getManipulationLayer();
+ vector<ViewManipulator*>::iterator iter = ml->getManipulatorIterator();
+ SelectableView *manipulatedView = (SelectableView *)m->getTarget();
+
+ while (iter != ml->getManipulatorIteratorEnd()) {
+ if(*iter = m) {
+ ml->removeManipulator(m);
+ manipulatedView->setManipulator(0);
+
+ // The deletion of the handles should be done in the destructor of the selector object
+ // m->deleteAllHandles();
+ return;
+ }
+ ++iter;
+ }
+ }
ViewManipulator* AbstractEditor::addManipulator(SelectableView *view){
SelectionLayer *sl = getSelectionLayer();
ViewManipulator *m = view->createManipulator();
ManipulationLayer *ml = getManipulationLayer();
+
+ // Its valid to not provide a manipulator
+ if(m == 0)
+ return 0;
CHECK_PTR(m);
Index: AbstractEditor.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors/AbstractEditor.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** AbstractEditor.h 2001/07/22 23:21:38 1.2
--- AbstractEditor.h 2001/07/24 11:34:49 1.3
***************
*** 67,70 ****
--- 67,71 ----
virtual ViewManipulator* addManipulator(SelectableView *view);
+ virtual void removeManipulator(ViewManipulator *m);
/**
Index: Editor.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors/Editor.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Editor.h 2001/07/22 23:21:38 1.2
--- Editor.h 2001/07/24 11:34:49 1.3
***************
*** 64,67 ****
--- 64,68 ----
virtual ViewManipulator* addManipulator(SelectableView *view) = 0;
+ virtual void removeManipulator(ViewManipulator *m) = 0;
virtual ManipulationLayer *getManipulationLayer() = 0;
Index: SelectionLayer.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors/SelectionLayer.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** SelectionLayer.cpp 2001/07/20 15:57:29 1.2
--- SelectionLayer.cpp 2001/07/24 11:34:49 1.3
***************
*** 19,22 ****
--- 19,25 ----
#include "SelectionLayer.h"
#include "LayerVisitor.h"
+ #include "ige/common/editors/Viewer.h"
+ #include "ige/common/views/SelectableView.h"
+ #include "ige/common/editors/DataLayer.h"
bool SelectionLayer::isAbove (Layer *other) {
***************
*** 30,33 ****
}
SelectionLayer::SelectionLayer(Viewer* v) : AbstractLayer(v) {
! qDebug("SelectionLayer created");
}
--- 33,49 ----
}
SelectionLayer::SelectionLayer(Viewer* v) : AbstractLayer(v) {
! qDebug("SelectionLayer created");
! }
! void SelectionLayer::selectViewsInsideRect(const QRect& rect) {
! DataLayer *dl = getViewer()->getDataLayer();
! vector<View*>::iterator iter = dl->getDataIterator();
! SelectableView *view = 0;
!
! while (iter != dl->getDataIteratorEnd()) {
! view = (SelectableView*)*iter;
! if(rect.contains(view->bounds())) {
! view->select();
! }
! ++iter;
! }
}
Index: SelectionLayer.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors/SelectionLayer.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** SelectionLayer.h 2001/07/22 23:21:38 1.3
--- SelectionLayer.h 2001/07/24 11:34:49 1.4
***************
*** 47,52 ****
virtual void removeAllHandles() = 0;
! virtual bool isAbove(Layer *other);
};
--- 47,53 ----
virtual void removeAllHandles() = 0;
! virtual void selectViewsInsideRect(const QRect& rect);
+ virtual bool isAbove(Layer *other);
};
Index: StandardManipulationLayer.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors/StandardManipulationLayer.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** StandardManipulationLayer.cpp 2001/07/22 23:21:38 1.3
--- StandardManipulationLayer.cpp 2001/07/24 11:34:49 1.4
***************
*** 27,32 ****
while ( iter != manipulators.end()) {
! if(*iter == m)
manipulators.erase(iter);
++iter;
}
--- 27,34 ----
while ( iter != manipulators.end()) {
! if(*iter == m) {
manipulators.erase(iter);
+ return;
+ }
++iter;
}
***************
*** 63,65 ****
--- 65,70 ----
ManipulatorVectorIter StandardManipulationLayer::getManipulatorIterator() {
return manipulators.begin();
+ }
+ ManipulatorVectorIter StandardManipulationLayer::getManipulatorIteratorEnd() {
+ return manipulators.end();
}
Index: StandardManipulationLayer.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors/StandardManipulationLayer.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** StandardManipulationLayer.h 2001/07/22 23:21:38 1.3
--- StandardManipulationLayer.h 2001/07/24 11:34:49 1.4
***************
*** 31,34 ****
--- 31,35 ----
ManipulatorVectorIter getManipulatorIterator();
+ ManipulatorVectorIter getManipulatorIteratorEnd();
virtual void paintContents(QPainter * p);
Index: StandardSelectionLayer.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/editors/StandardSelectionLayer.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** StandardSelectionLayer.cpp 2001/07/22 23:21:38 1.3
--- StandardSelectionLayer.cpp 2001/07/24 11:34:49 1.4
***************
*** 21,24 ****
--- 21,25 ----
#include "StandardSelectionLayer.h"
#include "ige/common/views/SelectionHandle.h"
+ #include "ige/common/editors/Viewer.h"
void StandardSelectionLayer::addHandle(SelectionHandle *h) {
***************
*** 29,34 ****
while ( iter != handles.end()) {
! if(*iter == h)
handles.erase(iter);
++iter;
}
--- 30,37 ----
while ( iter != handles.end()) {
! if(*iter == h) {
handles.erase(iter);
+ return;
+ }
++iter;
}
***************
*** 59,76 ****
}
}
-
- /* if(multiSelection)
- p->drawRect(startPoint.x(), startPoint.y(), endPoint.x(), endPoint.y());
- else {
- vector<SelectionHandle*>::iterator iter = handles.begin();
! while ( iter != handles.end()) {
! (*iter)->paint(p);
! ++iter;
! }
! }*/
}
void StandardSelectionLayer::endMultiSelection(){
multiSelection = false;
}
bool StandardSelectionLayer::isMultiSelection(){
--- 62,83 ----
}
}
! if(multiSelection) {
! /* QRect rect(startPoint, endPoint);
! rect = rect.normalize();
! p->drawWinFocusRect(rect);*/
! p->drawWinFocusRect(QRect(startPoint, endPoint));
! }
}
void StandardSelectionLayer::endMultiSelection(){
multiSelection = false;
+ QRect damagedArea(startPoint, endPoint);
+ damagedArea = damagedArea.normalize();
+
+ getViewer()->refresh(damagedArea);
+
+ QRect normRect(startPoint, endPoint);
+ normRect = normRect.normalize();
+ selectViewsInsideRect(normRect);
}
bool StandardSelectionLayer::isMultiSelection(){
***************
*** 87,92 ****
--- 94,107 ----
}
void StandardSelectionLayer::continueMultiSelection(int x, int y){
+ QRect damagedArea(startPoint, endPoint);
+ damagedArea = damagedArea.normalize();
+
endPoint.setX(x);
endPoint.setY(y);
+
+ damagedArea = damagedArea.unite(QRect(startPoint, endPoint));
+
+ // getViewer()->refreshAll();
+ getViewer()->refresh(damagedArea);
}
void StandardSelectionLayer::startMultiSelection(int x, int y){
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:52
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands
In directory usw-pr-cvs1:/tmp/cvs-serv15670/common/commands
Modified Files:
NewTextCmd.cpp NewTextCmd.h NewViewCmd.cpp
Log Message:
Added more core implementation. Editor now supports simple line
Index: NewTextCmd.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/NewTextCmd.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** NewTextCmd.cpp 2001/07/22 23:21:38 1.3
--- NewTextCmd.cpp 2001/07/24 11:34:49 1.4
***************
*** 1,2 ****
--- 1,4 ----
+
+
/***************************************************************************
CreateTextCmd.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 "NewTextCmd.h"
#include "ige/common/views/TextView.h"
--- 9,12 ----
***************
*** 25,40 ****
- 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;
}
--- 17,30 ----
void NewTextCmd::undo(){
! qDebug("NewTextCmd->Undo called (Not yet implemented!)");
}
View * NewTextCmd::createView(Document *doc){
TextModel *tm = new TextModel();
! ViewFactory factory(doc);
! TextView *tv = factory.create(tm);
! // TextView *tv = ViewFactory::getInstance()->create(tm);
! // tv->setViewer(doc->getViewer());
return tv;
}
Index: NewTextCmd.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/NewTextCmd.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** NewTextCmd.h 2001/07/22 23:21:38 1.2
--- NewTextCmd.h 2001/07/24 11:34:49 1.3
***************
*** 36,42 ****
}
! virtual void undo();
!
! virtual void execute(Editor* editor);
protected:
--- 36,40 ----
}
! virtual void undo();
protected:
Index: NewViewCmd.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/commands/NewViewCmd.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** NewViewCmd.cpp 2001/07/22 23:21:38 1.2
--- NewViewCmd.cpp 2001/07/24 11:34:49 1.3
***************
*** 24,28 ****
Document *doc = editor->getDocument();
createdView = createView(doc);
- doc->addView(createdView);
}
NewViewCmd::~NewViewCmd(){}
--- 24,27 ----
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:52
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige In directory usw-pr-cvs1:/tmp/cvs-serv15670 Modified Files: Makefile ige.pro Log Message: Added more core implementation. Editor now supports simple line Index: Makefile =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Makefile 2001/07/22 23:21:37 1.4 --- Makefile 2001/07/24 11:34:49 1.5 *************** *** 1,5 **** ############################################################################# # Makefile for building libige.so.1.0.0 ! # Generated by tmake at 23:12, 2001/07/22 # Project: ige # Template: lib --- 1,5 ---- ############################################################################# # Makefile for building libige.so.1.0.0 ! # Generated by tmake at 22:45, 2001/07/23 # Project: ige # Template: lib *************** *** 8,12 **** # Remove this if you use a system which sets this # environment variables correctly ! # QTDIR = /usr/lib/qt2 ####### Compiler, tools and options --- 8,12 ---- # Remove this if you use a system which sets this # environment variables correctly ! #QTDIR = /usr/lib/qt2 ####### Compiler, tools and options *************** *** 32,35 **** --- 32,36 ---- HEADERS = common/EventHandler.h \ common/GuiProvider.h \ + common/MathUtility.h \ common/Observable.h \ common/Observer.h \ *************** *** 42,45 **** --- 43,47 ---- common/commands/MoveCmd.h \ common/commands/NewDocumentCmd.h \ + common/commands/NewSimpleLineCmd.h \ common/commands/NewStdDocumentCmd.h \ common/commands/NewTextCmd.h \ *************** *** 78,81 **** --- 80,84 ---- common/editors/Viewer.h \ common/manipulators/AbstractViewManipulator.h \ + common/manipulators/LineViewResizer.h \ common/manipulators/RectangleViewResizer.h \ common/manipulators/ViewManipulator.h \ *************** *** 111,114 **** --- 114,118 ---- common/views/SelectableView.h \ common/views/SelectionHandle.h \ + common/views/SimpleLineView.h \ common/views/TextView.h \ common/views/View.h \ *************** *** 159,163 **** extensions/uml/views/ModelManagement/PackageView.h \ typedefs.h ! SOURCES = common/commands/AbstractCommand.cpp \ common/commands/CommandHistory.cpp \ common/commands/CopyCmd.cpp \ --- 163,168 ---- extensions/uml/views/ModelManagement/PackageView.h \ typedefs.h ! SOURCES = common/MathUtility.cpp \ ! common/commands/AbstractCommand.cpp \ common/commands/CommandHistory.cpp \ common/commands/CopyCmd.cpp \ *************** *** 165,168 **** --- 170,174 ---- common/commands/MoveCmd.cpp \ common/commands/NewDocumentCmd.cpp \ + common/commands/NewSimpleLineCmd.cpp \ common/commands/NewStdDocumentCmd.cpp \ common/commands/NewTextCmd.cpp \ *************** *** 191,194 **** --- 197,201 ---- common/editors/StandardSelectionLayer.cpp \ common/manipulators/AbstractViewManipulator.cpp \ + common/manipulators/LineViewResizer.cpp \ common/manipulators/RectangleViewResizer.cpp \ common/manipulators/ViewResizer.cpp \ *************** *** 202,211 **** --- 209,221 ---- common/tools/TextCreationTool.cpp \ common/views/AbstractView.cpp \ + common/views/CircleView.cpp \ common/views/DefaultViewLayouter.cpp \ common/views/LineView.cpp \ common/views/PaintAttributes.cpp \ + common/views/PolygonView.cpp \ common/views/RectangleView.cpp \ common/views/SelectableView.cpp \ common/views/SelectionHandle.cpp \ + common/views/SimpleLineView.cpp \ common/views/TextView.cpp \ common/views/ViewFactory.cpp \ *************** *** 217,220 **** --- 227,232 ---- extensions/net/tools/EdgeCreationTool.cpp \ extensions/net/views/GraphElement.cpp \ + extensions/net/views/LineEdgeView.cpp \ + extensions/net/views/RectVertexView.cpp \ extensions/uml/commands/NewAssociationCmd.cpp \ extensions/uml/commands/NewClassCmd.cpp \ *************** *** 244,248 **** extensions/uml/views/Foundation/Core/OperationView.cpp \ extensions/uml/views/ModelManagement/PackageView.cpp ! OBJECTS = common/commands/AbstractCommand.o \ common/commands/CommandHistory.o \ common/commands/CopyCmd.o \ --- 256,261 ---- extensions/uml/views/Foundation/Core/OperationView.cpp \ extensions/uml/views/ModelManagement/PackageView.cpp ! OBJECTS = common/MathUtility.o \ ! common/commands/AbstractCommand.o \ common/commands/CommandHistory.o \ common/commands/CopyCmd.o \ *************** *** 250,253 **** --- 263,267 ---- common/commands/MoveCmd.o \ common/commands/NewDocumentCmd.o \ + common/commands/NewSimpleLineCmd.o \ common/commands/NewStdDocumentCmd.o \ common/commands/NewTextCmd.o \ *************** *** 276,279 **** --- 290,294 ---- common/editors/StandardSelectionLayer.o \ common/manipulators/AbstractViewManipulator.o \ + common/manipulators/LineViewResizer.o \ common/manipulators/RectangleViewResizer.o \ common/manipulators/ViewResizer.o \ *************** *** 287,296 **** --- 302,314 ---- common/tools/TextCreationTool.o \ common/views/AbstractView.o \ + common/views/CircleView.o \ common/views/DefaultViewLayouter.o \ common/views/LineView.o \ common/views/PaintAttributes.o \ + common/views/PolygonView.o \ common/views/RectangleView.o \ common/views/SelectableView.o \ common/views/SelectionHandle.o \ + common/views/SimpleLineView.o \ common/views/TextView.o \ common/views/ViewFactory.o \ *************** *** 302,305 **** --- 320,325 ---- extensions/net/tools/EdgeCreationTool.o \ extensions/net/views/GraphElement.o \ + extensions/net/views/LineEdgeView.o \ + extensions/net/views/RectVertexView.o \ extensions/uml/commands/NewAssociationCmd.o \ extensions/uml/commands/NewClassCmd.o \ *************** *** 406,409 **** --- 426,432 ---- ####### Compile + common/MathUtility.o: common/MathUtility.cpp \ + common/MathUtility.h + common/commands/AbstractCommand.o: common/commands/AbstractCommand.cpp \ common/commands/AbstractCommand.h \ *************** *** 434,437 **** --- 457,466 ---- common/commands/AbstractCommand.h + common/commands/NewSimpleLineCmd.o: common/commands/NewSimpleLineCmd.cpp \ + common/commands/NewSimpleLineCmd.h \ + common/commands/NewViewCmd.h \ + common/commands/EditorCommand.h \ + common/commands/AbstractCommand.h + common/commands/NewStdDocumentCmd.o: common/commands/NewStdDocumentCmd.cpp \ common/commands/NewStdDocumentCmd.h \ *************** *** 647,650 **** --- 676,686 ---- common/manipulators/ViewManipulator.h + common/manipulators/LineViewResizer.o: common/manipulators/LineViewResizer.cpp \ + common/manipulators/LineViewResizer.h \ + common/manipulators/ViewResizer.h \ + common/manipulators/AbstractViewManipulator.h \ + common/manipulators/ViewManipulator.h \ + common/manipulators/ViewSelector.h + common/manipulators/RectangleViewResizer.o: common/manipulators/RectangleViewResizer.cpp \ common/manipulators/RectangleViewResizer.h \ *************** *** 709,712 **** --- 745,758 ---- common/views/View.h + common/views/CircleView.o: common/views/CircleView.cpp \ + common/views/CircleView.h \ + common/views/SelectableView.h \ + common/views/AbstractView.h \ + common/views/Positionable.h \ + common/views/Selectable.h \ + common/views/PaintAttributes.h \ + common/views/View.h \ + common/views/Clonable.h + common/views/DefaultViewLayouter.o: common/views/DefaultViewLayouter.cpp \ common/views/DefaultViewLayouter.h \ *************** *** 727,730 **** --- 773,786 ---- common/views/PaintAttributes.h + common/views/PolygonView.o: common/views/PolygonView.cpp \ + common/views/PolygonView.h \ + common/views/SelectableView.h \ + common/views/AbstractView.h \ + common/views/Positionable.h \ + common/views/Selectable.h \ + common/views/PaintAttributes.h \ + common/views/View.h \ + common/views/Clonable.h + common/views/RectangleView.o: common/views/RectangleView.cpp \ common/views/RectangleView.h \ *************** *** 760,763 **** --- 816,831 ---- common/views/ManipulatorHandle.h + common/views/SimpleLineView.o: common/views/SimpleLineView.cpp \ + common/views/SimpleLineView.h \ + common/views/LineView.h \ + common/views/SelectableView.h \ + common/views/AbstractView.h \ + common/views/Positionable.h \ + common/views/Selectable.h \ + common/views/PaintAttributes.h \ + common/views/View.h \ + common/views/Clonable.h \ + common/views/Line.h + common/views/TextView.o: common/views/TextView.cpp \ common/views/TextView.h \ *************** *** 783,787 **** common/views/View.h \ common/views/Clonable.h \ ! common/views/Rectangle.h extensions/net/commands/NewEdgeCmd.o: extensions/net/commands/NewEdgeCmd.cpp \ --- 851,858 ---- common/views/View.h \ common/views/Clonable.h \ ! common/views/Rectangle.h \ ! common/views/SimpleLineView.h \ ! common/views/LineView.h \ ! common/views/Line.h extensions/net/commands/NewEdgeCmd.o: extensions/net/commands/NewEdgeCmd.cpp \ *************** *** 806,809 **** --- 877,891 ---- extensions/net/views/GraphElement.o: extensions/net/views/GraphElement.cpp \ extensions/net/views/GraphElement.h + + extensions/net/views/LineEdgeView.o: extensions/net/views/LineEdgeView.cpp \ + extensions/net/views/LineEdgeView.h \ + extensions/net/views/Edge.h \ + extensions/net/views/GraphElement.h + + extensions/net/views/RectVertexView.o: extensions/net/views/RectVertexView.cpp \ + extensions/net/views/RectVertexView.h \ + extensions/net/views/Vertex.h \ + extensions/net/views/GraphElement.h \ + extensions/net/views/Connectable.h extensions/uml/commands/NewAssociationCmd.o: extensions/uml/commands/NewAssociationCmd.cpp \ Index: ige.pro =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/ige.pro,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** ige.pro 2001/07/22 23:21:37 1.4 --- ige.pro 2001/07/24 11:34:49 1.5 *************** *** 6,9 **** --- 6,10 ---- HEADERS = common/EventHandler.h \ common/GuiProvider.h \ + common/MathUtility.h \ common/Observable.h \ common/Observer.h \ *************** *** 16,19 **** --- 17,21 ---- common/commands/MoveCmd.h \ common/commands/NewDocumentCmd.h \ + common/commands/NewSimpleLineCmd.h \ common/commands/NewStdDocumentCmd.h \ common/commands/NewTextCmd.h \ *************** *** 52,55 **** --- 54,58 ---- common/editors/Viewer.h \ common/manipulators/AbstractViewManipulator.h \ + common/manipulators/LineViewResizer.h \ common/manipulators/RectangleViewResizer.h \ common/manipulators/ViewManipulator.h \ *************** *** 85,88 **** --- 88,92 ---- common/views/SelectableView.h \ common/views/SelectionHandle.h \ + common/views/SimpleLineView.h \ common/views/TextView.h \ common/views/View.h \ *************** *** 133,137 **** extensions/uml/views/ModelManagement/PackageView.h \ typedefs.h ! SOURCES = common/commands/AbstractCommand.cpp \ common/commands/CommandHistory.cpp \ common/commands/CopyCmd.cpp \ --- 137,142 ---- extensions/uml/views/ModelManagement/PackageView.h \ typedefs.h ! SOURCES = common/MathUtility.cpp \ ! common/commands/AbstractCommand.cpp \ common/commands/CommandHistory.cpp \ common/commands/CopyCmd.cpp \ *************** *** 139,142 **** --- 144,148 ---- common/commands/MoveCmd.cpp \ common/commands/NewDocumentCmd.cpp \ + common/commands/NewSimpleLineCmd.cpp \ common/commands/NewStdDocumentCmd.cpp \ common/commands/NewTextCmd.cpp \ *************** *** 165,168 **** --- 171,175 ---- common/editors/StandardSelectionLayer.cpp \ common/manipulators/AbstractViewManipulator.cpp \ + common/manipulators/LineViewResizer.cpp \ common/manipulators/RectangleViewResizer.cpp \ common/manipulators/ViewResizer.cpp \ *************** *** 176,185 **** --- 183,195 ---- common/tools/TextCreationTool.cpp \ common/views/AbstractView.cpp \ + common/views/CircleView.cpp \ common/views/DefaultViewLayouter.cpp \ common/views/LineView.cpp \ common/views/PaintAttributes.cpp \ + common/views/PolygonView.cpp \ common/views/RectangleView.cpp \ common/views/SelectableView.cpp \ common/views/SelectionHandle.cpp \ + common/views/SimpleLineView.cpp \ common/views/TextView.cpp \ common/views/ViewFactory.cpp \ *************** *** 191,194 **** --- 201,206 ---- extensions/net/tools/EdgeCreationTool.cpp \ extensions/net/views/GraphElement.cpp \ + extensions/net/views/LineEdgeView.cpp \ + extensions/net/views/RectVertexView.cpp \ extensions/uml/commands/NewAssociationCmd.cpp \ extensions/uml/commands/NewClassCmd.cpp \ |
|
From: Darius S. <dst...@us...> - 2001-07-24 11:34:52
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common In directory usw-pr-cvs1:/tmp/cvs-serv15670/common Modified Files: MathUtility.cpp MathUtility.h Log Message: Added more core implementation. Editor now supports simple line Index: MathUtility.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/MathUtility.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** MathUtility.cpp 2001/07/24 11:26:42 1.1 --- MathUtility.cpp 2001/07/24 11:34:49 1.2 *************** *** 1,4 **** ! /* Generated by Together */ #include "MathUtility.h" --- 1,19 ---- ! /*************************************************************************** ! MathUtility.cpp - description ! ------------------- ! begin : Tue July 24 2001 ! copyright : (C) 2001 by the kUML Team ! author : Darius Stachow ! 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 "MathUtility.h" Index: MathUtility.h =================================================================== RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/MathUtility.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** MathUtility.h 2001/07/24 11:26:42 1.1 --- MathUtility.h 2001/07/24 11:34:49 1.2 *************** *** 1,3 **** ! /* Generated by Together */ #ifndef MATHUTILITY_H --- 1,19 ---- ! /*************************************************************************** ! MathUtility.h - description ! ------------------- ! begin : Tue July 24 2001 ! copyright : (C) 2001 by the kUML Team ! author : Darius Stachow ! 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. * ! * * ! ***************************************************************************/ #ifndef MATHUTILITY_H |
|
From: Darius S. <dst...@us...> - 2001-07-24 11:31:12
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators
In directory usw-pr-cvs1:/tmp/cvs-serv14936
Added Files:
LineViewResizer.h LineViewResizer.cpp
Log Message:
Added file
--- NEW FILE ---
/***************************************************************************
LineViewResizer.h - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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. *
* *
***************************************************************************/
#ifndef LINEVIEWRESIZER_H
#define LINEVIEWRESIZER_H
#include "ViewResizer.h"
class SelectionLayer;
class SelectionHandle;
class LineViewResizer : public ViewResizer {
public:
virtual ~LineViewResizer();
LineViewResizer(View * target);
virtual void createHandles(SelectionLayer *layer);
virtual void placeHandles();
protected:
enum Handles { enumStartPoint = 1,
enumEndPoint = 2
};
virtual void resizeTarget(SelectionHandle *handle, int diffx, int diffy);
};
#endif //LINEVIEWRESIZER_H
--- NEW FILE ---
/***************************************************************************
LineViewResizer.cpp - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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 "LineViewResizer.h"
#include "ige/common/editors/SelectionLayer.h"
#include "ige/common/editors/Viewer.h"
#include "ige/common/views/LineView.h"
void LineViewResizer::placeHandles() {
LineView *v = (LineView*)getTarget();
CHECK_PTR(v);
// Place first handle at the start of the line
HandleVectorIter iter = getHandleIterator();
SelectionHandle *handle = *iter;
handle->setCenter(v->getStartPoint());
// Place second handle at the end of the line
++iter;
handle = *iter;
handle->setCenter(v->getEndPoint());
}
void LineViewResizer::createHandles(SelectionLayer *layer) {
SelectionHandle *handle = 0;
selectionLayer = layer;
handle = new SelectionHandle(this, enumStartPoint);
addHandle(handle);
layer->addHandle(handle);
handle = new SelectionHandle(this, enumEndPoint);
addHandle(handle);
layer->addHandle(handle);
placeHandles();
}
void LineViewResizer::resizeTarget(SelectionHandle *handle, int diffx, int diffy) {
QRect damagedArea = getTarget()->bounds();
LineView *view = (LineView*)getTarget();
QPoint newStart = view->getStartPoint();
QPoint newEnd = view->getEndPoint();
switch(handle->getId()) {
case enumStartPoint: newStart = newStart + QPoint(diffx, diffy);
break;
case enumEndPoint: newEnd = newEnd + QPoint(diffx, diffy);
break;
}
view->setStartPoint(newStart);
view->setEndPoint(newEnd);
damagedArea = damagedArea.unite(view->bounds());
damagedArea = damagedArea.unite(this->bounds());
placeHandles();
view->getViewer()->refresh(damagedArea);
}
LineViewResizer::~LineViewResizer(){}
LineViewResizer::LineViewResizer(View * target) : ViewResizer(target) {
}
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:29:10
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views
In directory usw-pr-cvs1:/tmp/cvs-serv14475
Added Files:
SimpleLineView.h SimpleLineView.cpp
Log Message:
Added file
--- NEW FILE ---
/***************************************************************************
SimpleLineView.h - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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. *
* *
***************************************************************************/
#ifndef SIMPLELINEVIEW_H
#define SIMPLELINEVIEW_H
#include "LineView.h"
class SimpleLineView : public LineView {
public:
SimpleLineView(Viewer * viewer, View * parent = 0);
virtual ~SimpleLineView();
virtual QPoint& getStartPoint();
virtual void setStartPoint(const QPoint& startPoint);
virtual QPoint& getEndPoint();
virtual void setEndPoint(const QPoint& endPoint);
virtual QRect bounds();
virtual bool intersects(const QPoint & mousePos);
virtual QPoint getCenter();
virtual void setCenter(const QPoint& p);
virtual void move(const QPoint& delta);
virtual ViewManipulator* createManipulator();
protected:
virtual void paintContents(QPainter * painter);
public:
private:
QPoint startPoint;
QPoint endPoint;
};
#endif //SIMPLELINEVIEW_H
--- NEW FILE ---
/***************************************************************************
SimpleLineView.cpp - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
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 "SimpleLineView.h"
#include "ige/common/MathUtility.h"
#include "ige/common/manipulators/LineViewResizer.h"
#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;
double r_distance, deg;
int x;
int y;
QPoint p1 = getStartPoint();
QPoint p2 = getEndPoint();
MathUtility::convertKartToPolar(p1.x() - p2.x(), p2.y() - p1.y(), r_distance, deg);
double r_touchRect;
double deg_touchRect;
QRect touchRect;
// This is the first touch rectangle in chain of rects
touchRect.setWidth(10);
touchRect.setHeight(10);
touchRect.moveCenter(p1);
// We want to know the distance from left bottom to the center of the touch rect
MathUtility::convertKartToPolar(touchRect.width(), touchRect.height(), r_touchRect, deg_touchRect);
r = r_touchRect;
r_touchRect /= 2;
while(r < r_distance) {
MathUtility::convertPolarToKart(r, deg, x, y);
touchRect.moveCenter(QPoint(p1.x()-x, p1.y()-y));
if(touchRect.contains(QPoint(mousePos.x(), mousePos.y()))) {
return true;
}
r += r_touchRect;
}
return false;
}
QRect SimpleLineView::bounds() {
QRect boundingRect(getStartPoint(), getEndPoint());
boundingRect = boundingRect.normalize();
return boundingRect;
}
void SimpleLineView::paintContents(QPainter * painter) {
painter->drawLine(getStartPoint(), getEndPoint());
}
void SimpleLineView::setEndPoint(const QPoint& endPoint){
this->endPoint = endPoint;
}
QPoint& SimpleLineView::getEndPoint(){
return endPoint;
}
void SimpleLineView::setStartPoint(const QPoint& startPoint){
this->startPoint = startPoint;
}
QPoint& SimpleLineView::getStartPoint(){
return startPoint;
}
SimpleLineView::~SimpleLineView(){
}
SimpleLineView::SimpleLineView(Viewer * viewer, View * parent) : LineView(viewer, parent) {
}
ViewManipulator* SimpleLineView::createManipulator() {
// qDebug("RectangleView::createManipulator() executed");
manipulator = new LineViewResizer(this);
return manipulator;
}
|
|
From: Darius S. <dst...@us...> - 2001-07-24 11:26:47
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common
In directory usw-pr-cvs1:/tmp/cvs-serv13849
Added Files:
MathUtility.h MathUtility.cpp
Log Message:
Added file
--- NEW FILE ---
/* Generated by Together */
#ifndef MATHUTILITY_H
#define MATHUTILITY_H
class QPoint;
/**
* The utility class provides some needed math/geometric function.
* All functions are static and may be used without creating an instance of this class.
* @stereotype Utility
*/
class MathUtility {
public:
/**
* The result we be stored in the variable r und fi
*/
static void convertKartToPolar(int x, int y, double& r, double& fi);
/**
* The result we be stored in the variable r und fi
*/
static void convertKartToPolar(const QPoint& start, const QPoint& end, double & r, double & fi);
/**
* The result we be stored in the variable x und y
*/
static void convertPolarToKart(double r, double fi, int& x, int& y);
// static void convertPolarToKartAbs(double r, double fi, int& x, int& y);
/**
* Return degree between two points from 0 (0) to 2PI (360).
* Right -- :0 (2PI)
* Up := PI/2
* Left := PI
* Down := PI + PI/2
*/
static double getDegree(const QPoint & p1, const QPoint & p2);
};
#endif //MATHUTILITY_H
--- NEW FILE ---
/* Generated by Together */
#include "MathUtility.h"
#include <qpoint.h>
#include <math.h>
#include <stdlib.h>
double MathUtility::getDegree(const QPoint & p1, const QPoint & p2){
double alpha;
double fi;
double deltaX;
double deltaY;
int x1 = p1.x();
int y1 = p1.y();
int x2 = p2.x();
int y2 = p2.y();
deltaX = abs(x1 - x2);
deltaY = abs(y1 - y2);
// First quadrant
if((x1 < x2) && (y1 >= y2)) {
fi = atan(deltaY/deltaX);
}
// Second quadrant
if((x1 >= x2) && (y1 > y2)) {
alpha = M_PI;
fi = alpha - atan(deltaY/deltaX);
}
// Third quadrant
if((x1 > x2) && (y1 <= y2)) {
alpha = M_PI;
fi = alpha + atan(deltaY/deltaX);
}
// Forth quadrant
if((x1 <= x2) && (y1 < y2)) {
alpha = M_PI + M_PI;
fi = alpha - atan(deltaY/deltaX);
}
return fi;
}
/*void MathUtility::convertPolarToKartAbs(double r, double fi, int& x, int& y){
x = getStartPoint().x();
y = getStartPoint().y();
x += int(r * cos(fi));
y -= int(r * sin(fi));
}*/
void MathUtility::convertPolarToKart(double r, double fi, int& x, int& y){
x = int(r * cos(fi));
y = int(r * sin(fi));
}
void MathUtility::convertKartToPolar(const QPoint& start, const QPoint& end, double & r, double & fi){
int x1 = start.x();
int y1 = start.y();
int x2 = end.x();
int y2 = end.y();
int deltaX = abs(x1 - x2);
int deltaY = abs(y1 - y2);
r = sqrt((deltaX*deltaX) + (deltaY*deltaY));
fi = getDegree(start, end);
}
void MathUtility::convertKartToPolar(int x, int y, double& r, double& fi){
r = sqrt((x*x) + (y*y));
QPoint p1(0,0);
QPoint p2(x,y);
fi = getDegree(p1, p2);
}
|
|
From: Darius S. <dst...@us...> - 2001-07-23 12:51:05
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators
In directory usw-pr-cvs1:/tmp/cvs-serv9502
Added Files:
ViewSelector.cpp
Log Message:
Added file
--- NEW FILE ---
/* Generated by Together */
#include "ViewSelector.h"
#include <qevent.h>
void ViewSelector::mouseLMBPress(QMouseEvent * e) {
getTarget()->mouseLMBPress(e);
oldMousePos = e->pos();
}
ViewSelector::ViewSelector(View * target) : AbstractViewManipulator(target) {
}
ViewSelector::~ViewSelector() {
if(handles.empty() == false) {
removeAllHandles();
}
}
void ViewSelector::removeAllHandles() {
HandleVectorIter iter = handles.begin();
while ( iter != handles.end()) {
delete *iter;
++iter;
}
handles.clear();
}
void ViewSelector::addHandle(SelectionHandle *handle) {
handles.insert(handles.end(), handle);
}
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views
In directory usw-pr-cvs1:/tmp/cvs-serv2714/common/views
Modified Files:
AbstractView.cpp AbstractView.h CircleView.h LineView.cpp
LineView.h ManipulatorHandle.h PaintAttributes.cpp
PaintAttributes.h PolygonView.h Positionable.h Rectangle.h
RectangleView.cpp RectangleView.h Selectable.h
SelectableView.cpp SelectableView.h SelectionHandle.cpp
SelectionHandle.h TextView.cpp TextView.h View.h
ViewFactory.cpp
Log Message:
Added more basic implementation for user interaction
Index: AbstractView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/AbstractView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AbstractView.cpp 2001/06/20 19:21:28 1.1.1.1
--- AbstractView.cpp 2001/07/22 23:21:38 1.2
***************
*** 1,2 ****
--- 1,4 ----
+
+
/***************************************************************************
AbstractView.cpp - description
***************
*** 7,25 ****
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. *
! * *
! ***************************************************************************/
! class View;
class ViewLayouter;
- #include "AbstractView.h"
-
void AbstractView::paint(QPainter * painter){
// Set paint attributes
--- 9,35 ----
email : sta...@in...
***************************************************************************/
+ #include "AbstractView.h"
! #include <qevent.h>
! void AbstractView::mouseRMBPress(QMouseEvent * e){
! }
! void AbstractView::mouseRelease(QMouseEvent* e){
! }
! void AbstractView::mousePress(QMouseEvent * e){
! if(Qt::LeftButton == e->button())
! mouseLMBPress(e);
! else
! if(Qt::RightButton == e->button())
! mouseRMBPress(e);
! }
! void AbstractView::mouseMove(QMouseEvent* e){
! }
! void AbstractView::mouseLMBPress(QMouseEvent * e){
! }
! void AbstractView::mouseDblClick(QMouseEvent* e){
! }
class ViewLayouter;
void AbstractView::paint(QPainter * painter){
// Set paint attributes
***************
*** 38,46 ****
}
! AbstractView::AbstractView(){
}
! void AbstractView::setCenter(QPoint& p){
}
! QPoint& AbstractView::getCenter(){
}
--- 48,57 ----
}
! AbstractView::AbstractView(Viewer* viewer, View * parent){
! this->parent = parent;
}
! void AbstractView::setCenter(const QPoint& p){
}
! QPoint AbstractView::getCenter(){
}
***************
*** 50,62 ****
}
- void AbstractView::mouseDblClick(QMouseEvent* e){
- }
- void AbstractView::mouseRelease(QMouseEvent* e){
- }
- void AbstractView::mousePress(QMouseEvent* e){
- }
- void AbstractView::mouseMove(QMouseEvent* e){
- }
View* AbstractView::getParent(){
}
void AbstractView::remove(View * v){
--- 61,66 ----
}
View* AbstractView::getParent(){
+ return parent;
}
void AbstractView::remove(View * v){
***************
*** 64,68 ****
void AbstractView::add(View * v){
}
! bool AbstractView::intersects(QPoint &p){
}
QRect & AbstractView::bounds() {
--- 68,72 ----
void AbstractView::add(View * v){
}
! bool AbstractView::intersects(const QPoint &p){
}
QRect & AbstractView::bounds() {
Index: AbstractView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/AbstractView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AbstractView.h 2001/06/20 19:21:27 1.1.1.1
--- AbstractView.h 2001/07/22 23:21:38 1.2
***************
*** 28,32 ****
--- 28,34 ----
#include <vector.h>
+ class Editor;
+ class QPopupMenu;
class ViewLayouter;
***************
*** 34,38 ****
public:
! AbstractView();
virtual ~AbstractView();
--- 36,40 ----
public:
! AbstractView(Viewer* viewer = 0, View * parent = 0);
virtual ~AbstractView();
***************
*** 40,44 ****
virtual QRect & bounds();
! virtual bool intersects(QPoint & p);
virtual void remove(View * v);
--- 42,46 ----
virtual QRect & bounds();
! virtual bool intersects(const QPoint & p);
virtual void remove(View * v);
***************
*** 46,50 ****
virtual void add(View * v);
! View* getParent();
virtual void mouseDblClick(QMouseEvent* e);
--- 48,52 ----
virtual void add(View * v);
! virtual View* getParent();
virtual void mouseDblClick(QMouseEvent* e);
***************
*** 52,57 ****
virtual void mouseRelease(QMouseEvent* e);
- virtual void mousePress(QMouseEvent* e);
-
virtual void mouseMove(QMouseEvent* e);
--- 54,57 ----
***************
*** 60,76 ****
void setLayouter(ViewLayouter* l);
! virtual QPoint& getCenter();
! virtual void setCenter(QPoint& p);
! void changed();
virtual void update();
- private:
! /** @link aggregation */
! PaintAttributes paintAttributes;
/** @link aggregation */
--- 60,87 ----
void setLayouter(ViewLayouter* l);
! virtual QPoint getCenter();
! virtual void setCenter(const QPoint& p);
! virtual void changed();
virtual void update();
+ /**
+ * This implementation sets the paint attributes and call paintContents()
+ * to paint the content.
+ */
+ virtual void paint(QPainter * painter);
+
+ virtual Viewer* getViewer() {
+ return viewer;
+ }
+
+ virtual void setViewer(Viewer *v) {
+ viewer = v;
+ }
! private:
/** @link aggregation */
***************
*** 79,83 ****
--- 90,99 ----
ViewLayouter * lnkLayouter;
+ View *parent;
+ Viewer *viewer;
+
protected:
+ /** @link aggregation */
+ PaintAttributes paintAttributes;
/**
***************
*** 90,100 ****
public:
- /**
- * This implementation sets the paint attributes and call drawContents()
- * to paint the content.
- */
- virtual void paint(QPainter * painter);
! protected:
};
#endif //ABSTRACTVIEW_H
--- 106,122 ----
public:
! /** Left mouse button clicked
! * Implement this in your sub classes
! */
! virtual void mouseLMBPress(QMouseEvent * e);
!
! /** Right mouse button clicked
! * Implement this in your sub classes
! */
! virtual void mouseRMBPress(QMouseEvent * e);
!
! virtual void mousePress(QMouseEvent * e);
!
};
#endif //ABSTRACTVIEW_H
Index: CircleView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/CircleView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** CircleView.h 2001/06/20 19:21:27 1.1.1.1
--- CircleView.h 2001/07/22 23:21:38 1.2
***************
*** 22,25 ****
--- 22,30 ----
class CircleView : public SelectableView {
+ public:
+
+ virtual ~CircleView();
+
+ CircleView(Viewer * viewer = 0, View * parent = 0): SelectableView(viewer, parent) {}
};
#endif //CIRCLEVIEW_H
Index: LineView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/LineView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** LineView.cpp 2001/06/20 19:21:29 1.1.1.1
--- LineView.cpp 2001/07/22 23:21:38 1.2
***************
*** 19,20 ****
--- 19,23 ----
#include "LineView.h"
+ LineView::~LineView(){}
+ LineView::LineView(Viewer * viewer, View * parent) : SelectableView(viewer, parent) {
+ }
Index: LineView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/LineView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** LineView.h 2001/06/20 19:21:27 1.1.1.1
--- LineView.h 2001/07/22 23:21:38 1.2
***************
*** 27,30 ****
--- 27,34 ----
public:
+ LineView(Viewer * viewer = 0, View * parent = 0);
+
+ virtual ~LineView();
+
virtual QPoint& getStartPoint() {}
virtual void setStartPoint(QPoint& p) {}
Index: ManipulatorHandle.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ManipulatorHandle.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ManipulatorHandle.h 2001/06/20 19:21:29 1.1.1.1
--- ManipulatorHandle.h 2001/07/22 23:21:38 1.2
***************
*** 31,34 ****
--- 31,36 ----
virtual void setName(string& n) = 0;
+
+ virtual int getId() = 0;
};
Index: PaintAttributes.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/PaintAttributes.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** PaintAttributes.cpp 2001/06/20 19:21:29 1.1.1.1
--- PaintAttributes.cpp 2001/07/22 23:21:38 1.2
***************
*** 35,39 ****
painter->setFont(font);
! painter->setPen(QPen(lineColor, lineWidth, Qt::SolidLine));
}
QColor& PaintAttributes::getLineColor(){
--- 35,39 ----
painter->setFont(font);
! // painter->setPen(QPen(lineColor, lineWidth, Qt::SolidLine));
}
QColor& PaintAttributes::getLineColor(){
***************
*** 48,52 ****
return font;
}
! void PaintAttributes::setBackgroundColor(QColor& backgroundColor){
this->backgroundColor = backgroundColor;
}
--- 48,52 ----
return font;
}
! void PaintAttributes::setBackgroundColor(const QColor & backgroundColor){
this->backgroundColor = backgroundColor;
}
Index: PaintAttributes.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/PaintAttributes.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** PaintAttributes.h 2001/06/20 19:21:27 1.1.1.1
--- PaintAttributes.h 2001/07/22 23:21:38 1.2
***************
*** 25,32 ****
class PaintAttributes {
public:
!
QColor& getBackgroundColor();
! void setBackgroundColor(QColor& backgroundColor);
QFont& getFont();
--- 25,32 ----
class PaintAttributes {
public:
! PaintAttributes() : backgroundColor(Qt::white), lineColor(Qt::black) {}
QColor& getBackgroundColor();
! void setBackgroundColor(const QColor & backgroundColor);
QFont& getFont();
Index: PolygonView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/PolygonView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** PolygonView.h 2001/06/20 19:21:27 1.1.1.1
--- PolygonView.h 2001/07/22 23:21:38 1.2
***************
*** 22,25 ****
--- 22,30 ----
class PolygonView : public SelectableView {
+ public:
+
+ virtual ~PolygonView();
+
+ PolygonView(Viewer * viewer = 0, View * parent = 0): SelectableView(viewer, parent) {}
};
#endif //POLYGONVIEW_H
Index: Positionable.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Positionable.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Positionable.h 2001/06/20 19:21:27 1.1.1.1
--- Positionable.h 2001/07/22 23:21:38 1.2
***************
*** 26,32 ****
public:
! virtual void setCenter(QPoint& p) = 0;
! virtual QPoint& getCenter() = 0;
};
#endif //POSITIONABLE_H
--- 26,32 ----
public:
! virtual void setCenter(const QPoint& p) = 0;
! virtual QPoint getCenter() = 0;
};
#endif //POSITIONABLE_H
Index: Rectangle.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Rectangle.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Rectangle.h 2001/06/20 19:21:29 1.1.1.1
--- Rectangle.h 2001/07/22 23:21:38 1.2
***************
*** 26,37 ****
public:
! virtual void setRectangle(QRect& r) = 0;
virtual QRect& getRectangle() = 0;
! virtual void setTopLeft(QPoint& r) = 0;
! virtual QPoint& getTopLeft() = 0;
! virtual void setBottomRight(QPoint& r) = 0;
! virtual QPoint& getBottomRight() = 0;
};
--- 26,37 ----
public:
! virtual void setRectangle(const QRect& r) = 0;
virtual QRect& getRectangle() = 0;
! virtual void setTopLeft(const QPoint& r) = 0;
! virtual QPoint getTopLeft() = 0;
! virtual void setBottomRight(const QPoint& r) = 0;
! virtual QPoint getBottomRight() = 0;
};
Index: RectangleView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/RectangleView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** RectangleView.cpp 2001/06/20 19:21:29 1.1.1.1
--- RectangleView.cpp 2001/07/22 23:21:38 1.2
***************
*** 1,2 ****
--- 1,4 ----
+
+
/***************************************************************************
RectangleView.cpp - description
***************
*** 7,41 ****
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 "RectangleView.h"
#include <qpainter.h>
RectangleView::~RectangleView(){
}
! RectangleView::RectangleView(){
}
QRect& RectangleView::bounds() {
return getRectangle();
}
- void RectangleView::setRectangle(QRect& rectangle){
- this->rectangle = rectangle; }
QRect& RectangleView::getRectangle(){
! return rectangle; }
! QPoint& RectangleView::getTopLeft() {
}
! void RectangleView::setTopLeft(QPoint& p) {
}
! QPoint& RectangleView::getBottomRight() {
}
! void RectangleView::setBottomRight(QPoint& p) {
}
void RectangleView::paintContents(QPainter * painter) {
--- 9,59 ----
email : sta...@in...
***************************************************************************/
#include "RectangleView.h"
+ #include "ige/common/manipulators/RectangleViewResizer.h"
+
#include <qpainter.h>
+ QPoint RectangleView::getCenter(){
+ return rectangle.center();
+ }
+ void RectangleView::setCenter(const QPoint& p){
+ rectangle.moveCenter(p);
+ }
+ ViewManipulator* RectangleView::createManipulator() {
+ // qDebug("RectangleView::createManipulator() executed");
+ RectangleViewResizer *manipulator = new RectangleViewResizer(this);
+ return manipulator;
+ }
+ bool RectangleView::intersects(const QPoint &p) {
+ if(rectangle.contains(p))
+ return true;
+ else
+ return false;
+ }
RectangleView::~RectangleView(){
}
! RectangleView::RectangleView(Viewer * viewer, View * parent) : rectangle(70,80,100,70), SelectableView(viewer, parent) {
! paintAttributes.setBackgroundColor(Qt::green);
}
QRect& RectangleView::bounds() {
return getRectangle();
+ }
+ void RectangleView::setRectangle(const QRect& rectangle){
+ this->rectangle = rectangle;
}
QRect& RectangleView::getRectangle(){
! return rectangle;
! }
! QPoint RectangleView::getTopLeft() {
! return rectangle.topLeft();
}
! void RectangleView::setTopLeft(const QPoint& p) {
! rectangle.moveTopLeft(p);
}
! QPoint RectangleView::getBottomRight() {
! return rectangle.bottomRight();
}
! void RectangleView::setBottomRight(const QPoint& p) {
! rectangle.moveBottomRight(p);
}
void RectangleView::paintContents(QPainter * painter) {
Index: RectangleView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/RectangleView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** RectangleView.h 2001/06/20 19:21:28 1.1.1.1
--- RectangleView.h 2001/07/22 23:21:38 1.2
***************
*** 25,51 ****
public:
! RectangleView();
virtual ~RectangleView();
! virtual void setTopLeft(QPoint& p);
! virtual QPoint& getTopLeft();
! virtual void setBottomRight(QPoint& p);
! virtual QPoint& getBottomRight();
virtual QRect& getRectangle();
! virtual void setRectangle(QRect& rectangle);
virtual QRect& bounds();
private:
QRect rectangle;
protected:
virtual void paintContents(QPainter * painter);
};
#endif //RECTANGLEVIEW_H
--- 25,65 ----
public:
! RectangleView(Viewer * viewer = 0, View * parent = 0);
virtual ~RectangleView();
! virtual void setTopLeft(const QPoint& p);
! virtual QPoint getTopLeft();
! virtual void setBottomRight(const QPoint& p);
! virtual QPoint getBottomRight();
virtual QRect& getRectangle();
! virtual void setRectangle(const QRect& rectangle);
virtual QRect& bounds();
+ /**
+ * Returns true if the view collides with the given mouse position
+ */
+ virtual bool intersects(const QPoint &p);
+
+ virtual ViewManipulator* createManipulator();
+
private:
QRect rectangle;
protected:
virtual void paintContents(QPainter * painter);
+ public:
+
+ virtual void setCenter(const QPoint& p);
+
+ virtual QPoint getCenter();
+
+ protected:
};
#endif //RECTANGLEVIEW_H
Index: Selectable.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/Selectable.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Selectable.h 2001/06/20 19:21:28 1.1.1.1
--- Selectable.h 2001/07/22 23:21:38 1.2
***************
*** 34,37 ****
--- 34,41 ----
virtual bool isSelected() = 0;
+
+ virtual void select() = 0;
+
+ virtual void unselect() = 0;
};
#endif //SELECTABLE_H
Index: SelectableView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectableView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** SelectableView.cpp 2001/06/20 19:21:29 1.1.1.1
--- SelectableView.cpp 2001/07/22 23:21:38 1.2
***************
*** 1,2 ****
--- 1,4 ----
+
+
/***************************************************************************
SelectableView.cpp - description
***************
*** 7,22 ****
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 "SelectableView.h"
SelectableView::~SelectableView(){}
! SelectableView::SelectableView(){}
--- 9,81 ----
email : sta...@in...
***************************************************************************/
+ #include "SelectableView.h"
+ #include "ige/common/editors/Viewer.h"
+ #include "ige/common/editors/Editor.h"
+ #include "ige/common/manipulators/ViewSelector.h"
! #include <qpopupmenu.h>
+ void SelectableView::mouseRMBPress(QMouseEvent * e){
+ if(isSelected() == false) {
+ select();
+ Viewer *v = getViewer();
+ Editor *ed = v->getEditor();
+
+ selector = (ViewSelector*) ed->addManipulator(this);
+ }
+
+ // A right mouse button click on the view opens the context menu
+ QPopupMenu *menu = 0;
+ menu = createPopupMenu();
+ if(menu) {
+ menu->exec(QCursor::pos());
+ delete menu;
+ }
+ }
+ void SelectableView::mouseLMBPress(QMouseEvent * e){
+ qDebug("View clicked");
+ // 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() {
+ QPopupMenu *menu = new QPopupMenu();
+ menu->setCaption("Selectable View");
+ menu ->insertItem("Copy (N/A)");
+ menu ->insertItem("Cut (N/A)");
+ menu ->insertItem("Delete (N/A)");
+ // menu ->insertSeperator();
+ menu ->insertItem("Properties (N/A)");
+
+ return menu;
+ }
+ void SelectableView::select(){
+ if(selected == false) {
+ selected = true;
+ }
+ }
+ void SelectableView::unselect(){
+ if(selected == true) {
+ selected = false;
+ if(selector)
+ delete selector;
+ }
+ }
SelectableView::~SelectableView(){}
! SelectableView::SelectableView(Viewer* viewer, View * parent) : AbstractView(viewer, parent) {
! selector = 0;
! selected = false;
! }
Index: SelectableView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectableView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** SelectableView.h 2001/06/20 19:21:28 1.1.1.1
--- SelectableView.h 2001/07/22 23:21:38 1.2
***************
*** 24,27 ****
--- 24,28 ----
#include "Clonable.h"
class ViewManipulator;
+ class ViewSelector;
class View;
***************
*** 29,47 ****
public:
! /** Factory method. Implement this your subclasses to create the desired object.
! */
!
- SelectableView();
-
virtual ~SelectableView();
- virtual SelectableView* createShallowCopy() {
- return 0;
- }
-
/** Factory method. Implement this your subclasses to create the desired object.
*/
! virtual SelectableView* createDeepCopy() {
return 0;
}
--- 30,40 ----
public:
! SelectableView(Viewer* viewer = 0, View * parent = 0);
virtual ~SelectableView();
/** Factory method. Implement this your subclasses to create the desired object.
*/
! virtual SelectableView* createShallowCopy() {
return 0;
}
***************
*** 49,53 ****
/** Factory method. Implement this your subclasses to create the desired object.
*/
! virtual QPopupMenu* createPopupMenu() {
return 0;
}
--- 42,46 ----
/** Factory method. Implement this your subclasses to create the desired object.
*/
! virtual SelectableView* createDeepCopy() {
return 0;
}
***************
*** 62,65 ****
--- 55,59 ----
*/
virtual ViewManipulator* createManipulator() {
+ qDebug("SelectableView::createManipulator() executed");
return 0;
}
***************
*** 73,78 ****
--- 67,83 ----
}
+ virtual void unselect();
+
+ virtual void select();
+
+ virtual QPopupMenu* createPopupMenu();
+
+ virtual void mouseLMBPress(QMouseEvent * e);
+
+ virtual void mouseRMBPress(QMouseEvent * e);
+
private:
bool selected;
+ ViewSelector *selector;
};
#endif //SELECTABLEVIEW_H
Index: SelectionHandle.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectionHandle.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** SelectionHandle.cpp 2001/06/20 19:21:29 1.1.1.1
--- SelectionHandle.cpp 2001/07/22 23:21:38 1.2
***************
*** 20,34 ****
#include <qbrush.h>
#include "SelectionHandle.h"
void SelectionHandle::paintContents(QPainter * painter) {
! painter->drawRect(bounds());
}
SelectionHandle::~SelectionHandle(){}
! class ViewManipulator;
!
! SelectionHandle::SelectionHandle(){}
! void SelectionHandle::setName(string& name){ this->name = name; }
! string& SelectionHandle::getName(){ return name; }
! void SelectionHandle::setOwner(ViewManipulator * owner){ this->owner = owner; }
! ViewManipulator * SelectionHandle::getOwner(){ return owner; }
--- 20,59 ----
#include <qbrush.h>
+ //class ViewManipulator;
+
#include "SelectionHandle.h"
+ #include "ige/common/manipulators/ViewSelector.h"
+
+ int SelectionHandle::SIZE = 6;
void SelectionHandle::paintContents(QPainter * painter) {
! static QBrush b(Qt::Dense4Pattern);
! painter->fillRect(bounds(), b);
}
SelectionHandle::~SelectionHandle(){}
! SelectionHandle::SelectionHandle(ViewSelector * vs, int id, Viewer* viewer, View * parent)
! : RectangleView(viewer, parent) {
! getRectangle().setWidth(SIZE);
! getRectangle().setHeight(SIZE);
! CHECK_PTR(vs);
! owner = vs;
! this->id = id;
! }
! void SelectionHandle::mouseMove(QMouseEvent* e){
! getOwner()->handleMoveEvent(this, e);
! }
! void SelectionHandle::mouseLMBPress(QMouseEvent * e) {
! getOwner()->handlePressEvent(this,e);
! }
! void SelectionHandle::setName(string& name){
! this->name = name;
! }
! string& SelectionHandle::getName(){
! return name;
! }
! void SelectionHandle::setOwner(ViewSelector * owner){
! this->owner = owner;
! }
! ViewSelector * SelectionHandle::getOwner(){
! return owner;
! }
Index: SelectionHandle.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/SelectionHandle.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** SelectionHandle.h 2001/06/20 19:21:28 1.1.1.1
--- SelectionHandle.h 2001/07/22 23:21:38 1.2
***************
*** 24,52 ****
#include <string>
- class ViewManipulator;
-
class SelectionHandle : public RectangleView , public ManipulatorHandle{
public:
! SelectionHandle();
virtual ~SelectionHandle();
! ViewManipulator * getOwner();
! void setOwner(ViewManipulator * owner);
virtual string& getName();
virtual void setName(string& name);
protected:
virtual void paintContents(QPainter * painter);
-
- public:
! private:
! ViewManipulator * owner;
string name;
};
--- 24,66 ----
#include <string>
+ class ViewSelector;
class SelectionHandle : public RectangleView , public ManipulatorHandle{
public:
! SelectionHandle(ViewSelector * vs, int id, Viewer* viewer = 0, View * parent = 0);
virtual ~SelectionHandle();
+
+ /** This method will be invoked when the user clicks on the selection handle
+ */
+ virtual void mouseLMBPress(QMouseEvent * e);
! ViewSelector * getOwner();
! void setOwner(ViewSelector * owner);
virtual string& getName();
virtual void setName(string& name);
+
+ virtual int getId() {
+ return id;
+ }
+
+
+
+ static int SIZE;
+
+ /** Implementation of interface EventHandler */
+ virtual void mouseMove(QMouseEvent* e);
+
protected:
virtual void paintContents(QPainter * painter);
! private:
! int id;
! ViewSelector * owner;
string name;
};
Index: TextView.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/TextView.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** TextView.cpp 2001/06/20 19:21:29 1.1.1.1
--- TextView.cpp 2001/07/22 23:21:38 1.2
***************
*** 22,27 ****
TextView::~TextView(){}
! TextView::TextView(int param){}
! TextView::TextView(){}
void TextView::paintContents(QPainter * painter) {
painter->drawRect(bounds());
--- 22,28 ----
TextView::~TextView(){}
!
! TextView::TextView(Viewer * viewer, View * parent) : RectangleView(viewer, parent) {
! }
void TextView::paintContents(QPainter * painter) {
painter->drawRect(bounds());
Index: TextView.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/TextView.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** TextView.h 2001/06/20 19:21:28 1.1.1.1
--- TextView.h 2001/07/22 23:21:38 1.2
***************
*** 26,32 ****
public:
! TextView();
!
! TextView(int param);
virtual ~TextView();
--- 26,30 ----
public:
! TextView(Viewer * viewer = 0, View * parent = 0);
virtual ~TextView();
Index: View.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/View.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** View.h 2001/06/20 19:21:28 1.1.1.1
--- View.h 2001/07/22 23:21:38 1.2
***************
*** 25,28 ****
--- 25,29 ----
#include <qrect.h>
#include "ige/common/Observer.h"
+ class Viewer;
class View;
***************
*** 43,47 ****
* Returns true if the view collides with the given mouse position
*/
! virtual bool intersects(QPoint &p) = 0;
/**
--- 44,48 ----
* Returns true if the view collides with the given mouse position
*/
! virtual bool intersects(const QPoint &p) = 0;
/**
***************
*** 61,64 ****
--- 62,69 ----
*/
virtual void changed() = 0;
+
+ virtual Viewer* getViewer() = 0;
+
+ virtual void setViewer(Viewer* v) = 0;
};
#endif //VIEW_H
Index: ViewFactory.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views/ViewFactory.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ViewFactory.cpp 2001/06/20 19:21:29 1.1.1.1
--- ViewFactory.cpp 2001/07/22 23:21:38 1.2
***************
*** 18,24 ****
#include "ViewFactory.h"
! TextView* ViewFactory::createText(){}
class TextView;
ViewFactory * ViewFactory::instance= 0;
ViewFactory * ViewFactory::getInstance(){
--- 18,33 ----
#include "ViewFactory.h"
! #include "TextView.h"
!
class TextView;
+ TextView* ViewFactory::createText(){
+ qDebug("ViewFactory::createText() not implemented!");
+ }
+ TextView* ViewFactory::create(TextModel * m){
+ TextView *view = new TextView();
+ return view;
+ }
+
ViewFactory * ViewFactory::instance= 0;
ViewFactory * ViewFactory::getInstance(){
***************
*** 28,31 ****
return instance;
}
- TextView* ViewFactory::create(TextModel * m){}
ViewFactory::ViewFactory(){}
--- 37,39 ----
|
|
From: Darius S. <dst...@us...> - 2001-07-22 23:21:41
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools
In directory usw-pr-cvs1:/tmp/cvs-serv2714/common/tools
Modified Files:
AbstractTool.cpp AbstractTool.h SelectionTool.cpp
SelectionTool.h Tool.h
Log Message:
Added more basic implementation for user interaction
Index: AbstractTool.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools/AbstractTool.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AbstractTool.cpp 2001/06/20 19:21:23 1.1.1.1
--- AbstractTool.cpp 2001/07/22 23:21:38 1.2
***************
*** 1,23 ****
- /***************************************************************************
- AbstractTool.cpp - description
- -------------------
- begin : Wed Jun 20 2001
- copyright : (C) 2001 by the kUML Team
- author : Darius Stachow
- 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 "AbstractTool.h"
class Editor;
void AbstractTool::setIcon(QPixmap& icon){
this->icon = icon;
--- 1,17 ----
#include "AbstractTool.h"
+ #include <qevent.h>
+
+ void AbstractTool::shutdown(){
+ }
+ void AbstractTool::init(){
+ }
class Editor;
+ void AbstractTool::mouseRMBPress(QMouseEvent* e, Editor *editor){
+ }
+ void AbstractTool::mouseLMBPress(QMouseEvent* e, Editor *editor){
+ }
void AbstractTool::setIcon(QPixmap& icon){
this->icon = icon;
***************
*** 30,39 ****
}
! void AbstractTool::setEditor(Editor* editor){
this->editor = editor;
}
Editor* AbstractTool::getEditor(){
return editor;
! }
void AbstractTool::paint(QPainter* p){
}
--- 24,33 ----
}
! /*void AbstractTool::setEditor(Editor* editor){
this->editor = editor;
}
Editor* AbstractTool::getEditor(){
return editor;
! }*/
void AbstractTool::paint(QPainter* p){
}
***************
*** 42,51 ****
AbstractTool::AbstractTool(){
}
! void AbstractTool::mouseDblClick(QMouseEvent* e){
}
! void AbstractTool::mouseMove(QMouseEvent* e){
}
! void AbstractTool::mouseRelease(QMouseEvent* e){
}
! void AbstractTool::mousePress(QMouseEvent* e){
}
--- 36,50 ----
AbstractTool::AbstractTool(){
}
! void AbstractTool::mouseDblClick(QMouseEvent* e, Editor *editor){
}
! void AbstractTool::mouseMove(QMouseEvent* e, Editor *editor){
}
! void AbstractTool::mouseRelease(QMouseEvent* e, Editor *editor){
}
! void AbstractTool::mousePress(QMouseEvent* e, Editor *editor){
! if(Qt::LeftButton == e->button())
! mouseLMBPress(e, editor);
! else
! if(Qt::RightButton == e->button())
! mouseRMBPress(e, editor);
}
Index: AbstractTool.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools/AbstractTool.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AbstractTool.h 2001/06/20 19:21:22 1.1.1.1
--- AbstractTool.h 2001/07/22 23:21:38 1.2
***************
*** 29,45 ****
virtual ~AbstractTool();
! virtual void mousePress(QMouseEvent* e);
! virtual void mouseRelease(QMouseEvent* e);
! virtual void mouseMove(QMouseEvent* e);
! virtual void mouseDblClick(QMouseEvent* e);
virtual void paint(QPainter* p);
! virtual Editor* getEditor();
! virtual void setEditor(Editor* editor);
virtual string getDescription();
--- 29,45 ----
virtual ~AbstractTool();
! virtual void mouseMove(QMouseEvent * e, Editor *editor);
! virtual void mouseRelease(QMouseEvent * e, Editor *editor);
! virtual void mouseDblClick(QMouseEvent * e, Editor *editor);
! virtual void mousePress(QMouseEvent* e, Editor *editor);
virtual void paint(QPainter* p);
! /* virtual Editor* getEditor();
! virtual void setEditor(Editor* editor);*/
virtual string getDescription();
***************
*** 48,51 ****
--- 48,63 ----
virtual void setIcon(QPixmap& icon);
+
+ virtual void mouseLMBPress(QMouseEvent* e, Editor *editor);
+
+ virtual void mouseRMBPress(QMouseEvent* e, Editor *editor);
+
+ /**
+ * This method should be called before usage of the tool.
+ * It initializes some variables.
+ */
+ virtual void init();
+
+ virtual void shutdown();
private:
Index: SelectionTool.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools/SelectionTool.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** SelectionTool.cpp 2001/06/20 19:21:23 1.1.1.1
--- SelectionTool.cpp 2001/07/22 23:21:38 1.2
***************
*** 18,21 ****
--- 18,61 ----
#include "SelectionTool.h"
+ #include "ige/common/documents/Document.h"
+ #include "ige/common/editors/SelectionLayer.h"
+ #include "ige/common/editors/Viewer.h"
+ #include "ige/common/views/SelectableView.h"
+ #include "ige/common/editors/AbstractEditor.h"
+ //#include "ige/common/editors/Viewer.h"
+
+ class ViewManipulator;
+
+ #include <qcursor.h>
+ #include <qpopupmenu.h>
+
+ void SelectionTool::init(){
+ _LMBPressed = false;
+ _RMBPressed = false;
+ forwardEvents = 0;
+ }
+ void SelectionTool::mouseLMBPress(QMouseEvent* e, Editor *editor) {
+ _LMBPressed = true;
+
+ Layer *layer = editor->getViewer()->getLayer();
+ View *view = 0;
+ ViewManipulator *manipulator = 0;
+
+ view = layer->pick(e->pos());
+ forwardEvents = view;
+
+ if(view) {
+ // Let the view process the event itself. The SelectableView's default implemention will create a popup menu
+ view->mouseLMBPress(e);
+ } else {
+ editor->unselectAll();
+ }
+
+ /* slayer->startMultiSelection(e->pos().x(), e->pos().y());
+ DataLayer *dlayer = editor->getViewer()->getDataLayer();
+ return;*/
+
+ }
+
string SelectionTool::getDescription(){
return "SelectionTool";
***************
*** 29,38 ****
SelectionTool * SelectionTool::instance= 0;
SelectionTool::SelectionTool(){}
! void SelectionTool::mouseDblClick(QMouseEvent* e){
! }
! void SelectionTool::mouseMove(QMouseEvent* e){
}
! void SelectionTool::mouseRelease(QMouseEvent* e){
}
! void SelectionTool::mousePress(QMouseEvent* e){
}
--- 69,106 ----
SelectionTool * SelectionTool::instance= 0;
SelectionTool::SelectionTool(){}
! void SelectionTool::mouseDblClick(QMouseEvent* e, Editor *editor){
}
! void SelectionTool::mouseMove(QMouseEvent* e, Editor *editor){
! qDebug("SelectionTool::mouseMoveEvent");
!
! if(forwardEvents)
! forwardEvents->mouseMove(e);
!
! SelectionLayer *slayer = ((AbstractEditor*)editor)->getSelectionLayer();
! slayer->continueMultiSelection(e->pos().x(), e->pos().y());
}
! void SelectionTool::mouseRelease(QMouseEvent* e, Editor *editor){
! _RMBPressed = false;
! _LMBPressed = false;
!
! SelectionLayer *slayer = ((AbstractEditor*)editor)->getSelectionLayer();
! slayer->endMultiSelection();
! }
! void SelectionTool::mouseRMBPress(QMouseEvent* e, Editor *editor) {
! _RMBPressed = true;
!
! Layer *layer = editor->getViewer()->getLayer();
! View *view = 0;
!
! view = layer->pick(e->pos());
!
! if(view)
! // Let the view process the event itself. The SelectableView's default implemention will create a popup menu
! view->mouseRMBPress(e);
! else {
! QPopupMenu *menu;
! menu = editor->getDocument()->createPopupMenu();
! menu->exec(QCursor::pos());
! delete menu;
! }
}
Index: SelectionTool.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools/SelectionTool.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** SelectionTool.h 2001/06/20 19:21:22 1.1.1.1
--- SelectionTool.h 2001/07/22 23:21:38 1.2
***************
*** 21,24 ****
--- 21,25 ----
#include "Tool.h"
#include "AbstractTool.h"
+ class Editor;
class ViewManipulator;
/**
***************
*** 32,42 ****
public:
- virtual void mousePress(QMouseEvent* e);
! virtual void mouseRelease(QMouseEvent* e);
! virtual void mouseMove(QMouseEvent* e);
! virtual void mouseDblClick(QMouseEvent* e);
static SelectionTool * getInstance();
--- 33,42 ----
public:
! virtual void mouseRelease(QMouseEvent* e, Editor *editor);
! virtual void mouseMove(QMouseEvent* e, Editor *editor);
! virtual void mouseDblClick(QMouseEvent* e, Editor *editor);
static SelectionTool * getInstance();
***************
*** 44,49 ****
--- 44,73 ----
virtual string getDescription();
+ virtual void mouseRMBPress(QMouseEvent* e, Editor *editor);
+
+ virtual void mouseLMBPress(QMouseEvent* e, Editor *editor);
+
+ bool isLMBPressed() {
+ return _LMBPressed;
+ }
+
+ bool isRMBPressed() {
+ return _RMBPressed;
+ }
+
+ /**
+ * This method should be called before usage of the tool.
+ * It initializes some variables.
+ */
+ virtual void init();
+
private:
static SelectionTool * instance;
+
+ bool _LMBPressed;
+ bool _RMBPressed;
+
+ View *forwardEvents;
+
};
#endif //SELECTIONTOOL_H
Index: Tool.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/tools/Tool.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Tool.h 2001/06/20 19:21:22 1.1.1.1
--- Tool.h 2001/07/22 23:21:38 1.2
***************
*** 20,24 ****
#ifndef TOOL_H
#define TOOL_H
! #include "ige/common/EventHandler.h"
#include "ige/common/Paintable.h"
--- 20,24 ----
#ifndef TOOL_H
#define TOOL_H
! //#include "ige/common/EventHandler.h"
#include "ige/common/Paintable.h"
***************
*** 28,32 ****
class Editor;
!
/*
* A tool defines a mode of the editor.
--- 28,32 ----
class Editor;
! class QMouseEvent;
/*
* A tool defines a mode of the editor.
***************
*** 37,51 ****
* @interface
*/
!
! class Tool : public Paintable , public EventHandler{
public:
! virtual void setEditor(Editor * e) = 0;
! virtual Editor* getEditor() = 0;
virtual string getDescription() = 0;
QPixmap& getIcon();
};
#endif //TOOL_H
--- 37,66 ----
* @interface
*/
! class Tool : public Paintable /* , public EventHandler */ {
public:
+
+ virtual void mouseMove(QMouseEvent * e, Editor *editor) = 0;
+
+ virtual void mousePress(QMouseEvent * e, Editor *editor) = 0;
! virtual void mouseRelease(QMouseEvent * e, Editor *editor) = 0;
! virtual void mouseDblClick(QMouseEvent * e, Editor *editor) = 0;
+ /* virtual void setEditor(Editor * e) = 0;
+
+ virtual Editor* getEditor() = 0;*/
+
virtual string getDescription() = 0;
QPixmap& getIcon();
+
+ /**
+ * This method should be called before usage of the tool.
+ * It initializes some variables.
+ */
+ virtual void init() =0;
+
+ virtual void shutdown() =0;
};
#endif //TOOL_H
|
|
From: Darius S. <dst...@us...> - 2001-07-22 23:21:41
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators
In directory usw-pr-cvs1:/tmp/cvs-serv2714/common/manipulators
Modified Files:
AbstractViewManipulator.cpp AbstractViewManipulator.h
RectangleViewResizer.cpp RectangleViewResizer.h
ViewManipulator.h ViewResizer.h ViewSelector.h
Log Message:
Added more basic implementation for user interaction
Index: AbstractViewManipulator.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/AbstractViewManipulator.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AbstractViewManipulator.cpp 2001/06/20 19:21:26 1.1.1.1
--- AbstractViewManipulator.cpp 2001/07/22 23:21:38 1.2
***************
*** 16,24 ****
* *
***************************************************************************/
#include "AbstractViewManipulator.h"
! AbstractViewManipulator::~AbstractViewManipulator(){}
! class View;
! void AbstractViewManipulator::mouseRelease(QMouseEvent* e){}
! AbstractViewManipulator::AbstractViewManipulator(){}
--- 16,52 ----
* *
***************************************************************************/
+ class SelectionHandle;
+ class View;
+
+ #include <qevent.h>
#include "AbstractViewManipulator.h"
! View* AbstractViewManipulator::getTarget(){
! return target;
! }
! void AbstractViewManipulator::setHandle(SelectionHandle* handle){
! this->handle = handle;
! }
! SelectionHandle* AbstractViewManipulator::getHandle(){
! return handle;
! }
! void AbstractViewManipulator::handlePressEvent(SelectionHandle * handle, QMouseEvent * event){
! oldMousePos = event->pos();
! }
! void AbstractViewManipulator::handleMoveEvent(SelectionHandle * handle, QMouseEvent * event){
! oldMousePos = event->pos();
! }
! void AbstractViewManipulator::mouseRMBPress(QMouseEvent * e){
! oldMousePos = e->pos();
! }
! void AbstractViewManipulator::mouseLMBPress(QMouseEvent * e){
! oldMousePos = e->pos();
! }
! AbstractViewManipulator::~AbstractViewManipulator(){
! }
! AbstractViewManipulator::AbstractViewManipulator(View * target){
! CHECK_PTR(target);
! handle = 0;
! this->target = target;
! }
Index: AbstractViewManipulator.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/AbstractViewManipulator.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** AbstractViewManipulator.h 2001/06/20 19:21:25 1.1.1.1
--- AbstractViewManipulator.h 2001/07/22 23:21:38 1.2
***************
*** 20,39 ****
#define ABSTRACTVIEWMANIPULATOR_H
#include "ViewManipulator.h"
class View;
class AbstractViewManipulator : public ViewManipulator {
public:
! AbstractViewManipulator();
virtual ~AbstractViewManipulator();
virtual void mousePress(QMouseEvent* e){}
virtual void mouseMove(QMouseEvent* e){}
! virtual void mouseRelease(QMouseEvent* e);
! virtual void mouseDblCLick(QMouseEvent* e){}
};
#endif //ABSTRACTVIEWMANIPULATOR_H
--- 20,121 ----
#define ABSTRACTVIEWMANIPULATOR_H
#include "ViewManipulator.h"
+
+ #include <qpoint.h>
+
class View;
+ class SelectionHandle;
+ class Viewer;
+ class RectangleView;
+ //class View;
class AbstractViewManipulator : public ViewManipulator {
public:
! AbstractViewManipulator(View * target);
virtual ~AbstractViewManipulator();
+ /** Implementation of interface EventHandler */
virtual void mousePress(QMouseEvent* e){}
+ /** Implementation of interface EventHandler */
virtual void mouseMove(QMouseEvent* e){}
+
+ /** Implementation of interface EventHandler */
+ virtual void mouseRelease(QMouseEvent* e) {}
+
+ /** Implementation of interface EventHandler */
+ virtual void mouseDblClick(QMouseEvent* e){}
+
+ /** Implementation of interface Paintable */
+ virtual void paint(QPainter * painter){}
+
+ /** Implementation of interface View */
+ virtual QRect & bounds() { }
+
+ /** Implementation of interface View */
+ virtual bool intersects(const QPoint & p) { return false; }
+
+ /** Implementation of interface View */
+ virtual void remove(View * v) {}
+
+ /** Implementation of interface View */
+ virtual void add(View * v) {}
+
+ /** Implementation of interface View */
+ virtual View* getParent() { return 0; }
+
+ /** Implementation of interface View */
+ virtual QPoint getCenter() {}
+
+ /** Implementation of interface View */
+ virtual void setCenter(const QPoint& p) {}
+
+ /** Implementation of interface Observer */
+ virtual void update() {}
+
+ /** Implementation of interface Observer */
+ virtual void changed() {}
+
+ /** Left mouse button clicked
+ */
+ virtual void mouseLMBPress(QMouseEvent * e);
+
+ /** Right mouse button clicked
+ */
+ virtual void mouseRMBPress(QMouseEvent * e);
+
+ virtual void setViewer(Viewer *v) {}
+
+ virtual Viewer* getViewer() { return 0; }
+
+ /**
+ * This method will be called when a handle has been clicked
+ *
+ */
+ virtual void handlePressEvent(SelectionHandle * handle, QMouseEvent * event);
+
+ /**
+ * This method will be called when a handle has been moved
+ *
+ */
+ virtual void handleMoveEvent(SelectionHandle * handle, QMouseEvent * event);
+
+ /**
+ * Gets the last pressed handle if any
+ *
+ */
+ SelectionHandle* getHandle();
+
+ void setHandle(SelectionHandle* handle);
+
+ virtual View* getTarget();
! protected:
! QPoint oldMousePos;
! private:
! SelectionHandle* handle;
! View* target;
};
#endif //ABSTRACTVIEWMANIPULATOR_H
Index: RectangleViewResizer.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/RectangleViewResizer.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** RectangleViewResizer.cpp 2001/06/20 19:21:26 1.1.1.1
--- RectangleViewResizer.cpp 2001/07/22 23:21:38 1.2
***************
*** 18,35 ****
#include "RectangleViewResizer.h"
class RectangleView;
RectangleViewResizer::~RectangleViewResizer(){
}
! RectangleViewResizer::RectangleViewResizer(){
}
!
! void RectangleViewResizer::setTarget(RectangleView* target){
! this->target = target;
}
! RectangleView* RectangleViewResizer::getTarget(){
! return target;
}
! RectangleViewResizer::RectangleViewResizer(RectangleView* v){
}
--- 18,188 ----
#include "RectangleViewResizer.h"
+ #include "ige/common/editors/SelectionLayer.h"
+ #include "ige/common/editors/Viewer.h"
+ #include <qevent.h>
+
class RectangleView;
+ void RectangleViewResizer::handleMoveEvent(SelectionHandle * handle, QMouseEvent * event){
+ int dx = event->x() - oldMousePos.x();
+ int dy = event->y() - oldMousePos.y();
+
+ resizeTarget(handle, dx, dy);
+
+ oldMousePos = event->pos();
+ }
+ void RectangleViewResizer::resizeTarget(SelectionHandle *handle, int diffx, int diffy) {
+ QRect damagedArea = getTarget()->bounds();
+ RectangleView *view = (RectangleView*)getTarget();
+ QRect rect = view->getRectangle();
+
+ int x = rect.x();
+ int y = rect.y();
+ int w = rect.width();
+ int h = rect.height();
+
+ switch(handle->getId()) {
+ case enumTopLeft: x += diffx;
+ y += diffy;
+ w -= diffx;
+ h -= diffy;
+ break;
+ case enumTopRight : y += diffy;
+ w += diffx;
+ h -= diffy;
+ break;
+ case enumBottomLeft: x += diffx;
+ w -= diffx;
+ h += diffy;
+ break;
+ case enumBottomRight: w += diffx;
+ h += diffy;
+ break;
+ case enumMiddleTop: y += diffy;
+ h -= diffy;
+ break;
+ case enumMiddleBottom: h += diffy;
+ break;
+ case enumMiddleLeft: x += diffx;
+ w -= diffx;
+ break;
+ case enumMiddleRight: w += diffx;
+ break;
+
+ }
+
+ // Check min size
+ if((w <= 10) || (h<=10))
+ return;
+
+ QRect temp(x,y,w,h);
+ view->setRectangle(temp);
+ damagedArea = damagedArea.unite(temp);
+
+ placeHandles();
+
+ view->getViewer()->refresh(damagedArea);
+ }
+ RectangleViewResizer::RectangleViewResizer(RectangleView * target) : ViewResizer((View*)target) {
+ // this->target = target;
+ }
RectangleViewResizer::~RectangleViewResizer(){
}
! QRect & RectangleViewResizer::bounds() {
! return getTarget()->bounds();
}
! bool RectangleViewResizer::intersects(const QPoint & p) {
! return getTarget()->intersects(p);
}
! void RectangleViewResizer::placeHandles() {
! View *target = getTarget();
! CHECK_PTR(target);
!
! int left = getTarget()->bounds().left();
! int right = getTarget()->bounds().right();
! int top = getTarget()->bounds().top();
! int bottom = getTarget()->bounds().bottom();
! int height = getTarget()->bounds().height();
! int width = getTarget()->bounds().width();
! int xcenter = getTarget()->bounds().center().x();
! int ycenter = getTarget()->bounds().center().y();
!
!
! // Place top left handle
! HandleVectorIter iter = getHandleIterator();
! SelectionHandle *handle = *iter;
! handle->getRectangle().moveTopLeft(QPoint(left, top));
!
! // Place top right handle
! ++iter;
! handle = *iter;
! handle->getRectangle().moveTopRight(QPoint(right, top));
!
! // Place bottom left handle
! ++iter;
! handle = *iter;
! handle->getRectangle().moveBottomRight(QPoint(right, bottom));
!
! // Place bottom right handle
! ++iter;
! handle = *iter;
! handle->getRectangle().moveBottomLeft(QPoint(left, bottom));
!
! // Place middle top handle
! ++iter;
! handle = *iter;
! handle->getRectangle().moveTopLeft(QPoint(xcenter-(SelectionHandle::SIZE>>1), top));
!
! // Place middle bottom handle
! ++iter;
! handle = *iter;
! handle->getRectangle().moveBottomLeft(QPoint(xcenter-(SelectionHandle::SIZE>>1), bottom));
!
! // Place middle left handle
! ++iter;
! handle = *iter;
! handle->getRectangle().moveTopLeft(QPoint(left, ycenter-(SelectionHandle::SIZE>>1)));
!
! // Place middle right selection handle
! ++iter;
! handle = *iter;
! handle->getRectangle().moveTopRight(QPoint(right, ycenter-(SelectionHandle::SIZE>>1)));
}
! void RectangleViewResizer::createHandles(SelectionLayer *layer) {
! SelectionHandle *handle = 0;
!
! handle = new SelectionHandle(this, enumTopLeft);
! addHandle(handle);
! layer->addHandle(handle);
!
! handle = new SelectionHandle(this, enumTopRight);
! addHandle(handle);
! layer->addHandle(handle);
!
! handle = new SelectionHandle(this, enumBottomRight);
! addHandle(handle);
! layer->addHandle(handle);
!
! handle = new SelectionHandle(this, enumBottomLeft);
! addHandle(handle);
! layer->addHandle(handle);
!
! handle = new SelectionHandle(this, enumMiddleTop);
! addHandle(handle);
! layer->addHandle(handle);
!
! handle = new SelectionHandle(this, enumMiddleBottom);
! addHandle(handle);
! layer->addHandle(handle);
!
! handle = new SelectionHandle(this, enumMiddleLeft);
! addHandle(handle);
! layer->addHandle(handle);
!
! handle = new SelectionHandle(this, enumMiddleRight);
! addHandle(handle);
! layer->addHandle(handle);
!
! placeHandles();
}
Index: RectangleViewResizer.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/RectangleViewResizer.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** RectangleViewResizer.h 2001/06/20 19:21:25 1.1.1.1
--- RectangleViewResizer.h 2001/07/22 23:21:38 1.2
***************
*** 22,44 ****
#include "ige/common/views/RectangleView.h"
class RectangleViewResizer : public ViewResizer {
public:
! RectangleViewResizer(RectangleView* v);
! RectangleViewResizer();
! virtual ~RectangleViewResizer();
! RectangleView* getTarget();
! void setTarget(RectangleView* target);
protected:
! /**
! * The figure to be manipulated.
! * @directed*/
! RectangleView* target;
};
#endif //RECTANGLEVIEWRESIZER_H
--- 22,63 ----
#include "ige/common/views/RectangleView.h"
+ class SelectionHandle;
+
class RectangleViewResizer : public ViewResizer {
public:
! RectangleViewResizer(RectangleView * target);
! virtual ~RectangleViewResizer();
! virtual void createHandles(SelectionLayer *layer);
! virtual void placeHandles();
! /** Implementation of interface View */
! virtual QRect & bounds();
! /** Implementation of interface View */
! virtual bool intersects(const QPoint & p);
! /**
! * This method will be called when a handle has been moved
! *
! */
! virtual void handleMoveEvent(SelectionHandle * handle, QMouseEvent * event);
protected:
+ void resizeTarget(SelectionHandle *handle, int diffx, int diffy);
! enum Handles { enumTopLeft = 1,
! enumTopRight = 2,
! enumBottomLeft = 3,
! enumBottomRight =4,
! enumMiddleTop = 5,
! enumMiddleBottom = 6,
! enumMiddleLeft = 7,
! enumMiddleRight =8
! };
!
!
! private:
};
#endif //RECTANGLEVIEWRESIZER_H
Index: ViewManipulator.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/ViewManipulator.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ViewManipulator.h 2001/06/20 19:21:25 1.1.1.1
--- ViewManipulator.h 2001/07/22 23:21:38 1.2
***************
*** 19,34 ****
#ifndef VIEWMANIPULATOR_H
#define VIEWMANIPULATOR_H
! #include "ige/common/EventHandler.h"
! #include "ige/common/Paintable.h"
! class View;
! /** @interface */
! class ViewManipulator : public EventHandler, public Paintable {
public:
virtual View* getTarget() = 0;
! virtual void setTarget(View* v) = 0;
private:
--- 19,75 ----
#ifndef VIEWMANIPULATOR_H
#define VIEWMANIPULATOR_H
! //#include "ige/common/EventHandler.h"
! //#include "ige/common/Paintable.h"
! #include "ige/common/views/View.h"
! class SelectionHandle;
! class SelectionLayer;
! //class View;
!
! /**
! * Manipulator means in this context an object that
! * reacts on user actions to modify graphical objects on the
! * screen. These actions are called direct manipulations.
! *
! * Manipulator objects are created by the manipulated
! * objects through the interface Selectable
! * and are associated to them. The manipulators
! * objects will be stored in the ManipulationLayer.
! * The manipulator can create some selection handles
! * that the user can drag to start a direct manipulation.
! * The handles will be stored in the SelectionLayer.
! * A direct manipulation will be started by pressing
! * and holding the mouse button.
! * A manipulator receive mouse events till the
! * user release the button. This is the end of the
! * manipulation.
! *
! * @interface
! */
! class ViewManipulator : public View {
! //class ViewManipulator : public EventHandler, public Paintable, public Pickable {
public:
virtual View* getTarget() = 0;
+
+ virtual void createHandles(SelectionLayer *layer) = 0;
+ virtual void placeHandles() = 0;
+
+ /**
+ * This method will be called when a handle has been clicked
+ *
+ */
+ virtual void handlePressEvent(SelectionHandle * handle, QMouseEvent * event) = 0;
+
+ /**
+ * This method will be called when a handle has been moved
+ *
+ */
+ virtual void handleMoveEvent(SelectionHandle * handle, QMouseEvent * event) = 0;
+
+ virtual SelectionHandle* getHandle() = 0;
! // virtual void setTarget(View* v) = 0;
private:
Index: ViewResizer.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/ViewResizer.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ViewResizer.h 2001/06/20 19:21:25 1.1.1.1
--- ViewResizer.h 2001/07/22 23:21:38 1.2
***************
*** 23,26 ****
--- 23,39 ----
class ViewResizer : public ViewSelector {
+ public:
+ ViewResizer(View * target);
+ virtual ~ViewResizer();
+
+ /** Left mouse button clicked
+ */
+ virtual void mouseLMBPress(QMouseEvent * e);
+
+ /** Implementation of interface EventHandler */
+ virtual void mouseMove(QMouseEvent* e);
+
+ protected:
+ void moveTarget(int diffx, int diffy);
};
#endif //VIEWRESIZER_H
Index: ViewSelector.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/common/manipulators/ViewSelector.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** ViewSelector.h 2001/06/20 19:21:25 1.1.1.1
--- ViewSelector.h 2001/07/22 23:21:38 1.2
***************
*** 21,26 ****
--- 21,48 ----
#include "AbstractViewManipulator.h"
#include "ige/common/views/SelectionHandle.h"
+ #include "ige/typedefs.h"
+ class SelectionLayer;
+
class ViewSelector : public AbstractViewManipulator {
+ public:
+ ViewSelector(View * target);
+ virtual ~ViewSelector();
+
+ // virtual void createHandles(SelectionLayer *layer) = 0;
+ virtual void placeHandles() = 0;
+
+ HandleVectorIter getHandleIterator() {
+ return handles.begin();
+ }
+
+ /** Left mouse button clicked
+ */
+ virtual void mouseLMBPress(QMouseEvent * e);
+
+ protected:
+ void removeAllHandles();
+ void addHandle(SelectionHandle *handle);
+
private:
|
|
From: Darius S. <dst...@us...> - 2001-07-22 23:21:41
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/net/editors
In directory usw-pr-cvs1:/tmp/cvs-serv2714/extensions/net/editors
Modified Files:
GraphLayer.cpp GraphLayer.h
Log Message:
Added more basic implementation for user interaction
Index: GraphLayer.cpp
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/net/editors/GraphLayer.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** GraphLayer.cpp 2001/06/20 19:21:15 1.1.1.1
--- GraphLayer.cpp 2001/07/22 23:21:38 1.2
***************
*** 21,25 ****
GraphLayer::~GraphLayer(){}
GraphLayer::GraphLayer(Viewer* v) : DataLayer(v) {}
! ViewMapIter GraphLayer::getDataIterator(){
// Return merged edge and vertex map
--- 21,25 ----
GraphLayer::~GraphLayer(){}
GraphLayer::GraphLayer(Viewer* v) : DataLayer(v) {}
! ViewVectorIter GraphLayer::getDataIterator(){
// Return merged edge and vertex map
Index: GraphLayer.h
===================================================================
RCS file: /cvsroot/kuml/kuml/kuml_gui/src/ige/extensions/net/editors/GraphLayer.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** GraphLayer.h 2001/06/20 19:21:15 1.1.1.1
--- GraphLayer.h 2001/07/22 23:21:38 1.2
***************
*** 34,38 ****
virtual ~GraphLayer();
! virtual ViewMapIter getDataIterator();
private:
--- 34,38 ----
virtual ~GraphLayer();
! virtual ViewVectorIter getDataIterator();
private:
|