insilmaril@0
|
1 |
#ifndef LINKABLEMAPOBJ_H
|
insilmaril@0
|
2 |
#define LINKABLEMAPOBJ_H
|
insilmaril@0
|
3 |
|
insilmaril@0
|
4 |
#include "frameobj.h"
|
insilmaril@0
|
5 |
#include "noteobj.h"
|
insilmaril@0
|
6 |
#include "headingobj.h"
|
insilmaril@0
|
7 |
#include "flagrowobj.h"
|
insilmaril@0
|
8 |
|
insilmaril@0
|
9 |
#define MAX_DEPTH 999
|
insilmaril@0
|
10 |
|
insilmaril@0
|
11 |
enum LinkOrient {OrientUndef,OrientLeftOfCenter, OrientRightOfCenter};
|
insilmaril@0
|
12 |
enum LinkStyle {
|
insilmaril@0
|
13 |
StyleUndef,
|
insilmaril@0
|
14 |
StyleLine,
|
insilmaril@0
|
15 |
StyleParabel,
|
insilmaril@0
|
16 |
StylePolyLine,
|
insilmaril@0
|
17 |
StylePolyParabel
|
insilmaril@0
|
18 |
};
|
insilmaril@0
|
19 |
enum LinkPos {LinkMiddle,LinkBottom};
|
insilmaril@0
|
20 |
enum LinkColorHint {DefaultColor,HeadingColor};
|
insilmaril@0
|
21 |
|
insilmaril@0
|
22 |
class LinkableMapObj:public QObject, public MapObj {
|
insilmaril@0
|
23 |
Q_OBJECT
|
insilmaril@0
|
24 |
public:
|
insilmaril@0
|
25 |
LinkableMapObj ();
|
insilmaril@0
|
26 |
LinkableMapObj (QCanvas*);
|
insilmaril@0
|
27 |
LinkableMapObj (LinkableMapObj*);
|
insilmaril@0
|
28 |
~LinkableMapObj ();
|
insilmaril@0
|
29 |
virtual void delLink();
|
insilmaril@0
|
30 |
virtual void init ();
|
insilmaril@0
|
31 |
virtual void copy (LinkableMapObj*);
|
insilmaril@0
|
32 |
void setChildObj (LinkableMapObj*);
|
insilmaril@0
|
33 |
virtual void setParObj (LinkableMapObj*);
|
insilmaril@0
|
34 |
virtual void setParObjTmp (LinkableMapObj*,QPoint,int); // Only for moving Obj around
|
insilmaril@0
|
35 |
virtual void unsetParObjTmp(); // reuse original ParObj
|
insilmaril@164
|
36 |
virtual bool hasParObjTmp();
|
insilmaril@0
|
37 |
LinkStyle getDefLinkStyle();
|
insilmaril@0
|
38 |
void setLinkStyle(LinkStyle);
|
insilmaril@0
|
39 |
LinkStyle getLinkStyle();
|
insilmaril@160
|
40 |
void setHideLinkUnselected(bool);
|
insilmaril@160
|
41 |
bool getHideLinkUnselected();
|
insilmaril@0
|
42 |
void setLinkPos (LinkPos);
|
insilmaril@0
|
43 |
LinkPos getLinkPos ();
|
insilmaril@0
|
44 |
|
insilmaril@0
|
45 |
virtual void setLinkColor(); // sets color according to colorhint, overloaded
|
insilmaril@0
|
46 |
virtual void setLinkColor(QColor);
|
insilmaril@0
|
47 |
QColor getLinkColor();
|
insilmaril@0
|
48 |
virtual FrameType getFrameType ();
|
insilmaril@0
|
49 |
virtual void setFrameType (const FrameType &);
|
insilmaril@0
|
50 |
virtual void setFrameType (const QString &);
|
insilmaril@0
|
51 |
virtual void setVisibility (bool);
|
insilmaril@0
|
52 |
virtual void updateLink(); // update parPos and childPos
|
insilmaril@0
|
53 |
// depending on pos
|
insilmaril@0
|
54 |
// redraw link with given style
|
insilmaril@0
|
55 |
LinkableMapObj* getChildObj(); // returns pointer to fromObj
|
insilmaril@0
|
56 |
LinkableMapObj* getParObj(); // returns pointer to toObj
|
insilmaril@106
|
57 |
virtual LinkableMapObj* findObjBySelect(QString s); // find obj by selectstring
|
insilmaril@0
|
58 |
QPoint getChildPos(); // returns pos where childs dock
|
insilmaril@0
|
59 |
QPoint getParPos(); // returns pos where parents dock
|
insilmaril@0
|
60 |
QPoint getRelPos(); // get position relative to parent (or (0,0))
|
insilmaril@0
|
61 |
LinkOrient getOrientation(); // get orientation
|
insilmaril@0
|
62 |
virtual int getDepth(); // return depth
|
insilmaril@0
|
63 |
virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag)
|
insilmaril@0
|
64 |
virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent);
|
insilmaril@0
|
65 |
virtual QPoint getRandPos(); // make randomised position
|
insilmaril@0
|
66 |
|
insilmaril@0
|
67 |
virtual void alignRelativeTo(const QPoint );
|
insilmaril@0
|
68 |
virtual void reposition();
|
insilmaril@0
|
69 |
virtual void requestReposition(); // do reposition after next user event
|
insilmaril@0
|
70 |
virtual void forceReposition(); // to force a reposition now (outside
|
insilmaril@0
|
71 |
// of mapeditor e.g. in noteeditor
|
insilmaril@0
|
72 |
virtual bool repositionRequested();
|
insilmaril@0
|
73 |
|
insilmaril@0
|
74 |
virtual QRect getTotalBBox()=0; // return BBox including childs
|
insilmaril@0
|
75 |
virtual QRect getBBoxSizeWithChilds()=0;// return size of BBox including childs
|
insilmaril@0
|
76 |
virtual void calcBBoxSizeWithChilds()=0;// calc size of BBox including childs recursivly
|
insilmaril@0
|
77 |
|
insilmaril@0
|
78 |
virtual void setSelBox();
|
insilmaril@0
|
79 |
virtual void select();
|
insilmaril@0
|
80 |
virtual void unselect();
|
insilmaril@0
|
81 |
virtual QString getSelectString()=0;
|
insilmaril@166
|
82 |
virtual QString saveToDir (const QString&,const QString&, const QPoint&)=0;// Save data to tempdir
|
insilmaril@0
|
83 |
|
insilmaril@0
|
84 |
protected:
|
insilmaril@0
|
85 |
void parabel(QPointArray &,double,double,double,double); // Create Parabel connecting two points
|
insilmaril@160
|
86 |
QString getLinkAttr();
|
insilmaril@160
|
87 |
|
insilmaril@0
|
88 |
QPoint childPos;
|
insilmaril@0
|
89 |
QPoint parPos;
|
insilmaril@0
|
90 |
bool link2ParPos; // While moving around, sometimes link to parent
|
insilmaril@0
|
91 |
MapEditor* mapEditor; // for updateNoteFlag() and toggleScroll()
|
insilmaril@0
|
92 |
LinkOrient orientation;
|
insilmaril@0
|
93 |
int linkwidth; // width of a link
|
insilmaril@0
|
94 |
int depth; // depth: undef=-1 mapCenter=0 branch=1..n
|
insilmaril@0
|
95 |
QRect bboxTotal; // bounding box including childs
|
insilmaril@0
|
96 |
|
insilmaril@0
|
97 |
LinkableMapObj* childObj;
|
insilmaril@0
|
98 |
LinkableMapObj* parObj;
|
insilmaril@0
|
99 |
LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
|
insilmaril@0
|
100 |
int offset; // vertical offset of dockpos to pos
|
insilmaril@0
|
101 |
|
insilmaril@0
|
102 |
int thickness_start; // for StylePoly*
|
insilmaril@160
|
103 |
LinkStyle style; // Current style
|
insilmaril@0
|
104 |
LinkPos linkpos;
|
insilmaril@0
|
105 |
QColor linkcolor; // Link color
|
insilmaril@0
|
106 |
QCanvasLine* l; // line style
|
insilmaril@0
|
107 |
QCanvasPolygon* p; // poly styles
|
insilmaril@0
|
108 |
int arcsegs; // arc: number of segments
|
insilmaril@0
|
109 |
QPtrList <QCanvasLine> segment; // a part of e.g. the parabel
|
insilmaril@0
|
110 |
QPointArray pa0; // For drawing of PolyParabel and PolyLine
|
insilmaril@0
|
111 |
QPointArray pa1; // For drawing of PolyParabel
|
insilmaril@0
|
112 |
QPointArray pa2; // For drawing of PolyParabel
|
insilmaril@0
|
113 |
QCanvasLine* bottomline; // on bottom of BBox
|
insilmaril@0
|
114 |
bool repositionRequest; //
|
insilmaril@0
|
115 |
|
insilmaril@0
|
116 |
bool selected; // Used for marking the selection
|
insilmaril@160
|
117 |
bool hideLinkUnselected; // to hide links if unselected
|
insilmaril@0
|
118 |
QCanvasRectangle* selbox;
|
insilmaril@0
|
119 |
FrameObj *frame; // frame around object
|
insilmaril@0
|
120 |
};
|
insilmaril@0
|
121 |
#endif
|