[GME-commit] GMESRC/GME/Gme ConnityDlg.cpp, 1.1, 1.2 ConnityDlg.h, 1.1, 1.2 GME.rc, 1.166, 1.167 GMEView.cpp, 1.198, 1.199 GMEView.h, 1.81, 1.82 GUIObject.cpp, 1.59, 1.60 GUIObject.h, 1.26, 1.27 GraphicsUtil.cpp, 1.15, 1.16 GraphicsUtil.h, 1.8, 1.9 resource.h, 1.77, 1.78

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Thu Mar 27 16:43:10 CDT 2008


Update of /project/gme-repository/GMESRC/GME/Gme
In directory escher:/tmp/cvs-serv16806

Modified Files:
	ConnityDlg.cpp ConnityDlg.h GME.rc GMEView.cpp GMEView.h 
	GUIObject.cpp GUIObject.h GraphicsUtil.cpp GraphicsUtil.h 
	resource.h 
Log Message:
PortContextMenu,
Bold Conn Lines in Visualization mode
Follow In/Out Connections feature fixes.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: ConnityDlg.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/ConnityDlg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConnityDlg.h	18 Mar 2008 19:20:30 -0000	1.1
--- ConnityDlg.h	27 Mar 2008 21:43:08 -0000	1.2
***************
*** 13,20 ****
  
  	CGuiConnectionList* m_listC;
- 	CGuiFcoList*        m_listF;
  
  	CGuiConnection*     m_selectedC;
- 	CGuiFco*            m_selectedF;
  
  	bool                m_reverse;
--- 13,18 ----
***************
*** 32,39 ****
  
  	void setList( CGuiConnectionList& p_list);
- 	void setList( CGuiFcoList&        p_list);
  
  	CGuiConnection*    getSelectedC();
- 	CGuiFco*           getSelectedF();
  
  // Dialog Data
--- 30,35 ----

Index: GMEView.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEView.cpp,v
retrieving revision 1.198
retrieving revision 1.199
diff -C2 -d -r1.198 -r1.199
*** GMEView.cpp	18 Mar 2008 19:20:29 -0000	1.198
--- GMEView.cpp	27 Mar 2008 21:43:08 -0000	1.199
***************
*** 315,322 ****
  	ON_COMMAND(ID_CONNCNTX_PROPERTIES, OnConncntxProperties)
  	ON_COMMAND(ID_CONNCNTX_DELETE, OnConncntxDelete)
! 	ON_COMMAND(ID_CONNCNTX_FOLLOW, OnConncntxFollow)
! 	ON_COMMAND(ID_CONNCNTX_REVERSE, OnConncntxRevfollow)
  	ON_COMMAND(ID_CNTX_FOLLOWCONNECTION, OnCntxFollowConnection)
  	ON_COMMAND(ID_CNTX_REVERSECONNECTION, OnCntxRevfollowConnection)
  	ON_COMMAND(ID_JUMPALONGCONN, OnJumpAlongConnection)
  	ON_COMMAND(ID_BACKALONGCONN, OnBackAlongConnection)
--- 315,326 ----
  	ON_COMMAND(ID_CONNCNTX_PROPERTIES, OnConncntxProperties)
  	ON_COMMAND(ID_CONNCNTX_DELETE, OnConncntxDelete)
! 	ON_COMMAND(ID_CONNCNTX_FOLLOW, OnConnCntxFollow)
! 	ON_COMMAND(ID_CONNCNTX_REVERSE, OnConnCntxRevfollow)
! 	ON_COMMAND(ID_PORTCNTX_FOLLOWCONNECTION, OnPortCntxFollowConnection)
! 	ON_COMMAND(ID_PORTCNTX_REVERSECONNECTION, OnPortCntxRevfollowConnection)
  	ON_COMMAND(ID_CNTX_FOLLOWCONNECTION, OnCntxFollowConnection)
  	ON_COMMAND(ID_CNTX_REVERSECONNECTION, OnCntxRevfollowConnection)
+ 	ON_COMMAND(ID_CNTX_SHOWPORTINPARENT, OnCntxPortShowInParent)
+ 	ON_COMMAND(ID_CNTX_LOCATEPORTINBROWSER, OnCntxPortLocateInBrw)
  	ON_COMMAND(ID_JUMPALONGCONN, OnJumpAlongConnection)
  	ON_COMMAND(ID_BACKALONGCONN, OnBackAlongConnection)
***************
*** 331,336 ****
  	ON_UPDATE_COMMAND_UI(ID_CONNCNTX_DELETE, OnUpdateConncntxDelete)
  	ON_UPDATE_COMMAND_UI(ID_CNTX_CUT, OnUpdateCntxCut)
! 	ON_UPDATE_COMMAND_UI(ID_CONNCNTX_FOLLOW, OnUpdateConncntxFollow)
! 	ON_UPDATE_COMMAND_UI(ID_CONNCNTX_REVERSE, OnUpdateConncntxRevfollow)
  	ON_UPDATE_COMMAND_UI(ID_CNTX_FOLLOWCONNECTION, OnUpdateCntxFollowConnection)
  	ON_UPDATE_COMMAND_UI(ID_CNTX_REVERSECONNECTION, OnUpdateCntxRevfollowConnection)
--- 335,340 ----
  	ON_UPDATE_COMMAND_UI(ID_CONNCNTX_DELETE, OnUpdateConncntxDelete)
  	ON_UPDATE_COMMAND_UI(ID_CNTX_CUT, OnUpdateCntxCut)
! 	ON_UPDATE_COMMAND_UI(ID_PORTCNTX_FOLLOWCONNECTION, OnUpdatePortCntxFollowConnection)
! 	ON_UPDATE_COMMAND_UI(ID_PORTCNTX_REVERSECONNECTION, OnUpdatePortCntxRevfollowConnection)
  	ON_UPDATE_COMMAND_UI(ID_CNTX_FOLLOWCONNECTION, OnUpdateCntxFollowConnection)
  	ON_UPDATE_COMMAND_UI(ID_CNTX_REVERSECONNECTION, OnUpdateCntxRevfollowConnection)
***************
*** 514,517 ****
--- 518,522 ----
  	contextSelection = 0;
  	contextAnnotation = 0;
+ 	contextPort = 0;
  
  	tmpConnectMode = false;
***************
*** 1789,1793 ****
  		m_lstSelect.clear(); // clear the contents of these buffers [will be refilled soon] 
  		m_lstUnselect.clear();
! 		contextAnnotation = 0; contextSelection = 0; // these will be recalculated also
  		children.RemoveAll();
  		annotators.RemoveAll();
--- 1794,1798 ----
  		m_lstSelect.clear(); // clear the contents of these buffers [will be refilled soon] 
  		m_lstUnselect.clear();
! 		contextAnnotation = 0; contextSelection = 0; contextPort = 0;// these will be recalculated also
  		children.RemoveAll();
  		annotators.RemoveAll();
***************
*** 4390,4394 ****
--- 4395,4407 ----
  	contextMenuLocation = local;
  
+ 	contextPort = 0;
  	contextSelection = FindObject(local);
+ 	if( dynamic_cast<CGuiObject*>( contextSelection)) {
+ 		CGuiPort *port = dynamic_cast<CGuiObject*>( contextSelection)->FindPort( local);
+ 		if(port && port->IsRealPort()) {
+ 			contextPort = port;
+ 		}
+ 	}
+ 
  	if(contextSelection == 0)
  		contextSelection = router.FindConnection(local);
***************
*** 4516,4520 ****
  			}
  
! 			if(contextSelection) {
  				CMenu menu;
  				menu.LoadMenu(dynamic_cast<CGuiConnection *>(contextSelection) ? IDR_CONNCONTEXT_MENU : IDR_CONTEXT_MENU);
--- 4529,4546 ----
  			}
  
! 			if(contextPort) {
! 				CString itemname = CString( "[") + (contextSelection?(contextSelection->GetInfoText() + CString(" : ")): CString("")) + contextPort->GetInfoText() + CString( "]");
! 
! 				CMenu menu;
! 				menu.LoadMenu(IDR_PORTCONTEXT_MENU);
! 
! 				CMenu *sm = menu.GetSubMenu(0); ASSERT( sm);
! 				if( sm) {
! 					sm->InsertMenu( 0, MF_BYPOSITION|MF_SEPARATOR); 
! 					sm->InsertMenu( 0, MF_BYPOSITION|MFS_DEFAULT, ID_CNTX_SHOWPORTINPARENT, itemname);
! 					sm->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, global.x,global.y,GetParent());
! 				}
! 			}
! 			else if(contextSelection) {
  				CMenu menu;
  				menu.LoadMenu(dynamic_cast<CGuiConnection *>(contextSelection) ? IDR_CONNCONTEXT_MENU : IDR_CONTEXT_MENU);
***************
*** 4953,4956 ****
--- 4979,4983 ----
  		ShowProperties();
  	contextSelection = 0;
+ 	contextPort = 0;
  
  	/*CComPtr<IMgaFCO> fco;
***************
*** 5012,5015 ****
--- 5039,5043 ----
  	contextSelection = 0;
  	contextAnnotation = 0;
+ 	contextPort = 0;
  }
  
***************
*** 5029,5032 ****
--- 5057,5061 ----
  				}
  				contextSelection = 0;
+ 				contextPort = 0;
  				CommitTransaction();
  			}
***************
*** 5062,5065 ****
--- 5091,5095 ----
  		ShowAttributes();
  	contextSelection = 0;
+ 	contextPort = 0;
  }
  
***************
*** 5237,5240 ****
--- 5267,5271 ----
  		}
  		contextSelection = 0;
+ 		contextPort = 0;
  	}
  	else if (contextAnnotation) {
***************
*** 5273,5276 ****
--- 5304,5308 ----
  		}
  		contextSelection = 0;
+ 		contextPort = 0;
  	}
  	else if (contextAnnotation) {
***************
*** 5330,5333 ****
--- 5362,5366 ----
  		}
  		contextSelection = 0;
+ 		contextPort = 0;
  	}
  	else if (contextAnnotation) {
***************
*** 5368,5371 ****
--- 5401,5405 ----
  		}
  		contextSelection = 0;
+ 		contextPort = 0;
  	}
  	else if (contextAnnotation) {
***************
*** 5406,5409 ****
--- 5440,5444 ----
  		}
  		contextSelection = 0;
+ 		contextPort = 0;
  	}
  	if( contextAnnotation) {
***************
*** 5662,5665 ****
--- 5697,5701 ----
  			AfxMessageBox("Connection cannot be deleted!");
  		contextSelection = 0;
+ 		contextPort = 0;
  	}
  }
***************
*** 5670,5674 ****
  }
  
! void CGMEView::OnShowContextMenu()
  {
  	CGMEEventLogger::LogGMEEvent("CGMEView::OnShowContextMenu in "+path+name+"\r\n");
--- 5706,5710 ----
  }
  
! void CGMEView::OnShowContextMenu() // called from Accelerators like SHIFT+F10 or Property (VK_APPS)
  {
  	CGMEEventLogger::LogGMEEvent("CGMEView::OnShowContextMenu in "+path+name+"\r\n");
***************
*** 5747,5919 ****
  }
  
! void CGMEView::OnConncntxFollow()
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnConncntxFollow in "+path+name+"\r\n");
! 	if(isType) {
  		CGuiConnection *conn = dynamic_cast<CGuiConnection *>(contextSelection);
! 		if(!conn || !FollowLine( conn, false))
! 			AfxMessageBox("Can't follow along connection!");
  		contextSelection = 0;
  	}
  }
  
! void CGMEView::OnConncntxRevfollow()
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnConncntxRevfollow in "+path+name+"\r\n");
! 	if(isType) {
  		CGuiConnection *conn = dynamic_cast<CGuiConnection *>(contextSelection);
! 		if(!conn || !FollowLine( conn, true))
! 			AfxMessageBox("Can't follow connection in reverse!");
  		contextSelection = 0;
  	}
  }
  
! void CGMEView::OnCntxFollowConnection()
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnCntxFollowConnection in "+path+name+"\r\n");
! 	if( selected.GetCount() > 0)
! 		FollowLine( selected.GetHead(), 0, false);
! 	else
! 		FollowLine( lastObject, lastPort, false);
  }
  
! void CGMEView::OnCntxRevfollowConnection()
  {
  	CGMEEventLogger::LogGMEEvent("CGMEView::OnCntxRevfollowConnection in "+path+name+"\r\n");
! 	if( selected.GetCount() > 0)
! 		FollowLine( selected.GetHead(), 0, true);
! 	else
! 		FollowLine( lastObject, lastPort, true);
  }
  
! void CGMEView::OnJumpAlongConnection()
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnJumpAlongConnection in "+path+name+"\r\n");
  	if( selected.GetCount() > 0)
! 		FollowLine( selected.GetHead(), 0, false);
  }
  
! void CGMEView::OnBackAlongConnection()
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnBackAlongConnection in "+path+name+"\r\n");
  	if( selected.GetCount() > 0)
! 		FollowLine( selected.GetHead(), 0, true);
  }
  
! bool CGMEView::FollowLine( CGuiConnection *p_guiConn, bool p_reverse)
  {
! 	CGuiObject * next = 0;
! 	if( p_reverse)
! 		next = p_guiConn->src;
! 	else
! 		next = p_guiConn->dst;
  
! 	if( next && next->mgaFco && CGMEDoc::theInstance)
! 		CGMEDoc::theInstance->ShowObject( CComPtr<IUnknown>( next->mgaFco), TRUE);
  
! 	return true;
  }
  
! bool CGMEView::FollowLine( CGuiObject* p_guiObj, CGuiPort* p_guiPort, bool p_reverse)
  {
! 	CGuiObject* currO = p_guiObj;
! 	CGuiPort*   currP = p_guiPort;
  
! 	if( !currO && !currP)
! 		return false;
  
! 	int hmany = 0;
! 	if( currP) // initial examination of the number of connections to the port
! 	{
! 		CGuiConnectionList& curr_conns = p_reverse? currP->inConns: currP->outConns;
! 		hmany = curr_conns.GetCount();
! 	}
  
! 	if( currP && hmany > 0) // port selection has priority over object selection, but only if there are >0 ports
  	{
! 		CGuiConnectionList& curr_conns = p_reverse? currP->inConns: currP->outConns;
! 		int hmany = curr_conns.GetCount();
! 		if( hmany >= 1)
! 		{
! 			CGuiConnection*     a_conn       = curr_conns.GetHead();
! 			CGuiFco*            a_neighbor   = a_conn? p_reverse? a_conn->src: a_conn->dst: 0;
  
! 			if( hmany > 1)
! 			{
! 				CConnityDlg dlg( p_reverse);
! 				dlg.setList( curr_conns);
! 				if( IDOK != dlg.DoModal())
! 					return false;
  
! 				a_conn     = dlg.getSelectedC(); // owerwrite with the selected one (if > 1)
! 				a_neighbor = a_conn? p_reverse? a_conn->src: a_conn->dst: 0;
! 			}
  			
! 			if( a_neighbor)
! 			{
  				CGMEDoc::theInstance->ShowObject( CComPtr<IUnknown>( a_neighbor->mgaFco), TRUE);
! 				return true;
! 			}
  		}
- 		return false;
  	}
! 	else if( currO)
! 	{
! 		CGuiFcoList neighbor_list;
! 		currO->GetNeighborsInOut( neighbor_list, p_reverse);
! 		int hmany = neighbor_list.GetCount();
! 		if( hmany >= 1)
! 		{
! 			CGuiFco*         a_neighbor = neighbor_list.GetHead();
  
! 			if( hmany > 1)
! 			{
! 				CConnityDlg dlg( p_reverse);
! 				dlg.setList( neighbor_list);
! 				if( IDOK != dlg.DoModal())
! 					return false;
! 				a_neighbor = dlg.getSelectedF(); // owerwrite with the selected one (if > 1)
! 			}
  
! 			if( a_neighbor)
! 			{
! 				CGMEDoc::theInstance->ShowObject( CComPtr<IUnknown>( a_neighbor->mgaFco), TRUE);
! 				return true;
! 			}
! 		}
  		return false;
  	}
  
! 	return false;
  }
  
! void CGMEView::OnUpdateConncntxFollow(CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable(TRUE);
  }
  
! void CGMEView::OnUpdateConncntxRevfollow(CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable(TRUE);
  }
  
  void CGMEView::OnUpdateCntxFollowConnection( CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable(TRUE);
  }
  
  void CGMEView::OnUpdateCntxRevfollowConnection( CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable(TRUE);
  }
  
  void CGMEView::OnUpdateJumpAlongConnection(CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable( selected.GetCount() == 1);
  }
  
  void CGMEView::OnUpdateBackAlongConnection(CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable( selected.GetCount() == 1);
  }
  
--- 5783,5982 ----
  }
  
! void CGMEView::OnConnCntxFollow() // 'Go to Dst' context command of a connection 
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnConnCntxFollow in "+path+name+"\r\n");
! 	if(contextSelection) {
  		CGuiConnection *conn = dynamic_cast<CGuiConnection *>(contextSelection);
! 		FollowLine( conn, false, ::GetKeyState( VK_CONTROL) < 0);
  		contextSelection = 0;
+ 		contextPort = 0;
  	}
  }
  
! void CGMEView::OnConnCntxRevfollow() // 'Go to Src' context command of a connection
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnConnCntxRevfollow in "+path+name+"\r\n");
! 	if(contextSelection) {
  		CGuiConnection *conn = dynamic_cast<CGuiConnection *>(contextSelection);
! 		FollowLine( conn, true, ::GetKeyState( VK_CONTROL) < 0);
  		contextSelection = 0;
+ 		contextPort = 0;
  	}
  }
  
! void CGMEView::OnPortCntxFollowConnection() // 'Follow Connection' context command of a port
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnPortCntxFollowConnection in "+path+name+"\r\n");
! 	if( contextPort)
! 	{
! 		FollowLine( contextPort, false, ::GetKeyState( VK_CONTROL) < 0);
! 		contextSelection = 0;
! 		contextPort = 0;
! 	}
  }
  
! void CGMEView::OnPortCntxRevfollowConnection() // 'Follow Reverse Connection' context command of a port
  {
  	CGMEEventLogger::LogGMEEvent("CGMEView::OnCntxRevfollowConnection in "+path+name+"\r\n");
! 	if( contextPort)
! 	{
! 		FollowLine( contextPort, true, ::GetKeyState( VK_CONTROL) < 0);
! 		contextSelection = 0;
! 		contextPort = 0;
! 	}
  }
  
! void CGMEView::OnCntxFollowConnection() // 'Follow Connection' context command of an fco
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnCntxFollowConnection in "+path+name+"\r\n");
  	if( selected.GetCount() > 0)
! 		FollowLine( selected.GetHead(), false, ::GetKeyState( VK_CONTROL) < 0);
  }
  
! void CGMEView::OnCntxRevfollowConnection() // 'Follow Reverse Connection' context command of an fco
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnCntxRevfollowConnection in "+path+name+"\r\n");
  	if( selected.GetCount() > 0)
! 		FollowLine( selected.GetHead(), true, ::GetKeyState( VK_CONTROL) < 0);
  }
  
! void CGMEView::OnCntxPortShowInParent() // 'Show Port in Parent' context command of a PORT
  {
! 	if( !contextPort) return;
! 	
! 	CGMEDoc::theInstance->ShowObject( CComPtr<IUnknown>( contextPort->mgaFco), TRUE);
! 	contextPort = 0;
! }
  
! void CGMEView::OnCntxPortLocateInBrw() // 'Locate Port in Browser' context command of a PORT
! {
! 	if( !contextPort) return;
  
! 	CGMEBrowser::theInstance->FocusItem( CComBSTR( contextPort->id));
! 	contextPort = 0;
  }
  
! void CGMEView::OnJumpAlongConnection() // 'Jump Along Conn' command on the Navigation toolbar
  {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnJumpAlongConnection in "+path+name+"\r\n");
! 	if( selected.GetCount() > 0)
! 		FollowLine( selected.GetHead(), false, ::GetKeyState( VK_CONTROL) < 0);
! }
  
! void CGMEView::OnBackAlongConnection() // 'Jump back Along Conn' on Navigation toolbar
! {
! 	CGMEEventLogger::LogGMEEvent("CGMEView::OnBackAlongConnection in "+path+name+"\r\n");
! 	if( selected.GetCount() > 0)
! 		FollowLine( selected.GetHead(), true, ::GetKeyState( VK_CONTROL) < 0);
! }
  
! bool jumpToSelectedEnd( CGuiConnectionList& p_collOfConns, bool p_reverse, bool p_tryPort)
! {
! 	int hmany = p_collOfConns.GetCount();
  
! 	if( hmany > 0)
  	{
! 		CGuiConnection*     a_conn       = p_collOfConns.GetHead();
! 		CGuiFco*            a_neighbor   = a_conn? p_reverse? a_conn->src: a_conn->dst: 0;
! 		CGuiPort*           a_port       = a_conn? p_reverse? a_conn->srcPort: a_conn->dstPort: 0;
  
! 		if( hmany > 1)
! 		{
! 			CConnityDlg dlg( p_reverse);
! 			dlg.setList( p_collOfConns);
! 			if( IDOK != dlg.DoModal())
! 				return false;
  
! 			a_conn     = dlg.getSelectedC(); // owerwrite with the selected one (if > 1)
! 			a_neighbor = a_conn? p_reverse? a_conn->src: a_conn->dst: 0;
! 			a_port     = a_conn? p_reverse? a_conn->srcPort: a_conn->dstPort: 0;
! 		}
  			
! 		if( a_neighbor)
! 		{
! 			if( p_tryPort && a_port && a_port->IsRealPort())
! 				CGMEDoc::theInstance->ShowObject( CComPtr<IUnknown>( a_port->mgaFco), TRUE);
! 			else
  				CGMEDoc::theInstance->ShowObject( CComPtr<IUnknown>( a_neighbor->mgaFco), TRUE);
! 			return true;
  		}
  	}
! 	return false;
! }
  
! bool CGMEView::FollowLine( CGuiConnection *p_guiConn, bool p_reverse, bool p_tryPort)
! {
! 	if( !p_guiConn) 
! 		return false;
  
! 	CGuiConnectionList curr_conns;
! 	curr_conns.AddTail( p_guiConn);
! 
! 	return jumpToSelectedEnd( curr_conns, p_reverse, p_tryPort);
! }
! 
! bool CGMEView::FollowLine( CGuiPort* p_guiPort, bool p_reverse, bool p_tryPort)
! {
! 	if( !p_guiPort)
  		return false;
+ 
+ 	CGuiConnectionList& curr_conns = p_reverse? p_guiPort->inConns: p_guiPort->outConns;
+ 	return jumpToSelectedEnd( curr_conns, p_reverse, p_tryPort);
+ }
+ 
+ bool CGMEView::FollowLine( CGuiObject* p_guiObj, bool p_reverse, bool p_tryPort)
+ {
+ 	if( !p_guiObj)
+ 		return false;
+ 
+ 	CGuiConnectionList curr_conns;
+ 	p_guiObj->GetRelationsInOut( curr_conns, p_reverse);
+ 	return jumpToSelectedEnd( curr_conns, p_reverse, p_tryPort);
+ }
+ 
+ bool areConnsForSels( CGuiObjectList& p_sels, bool p_inOrOut)
+ {
+ 	CGuiConnectionList conn_list;
+ 	if( p_sels.GetCount() == 1)
+ 	{
+ 		CGuiObject* head = p_sels.GetHead();
+ 		if( head) head->GetRelationsInOut( conn_list, p_inOrOut);
  	}
+ 	return conn_list.GetCount() > 0;
+ }
  
! bool areConnsForPort( CGuiPort* p_contextPort, bool p_inOrOut)
! {
! 	return p_contextPort && (p_inOrOut? p_contextPort->inConns: p_contextPort->outConns).GetCount() > 0;
  }
  
! void CGMEView::OnUpdatePortCntxFollowConnection( CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable( areConnsForPort( contextPort, false));
  }
  
! void CGMEView::OnUpdatePortCntxRevfollowConnection( CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable( areConnsForPort( contextPort, true));
  }
  
  void CGMEView::OnUpdateCntxFollowConnection( CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable( areConnsForSels( selected, false));
  }
  
  void CGMEView::OnUpdateCntxRevfollowConnection( CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable( areConnsForSels( selected, true));
  }
  
  void CGMEView::OnUpdateJumpAlongConnection(CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable( areConnsForSels( selected, false));
  }
  
  void CGMEView::OnUpdateBackAlongConnection(CCmdUI* pCmdUI)
  {
! 	pCmdUI->Enable( areConnsForSels( selected, true));
  }
  
***************
*** 6063,6066 ****
--- 6126,6130 ----
  
  	contextSelection = 0;
+ 	contextPort = 0;
  }
  
***************
*** 6071,6074 ****
--- 6135,6139 ----
  	CGMEEventLogger::LogGMEEvent("CGMEView::OnEditShowtype in "+path+name+"\r\n");
  	contextSelection = 0;	// just to be on the safe side
+ 	contextPort = 0;
  	CComPtr<IMgaModel> type;
  	FindDerivedFrom(currentModel,type);
***************
*** 6089,6092 ****
--- 6154,6158 ----
  	ShowModel(type);
  	contextSelection = 0;
+ 	contextPort = 0;
  }
  
***************
*** 6105,6108 ****
--- 6171,6175 ----
  	ShowModel(type);
  	contextSelection = 0;
+ 	contextPort = 0;
  }
  
***************
*** 6123,6126 ****
--- 6190,6194 ----
  	ShowModel(type);
  	contextSelection = 0;
+ 	contextPort = 0;
  }
  
***************
*** 6313,6316 ****
--- 6381,6385 ----
  
  	contextSelection = 0;
+ 	contextPort = 0;
  
  }
***************
*** 6888,6891 ****
--- 6957,6978 ----
  	}
  
+ 	if (GetDocument()->GetEditMode() == GME_VISUAL_MODE)
+ 	{
+ 		CGMEView *self = const_cast<CGMEView *>(this);
+ 		CPoint point(screenpoint);
+ 		CoordinateTransfer(point);
+ 
+ 		CGuiObject *object = self? self->FindObject(point): 0;
+ 		// if object found, curr_Connection will be 0
+ 		CGuiConnection        *curr_Connection = object? 0: router.FindConnection( point);
+ 		static CGuiConnection *last_Connection = 0;
+ 		if( last_Connection != curr_Connection) // state change for at most two connections
+ 		{
+ 			if( last_Connection) last_Connection->ToggleSelect(); // if a previous was selected, now it will become unselected
+ 			if( curr_Connection) curr_Connection->ToggleSelect(); // toggle the new one
+ 			last_Connection = curr_Connection;
+ 			Invalidate();
+ 		} 
+ 	}
  	if ((GetDocument()->GetEditMode() == GME_AUTOCONNECT_MODE || GetDocument()->GetEditMode() == GME_SHORTAUTOCONNECT_MODE) || (tmpConnectMode)) {
  		CGMEView *self = const_cast<CGMEView *>(this);

Index: GMEView.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEView.h,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -d -r1.81 -r1.82
*** GMEView.h	18 Mar 2008 19:20:29 -0000	1.81
--- GMEView.h	27 Mar 2008 21:43:08 -0000	1.82
***************
*** 104,107 ****
--- 104,108 ----
  	CGuiAnnotator *contextAnnotation;
  	CGuiSet *currentSet;
+ 	CGuiPort *contextPort;
  	CString currentSetID;
  
***************
*** 167,172 ****
  	bool SendMouseOver4Object( CGuiObject * object);
  	bool SendNow();
! 	bool FollowLine( CGuiConnection *guiConn, bool reverse);
! 	bool FollowLine( CGuiObject* guiObj, CGuiPort* guiPort, bool reverse);
  	std::list<CGuiObject*> m_lstSelect;
  	std::list<CGuiObject*> m_lstUnselect;
--- 168,174 ----
  	bool SendMouseOver4Object( CGuiObject * object);
  	bool SendNow();
! 	bool FollowLine( CGuiConnection *guiConn, bool reverse, bool tryPort);
! 	bool FollowLine( CGuiObject* guiObj, bool reverse, bool tryPort);
! 	bool FollowLine( CGuiPort* guiPort, bool reverse, bool tryPort);
  	std::list<CGuiObject*> m_lstSelect;
  	std::list<CGuiObject*> m_lstUnselect;
***************
*** 360,365 ****
  	afx_msg void OnConncntxProperties();
  	afx_msg void OnConncntxDelete();
! 	afx_msg void OnConncntxFollow();
! 	afx_msg void OnConncntxRevfollow();
  	afx_msg void OnCntxClear();
  	afx_msg void OnUpdateCntxClear(CCmdUI* pCmdUI);
--- 362,367 ----
  	afx_msg void OnConncntxProperties();
  	afx_msg void OnConncntxDelete();
! 	afx_msg void OnConnCntxFollow();
! 	afx_msg void OnConnCntxRevfollow();
  	afx_msg void OnCntxClear();
  	afx_msg void OnUpdateCntxClear(CCmdUI* pCmdUI);
***************
*** 369,374 ****
  	afx_msg void OnUpdateConncntxDelete(CCmdUI* pCmdUI);
  	afx_msg void OnUpdateCntxCut(CCmdUI* pCmdUI);
- 	afx_msg void OnUpdateConncntxFollow(CCmdUI* pCmdUI);
- 	afx_msg void OnUpdateConncntxRevfollow(CCmdUI* pCmdUI);
  	afx_msg void OnCntxPreferences();
  	afx_msg void OnEditPreferences();
--- 371,374 ----
***************
*** 448,453 ****
--- 448,457 ----
  	afx_msg void OnCntxSrcarSet();
  	afx_msg void OnCntxDstarSet();
+ 	afx_msg void OnPortCntxFollowConnection();
+ 	afx_msg void OnPortCntxRevfollowConnection();
  	afx_msg void OnCntxFollowConnection();
  	afx_msg void OnCntxRevfollowConnection();
+ 	afx_msg void OnCntxPortShowInParent();
+ 	afx_msg void OnCntxPortLocateInBrw();
  	afx_msg void OnJumpAlongConnection();
  	afx_msg void OnBackAlongConnection();
***************
*** 469,472 ****
--- 473,478 ----
  	afx_msg void OnUpdateCntxNamePositionEast( CCmdUI* pCmdUI );
  	afx_msg void OnUpdateCntxNamePositionWest( CCmdUI* pCmdUI );
+ 	afx_msg void OnUpdatePortCntxFollowConnection( CCmdUI* pCmdUI );
+ 	afx_msg void OnUpdatePortCntxRevfollowConnection( CCmdUI* pCmdUI );
  	afx_msg void OnUpdateCntxFollowConnection( CCmdUI* pCmdUI );
  	afx_msg void OnUpdateCntxRevfollowConnection( CCmdUI* pCmdUI );

Index: GME.rc
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GME.rc,v
retrieving revision 1.166
retrieving revision 1.167
diff -C2 -d -r1.166 -r1.167
*** GME.rc	18 Mar 2008 19:20:29 -0000	1.166
--- GME.rc	27 Mar 2008 21:43:08 -0000	1.167
***************
*** 588,593 ****
          MENUITEM "Help",                        ID_CNTX_HELP
          MENUITEM SEPARATOR
!         MENUITEM "Jump Back Along Connection",  ID_CNTX_REVERSECONNECTION
!         MENUITEM "Jump Along Connection",       ID_CNTX_FOLLOWCONNECTION
      END
  END
--- 588,593 ----
          MENUITEM "Help",                        ID_CNTX_HELP
          MENUITEM SEPARATOR
!         MENUITEM "Follow Incoming Connection",  ID_CNTX_REVERSECONNECTION
!         MENUITEM "Follow Outgoing Connection",  ID_CNTX_FOLLOWCONNECTION
      END
  END
***************
*** 604,607 ****
--- 604,620 ----
  END
  
+ IDR_PORTCONTEXT_MENU MENU 
+ BEGIN
+     POPUP "PortCntx"
+     BEGIN
+         MENUITEM "Follow Incoming Connection",  ID_PORTCNTX_REVERSECONNECTION
+ 
+         MENUITEM "Follow Outgoing Connection",  ID_PORTCNTX_FOLLOWCONNECTION
+         MENUITEM SEPARATOR
+         MENUITEM "Show Port in Parent",         ID_CNTX_SHOWPORTINPARENT
+         MENUITEM "Locate Port in Browser",      ID_CNTX_LOCATEPORTINBROWSER
+     END
+ END
+ 
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 1108,1113 ****
  FONT 8, "MS Shell Dlg", 400, 0, 0x1
  BEGIN
!     LISTBOX         IDC_LIST1,7,7,206,53,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | 
!                     WS_TABSTOP
      DEFPUSHBUTTON   "OK",IDOK,50,65,50,14
      PUSHBUTTON      "Cancel",IDCANCEL,124,65,50,14
--- 1121,1126 ----
  FONT 8, "MS Shell Dlg", 400, 0, 0x1
  BEGIN
!     LISTBOX         IDC_LIST1,7,7,206,53,LBS_USETABSTOPS | 
!                     LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
      DEFPUSHBUTTON   "OK",IDOK,50,65,50,14
      PUSHBUTTON      "Cancel",IDCANCEL,124,65,50,14
***************
*** 1667,1672 ****
      ID_BUTTON33044          "Next Window\nNext Window"
      ID_VIEW_CLEARCONSOLE    "Clears Console Contents\nClears Console Contents"
!     ID_JUMPALONGCONN        "Jump Along Connection\nJump Along Connection"
!     ID_BACKALONGCONN        "Jump Back Along Connection\nJump Back Along Connection"
  END
  
--- 1680,1692 ----
      ID_BUTTON33044          "Next Window\nNext Window"
      ID_VIEW_CLEARCONSOLE    "Clears Console Contents\nClears Console Contents"
!     ID_CNTX_FOLLOWCONNECTION 
!                             "Jump to the destination of an outgoing connection"
!     ID_CNTX_REVERSECONNECTION "Jump to the source of an incoming connection"
!     ID_JUMPALONGCONN        "Jump to the destination of an outgoing connection\nJump Along Outgoing Connection"
! END
! 
! STRINGTABLE 
! BEGIN
!     ID_BACKALONGCONN        "Jump to the source of an incoming connection\nJump Along Incoming Connection"
  END
  

Index: GUIObject.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GUIObject.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** GUIObject.h	18 Mar 2008 19:23:57 -0000	1.26
--- GUIObject.h	27 Mar 2008 21:43:08 -0000	1.27
***************
*** 218,222 ****
  	int	MapAspect(int parent)							{ return guiAspects[parent] ? guiAspects[parent]->GetIndex() : -1; }
  	void GetNeighbors(CGuiFcoList &list);
! 	void GetNeighborsInOut(CGuiFcoList &list, bool inOrOut);
  	CGuiPortList &GetPorts()							{ VERIFY(GetCurrentAspect()); return GetCurrentAspect()->GetPortList(); }
  	CGuiAspect *GetCurrentAspect()						{ return guiAspects[parentAspect]; }
--- 218,222 ----
  	int	MapAspect(int parent)							{ return guiAspects[parent] ? guiAspects[parent]->GetIndex() : -1; }
  	void GetNeighbors(CGuiFcoList &list);
! 	void GetRelationsInOut(CGuiConnectionList &list, bool inOrOut);
  	CGuiPortList &GetPorts()							{ VERIFY(GetCurrentAspect()); return GetCurrentAspect()->GetPortList(); }
  	CGuiAspect *GetCurrentAspect()						{ return guiAspects[parentAspect]; }
***************
*** 364,367 ****
--- 364,368 ----
  	void SetRouterPath(CArPath *path) 		{ routerPath = path; }
  	void GrayOutEndPoints();
+ 	void ToggleSelect()                     { selected = !selected; }
  	void Resolve();
  	void ReadARPreferences();
***************
*** 389,392 ****
--- 390,394 ----
  	COLORREF nameColor;
  	bool* autorouterPrefs;
+ 	bool  selected;
  };
  

Index: resource.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/resource.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** resource.h	18 Mar 2008 19:20:29 -0000	1.77
--- resource.h	27 Mar 2008 21:43:08 -0000	1.78
***************
*** 77,80 ****
--- 77,81 ----
  #define IDD_PART_BROWSER_DIALOG         214
  #define IDD_CONNECTIVITYDIALOG          216
+ #define IDR_PORTCONTEXT_MENU            217
  #define IDC_NAME                        1000
  #define IDC_TYPENAME                    1001
***************
*** 419,422 ****
--- 420,427 ----
  #define ID_JUMPTONEXTOBJ                33061
  #define ID_SHOWCONTEXTMENU              33063
+ #define ID_CNTX_SHOWPORTINPARENT        33068
+ #define ID_CNTX_LOCATEPORTINBROWSER     33070
+ #define ID_PORTCNTX_REVERSECONNECTION   33071
+ #define ID_PORTCNTX_FOLLOWCONNECTION    33072
  #define IDW_TOOLBAR_MAIN                0xE820
  #define IDW_TOOLBAR_WINS                0xE821
***************
*** 430,435 ****
  #ifndef APSTUDIO_READONLY_SYMBOLS
  #define _APS_3D_CONTROLS                     1
! #define _APS_NEXT_RESOURCE_VALUE        217
! #define _APS_NEXT_COMMAND_VALUE         33064
  #define _APS_NEXT_CONTROL_VALUE         1125
  #define _APS_NEXT_SYMED_VALUE           115
--- 435,440 ----
  #ifndef APSTUDIO_READONLY_SYMBOLS
  #define _APS_3D_CONTROLS                     1
! #define _APS_NEXT_RESOURCE_VALUE        218
! #define _APS_NEXT_COMMAND_VALUE         33073
  #define _APS_NEXT_CONTROL_VALUE         1125
  #define _APS_NEXT_SYMED_VALUE           115

Index: GraphicsUtil.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GraphicsUtil.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** GraphicsUtil.h	15 Mar 2006 20:05:19 -0000	1.8
--- GraphicsUtil.h	27 Mar 2008 21:43:08 -0000	1.9
***************
*** 37,41 ****
  
  public:
! 	CPen *GetPen(COLORREF color, bool isPrinting = false, bool dash = false);
  	CBrush *GetBrush(COLORREF color);
  	CFont *GetFont(GMEFontKind kind);
--- 37,41 ----
  
  public:
! 	CPen *GetPen(COLORREF color, bool isPrinting = false, bool dash = false, int width = 1);
  	CBrush *GetBrush(COLORREF color);
  	CFont *GetFont(GMEFontKind kind);
***************
*** 47,51 ****
  	void DrawGrid(CDC *pDC,int xSpace,int ySpace,int maxx,int maxy,COLORREF color = GME_GRID_COLOR);
  	void DrawArrow(CDC *pDC,CPoint &beforeLast,CPoint &last, int iEnd );
! 	void DrawConnection(CDC *pDC,const CPointList &points,COLORREF color,int lineType,int srcEnd,int dstEnd,bool mark);
  	void DrawText(CDC *pDC,CString &txt,CPoint &pt,CFont *font,COLORREF color,int align);
  
--- 47,51 ----
  	void DrawGrid(CDC *pDC,int xSpace,int ySpace,int maxx,int maxy,COLORREF color = GME_GRID_COLOR);
  	void DrawArrow(CDC *pDC,CPoint &beforeLast,CPoint &last, int iEnd );
! 	void DrawConnection(CDC *pDC,const CPointList &points,COLORREF color,int lineType,int srcEnd,int dstEnd,bool mark,int lineStyle = 0);
  	void DrawText(CDC *pDC,CString &txt,CPoint &pt,CFont *font,COLORREF color,int align);
  

Index: GUIObject.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GUIObject.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** GUIObject.cpp	26 Mar 2008 16:46:56 -0000	1.59
--- GUIObject.cpp	27 Mar 2008 21:43:08 -0000	1.60
***************
*** 1297,1301 ****
  }
  
! void CGuiObject::GetNeighborsInOut(CGuiFcoList &list, bool p_inOrOut)
  {
  	VERIFY(GetCurrentAspect());
--- 1297,1301 ----
  }
  
! void CGuiObject::GetRelationsInOut(CGuiConnectionList &p_list, bool p_inOrOut)
  {
  	VERIFY(GetCurrentAspect());
***************
*** 1321,1327 ****
  			if( !conn) continue;
  
! 			// store its src/dst
! 			if( p_inOrOut? conn->src: conn->dst)
! 				list.AddTail( p_inOrOut? conn->src: conn->dst);
  		}
  	}
--- 1321,1326 ----
  			if( !conn) continue;
  
! 			// store it
! 			p_list.AddTail( conn);
  		}
  	}
***************
*** 2097,2101 ****
  ////////////////////////////////////////////////
  
! CGuiConnection::CGuiConnection(CComPtr<IMgaFCO> &pt,CComPtr<IMgaMetaRole> &role,CGMEView *vw,int numAsp,bool resolve) : CGuiFco(pt,role,vw,numAsp), routerPath(0), visible(0), src(0), srcPort(0), dst(0), dstPort(0), autorouterPrefs(0)
  {
  	if(resolve)
--- 2096,2100 ----
  ////////////////////////////////////////////////
  
! CGuiConnection::CGuiConnection(CComPtr<IMgaFCO> &pt,CComPtr<IMgaMetaRole> &role,CGMEView *vw,int numAsp,bool resolve) : CGuiFco(pt,role,vw,numAsp), routerPath(0), visible(0), src(0), srcPort(0), dst(0), dstPort(0), autorouterPrefs(0),selected(false)
  {
  	if(resolve)
***************
*** 2329,2333 ****
  	const CPointList &points = routerPath ? routerPath->GetPointList() : tmpPoints;
  
! 	graphics.DrawConnection(pDC,points,grayedOut ? GME_GRAYED_OUT_COLOR : color,lineType,srcStyle,dstStyle,true);
  
  	POSITION pos = points.GetHeadPosition();
--- 2328,2332 ----
  	const CPointList &points = routerPath ? routerPath->GetPointList() : tmpPoints;
  
! 	graphics.DrawConnection(pDC,points,grayedOut ? GME_GRAYED_OUT_COLOR : color,lineType,srcStyle,dstStyle,true,selected? 1: 0);
  
  	POSITION pos = points.GetHeadPosition();

Index: ConnityDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/ConnityDlg.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConnityDlg.cpp	18 Mar 2008 19:20:30 -0000	1.1
--- ConnityDlg.cpp	27 Mar 2008 21:43:08 -0000	1.2
***************
*** 23,29 ****
  	: CDialog(CConnityDlg::IDD, pParent)
  	, m_listC( 0)
- 	, m_listF( 0)
  	, m_selectedC( 0)
- 	, m_selectedF( 0)
  	, m_reverse( p_reverse)
  {
--- 23,27 ----
***************
*** 39,47 ****
  }
  
- void CConnityDlg::setList( CGuiFcoList&        p_list)
- {
- 	m_listF = &p_list;
- }
- 
  CGuiConnection*    CConnityDlg::getSelectedC()
  {
--- 37,40 ----
***************
*** 49,58 ****
  }
  
- CGuiFco*           CConnityDlg::getSelectedF()
- {
- 	return m_selectedF;
- }
- 
- 
  void CConnityDlg::DoDataExchange(CDataExchange* pDX)
  {
--- 42,45 ----
***************
*** 91,118 ****
  		{
  			CGuiConnection* one = m_listC->GetNext( pos);
  
! 			CString item = one? one->name: "Null";
! 			if( m_reverse)
! 			{
! 				item += CString( " : ") + ((one && one->src)? one->src->name: CString( "Null"));
! 			}
! 			else
  			{
! 				item += CString( " : ") + ((one && one->dst)? one->dst->name: CString( "Null"));
  			}
  
  			m_options.AddString( item);
  		}
  	}
- 	else if( m_listF && m_listF->GetCount() > 0)
- 	{
- 		POSITION pos = m_listF->GetHeadPosition();
- 		while( pos)
- 		{
- 			CGuiFco* one = m_listF->GetNext( pos);
- 
- 			m_options.AddString( one? one->name: "Null");
- 		}
- 	}
  
  	return TRUE;
--- 78,98 ----
  		{
  			CGuiConnection* one = m_listC->GetNext( pos);
+ 			if( !one) continue;
  
! 			CGuiObject* end = m_reverse? one->src    : one->dst;
! 			CGuiPort*  port = m_reverse? one->srcPort: one->dstPort;
! 
! 			CString item;
! 			item += ( !one->name.IsEmpty()? one->name: one->kindName);
! 			if( end && port && port->IsRealPort())
  			{
! 				item += " -> [ " + end->name + " : " + port->name + " ]";
  			}
+ 			else if( end)
+ 				item += " -> " + end->name;
  
  			m_options.AddString( item);
  		}
  	}
  
  	return TRUE;
***************
*** 134,148 ****
  			if( ++pos_i == which)
  				m_selectedC = one;
- 		}
- 	}
- 	else if( m_listF && m_listF->GetCount() > 0)
- 	{
- 		int pos_i = -1;
- 		POSITION pos = m_listF->GetHeadPosition();
- 		while( pos)
- 		{
- 			CGuiFco* one = m_listF->GetNext( pos);
- 			if( ++pos_i == which)
- 				m_selectedF = one;
  		}
  	}
--- 114,117 ----

Index: GraphicsUtil.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GraphicsUtil.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** GraphicsUtil.cpp	15 Mar 2006 20:05:19 -0000	1.15
--- GraphicsUtil.cpp	27 Mar 2008 21:43:08 -0000	1.16
***************
*** 204,208 ****
  }
  
! CPen *CGraphics::GetPen(COLORREF color, bool isPrinting, bool dash)
  {
  	LOGBRUSH logb = {BS_SOLID, 0, 0};
--- 204,208 ----
  }
  
! CPen *CGraphics::GetPen(COLORREF color, bool isPrinting, bool dash, int width /* = 1 */)
  {
  	LOGBRUSH logb = {BS_SOLID, 0, 0};
***************
*** 211,215 ****
  	// print real dashed line
  	CPen *pen = 0;
! 	if(!((dash ? (isPrinting? dashPrintPens: dashPens) : (isPrinting? printPens: pens)).Lookup((void *)color,pen))) {
  		pen = new CPen();
  //		pen->CreatePen((dash ? PS_DOT : PS_SOLID),1,color);
--- 211,215 ----
  	// print real dashed line
  	CPen *pen = 0;
! 	if( width != 1 || !((dash ? (isPrinting? dashPrintPens: dashPens) : (isPrinting? printPens: pens)).Lookup((void *)color,pen))) {
  		pen = new CPen();
  //		pen->CreatePen((dash ? PS_DOT : PS_SOLID),1,color);
***************
*** 220,225 ****
  //			&logb, (dash && isPrinting)? 2: 0, (dash && isPrinting)? dashstyle: NULL);
  		pen->CreatePen((dash ? (isPrinting? PS_USERSTYLE|PS_GEOMETRIC: PS_DOT) : 
! 			(isPrinting? PS_USERSTYLE|PS_GEOMETRIC: PS_SOLID)), (isPrinting? 1: 1),
  				&logb, (isPrinting)? 2: 0, (isPrinting)? (dash? dashstyle: solidstyle): NULL);
  		(dash ? (isPrinting? dashPrintPens: dashPens) : (isPrinting? printPens: pens)).SetAt((void *)color,pen);
  	}
--- 220,226 ----
  //			&logb, (dash && isPrinting)? 2: 0, (dash && isPrinting)? dashstyle: NULL);
  		pen->CreatePen((dash ? (isPrinting? PS_USERSTYLE|PS_GEOMETRIC: PS_DOT) : 
! 			(isPrinting? PS_USERSTYLE|PS_GEOMETRIC: PS_SOLID|PS_GEOMETRIC)), (isPrinting? 1: width),
  				&logb, (isPrinting)? 2: 0, (isPrinting)? (dash? dashstyle: solidstyle): NULL);
+ 		if( width == 1) // only if regular
  		(dash ? (isPrinting? dashPrintPens: dashPens) : (isPrinting? printPens: pens)).SetAt((void *)color,pen);
  	}
***************
*** 259,263 ****
  #pragma warning ( disable : 4100 ) // Unreferenced formal param
  void CGraphics::DrawConnection(CDC *pDC,const CPointList &points,COLORREF color,int lineType,
! 							   int srcEnd,int dstEnd,bool mark)
  {
  	if( points.GetCount()==0 )
--- 260,264 ----
  #pragma warning ( disable : 4100 ) // Unreferenced formal param
  void CGraphics::DrawConnection(CDC *pDC,const CPointList &points,COLORREF color,int lineType,
! 							   int srcEnd,int dstEnd,bool mark,int lineStyle /* = 0 */)
  {
  	if( points.GetCount()==0 )
***************
*** 270,274 ****
  	}
  
! 	CPen *pen = GetPen(color, pDC->IsPrinting()!=FALSE, lineType > 0);
  	CPen *oldpen = pDC->SelectObject(pen);
  	CBrush *brush = GetBrush(color);
--- 271,278 ----
  	}
  
! 	// the color has to be altered a little bit, because the predefined PenMap has color at its key 
! 	// so it will confuse this bold Pen with already existing pens
! 	//CPen *pen = GetPen(color, pDC->IsPrinting()!=FALSE, lineType > 0);
! 	CPen *pen = GetPen(/*lineStyle > 0? (color+0x0f0f0f):*/ color, pDC->IsPrinting()!=FALSE, lineType > 0, lineStyle > 0? 5: 1);
  	CPen *oldpen = pDC->SelectObject(pen);
  	CBrush *brush = GetBrush(color);
***************
*** 306,309 ****
--- 310,315 ----
  	pDC->SelectObject(oldbrush);
  	pDC->SelectObject(oldpen);
+ 	
+ 	if( lineStyle > 0) pen->DeleteObject(); // delete special pen
  }
  #pragma warning ( default : 4100 ) // Unreferenced formal param



More information about the GME-commit mailing list