GME  13
GUIObject.h
Go to the documentation of this file.
00001 #ifndef _GUIOBJECT_INCLUDED_
00002 #define _GUIOBJECT_INCLUDED_
00003 
00004 #include "Autoroute/AutoRouter.h"
00005 #include "GMEStd.h"
00006 #include <vector>
00007 #include <memory>
00008 
00009 class CGMEView;
00010 class CModelGrid;
00011 class CDecoratorEventSink;
00012 class CAnnotatorEventSink;
00013 
00014 extern CModelGrid modelGrid;
00015 
00016 void SetLocation(CRect& location, CPoint pt);
00017 
00018 class CGuiBase : public CObject
00019 {
00020 public:
00021         CGuiBase() : flag(0) {}
00022         CString& GetName() {return name;}
00023         CString& GetID() {return id;}
00024 
00025 public:
00026         CString name;
00027         CString id;
00028 
00029 protected:
00030         int flag;
00031 };
00032 
00033 class CGuiAspect : public CGuiBase
00034 {
00035 public:
00036         CGuiAspect(CGuiMetaAspect* meta, CGuiObject* p, int ind, int pind, CComPtr<IMgaDecorator>& decor,
00037                            CComPtr<IMgaElementDecorator>& newDecor, CComObjPtr<CDecoratorEventSink>& decorEventSink);
00038         virtual ~CGuiAspect();
00039 
00040 
00041 public:
00042         void InitPorts();
00043         
00044         CAutoRouterBox* GetRouterBox()                                  { return routerBox; }
00045         void SetRouterBox(CAutoRouterBox* rbox)                 { routerBox = rbox; }
00046         CAutoRouterBox* GetRouterNameBox()                              { return routerNameBox; }
00047         void SetRouterNameBox(CAutoRouterBox* rnbox)    { routerNameBox = rnbox; }
00048 
00049         const CRect& GetLocation()                                              { return loc; }
00050         const CRect& GetNameLocation()                                  { return nameLoc; }
00051         void SetLocation(const CRect& location);
00052         CComPtr<IMgaDecorator> GetDecorator()                   { return decorator; }
00053         CComPtr<IMgaElementDecorator> GetNewDecorator() { return newDecorator; }
00054         int     GetIndex()                                                                      { return index; }
00055         CGuiPortList& GetPortList()                                             { return ports; }
00056         CGuiObject* GetParent()                                                 { return parent; }
00057         
00058 public:
00059         CGuiObject*                             parent;
00060         CGuiMetaAspect*                 guiMeta;
00061 
00062 private:
00063         int                                             parentIndex;
00064         int                                             index;
00065         CGuiPortList                    ports;
00066         CComPtr<IMgaDecorator>  decorator;
00067         CComPtr<IMgaElementDecorator>   newDecorator;
00068         CComObjPtr<CDecoratorEventSink> decoratorEventSink;
00069         unsigned long                   features;
00070         CRect                                   loc;
00071         CRect                                   nameLoc;
00072         CAutoRouterBox*                 routerBox;
00073         CAutoRouterBox*                 routerNameBox;
00074 };
00075 
00076 class CGuiPort : public CGuiBase
00077 {
00078 public:
00079         CGuiPort(CGuiAspect *asp,CComPtr<IMgaFCO> fco);
00080 public:
00081         const CGuiConnectionList& GetInConns()          { return inConns; }
00082         const CGuiConnectionList& GetOutConns()         { return outConns; }
00083 
00084         void ReadARPreferences();
00085         bool GetPreference(CString& val, CString path);
00086         bool GetARPref(int dir);
00087         bool IsVisible();
00088         void SetVisible(bool v);
00089         CRect GetLocation();
00090         CAutoRouterPort* GetRouterPort()                        { return routerPort; }
00091         void SetRouterPort(CAutoRouterPort* port)       { routerPort = port; }
00092         CString GetInfoText()                                           { return name; }
00093         bool IsRealPort();
00094 
00095 public:
00096         CComPtr<IMgaFCO> mgaFco;
00097         CGuiAspect* parent;
00098         CGuiConnectionList inConns;
00099         CGuiConnectionList outConns;
00100         CComPtr<IMgaMetaFCO> metaFco;
00101         CComPtr<IMgaMetaRole> metaRole;
00102 
00103 private:
00104         bool autorouterPrefs[GME_AR_NUM];
00105         CAutoRouterPort* routerPort;
00106 };
00107 
00108 class AnnotatorDecoratorData
00109 {
00110 public:
00111         AnnotatorDecoratorData();
00112         AnnotatorDecoratorData(CComPtr<IMgaElementDecorator>& nD, CComObjPtr<CAnnotatorEventSink>& aES, const CRect& loc);
00113         virtual ~AnnotatorDecoratorData();
00114 
00115         CComPtr<IMgaElementDecorator>   decorator;
00116         CComObjPtr<CAnnotatorEventSink> annotatorEventSink;
00117         CRect                                                   location;
00118 };
00119 
00120 class CGuiAnnotator : public CGuiBase
00121 {
00122 public:
00123         CGuiAnnotator(CComPtr<IMgaModel>& pModel, CComPtr<IMgaRegNode>& mRootNode, CGMEView* vw, int numAsp);
00124         virtual ~CGuiAnnotator();
00125 
00126         void InitDecorator(int asp);
00127         void ToggleGrayOut()                                                    { GrayOut(!grayedOut); }
00128         void SetAspect(int a)                                                   { parentAspect = (a < numParentAspects ? a : 0); }
00129         bool IsVisible(int aspect = -1);
00130         bool IsResizable(void) const;
00131         bool IsSpecial()                                { return special; }
00132         void Draw(HDC pDC, Gdiplus::Graphics* gdip);
00133         void GrayOut(bool set = true);
00134 
00135         const CRect& GetLocation(int aspect = -1);
00136         void  SetLocation(const CRect& loc, int aspect = -1, bool doMga = true);
00137         void  ReadLocation(int aspect, CComPtr<IMgaRegNode> &aspNode);
00138         void  WriteLocation(int aspect = -1);
00139 
00140         static void SetAspect(CGuiAnnotatorList& list, int asp);
00141         static void GrayOutAnnotations(CGuiAnnotatorList& list, bool set = true);
00142         static void NudgeAnnotations(CGuiAnnotatorList& annotatorList, int right, int down);
00143         static void GetExtent(CGuiAnnotatorList& annotatorList, CRect& rect);
00144         static void GetRectList(CGuiAnnotatorList& selectedAnnotations, CRectList& annRects);
00145         static void MoveAnnotations(CGuiAnnotatorList& annList, CPoint& pt);
00146         static void FindUpperLeft(CGuiAnnotatorList& anns, int& left, int& top);
00147         static void ShiftAnnotations(CGuiAnnotatorList& annList, CPoint& shiftBy);
00148         static bool Showable( CComPtr<IMgaRegNode>& mRootNode, CComPtr<IMgaFCO>& baseType);
00149         static int  Hide( CComPtr<IMgaRegNode>& mRootNode);
00150         CComPtr<IMgaElementDecorator> GetDecorator(int asp) { return decoratorData[asp]->decorator; }
00151 
00152 public:
00153         CComPtr<IMgaRegNode>                                            rootNode;
00154 
00155 protected:
00156         CComPtr<IMgaModel>                                                      model;
00157         int                                                                                     numParentAspects;
00158         int                                                                                     parentAspect;
00159         bool                                                                            grayedOut;
00160         CGMEView*                                                                       view;
00161         std::vector<AnnotatorDecoratorData*>            decoratorData;
00162         bool                                                                            special;
00163 };
00164 
00165 class CGuiReference;
00166 class CGuiCompoundReference;
00167 class CGuiSet;
00168 
00169 class CGuiFco : public CGuiBase
00170 {
00171 public:
00172         CGuiFco(CComPtr<IMgaFCO>& pt, CComPtr<IMgaMetaRole>& role, CGMEView* vw, int numAsp);
00173         virtual ~CGuiFco() {}
00174 
00175         // This is a trick to speed up dynamic_cast
00176         virtual CGuiObject*                             dynamic_cast_CGuiObject(void)                           { return NULL; }
00177         virtual CGuiCompound*                   dynamic_cast_CGuiCompound(void)                         { return NULL; }
00178         virtual CGuiModel*                              dynamic_cast_CGuiModel(void)                            { return NULL; }
00179         virtual CGuiReference*                  dynamic_cast_CGuiReference(void)                        { return NULL; }
00180         virtual CGuiCompoundReference*  dynamic_cast_CGuiCompoundReference(void)        { return NULL; }
00181         virtual CGuiSet*                                dynamic_cast_CGuiSet(void)                                      { return NULL; }
00182         virtual CGuiConnection*                 dynamic_cast_CGuiConnection(void)                       { return NULL; }
00183 
00184 public:
00185         bool IsReal()                                                                   {return (mgaFco != NULL);}
00186         bool IsType()                                                                   {return isType;}
00187         void ToggleGrayOut()                                                    { GrayOut(!grayedOut); }
00188         void SetAspect(int a)                                                   { /*VERIFY(a < numParentAspects);*/ parentAspect = (a < numParentAspects ? a : 0); }
00189         metaref_type GetRoleMetaRef();
00190         bool IsPrimary(CGuiMetaModel* guiMetaModel, int aspectInd);
00191         bool IsPrimary(CGuiMetaModel* guiMetaModel, CGuiMetaAspect* guiAspect);
00192         bool GetPreference(CString& val, CString path);
00193         bool GetPreference(int& val, CString path, bool hex);
00194         bool GetColorPreference(unsigned long& color, CString path);
00195         int      GetParentAspect()                                                      { return parentAspect; }
00196         CGuiMetaModel*  GetGuiMetaParent();
00197         CGMEView*               GetView()                                               { return view; }
00198         
00199         static bool IsPrimary(CGuiMetaModel* guiMetaModel, CGuiMetaAspect* guiAspect, CComPtr<IMgaMetaRole>& metaRole);
00200         static void SetAspect(CGuiFcoList& list, int asp);
00201         static CGuiObject* FindObject(CComPtr<IMgaFCO>& fco, CGuiFcoList& fcoList);
00202         static CGuiConnection* FindConnection(CComPtr<IMgaFCO>& fco, CGuiConnectionList& conns);
00203         static void GrayOutFcos(CGuiFcoList &list, bool set = true);
00204         static void GrayOutFcos(CGuiConnectionList &list, bool set = true);
00205         static void GrayOutNonInternalConnections(CGuiConnectionList& list);
00206         static void ResetFlags(CGuiFcoList &list);
00207 
00208         virtual CString GetInfoText()                                   { return name + " (" + roleDisplayedName + ")"; }
00209         virtual CGuiMetaAttributeList* GetMetaAttributes();
00210         virtual void RemoveFromRouter(CAutoRouter &router) = 0;
00211         virtual bool IsVisible(int aspect = -1) = 0;
00212         virtual void Draw(HDC pDC, Gdiplus::Graphics* gdip) = 0;
00213         virtual void GrayOut(bool set = true)                   { grayedOut = set; }
00214 
00215 public:
00216         CComPtr<IMgaFCO> mgaFco;
00217         CComPtr<IMgaMetaRole> metaRole;
00218         CGuiMetaFco *guiMeta;
00219         CString kindName;
00220         CString roleName;
00221         CString kindDisplayedName;
00222         CString roleDisplayedName;
00223         CComPtr<IMgaMetaFCO> metaFco;
00224 
00225 protected:
00226         int numParentAspects;
00227         int parentAspect;
00228         bool grayedOut;
00229         bool isType;
00230         CGMEView* view;
00231 };
00232 
00233 class CGuiObject : public CGuiFco
00234 {
00235 public:
00236         CGuiObject(CComPtr<IMgaFCO>& pt, CComPtr<IMgaMetaRole>& role, CGMEView* vw, int numAsp);                                        // regular objects
00237         virtual ~CGuiObject();
00238         void InitObject(CWnd* viewWnd);                                                         // Need this because of virtual functions
00239 
00240         // This is a trick to speed up dynamic_cast
00241         virtual CGuiObject*                             dynamic_cast_CGuiObject(void)                           { return this; }
00242 
00243 public:
00244         void InitAspect(int asp, CComPtr<IMgaMetaPart>& metaPart, CString& decorStr, CWnd* viewWnd);
00245         void GetDecoratorStr(CString& str);
00246         const CRect& GetLocation(int aspect = -1)                       { aspect = (aspect < 0) ? parentAspect : aspect;  return guiAspects[aspect]->GetLocation(); }
00247         const CRect& GetNameLocation(int aspect = -1)           { aspect = (aspect < 0) ? parentAspect : aspect;  return guiAspects[aspect]->GetNameLocation(); }
00248         CSize GetSize(int aspect = -1)                                          { return GetLocation(aspect).Size(); }
00249         CPoint GetCenter()                                                                      { CRect rect = GetLocation(); return rect.CenterPoint();}
00250         void SetObjectLocation(CRect& rect, int aspect = -1, bool doMga = true);
00251         void SetSize(CSize& s, int aspect = -1, bool doMga = true);
00252         void SetAllSizes(CSize& s, bool doMga = true);
00253         void SetLocation(CRect& r, int aspect = -1, bool doMga = true);
00254         CSize GetNativeSize(int aspect = -1);
00255         void SetAllSizesToNative();                                                     // Used by non real objects
00256         int     MapAspect(int parent)                                                   { return guiAspects[parent] ? guiAspects[parent]->GetIndex() : -1; }
00257         void GetNeighbors(CGuiFcoList& list);
00258         void GetRelationsInOut(CGuiConnectionList& list, bool inOrOut);
00259         CGuiPortList& GetPorts()                                                        { VERIFY(GetCurrentAspect()); return GetCurrentAspect()->GetPortList(); }
00260         CGuiAspect* GetCurrentAspect()                                          { return guiAspects[parentAspect]; }
00261         CGuiPort* FindPort(CPoint& pt, bool lookNearToo = false);
00262         CGuiPort* FindPort(CComPtr<IMgaFCO> mgaFco);
00263         CAutoRouterBox* GetRouterBox()                                          { return GetCurrentAspect()->GetRouterBox(); }
00264         CAutoRouterBox* GetRouterNameBox()                                      { return GetCurrentAspect()->GetRouterNameBox(); }
00265         void SetRouterBox(CAutoRouterBox* rbox)                         { GetCurrentAspect()->SetRouterBox(rbox) ; }
00266         void SetRouterNameBox(CAutoRouterBox* rnbox)            { GetCurrentAspect()->SetRouterNameBox(rnbox) ; }
00267         void ReadAllLocations();
00268         void WriteLocation(int aspect = -1);
00269         bool IsHotspotEnabled() const                                           { return isHotspotEnabled; }
00270         void DeleteCustomizationOfConnections(CGuiConnectionList& conns, long aspect);
00271         void DeleteCustomizationOfInOutConnections(long aspect);
00272 
00273 public:
00274         void GrayOutNeighbors();
00275         bool IsInside(CPoint& pt, bool lookNearToo = false);
00276         bool IsLabelInside(CPoint& pt, bool lookNearToo = false);
00277 
00278         void IncrementAnimRefCnt();
00279         void DecrementAnimRefCnt();
00280 
00281         static void GetExtent(CGuiFcoList& objectList, CRect& rect);
00282         static void GetExtent(CGuiObjectList& objectList,CRect& rect);
00283         static CSize GetExtent(CGuiFcoList& list)                       {CRect rect; GetExtent(list, rect); return rect.Size();}
00284         static void MoveObjects(CGuiFcoList& fcoList, CPoint& pt);
00285         static void MoveObjects(CGuiObjectList& objectList, CPoint& pt);
00286         static void FindUpperLeft(CGuiObjectList& objs, int& left, int& top);
00287         static void ShiftModels(CGuiObjectList& objList, CPoint& shiftBy);
00288         void ResizeObject(const CRect& newLocation);
00289         static bool NudgeObjects(CGuiObjectList& modelList, int right, int down);
00290         static void GetRectList(CGuiObjectList& objList, CRectList& rects);
00291 
00292         virtual bool IsVisible(int aspect = -1)                         { return guiAspects[(aspect < 0 ? parentAspect : aspect)] != NULL; }
00293         virtual bool IsResizable(void);
00294         virtual void RemoveFromRouter(CAutoRouter& router)      { router.DeleteObject(this); }
00295         virtual void Draw(HDC pDC, Gdiplus::Graphics* gdip);
00296         virtual void GrayOut(bool set);
00297         virtual CGuiMetaAspect* GetKindAspect(CComPtr<IMgaMetaPart> metaPart);
00298 
00299 protected:
00300         CArray<CGuiAspect*,CGuiAspect*> guiAspects;
00301         bool isHotspotEnabled;
00302 };
00303 
00304 
00305 class CGuiCompound : public CGuiObject
00306 {
00307 public:
00308         CGuiCompound(CComPtr<IMgaFCO>& pt,CComPtr<IMgaMetaRole>& role, CGMEView* vw, int numAsp) : CGuiObject(pt, role, vw, numAsp) {}
00309 
00310         // This is a trick to speed up dynamic_cast
00311         virtual CGuiCompound*                   dynamic_cast_CGuiCompound(void)                         { return this; }
00312 };
00313 
00314 class CGuiModel : public CGuiCompound
00315 {
00316 public:
00317         CGuiModel(CComPtr<IMgaFCO>& pt, CComPtr<IMgaMetaRole>& role, CGMEView* vw, int numAsp);
00318 
00319         // This is a trick to speed up dynamic_cast
00320         virtual CGuiModel*                              dynamic_cast_CGuiModel(void)                            { return this; }
00321 
00322         virtual CGuiMetaAspect* GetKindAspect(CComPtr<IMgaMetaPart> metaPart);
00323         virtual CGuiMetaAttributeList* GetMetaAttributes();
00324 };
00325 
00326 class CReference
00327 {
00328 public:
00329         CReference(CComPtr<IMgaFCO> mgaRefd, CComPtr<IMgaFCO> mgaTermRefd);
00330 
00331 public:
00332         bool IsNull()                                                   { return mgaReferee == NULL; }
00333         CComPtr<IMgaFCO>& GetTerminalReferee()  { return mgaTerminalReferee; }
00334         CString GetInfoText(CString &name);
00335 
00336 protected:
00337         CComPtr<IMgaFCO> mgaReferee;
00338         CComPtr<IMgaFCO> mgaTerminalReferee;
00339         CString targetName;
00340         CString targetKindDisplayedName;
00341 };
00342 
00343 // both null and atom ref
00344 class CGuiReference : public CGuiObject, public CReference
00345 {
00346 public:
00347         CGuiReference(CComPtr<IMgaFCO>& pt, CComPtr<IMgaMetaRole>& role, CGMEView* vw, int numAsp, CComPtr<IMgaFCO> mgaRefd, CComPtr<IMgaFCO> mgaTermRefd) : CGuiObject(pt, role, vw, numAsp), CReference(mgaRefd, mgaTermRefd) {}
00348 
00349         // This is a trick to speed up dynamic_cast
00350         virtual CGuiReference*                  dynamic_cast_CGuiReference(void)                        { return this; }
00351 
00352 public:
00353         virtual CString GetInfoText() { return CReference::GetInfoText(name); }
00354 };
00355 
00356 class CGuiCompoundReference : public CGuiCompound, public CReference
00357 {
00358 public:
00359         CGuiCompoundReference(CComPtr<IMgaFCO>& pt, CComPtr<IMgaMetaRole>& role, CGMEView* vw, int numAsp, CComPtr<IMgaFCO> mgaRefd, CComPtr<IMgaFCO> mgaTermRefd) : CGuiCompound(pt, role, vw, numAsp), CReference(mgaRefd, mgaTermRefd) {}
00360 
00361         // This is a trick to speed up dynamic_cast
00362         virtual CGuiCompoundReference*  dynamic_cast_CGuiCompoundReference(void)        { return this; }
00363 
00364 public:
00365         virtual CString GetInfoText() { return CReference::GetInfoText(name); }
00366         virtual CGuiMetaAttributeList* GetMetaAttributes();
00367         virtual CGuiMetaAspect* GetKindAspect(CComPtr<IMgaMetaPart> metaPart);
00368 };
00369 
00370 
00371 class CGuiSet : public CGuiObject
00372 {
00373 public:
00374         CGuiSet(CComPtr<IMgaFCO>& pt, CComPtr<IMgaMetaRole>& role, CGMEView* vw, int numAsp) : CGuiObject(pt, role, vw, numAsp) {}
00375 
00376         // This is a trick to speed up dynamic_cast
00377         virtual CGuiSet*                                dynamic_cast_CGuiSet(void)                                      { return this; }
00378 
00379 public:
00380         void Init(CGuiFcoList& fcos, CGuiConnectionList& conns);
00381         bool CheckMember(CGuiFco* fco);
00382         bool ToggleMember(CGuiFco* member);
00383         void GrayOutMembers(bool set = true)    { GrayOutFcos(members, set); }
00384 
00385 protected:
00386         CGuiFcoList members;
00387 };
00388 
00389 class CGuiConnectionLabel {
00390 private:
00391         CString label;
00392         CPoint loc;
00393         int alignment;
00394         bool primary;
00395 public:
00396         CGuiConnectionLabel();
00397         virtual ~CGuiConnectionLabel();
00398         void SetLabel(const CString& l);
00399         void SetPrimary(bool prim);
00400         void SetLocation(const CPoint& endPoint, const CPoint& nextPoint, const CRect& box);
00401         void Draw(Gdiplus::Graphics* gdip, COLORREF color, CGuiConnection* conn);
00402         CPoint GetLocation(void) const;
00403         int GetAlignment(void) const;
00404         CString GetLabel(void) const;
00405 };
00406 
00407 class CGuiConnectionLabelSet {
00408 public:
00409         CGuiConnectionLabelSet();
00410         virtual ~CGuiConnectionLabelSet();
00411 private:
00412         CGuiConnectionLabel labels[GME_CONN_LABEL_NUM];
00413 public:
00414         void SetLabel(int index, const CString& label);
00415         void SetLocation(int index, const CPoint& endPoint, const CPoint& nextPoint, const CRect& box);
00416         void Draw(Gdiplus::Graphics* gdip, COLORREF color, CGuiConnection* conn);
00417         CPoint GetLocation(int index) const;
00418         int GetAlignment(int index) const;
00419         CString GetLabel(int index) const;
00420 };
00421 
00422 enum ConnectionPartMoveType {
00423         HorizontalEdgeMove                      = 0,
00424         VerticalEdgeMove                        = 1,
00425         AdjacentEdgeMove                        = 2,
00426         InsertNewCustomPoint            = 3,
00427         ModifyExistingCustomPoint       = 4
00428 };
00429 
00430 class CGuiConnection : public CGuiFco
00431 {
00432 public:
00433         CGuiConnection(CComPtr<IMgaFCO>& pt, CComPtr<IMgaMetaRole>& role, CGMEView* vw, int numAsp, bool resolve = true);
00434         virtual ~CGuiConnection() { }
00435 
00436         // This is a trick to speed up dynamic_cast
00437         virtual CGuiConnection*                 dynamic_cast_CGuiConnection(void)                       { return this; }
00438 
00439         void RefreshAttributeCache();
00440         CAutoRouterPath* GetRouterPath()                                                { return routerPath; }
00441         void SetRouterPath(CAutoRouterPath* path)                               { routerPath = path; }
00442         void GrayOutEndPoints();
00443         void ToggleHover()                                                                              { hovered = !hovered; }
00444         void SetSelect(bool sel)                                                                { selected = sel; }
00445         bool IsSelected() { return selected; }
00446         void GiveConnectionEndErroMessage(const TCHAR* mainMsg, const TCHAR* srcOrDst, const CGuiPort* otherPort) const;
00447         void Resolve();
00448         void ReadARPreferences();
00449         bool GetARPref(int dir) const { return autorouterPrefs[dir]; }
00450         void GetPointList(CPointList& points) const;
00451         int GetEdgeCount(void) const;
00452         CRect GetBounds(void) const;
00453         CPoint GetCenter(void) const;
00454         bool AdjustCoordLimits(CPointList& points, int edgeIndex, bool isPathEnd, bool xOrY, POSITION pos,
00455                                                    int ptCoord, int lastlastCoord, long& coordMinLimit, long& coordMaxLimit) const;
00456         int GetEdgeIndex(const CPoint& point, CPoint& startPoint, CPoint& endPoint, CPoint& thirdPoint,
00457                                          ConnectionPartMoveType& connectionMoveMethod, bool& horizontalOrVerticalEdge,
00458                                          bool& isPartFixed, long& xMinLimit, long& xMaxLimit,
00459                                          long& yMinLimit, long& yMaxLimit, bool checkPointOnEdge = true) const;
00460         int IsPathAt(const CPoint& point, ConnectionPartMoveType& connectionMoveMethod, bool& horizontalOrVerticalEdge,
00461                                  bool& isPartFixed) const;
00462         long IsPointOnSectionAndDeletable(long edgeIndex, const CPoint& point);
00463         std::vector<long> GetRelevantCustomizedEdgeIndexes(void);
00464         void FillOutCustomPathData(CustomPathData& pathData, PathCustomizationType custType, long asp, int newPosX, int newPosY,
00465                                                            int edgeIndex, int edgeCount, bool horizontalOrVerticalEdge);
00466         std::vector<CustomPathData> GetCurrentPathCustomizations(void);
00467         bool HasPathCustomization(void) const;
00468         bool HasPathCustomizationForCurrentAspect(int edgeIndex = -1) const;
00469         bool HasPathCustomizationForAspect(long asp, int edgeIndex = -1) const;
00470         bool HasPathCustomizationForTypeAndCurrentAspect(PathCustomizationType custType = Invalid, int edgeIndex = -1) const;
00471         bool HasPathCustomizationForTypeAndAspect(long asp, PathCustomizationType custType = Invalid, int edgeIndex = -1) const;
00472         void ReadCustomPathData(void);
00473         void WriteCustomPathData(bool handleTransaction = true);
00474         void InsertCustomPathData(const CustomPathData& pathData);
00475         void UpdateCustomPathData(const CustomPathData& pathData);
00476         void DeletePathCustomization(const CustomPathData& pathData);
00477         bool DeleteAllPathCustomizationsForAnAspect(long asp);
00478         bool DeleteAllPathCustomizationsForCurrentAspect(void);
00479         void DeleteAllPathCustomizationsForAllAspects(void);
00480         void RemoveDeletedPathCustomizations(const std::vector<CustomPathData>& customPathDat);
00481         void SnapCoordIfApplicable(CustomPathData* coordToSet, const CPoint& last, const CPoint& pt);
00482         bool VerticalAndHorizontalSnappingOfConnectionLineSegments(long asp, int edgeIndex = -1);
00483         bool IsAutoRouted(void) const;
00484         void SetAutoRouted(bool autoRouteState);
00485         bool NeedsRouterPathConversion(bool expectedAutoRouterState = true);
00486         void ConvertAutoRoutedPathToCustom(long asp, bool handleTransaction = false, bool expectedAutoRouterState = true);
00487         bool ReadAutoRouteState(void);
00488         void WriteAutoRouteState(bool handleTransaction = true);
00489         CGuiConnectionLabelSet& GetLabelSet(void);
00490 
00491         virtual bool IsVisible(int aspect = -1)                         { return visible && visible[aspect < 0 ? parentAspect : aspect]; }
00492         virtual void RemoveFromRouter(CAutoRouter &router);
00493         virtual void Draw(HDC pDC, Gdiplus::Graphics* gdip);
00494 
00495 protected:
00496 
00497 public:
00498         CGuiObject* src;
00499         CGuiPort* srcPort;
00500         CGuiObject* dst;
00501         CGuiPort* dstPort;
00502         CMapStringToString      attributeCache;
00503 
00504 private:
00505         CAutoRouterPath* routerPath;
00506         CGuiConnectionLabelSet labelset;
00507         std::unique_ptr<bool[]> visible;
00508         GMEConnLineType lineType;
00509         int srcStyle;
00510         int dstStyle;
00511         COLORREF color;
00512         COLORREF nameColor;
00513         bool autorouterPrefs[GME_AR_NUM];
00514         bool hovered;
00515         bool selected;
00516         bool connRegAutoRouteNotSet;
00517         bool isAutoRouted;
00518         std::vector<CustomPathData> customPathData;
00519 };
00520 
00521 
00522 
00523 
00524 
00525 #endif // whole file