UND_Rotate.cpp
上传用户:lj3531212
上传日期:2007-06-18
资源大小:346k
文件大小:2k
源码类别:

绘图程序

开发平台:

Visual C++

  1. // UND_Rotate.cpp: implementation of the CUND_Rotate class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "graphsoft.h"
  6. #include "UND_Rotate.h"
  7. #include "Core.h"
  8. #include "GraphDefines.h"
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[]=__FILE__;
  12. #define new DEBUG_NEW
  13. #endif
  14. //////////////////////////////////////////////////////////////////////
  15. // Construction/Destruction
  16. //////////////////////////////////////////////////////////////////////
  17. CUND_Rotate::CUND_Rotate()
  18. {
  19. CString str;
  20. str.LoadString(IDS_ROTATE);
  21. SetTitle(str);
  22. m_pSRotate=NULL;
  23. }
  24. CUND_Rotate::CUND_Rotate(void* pVoid)
  25. {
  26. m_pSRotate=NULL;
  27. m_pSRotate=(SUNDRotate*)pVoid;
  28. CString str;
  29. str.LoadString(IDS_ROTATE);
  30. SetTitle(str);
  31. }
  32. CUND_Rotate::~CUND_Rotate()
  33. {
  34. if(m_pSRotate!=NULL)
  35. delete m_pSRotate;
  36. m_pSRotate=NULL;
  37. }
  38. void CUND_Rotate::Destroy()
  39. {
  40. }
  41. BOOL CUND_Rotate::OnEditUndo(CCore *pCore)
  42. {
  43. int nShapeNum=m_pSRotate->ArrId.GetSize();
  44. CShape* pShape;
  45. CDC* pDC=CDC::FromHandle(GetDC(pCore->m_pView->GetSafeHwnd()));
  46. for(int i=0;i<nShapeNum;i++){
  47. pShape=pCore->GetShapeByID(m_pSRotate->ArrId.GetAt(i));
  48. pCore->DrawGraph(pShape,FALSE);
  49. pShape->Rotate(pDC,m_pSRotate->flCX,m_pSRotate->flCY,-(m_pSRotate->flAngle));
  50. pCore->DrawGraph(pShape,TRUE);
  51. }
  52. pCore->m_pDoc->RefreshSelectGraph();
  53. return TRUE;
  54. }
  55. BOOL CUND_Rotate::OnEditRedo(CCore *pCore)
  56. {
  57. int nShapeNum=m_pSRotate->ArrId.GetSize();
  58. CShape* pShape;
  59. CDC* pDC=CDC::FromHandle(GetDC(pCore->m_pView->GetSafeHwnd()));
  60. for(int i=0;i<nShapeNum;i++){
  61. pShape=pCore->GetShapeByID(m_pSRotate->ArrId.GetAt(i));
  62. pCore->DrawGraph(pShape,FALSE);
  63. pShape->Rotate(pDC,m_pSRotate->flCX,m_pSRotate->flCY,m_pSRotate->flAngle);
  64. pCore->DrawGraph(pShape,TRUE);
  65. }
  66. pCore->m_pDoc->RefreshSelectGraph();
  67. return TRUE;
  68. }
  69. BOOL CUND_Rotate::OutputLog(CCore *pCore) 
  70. //未做
  71. return false; 
  72. }