[GME-commit]
GMESRC/GME/Gme GME.dsp,1.88,1.89 GMEView.cpp,1.151,1.152
GUIObject.cpp,1.46,1.47 ModelGrid.cpp,1.3,1.4 ModelGrid.h,1.3,1.4
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Mon Jul 19 13:19:33 CDT 2004
Update of /var/lib/gme/GMESRC/GME/Gme
In directory braindrain:/tmp/cvs-serv4287/Gme
Modified Files:
GME.dsp GMEView.cpp GUIObject.cpp ModelGrid.cpp ModelGrid.h
Log Message:
AutoRouter and ModelGrid handle labels and their locations
CVS User: volgy
Index: GME.dsp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Gme/GME.dsp,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -d -r1.88 -r1.89
*** GME.dsp 24 May 2004 13:35:43 -0000 1.88
--- GME.dsp 19 Jul 2004 17:19:29 -0000 1.89
***************
*** 324,327 ****
--- 324,331 ----
# Begin Source File
+ SOURCE=.\ParadigmPropertiesDlg.cpp
+ # End Source File
+ # Begin Source File
+
SOURCE=.\PartBrowser.cpp
# End Source File
***************
*** 553,556 ****
--- 557,564 ----
# Begin Source File
+ SOURCE=.\ParadigmPropertiesDlg.h
+ # End Source File
+ # Begin Source File
+
SOURCE=.\PartBrowser.h
# End Source File
***************
*** 801,816 ****
# End Target
# End Project
! # Section GME : {5C402C89-C848-11D3-9A6E-00902721DB65}
! # 2:5:Class:CActiveBrowser
! # 2:10:HeaderFile:activebrowser.h
! # 2:8:ImplFile:activebrowser.cpp
! # End Section
! # Section GME : {5C402C8B-C848-11D3-9A6E-00902721DB65}
! # 2:21:DefaultSinkHeaderFile:activebrowser.h
! # 2:16:DefaultSinkClass:CActiveBrowser
! # End Section
! # Section GME : {B786F53C-297F-4DB8-8060-D45057217AEE}
! # 2:21:DefaultSinkHeaderFile:objectinspector.h
! # 2:16:DefaultSinkClass:CObjectInspector
# End Section
# Section GME : {B718CCF7-5055-40DD-9CBD-AB17F72AB113}
--- 809,816 ----
# End Target
# End Project
! # Section GME : {72ADFD7B-2C39-11D0-9903-00A0C91BC942}
! # 1:17:ID_INDICATOR_TIME:103
! # 2:2:BH:
! # 2:17:ID_INDICATOR_TIME:ID_INDICATOR_TIME
# End Section
# Section GME : {B718CCF7-5055-40DD-9CBD-AB17F72AB113}
***************
*** 819,827 ****
# 2:8:ImplFile:search.cpp
# End Section
- # Section GME : {72ADFD7B-2C39-11D0-9903-00A0C91BC942}
- # 1:17:ID_INDICATOR_TIME:103
- # 2:2:BH:
- # 2:17:ID_INDICATOR_TIME:ID_INDICATOR_TIME
- # End Section
# Section GME : {72ADFD78-2C39-11D0-9903-00A0C91BC942}
# 1:10:IDB_SPLASH:112
--- 819,822 ----
***************
*** 836,838 ****
--- 831,846 ----
# 2:21:DefaultSinkHeaderFile:search.h
# 2:16:DefaultSinkClass:CSearch
+ # End Section
+ # Section GME : {5C402C89-C848-11D3-9A6E-00902721DB65}
+ # 2:5:Class:CActiveBrowser
+ # 2:10:HeaderFile:activebrowser.h
+ # 2:8:ImplFile:activebrowser.cpp
+ # End Section
+ # Section GME : {B786F53C-297F-4DB8-8060-D45057217AEE}
+ # 2:21:DefaultSinkHeaderFile:objectinspector.h
+ # 2:16:DefaultSinkClass:CObjectInspector
+ # End Section
+ # Section GME : {5C402C8B-C848-11D3-9A6E-00902721DB65}
+ # 2:21:DefaultSinkHeaderFile:activebrowser.h
+ # 2:16:DefaultSinkClass:CActiveBrowser
# End Section
Index: GMEView.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Gme/GMEView.cpp,v
retrieving revision 1.151
retrieving revision 1.152
diff -C2 -d -r1.151 -r1.152
*** GMEView.cpp 2 Jun 2004 22:32:38 -0000 1.151
--- GMEView.cpp 19 Jul 2004 17:19:29 -0000 1.152
***************
*** 2940,2946 ****
if(!obj || !obj->IsVisible())
continue;
! CPoint pt = obj->GetCenter();
! if(!modelGrid.IsAvailable(obj->GetLocation())) {
! if(!modelGrid.GetClosestAvailable(obj->GetSize(),pt)) {
AfxMessageBox("Too Many Models! Internal Program Error!",MB_OK | MB_ICONSTOP);
EndWaitCursor();
--- 2940,2946 ----
if(!obj || !obj->IsVisible())
continue;
! CPoint pt = obj->GetLocation().CenterPoint();
! if(!modelGrid.IsAvailable(obj)) {
! if(!modelGrid.GetClosestAvailable(obj,pt)) {
AfxMessageBox("Too Many Models! Internal Program Error!",MB_OK | MB_ICONSTOP);
EndWaitCursor();
***************
*** 5481,5490 ****
void CGMEView::SyncOnGrid(CGuiObject *obj, int aspectIndexFrom, int aspectIndexTo)
{
! CRect loc = obj->GetLocation(aspectIndexFrom);
! CPoint center = loc.CenterPoint();
! CSize size = loc.Size();
! if (!modelGrid.IsAvailable(loc)) {
! if (!modelGrid.GetClosestAvailable(size, center)) {
AfxMessageBox("Too Many Models! Internal Program Error!",MB_OK | MB_ICONSTOP);
throw hresult_exception();
--- 5481,5488 ----
void CGMEView::SyncOnGrid(CGuiObject *obj, int aspectIndexFrom, int aspectIndexTo)
{
! CPoint center = obj->GetLocation(aspectIndexFrom).CenterPoint();
! if (!modelGrid.IsAvailable(obj, aspectIndexFrom)) {
! if (!modelGrid.GetClosestAvailable(obj, center)) {
AfxMessageBox("Too Many Models! Internal Program Error!",MB_OK | MB_ICONSTOP);
throw hresult_exception();
***************
*** 5492,5496 ****
}
obj->SetCenter(center, aspectIndexTo);
! modelGrid.Set(size,center);
}
--- 5490,5494 ----
}
obj->SetCenter(center, aspectIndexTo);
! modelGrid.Set(obj);
}
Index: GUIObject.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Gme/GUIObject.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** GUIObject.cpp 19 Jul 2004 15:22:58 -0000 1.46
--- GUIObject.cpp 19 Jul 2004 17:19:29 -0000 1.47
***************
*** 1434,1438 ****
VERIFY(obj->IsVisible());
CPoint point = obj->GetCenter() + shiftBy;
! if(!modelGrid.GetClosestAvailable(obj->GetSize(),point)) {
AfxMessageBox("Too Many Models! Internal Program Error!",MB_OK | MB_ICONSTOP);
return;
--- 1434,1438 ----
VERIFY(obj->IsVisible());
CPoint point = obj->GetCenter() + shiftBy;
! if(!modelGrid.GetClosestAvailable(obj,point)) {
AfxMessageBox("Too Many Models! Internal Program Error!",MB_OK | MB_ICONSTOP);
return;
***************
*** 1470,1475 ****
ASSERT(point.x % GME_GRID_SIZE == 0);
ASSERT(point.y % GME_GRID_SIZE == 0);
- ASSERT(modelGrid.IsAvailable(point,model->GetSize()));
model->SetCenter(point);
modelGrid.Set(model);
}
--- 1470,1475 ----
ASSERT(point.x % GME_GRID_SIZE == 0);
ASSERT(point.y % GME_GRID_SIZE == 0);
model->SetCenter(point);
+ ASSERT(modelGrid.IsAvailable(model));
modelGrid.Set(model);
}
Index: ModelGrid.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Gme/ModelGrid.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ModelGrid.cpp 7 Feb 2003 15:11:24 -0000 1.3
--- ModelGrid.cpp 19 Jul 2004 17:19:29 -0000 1.4
***************
*** 85,102 ****
}
! BOOL CModelGrid::CanNudge(CGuiObject *model,int right,int down)
! {
! ASSERT(right == 0 || down == 0); // no diagonal nudge!
! CRect r = model->GetLocation();
! right *= GME_GRID_SIZE;
! down *= GME_GRID_SIZE;
! r.right += right;
! r.left += right;
! r.top += down;
! r.bottom += down;
! return IsAvailable(r.CenterPoint(),r.Size());
! }
!
! BOOL CModelGrid::IsAvailableG(CPoint &pt,CSize &halfSize) // centerpoint!
{
int startx = pt.x - halfSize.cx;
--- 85,89 ----
}
! bool CModelGrid::IsAvailableG(CPoint &pt,CSize &halfSize) // centerpoint!
{
int startx = pt.x - halfSize.cx;
***************
*** 105,120 ****
int endy = pt.y + halfSize.cy;
if(startx < 0 || starty < 0 || endx >= GME_MAX_GRID_DIM || endy >= GME_MAX_GRID_DIM)
! return FALSE;
for(int i = starty; i < endy; i++)
for(int j = startx; j < endx; j++)
if(!IsAvailable(j,i))
! return FALSE;
! return TRUE;
}
- BOOL CModelGrid::IsAvailable(const CRect &rect)
- {
- return IsAvailable(rect.CenterPoint(),rect.Size());
- }
#define FindStartEnd(pt,size,chk) \
--- 92,103 ----
int endy = pt.y + halfSize.cy;
if(startx < 0 || starty < 0 || endx >= GME_MAX_GRID_DIM || endy >= GME_MAX_GRID_DIM)
! return false;
for(int i = starty; i < endy; i++)
for(int j = startx; j < endx; j++)
if(!IsAvailable(j,i))
! return false;
! return true;
}
#define FindStartEnd(pt,size,chk) \
***************
*** 133,170 ****
! BOOL CModelGrid::IsAvailable(CPoint pt,CSize size) // centerpoint!
{
FindStartEnd(pt,size,0);
if(startx < 0 || starty < 0 || endx >= GME_MAX_GRID_DIM || endy >= GME_MAX_GRID_DIM)
! return FALSE;
for(int y = starty; y < endy; y++)
for(int x = startx; x < endx; x++)
if(!IsAvailable(x,y))
! return FALSE;
! return TRUE;
! }
!
! void CModelGrid::Set(CGuiObject *model,CPoint &pt,BOOL reset) // centerpoint!
! {
! CSize s = model->GetSize();
! Set(s, pt, reset);
! }
!
! void CModelGrid::Set(CGuiObject *model,BOOL reset)
! {
! CPoint pt = model->GetCenter();
! Set(model,pt,reset);
! }
!
! void CModelGrid::Reset(CGuiObject *model)
! {
! Set(model,TRUE);
}
- void CModelGrid::Move(CGuiObject *model,CPoint &pt,BOOL /*force*/) // centerpoint!
- {
- Reset(model);
- Set(model,pt);
- }
#define test_and_return_if_found() \
--- 116,131 ----
! bool CModelGrid::IsAvailable(CPoint pt,CSize size) // centerpoint!
{
FindStartEnd(pt,size,0);
if(startx < 0 || starty < 0 || endx >= GME_MAX_GRID_DIM || endy >= GME_MAX_GRID_DIM)
! return false;
for(int y = starty; y < endy; y++)
for(int x = startx; x < endx; x++)
if(!IsAvailable(x,y))
! return false;
! return true;
}
#define test_and_return_if_found() \
***************
*** 175,179 ****
}
! BOOL CModelGrid::GetClosestAvailable(CSize size,CPoint &pt) // centerpoint!
{
if(IsAvailable(pt,size)) {
--- 136,140 ----
}
! bool CModelGrid::GetClosestAvailable(CSize size,CPoint &pt) // centerpoint!
{
if(IsAvailable(pt,size)) {
***************
*** 211,215 ****
! void CModelGrid::Set(CSize &size, CPoint ¢er, BOOL reset)
{
FindStartEnd(center,size,1);
--- 172,176 ----
! void CModelGrid::Set(CSize &size, CPoint ¢er, bool reset)
{
FindStartEnd(center,size,1);
***************
*** 217,219 ****
--- 178,257 ----
for(int x = startx; x < endx; x++)
reset ? Reset(x,y) : Set(x,y);
+ }
+
+
+
+ ///////////////////////////////////////////////////
+ // Public methods - accepts objects as parameters
+
+ void CModelGrid::Set(CGuiObject *model,bool reset)
+ {
+ CRect loc = model->GetLocation();
+ CPoint pt = loc.CenterPoint();
+ CSize s = loc.Size();
+ Set(s,pt,reset);
+
+ loc = model->GetNameLocation();
+ pt = loc.CenterPoint();
+ s = loc.Size();
+ Set(s,pt,reset);
+ }
+
+ void CModelGrid::Reset(CGuiObject *model)
+ {
+ Set(model,TRUE);
+ }
+
+ bool CModelGrid::IsAvailable(CGuiObject *model, int aspIdx)
+ {
+ CRect rect = model->GetLocation(aspIdx);
+ bool avail = modelGrid.IsAvailable(rect.CenterPoint(), rect.Size());
+
+ rect = model->GetNameLocation(aspIdx);
+ avail = avail && modelGrid.IsAvailable(rect.CenterPoint(), rect.Size());
+
+ return avail;
+ }
+
+ bool CModelGrid::GetClosestAvailable(CGuiObject *model,CPoint &pt)
+ {
+ CRect loc = model->GetLocation();
+ CRect nameLoc = model->GetNameLocation();
+ CRect unionLoc;
+ unionLoc.UnionRect(&loc, &nameLoc);
+
+ CSize offset = unionLoc.CenterPoint() - loc.CenterPoint();
+
+ offset.cx -= offset.cx % GME_GRID_SIZE;
+ offset.cy -= offset.cy % GME_GRID_SIZE;
+
+ pt += offset;
+
+ bool ret = GetClosestAvailable(unionLoc.Size(), pt);
+
+ pt -= offset;
+
+ return ret;
+ }
+
+ bool CModelGrid::CanNudge(CGuiObject *model,int right,int down)
+ {
+ ASSERT(right == 0 || down == 0); // no diagonal nudge!
+ CRect r = model->GetLocation();
+ right *= GME_GRID_SIZE;
+ down *= GME_GRID_SIZE;
+ r.right += right;
+ r.left += right;
+ r.top += down;
+ r.bottom += down;
+ bool can = IsAvailable(r.CenterPoint(),r.Size());
+
+ r = model->GetNameLocation();
+ r.right += right;
+ r.left += right;
+ r.top += down;
+ r.bottom += down;
+ can = can && IsAvailable(r.CenterPoint(),r.Size());
+
+ return can;
}
Index: ModelGrid.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Gme/ModelGrid.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ModelGrid.h 7 Feb 2003 15:11:24 -0000 1.3
--- ModelGrid.h 19 Jul 2004 17:19:29 -0000 1.4
***************
*** 18,37 ****
void SetSource(CGMEView *vw) { view = vw; }
void Set(int x,int y);
void Reset(int x,int y);
bool IsAvailable(int x,int y);
! void Clear();
! void Set(CSize &size, CPoint ¢er, BOOL reset = FALSE);
! void Set(CGuiObject *model,CPoint &pt,BOOL reset = FALSE);
! void Set(CGuiObject *model,BOOL reset = FALSE);
! void Reset(CGuiObject *model);
! void ConditionalReset(CGuiObject *model);
! void Move(CGuiObject *model,CPoint &pt,BOOL force = FALSE);
! BOOL CanNudge(CGuiObject *model,int right,int down);
! BOOL IsAvailable(const CRect &rect);
! BOOL IsAvailable(CPoint pt,CSize size);
! BOOL IsAvailableG(CPoint &pt,CSize &size);
! BOOL GetClosestAvailable(CSize size,CPoint &pt);
};
--- 18,43 ----
void SetSource(CGMEView *vw) { view = vw; }
+ void Clear();
+
+ void Set(CGuiObject *model,bool reset = FALSE);
+ void Reset(CGuiObject *model);
+
+ bool IsAvailable(CGuiObject *model, int aspIdx = -1);
+ bool GetClosestAvailable(CGuiObject *model,CPoint &pt);
+
+ bool CanNudge(CGuiObject *model,int right,int down);
+
+ private:
+
void Set(int x,int y);
void Reset(int x,int y);
bool IsAvailable(int x,int y);
! void Set(CSize &size, CPoint ¢er, bool reset = FALSE);
!
! bool IsAvailable(CPoint pt,CSize size);
! bool IsAvailableG(CPoint &pt,CSize &size);
!
! bool GetClosestAvailable(CSize size,CPoint &pt);
};
More information about the GME-commit
mailing list