[GME-commit] GMESRC/GME/Gme GMEView.cpp,1.131,1.132
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Fri Mar 12 14:57:23 CST 2004
Update of /var/lib/gme/GMESRC/GME/Gme
In directory braindrain:/tmp/cvs-serv16378
Modified Files:
GMEView.cpp
Log Message:
zoom problem solved and enhanced
CVS User: bogyom
Index: GMEView.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Gme/GMEView.cpp,v
retrieving revision 1.131
retrieving revision 1.132
diff -C2 -d -r1.131 -r1.132
*** GMEView.cpp 12 Mar 2004 15:41:54 -0000 1.131
--- GMEView.cpp 12 Mar 2004 20:57:21 -0000 1.132
***************
*** 1642,1645 ****
--- 1642,1648 ----
}
+ // prevous zoom value : curzoom
+ // new zoom value stored in m_zoomVal
+ // point : win client coordinates - this image point has to be centered
void CGMEView::setZoomPoint(int curzoom, CPoint point)
{
***************
*** 3529,3533 ****
{
CGMEEventLogger::LogGMEEvent(" mode=GME_ZOOM_MODE\r\n");
! ZoomIn(ppoint);
Invalidate();
}
--- 3532,3548 ----
{
CGMEEventLogger::LogGMEEvent(" mode=GME_ZOOM_MODE\r\n");
! CRectTracker tracker;
! CClientDC dc(this);
! // OnPrepareDC(&dc);
! if(tracker.TrackRubberBand(this, trackPoint,TRUE))
! {
! tracker.m_rect.NormalizeRect();
! // dc.DPtoLP(tracker.m_rect);
! }
!
! // ZoomIn(ppoint); // this is OK
! // for test purpose only ??
! CRect srect = tracker.m_rect;
! ZoomRect(srect);
Invalidate();
}
***************
*** 5794,5797 ****
--- 5809,5850 ----
DeleteEnhMetaFile(hEmf);
}
+ }
+
+ void CGMEView::ZoomRect(CRect srect)
+ {
+ CRect crect;
+ GetClientRect(&crect);
+ int curzoom = m_zoomVal;
+ CPoint home = CPoint(srect.left, srect.top);
+ CSize orisize_srect(srect.Width(), srect.Height());
+ srect.OffsetRect(-home);
+
+ // convert srect to client coordinates like extent
+ {
+ CWindowDC dc(NULL);
+ dc.SetMapMode(MM_ISOTROPIC);
+ dc.SetWindowExt(100,100);
+ dc.SetViewportExt(curzoom, curzoom);
+ 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);
+
+ if (m_zoomVal != curzoom)
+ frame->propBar.SetZoomVal(m_zoomVal);
+ CMainFrame::theInstance->WriteStatusZoom(m_zoomVal);
+ m_zoomP.x = m_zoomP.y = 0;
+ if (curzoom == m_zoomVal)
+ return;
+
+ CPoint point = home;
+ point.x += orisize_srect.cx/2;
+ point.y += orisize_srect.cy/2;
+
+ // prevous zoom value : curzoom
+ // new zoom value stored in m_zoomVal
+ // point : win client coordinates - this image point has to be centered
+ setZoomPoint(curzoom, point);
+ Invalidate();
}
More information about the GME-commit
mailing list