[GME-commit] GMESRC/GME/Gme GMEView.cpp,1.135,1.136

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Thu Mar 25 10:45:22 CST 2004


Update of /var/lib/gme/GMESRC/GME/Gme
In directory braindrain:/tmp/cvs-serv10483

Modified Files:
	GMEView.cpp 
Log Message:
Panning Window embedded

CVS User: bogyom

Index: GMEView.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Gme/GMEView.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -C2 -d -r1.135 -r1.136
*** GMEView.cpp	12 Mar 2004 23:29:14 -0000	1.135
--- GMEView.cpp	25 Mar 2004 16:45:20 -0000	1.136
***************
*** 1,3 ****
! // GMEView.cpp : implementation of the CGMEView class
  //
  
--- 1,3 ----
! z// GMEView.cpp : implementation of the CGMEView class
  //
  
***************
*** 44,48 ****
  };*/
  
! #define END_SCROLL_OFFSET 50
  
  #ifdef _DEBUG
--- 44,48 ----
  };*/
  
! // #define END_SCROLL_OFFSET 50 // not used - instead EXTENT_ERROR_CORR
  
  #ifdef _DEBUG
***************
*** 88,92 ****
  		// PETER END
  		break;
! 	case GLOBALEVENT_NOTIFICATION_READY:
  		VERIFY(view);
  		POSITION pos = viewsToKill.GetHeadPosition();
--- 88,92 ----
  		// PETER END
  		break;
! 	case GLOBALEVENT_NOTIFICATION_READY: 
  		VERIFY(view);
  		POSITION pos = viewsToKill.GetHeadPosition();
***************
*** 105,108 ****
--- 105,109 ----
  			attrNeedsRefresh = false;
  		}
+ 		view->m_refreshpannwin = true; // terge 
  		break;
  	}
***************
*** 208,211 ****
--- 209,213 ----
  						COMTHROW(object->get_Name(&bstr));
  						CopyTo(bstr,conn->name);
+ 						// ?? 
  						view->Invalidate();
  					}
***************
*** 396,399 ****
--- 398,402 ----
  	m_lastPrnPage = 0;
  	m_zoomVal = ZOOM_NO;
+ 	m_refreshpannwin = false;
  
  	initDone = false;
***************
*** 478,481 ****
--- 481,546 ----
  // CGMEView drawing
  
+ #define PANNING_RATIO	4 // ??
+ void CGMEView::DoPannWinRefresh()
+ {
+ 	// the original size of the image
+ 	CRect extent, objext, annext;
+ 	CGuiObject::GetExtent(children,objext);
+ 	CGuiAnnotator::GetExtent(annotators,annext);
+ 	extent.UnionRect(&objext, &annext);
+ 	extent.right = (int)(extent.right*EXTENT_ERROR_CORR); // ??
+ 	extent.bottom = (int)(extent.bottom*EXTENT_ERROR_CORR); // ??
+ 	
+ 	CRect target = CRect(0, 0, extent.Width()/PANNING_RATIO, extent.Height()/PANNING_RATIO);
+ 
+ 	// make a bitmap DC
+ 	CDC *pannDC = new CDC();
+ 	CClientDC tmpDC(this);
+ 
+ 	BOOL ret1 = pannDC->CreateCompatibleDC(&tmpDC);
+ 	CBitmap * pannBmp = new CBitmap();
+ 
+ 
+ 	BOOL ret2 = pannBmp->CreateCompatibleBitmap(&tmpDC, target.Width(), target.Height());
+ 	pannDC->SelectObject(pannBmp);
+ 
+ 	pannDC->SetMapMode(MM_TEXT);
+ 	DWORD dw1 = GetSysColor(COLOR_WINDOW);
+ 	BYTE r1 = GetRValue(dw1);
+ 	BYTE g1 = GetGValue(dw1); 
+ 	BYTE b1 = GetBValue(dw1); 
+ 	pannDC->FillSolidRect(&target, RGB(r1,g1,b1));
+ 
+ 	pannDC->SetMapMode(MM_ISOTROPIC);
+ 	pannDC->SetWindowExt(extent.Width(), extent.Height());
+ 	pannDC->SetViewportExt(target.Width(), target.Height());
+ 
+ 	{
+ 		// draw the image
+ 		POSITION pos = annotators.GetHeadPosition();
+ 			while (pos) {
+ 			CGuiAnnotator *annotator = annotators.GetNext(pos);
+ 			if (annotator->IsVisible()) {
+ 				annotator->Draw(pannDC);
+ 			}
+ 		}
+ 
+ 		pos = children.GetHeadPosition();
+ 		while(pos) {
+ 			CGuiFco *fco = children.GetNext(pos);
+ 			if(fco->IsVisible()) {
+ 				CGuiConnection *conn = dynamic_cast<CGuiConnection *>(fco);
+ 				if(!conn)
+ 					fco->Draw(pannDC);
+ 			}
+ 		}
+ 	}
+ 
+ 	// force CPanningWindow to reset the DC 
+ 	CMainFrame* main = (CMainFrame*)AfxGetMainWnd();
+ 
+ 	main->m_pannWin.SetBitmapDC(pannDC, extent, target);
+ }
+ 
  void CGMEView::OnDraw(CDC* pDC)
  {
***************
*** 496,502 ****
  		CGuiAnnotator::GetExtent(annotators, annext);
  		extent.UnionRect(&objext, &annext);
  		CSize s(extent.right, extent.bottom);
! 		s.cx = s.cx + END_SCROLL_OFFSET;
! 		s.cy = s.cy + END_SCROLL_OFFSET;
  		CRect rect;
  		GetClientRect(&rect);
--- 561,569 ----
  		CGuiAnnotator::GetExtent(annotators, annext);
  		extent.UnionRect(&objext, &annext);
+ 		extent.right = (int)(extent.right*EXTENT_ERROR_CORR); // ??
+ 		extent.bottom = (int)(extent.bottom*EXTENT_ERROR_CORR); // ??
  		CSize s(extent.right, extent.bottom);
! //		s.cx = s.cx + END_SCROLL_OFFSET;
! //		s.cy = s.cy + END_SCROLL_OFFSET;
  		CRect rect;
  		GetClientRect(&rect);
***************
*** 528,531 ****
--- 595,599 ----
  	*/
  
+ 
  	POSITION pos = annotators.GetHeadPosition();
  	while (pos) {
***************
*** 658,664 ****
--- 726,738 ----
  		CPoint pt = GetScrollPosition();
  		onScreen->BitBlt(pt.x-5,pt.y-5,r.Width()+10,r.Height()+10,offScreen,pt.x-5,pt.y-5,SRCCOPY);
+ 		if (m_refreshpannwin)
+ 		{
+ 			m_refreshpannwin = false;
+ 			DoPannWinRefresh();
+ 		}
  	}
  }
  
+ 
  void CGMEView::OnInitialUpdate()
  {
***************
*** 757,760 ****
--- 831,835 ----
  
  	// AutoRoute();
+ 	DoPannWinRefresh(); // terge - new window opened
  	SetScroll();
  	SetCenterObject(centerObj);
***************
*** 1031,1034 ****
--- 1106,1111 ----
  		CGuiAnnotator::GetExtent(annotators,annext);
  		extent.UnionRect(&objext, &annext);
+ 		extent.right = (int)(extent.right*EXTENT_ERROR_CORR); // ??
+ 		extent.bottom = (int)(extent.bottom*EXTENT_ERROR_CORR); // ??
  		double wpage, hpage;
  		double wmargin = GetDeviceCaps(pDC->m_hDC,PHYSICALOFFSETX);
***************
*** 1038,1042 ****
  
  		// headerY was calculated with another scaling
! 		pDC->SetWindowExt((int)(extent.right*1.1), (int)(extent.bottom*1.1));
  		int devheader = (headerY)? (int)(pDC->GetDeviceCaps(LOGPIXELSY)/3): 0; // I know it is 1/3 inch - pfujj
  
--- 1115,1119 ----
  
  		// headerY was calculated with another scaling
! 		pDC->SetWindowExt(extent.right, extent.bottom);
  		int devheader = (headerY)? (int)(pDC->GetDeviceCaps(LOGPIXELSY)/3): 0; // I know it is 1/3 inch - pfujj
  
***************
*** 1064,1068 ****
  		timerID = 0;
  	}
!    CScrollZoomView::OnDestroy();
  }
  
--- 1141,1149 ----
  		timerID = 0;
  	}
! 	CMainFrame* main = (CMainFrame*)AfxGetMainWnd();
! 
! 	CRect extent(0,0,0,0), target(0,0,0,0); // terge
! 	main->m_pannWin.SetBitmapDC(NULL, extent, target);
! 	CScrollZoomView::OnDestroy();
  }
  
***************
*** 1161,1164 ****
--- 1242,1246 ----
  }
  
+ // ??
  void CGMEView::CreateGuiObjects(CComPtr<IMgaFCOs> &fcos,CGuiFcoList &objList,CGuiConnectionList &connList)
  {
***************
*** 1259,1262 ****
--- 1341,1345 ----
  }
  
+ // ??
  void CGMEView::CreateGuiObjects()
  {
***************
*** 1331,1334 ****
--- 1414,1418 ----
  }
  
+ 
  void CGMEView::Reset(bool doInvalidate)
  {
***************
*** 1467,1470 ****
--- 1551,1555 ----
  
  	EndWaitCursor();
+ 	m_refreshpannwin = true;	// terge - graphics modified
  }
  
***************
*** 1724,1727 ****
--- 1809,1813 ----
  }
  
+ // ??
  void CGMEView::ShowModel(CComPtr<IMgaModel> model,CString *aspect)
  {
***************
*** 1888,1897 ****
  	CGuiAnnotator::GetExtent(annotators, annext);
  	extent.UnionRect(&objext, &annext);
  	CSize s(extent.right, extent.bottom);
! 	s.cx = s.cx + END_SCROLL_OFFSET;
! 	s.cy = s.cy + END_SCROLL_OFFSET;
  
  //	if (setZoomPercents[zoomIdx] == 100) {
- 	// terge  - for what purpose, it makes it more complex
  	if (m_zoomVal == ZOOM_NO) {
  		SetScrollSizes(MM_TEXT,s, m_zoomVal); // setZoomPercents[zoomIdx]);
--- 1974,1984 ----
  	CGuiAnnotator::GetExtent(annotators, annext);
  	extent.UnionRect(&objext, &annext);
+ 	extent.right = (int)(extent.right*EXTENT_ERROR_CORR); // ??
+ 	extent.bottom = (int)(extent.bottom*EXTENT_ERROR_CORR); // ??
  	CSize s(extent.right, extent.bottom);
! //	s.cx = s.cx + END_SCROLL_OFFSET;
! //	s.cy = s.cy + END_SCROLL_OFFSET;
  
  //	if (setZoomPercents[zoomIdx] == 100) {
  	if (m_zoomVal == ZOOM_NO) {
  		SetScrollSizes(MM_TEXT,s, m_zoomVal); // setZoomPercents[zoomIdx]);
***************
*** 3086,3089 ****
--- 3173,3177 ----
  			selectedAnnotations.RemoveAll();
  
+ 			m_refreshpannwin = true;
  			Invalidate();
  		}
***************
*** 3218,3221 ****
--- 3306,3310 ----
  		selectedAnnotations.RemoveAll();
  
+ 		m_refreshpannwin = true;
  		Invalidate();
  	}
***************
*** 4597,4600 ****
--- 4686,4695 ----
  	CMainFrame::theInstance->UpdateTitle(theApp.projectName);
  
+ 	CGMEView * gmeviewA = (CGMEView *)pActivateView;
+ 	CGMEView * gmeviewI = (CGMEView *)pDeactiveView;
+ 	if (bActivate)
+ 		gmeviewA->m_refreshpannwin = true; // ??
+ 	else
+ 		gmeviewI->m_refreshpannwin = false; // ??
  	CScrollZoomView::OnActivateView(bActivate, pActivateView, pDeactiveView);
  }
***************
*** 5830,5834 ****
  		dc.DPtoLP(&srect);
  	}
! 	int zoom = min(100.*crect.Height()/srect.Height(), 100.*crect.Width()/srect.Width());
  	m_zoomVal = (zoom<ZOOM_MIN)? ZOOM_MIN: ((zoom>ZOOM_MAX)? ZOOM_MAX: zoom);
  
--- 5925,5929 ----
  		dc.DPtoLP(&srect);
  	}
! 	int zoom = (int)min(100.*crect.Height()/srect.Height(), 100.*crect.Width()/srect.Width());
  	m_zoomVal = (zoom<ZOOM_MIN)? ZOOM_MIN: ((zoom>ZOOM_MAX)? ZOOM_MAX: zoom);
  
***************
*** 5886,5902 ****
  		CGuiAnnotator::GetExtent(annotators, annext);
  		extent.UnionRect(&objext, &annext);
  		CSize s(extent.right, extent.bottom);
! 		s.cx = s.cx + END_SCROLL_OFFSET;
! 		s.cy = s.cy + END_SCROLL_OFFSET;
  		switch (zoom)
  		{
  		case ZOOM_WIDTH:
! 			m_zoomVal = 100.*rect.Width()/s.cx;
  			break;
  		case ZOOM_HEIGHT:
! 			m_zoomVal = 100.*rect.Height()/s.cy;
  			break;
  		case ZOOM_ALL:
! 			m_zoomVal = min(100.*rect.Height()/s.cy, 100.*rect.Width()/s.cx);
  			break;
  		}
--- 5981,5999 ----
  		CGuiAnnotator::GetExtent(annotators, annext);
  		extent.UnionRect(&objext, &annext);
+ 		extent.right = (int)(extent.right*EXTENT_ERROR_CORR); // ??
+ 		extent.bottom = (int)(extent.bottom*EXTENT_ERROR_CORR); // ??
  		CSize s(extent.right, extent.bottom);
! //		s.cx = s.cx + END_SCROLL_OFFSET;
! //		s.cy = s.cy + END_SCROLL_OFFSET;
  		switch (zoom)
  		{
  		case ZOOM_WIDTH:
! 			m_zoomVal = (int)(100.*rect.Width()/s.cx);
  			break;
  		case ZOOM_HEIGHT:
! 			m_zoomVal = (int)(100.*rect.Height()/s.cy);
  			break;
  		case ZOOM_ALL:
! 			m_zoomVal = (int)min(100.*rect.Height()/s.cy, 100.*rect.Width()/s.cx);
  			break;
  		}



More information about the GME-commit mailing list