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

绘图程序

开发平台:

Visual C++

  1. // UND_Delete.cpp: implementation of the CUND_Delete class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "graphsoft.h"
  6. #include "UND_Delete.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_Delete::CUND_Delete()
  18. {
  19. CString str;
  20. str.LoadString(IDS_DELETE);
  21. SetTitle(str);
  22. m_pSDelete=NULL;
  23. }
  24. CUND_Delete::CUND_Delete(void* pVoid)
  25. {
  26. m_pSDelete=NULL;
  27. m_pSDelete=(SUNDDelete*)pVoid;
  28. CString str;
  29. str.LoadString(IDS_DELETE);
  30. SetTitle(str);
  31. }
  32. CUND_Delete::~CUND_Delete()
  33. {
  34. if(m_pSDelete!=NULL){
  35. delete m_pSDelete;
  36. m_pSDelete=NULL;
  37. }
  38. }
  39. //只有在最后的时候在调用到
  40. void CUND_Delete::Destroy()
  41. {
  42. if(m_pSDelete!=NULL){
  43. //for (int ii = 0; ii < m_pSDelete->ArrShape.GetSize(); ii++){
  44. // delete m_pSDelete->ArrShape[ii];
  45. //}
  46. m_pSDelete->ArrShape.RemoveAll();
  47. delete m_pSDelete;
  48. m_pSDelete=NULL;
  49. }
  50. }
  51. BOOL CUND_Delete::OnEditUndo(CCore *pCore)
  52. {
  53. int nShapeNum=m_pSDelete->ArrShape.GetSize();
  54. CShape* pShape;
  55. CDC* pDC=CDC::FromHandle(GetDC(pCore->m_pView->GetSafeHwnd()));
  56. for(int i=0;i<nShapeNum;i++){
  57. pShape=m_pSDelete->ArrShape.GetAt(i);
  58. pCore->DrawGraph(pShape,TRUE);
  59. pCore->m_pDoc->m_shapeList.AddTail(pShape);
  60. }
  61. return TRUE;
  62. }
  63. BOOL CUND_Delete::OnEditRedo(CCore *pCore)
  64. {
  65. int nShapeNum=m_pSDelete->ArrShape.GetSize();
  66. CShape* pShape;
  67. CDC* pDC=CDC::FromHandle(GetDC(pCore->m_pView->GetSafeHwnd()));
  68. for(int i=0;i<nShapeNum;i++){
  69. pShape=m_pSDelete->ArrShape.GetAt(i);
  70. pCore->DrawGraph(pShape,FALSE);
  71. pCore->ReMoveShape(pShape->GetID());
  72. }
  73. return TRUE;
  74. }
  75. BOOL CUND_Delete::OutputLog(CCore *pCore) 
  76. //未做
  77. return false; 
  78. }