EastDrawView.cpp 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280
  1. // EastDrawView.cpp : implementation of the CEastDrawView class
  2. //
  3. #include "stdafx.h"
  4. #include "EastDraw.h"
  5. #include "EastDrawDoc.h"
  6. #include "EastDrawView.h"
  7. #include "ReginSet.h"
  8. #include "EditBox.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CEastDrawView
  16. IMPLEMENT_DYNCREATE(CEastDrawView, CScrollView)
  17. BEGIN_MESSAGE_MAP(CEastDrawView, CScrollView)
  18. //{{AFX_MSG_MAP(CEastDrawView)
  19. ON_WM_LBUTTONDOWN()
  20. ON_WM_LBUTTONUP()
  21. ON_WM_MOUSEMOVE()
  22. ON_COMMAND(ID_BUTTON_DLine, OnBUTTONDLine)
  23. ON_COMMAND(ID_BUTTON32774_Move, OnBUTTON32774Move)
  24. ON_COMMAND(ID_BUTTON32775_CircumRotate, OnBUTTON32775CircumRotate)
  25. ON_COMMAND(ID_BUTTON32777_Curve, OnBUTTON32777Curve)
  26. ON_COMMAND(ID_BUTTON32776_Rectangle, OnBUTTON32776Rectangle)
  27. ON_COMMAND(ID_BUTTON32778_RoundRectangle, OnBUTTON32778RoundRectangle)
  28. ON_COMMAND(ID_BUTTON32779_Ellipse, OnBUTTON32779Ellipse)
  29. ON_COMMAND(ID_BUTTON32780_Round, OnBUTTON32780Round)
  30. ON_COMMAND(ID_BUTTON32791_Polygon, OnBUTTON32791Polygon)
  31. ON_WM_LBUTTONDBLCLK()
  32. ON_WM_SETFOCUS()
  33. ON_COMMAND(ID_MENUITEM32794_SetRegin, OnMENUITEM32794SetRegin)
  34. ON_COMMAND(ID_BUTTON_LiEllipse, OnBUTTONLiEllipse)
  35. ON_COMMAND(ID_BUTTON32800_RoundArc, OnBUTTON32800RoundArc)
  36. ON_COMMAND(ID_BUTTON32805_EllipseArc, OnBUTTON32805EllipseArc)
  37. ON_COMMAND(ID_BUTTON32807_PolyBezier, OnBUTTON32807PolyBezier)
  38. ON_COMMAND(ID_BUTTON32809_Text, OnBUTTON32809Text)
  39. ON_COMMAND(ID_CHAR_BOLD, OnCharBold)
  40. ON_COMMAND(ID_CHAR_ITALIC, OnCharItalic)
  41. ON_COMMAND(ID_CHAR_UNDERLINE, OnCharUnderline)
  42. ON_WM_CONTEXTMENU()
  43. ON_COMMAND(ID_MENUITEM_OK, OnMenuitemOk)
  44. ON_WM_SETCURSOR()
  45. ON_COMMAND(ID_CirCu, OnCirCu)
  46. ON_UPDATE_COMMAND_UI(ID_CirCu, OnUpdateCirCu)
  47. ON_WM_KEYUP()
  48. ON_COMMAND(ID_Delete, OnDelete)
  49. ON_COMMAND(ID_BUTTON32830_Lock, OnBUTTON32830Lock)
  50. ON_UPDATE_COMMAND_UI(ID_BUTTON32830_Lock, OnUpdateBUTTON32830Lock)
  51. ON_UPDATE_COMMAND_UI(ID_BUTTON_DLine, OnUpdateBUTTONDLine)
  52. ON_UPDATE_COMMAND_UI(ID_BUTTON32776_Rectangle, OnUpdateBUTTON32776Rectangle)
  53. ON_UPDATE_COMMAND_UI(ID_BUTTON32778_RoundRectangle, OnUpdateBUTTON32778RoundRectangle)
  54. ON_UPDATE_COMMAND_UI(ID_BUTTON32791_Polygon, OnUpdateBUTTON32791Polygon)
  55. ON_UPDATE_COMMAND_UI(ID_BUTTON32779_Ellipse, OnUpdateBUTTON32779Ellipse)
  56. ON_UPDATE_COMMAND_UI(ID_BUTTON32780_Round, OnUpdateBUTTON32780Round)
  57. ON_UPDATE_COMMAND_UI(ID_BUTTON32777_Curve, OnUpdateBUTTON32777Curve)
  58. ON_UPDATE_COMMAND_UI(ID_BUTTON_LiEllipse, OnUpdateBUTTONLiEllipse)
  59. ON_UPDATE_COMMAND_UI(ID_BUTTON32800_RoundArc, OnUpdateBUTTON32800RoundArc)
  60. ON_UPDATE_COMMAND_UI(ID_BUTTON32805_EllipseArc, OnUpdateBUTTON32805EllipseArc)
  61. ON_UPDATE_COMMAND_UI(ID_BUTTON32807_PolyBezier, OnUpdateBUTTON32807PolyBezier)
  62. ON_UPDATE_COMMAND_UI(ID_BUTTON32809_Text, OnUpdateBUTTON32809Text)
  63. ON_UPDATE_COMMAND_UI(ID_BUTTON32774_Move, OnUpdateBUTTON32774Move)
  64. ON_COMMAND(ID_BUTTON32845_Axis, OnBUTTON32845Axis)
  65. ON_UPDATE_COMMAND_UI(ID_BUTTON32845_Axis, OnUpdateBUTTON32845Axis)
  66. ON_COMMAND(ID_BUTTON32850_ReDraw, OnBUTTON32850ReDraw)
  67. ON_COMMAND(ID_BUTTON32856_DONothing, OnBUTTON32856DONothing)
  68. ON_COMMAND(ID_BUTTON32858_OnDo, OnBUTTON32858OnDo)
  69. ON_COMMAND(ID_BUTTON32859_ReDo, OnBUTTON32859ReDo)
  70. ON_UPDATE_COMMAND_UI(ID_BUTTON32858_OnDo, OnUpdateBUTTON32858OnDo)
  71. ON_UPDATE_COMMAND_UI(ID_BUTTON32859_ReDo, OnUpdateBUTTON32859ReDo)
  72. ON_COMMAND(ID_MouseCap_On, OnMouseCapOn)
  73. ON_UPDATE_COMMAND_UI(ID_MouseCap_On, OnUpdateMouseCapOn)
  74. ON_WM_KEYDOWN()
  75. //}}AFX_MSG_MAP
  76. // Standard printing commands
  77. ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
  78. ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
  79. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
  80. END_MESSAGE_MAP()
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CEastDrawView construction/destruction
  83. #include "MainFrm.h"
  84. #include "CCurve.h"
  85. #include "CDLine.h"
  86. #include "CRectangle.h"
  87. #include "CRoundRectangle.h"
  88. #include "CEllipse.h"
  89. #include "CRound.h"
  90. #include "CPolygon.h"
  91. #include"CLiEllipse.h"
  92. #include"CRoundArc.h"
  93. #include"CEllipseArc.h"
  94. #include "CPolyBezier.h"
  95. //#include "TextEdit.h"
  96. #include "CText.h"
  97. CEastDrawView::CEastDrawView()
  98. {
  99. // TODO: add construction code here
  100. m_IsLastMove=false;
  101. m_Rtimes=0;
  102. m_Index=0;
  103. m_pCurrentUnit=new CUnit;
  104. m_HaveAxis=true;
  105. m_Bitmap=NULL;
  106. m_IsLocked=false;
  107. CMainFrame*pMainFrame=STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
  108. m_DLineProperty=pMainFrame->m_DLineProperty;
  109. m_IsMouseCap=true;
  110. }
  111. CEastDrawView::~CEastDrawView()
  112. {
  113. this->ReMoveTemp();
  114. }
  115. BOOL CEastDrawView::PreCreateWindow(CREATESTRUCT& cs)
  116. {
  117. // TODO: Modify the Window class or styles here by modifying
  118. // the CREATESTRUCT cs
  119. return CScrollView::PreCreateWindow(cs);
  120. }
  121. /////////////////////////////////////////////////////////////////////////////
  122. // CEastDrawView drawing
  123. void CEastDrawView::OnDraw(CDC* pDC)
  124. {
  125. CEastDrawDoc* pDoc = GetDocument();
  126. ASSERT_VALID(pDoc);
  127. pDC->SetWindowOrg(m_CenterPoint);
  128. this->DrawAll(pDC);
  129. if(this->m_HaveAxis)
  130. this->DrawAxis(pDC);
  131. }
  132. void CEastDrawView::OnInitialUpdate()
  133. {
  134. CScrollView::OnInitialUpdate();
  135. CEastDrawDoc* pDoc = GetDocument();
  136. ASSERT_VALID(pDoc);
  137. CSize sizeTotal;
  138. // TODO: calculate the total size of this view
  139. sizeTotal.cx = sizeTotal.cy =2000;
  140. SetScrollSizes(MM_TEXT,pDoc->m_TotalSize);
  141. m_CenterPoint=pDoc->m_CenterPoint;
  142. //SetScrollSizes(MM_HIENGLISH, sizeTotal);
  143. m_bHaveFindFirst=FALSE;
  144. m_bHaveFindSecond=false;
  145. m_LBDownTimes=0;
  146. m_CurrentDrawTool=0;
  147. m_CurrentDrawStatus=0;
  148. ScrollToPosition(CPoint(900,600));
  149. AddTempFile();
  150. AutoSave();
  151. }
  152. /////////////////////////////////////////////////////////////////////////////
  153. // CEastDrawView printing
  154. void CEastDrawView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  155. {
  156. // TODO: add extra initialization before printing
  157. }
  158. void CEastDrawView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  159. {
  160. // TODO: add cleanup after printing
  161. }
  162. /////////////////////////////////////////////////////////////////////////////
  163. // CEastDrawView diagnostics
  164. #ifdef _DEBUG
  165. void CEastDrawView::AssertValid() const
  166. {
  167. CScrollView::AssertValid();
  168. }
  169. void CEastDrawView::Dump(CDumpContext& dc) const
  170. {
  171. CScrollView::Dump(dc);
  172. }
  173. CEastDrawDoc* CEastDrawView::GetDocument() // non-debug version is inline
  174. {
  175. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEastDrawDoc)));
  176. return (CEastDrawDoc*)m_pDocument;
  177. }
  178. #endif //_DEBUG
  179. /////////////////////////////////////////////////////////////////////////////
  180. // CEastDrawView message handlers
  181. //******************************************************************************
  182. //******************************************************************************
  183. //**********void CEastDrawView::OnLButtonDown(UINT nFlags, CPoint point)********************************************************************
  184. //******************************************************************************
  185. //******************************************************************************
  186. void CEastDrawView::OnLButtonDown(UINT nFlags, CPoint point)
  187. {
  188. // TODO: Add your message handler code here and/or call default
  189. CEastDrawDoc*pDoc=this->GetDocument();
  190. CPoint Devpoint=point;
  191. CClientDC dc(this);
  192. this->OnPrepareDC(&dc);
  193. dc.SetWindowOrg(m_CenterPoint);
  194. dc.DPtoLP(&point);
  195. dc.SetROP2(R2_NOTXORPEN);
  196. this->ComputeMinandMaxPoint(point);
  197. m_ChangeingPoint=point;
  198. this->SetMousePosText(point,Devpoint);
  199. if(this->m_CurrentDrawStatus==Draw_Status)
  200. {
  201. if(this->m_CurrentDrawTool!=Polygon_Tool&&this->m_CurrentDrawTool!=PolyBezier_Tool)
  202. {
  203. if(this->m_CurrentDrawTool==EllipseArc_Tool)
  204. {
  205. if(m_LBDownTimes==3)
  206. {
  207. this->m_pCurrentUnit->DrawActive(&dc,point);
  208. this->m_pCurrentUnit->DrawStatic(&dc);
  209. this->m_LBDownTimes=-1;
  210. //if(m_DLineProperty->m_Mode->m_bMode)
  211. //this->m_pCurrentUnit->DrawStatic(&dc);
  212. }
  213. }
  214. if(this->m_CurrentDrawTool==Ellipse_Tool||m_CurrentDrawTool==RoundArc_Tool)
  215. {
  216. if(m_LBDownTimes==2)
  217. {
  218. this->ComputeMinandMaxPoint(point);
  219. this->m_pCurrentUnit->DrawActive(&dc,point);
  220. this->m_pCurrentUnit->DrawStatic(&dc);
  221. this->InvalidateMovingRect(m_pCurrentUnit);
  222. m_LBDownTimes=-1;
  223. //if(m_DLineProperty->m_Mode->m_bMode)
  224. //this->m_pCurrentUnit->DrawStatic(&dc);
  225. }
  226. }
  227. if(this->m_CurrentDrawTool!=Text_Tool&&this->m_CurrentDrawTool!=Ellipse_Tool&&this->m_CurrentDrawTool!=RoundArc_Tool&&this->m_CurrentDrawTool!=EllipseArc_Tool)
  228. {
  229. if(m_LBDownTimes==1)
  230. {
  231. //this->ComputeMinandMaxPoint(point);
  232. //this->InvalidateMovingRect(m_pCurrentUnit);
  233. m_LBDownTimes=-1;
  234. //if(m_DLineProperty->m_Mode->m_bMode)
  235. //this->m_pCurrentUnit->DrawStatic(&dc);
  236. }
  237. }//*****if(this->m_CurrentDrawTool!=Ellipse_Tool)
  238. }//*****if(this->m_CurrentDrawTool!=Polygon_Tool)
  239. }//*******if(this->m_CurrentDrawStatus==Draw_Status)
  240. if(this->m_CurrentDrawStatus==Select_Status)
  241. {
  242. m_LBDownTimes=0;
  243. this->m_CurrentDrawTool=0;
  244. }
  245. if(m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Drag_Status)
  246. {
  247. if((m_CurrentDrawTool==Round_Tool||m_CurrentDrawTool==Ellipse_Tool)&&m_CurrentDrawStatus==Change_Status)
  248. {
  249. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_CenterPoint,m_pCurrentUnit->m_FoundPoint);
  250. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_CenterPoint,point);
  251. }
  252. m_LBDownTimes=-1;
  253. m_bHaveFindFirst=false;
  254. m_CurrentDrawStatus=Select_Status;
  255. m_pCurrentUnit->ShowSelectPoint(&dc);
  256. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,point);
  257. m_pCurrentUnit->DrawOldReferencePoint(&dc,m_pCurrentUnit->m_FoundPoint);
  258. this->ComputeMinandMaxPoint(point);
  259. this->InvalidateMovingRect(m_pCurrentUnit);
  260. if(m_CurrentDrawTool==RoundArc_Tool)
  261. {
  262. m_pCurrentUnit->DrawActive(&dc,point);
  263. m_pCurrentUnit->DrawStatic(&dc);
  264. }
  265. }
  266. if(m_LBDownTimes==-1||m_CurrentDrawTool==0||m_CurrentDrawTool==Text_Tool||m_CurrentDrawStatus==Select_Status)
  267. {
  268. if(m_IsMouseCap)
  269. ::ReleaseCapture();
  270. }
  271. if(m_LBDownTimes==-1)
  272. {
  273. ExchangeSave();
  274. }
  275. m_LBDownTimes++;
  276. m_bHaveFindSecond=false;
  277. m_bHaveFindFirst=false;
  278. m_LastDownPoint=point;
  279. L_iPointCount=-1;
  280. if(m_LBDownTimes==1&&m_CurrentDrawTool!=Text_Tool&&m_CurrentDrawStatus!=Select_Status)
  281. {
  282. m_FirstPoint=point;
  283. m_SecondPoint=point;
  284. m_MinPoint=point;
  285. this->m_MaxPoint=point;
  286. if(m_IsMouseCap)
  287. this->SetCapture();
  288. }
  289. this->ComputeMinandMaxPoint(point);
  290. if(m_DLineProperty->m_DLineDlg2->m_Draw_Status==Select_Color_Status)
  291. {
  292. m_DLineProperty->m_DLineDlg2->OnChange(dc.GetPixel(point));
  293. m_CurrentDrawStatus=Select_Color_Status;
  294. m_CurrentDrawTool=0;
  295. }
  296. //******************************************************************************
  297. //******************************************************************************
  298. dc.SetROP2(R2_NOTXORPEN);
  299. if((m_LBDownTimes==1)&&(m_CurrentDrawStatus==Select_Status))
  300. {
  301. for(int i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_PolyBezierArray.GetSize();i++)
  302. {
  303. CPolyBezier*L_pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
  304. L_pPolyBezier->OnLButtonDown(&dc,this,point);
  305. }
  306. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_TextArray.GetSize();i++)
  307. {
  308. CText*L_pText=(CText*)pDoc->m_TextArray.GetAt(i);
  309. L_pText->OnLButtonDown(&dc,this,point);
  310. }
  311. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_EllipseArcArray.GetSize();i++)
  312. {
  313. CEllipseArc*L_pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
  314. L_pEllipseArc->OnLButtonDown(&dc,this,point);
  315. }//for(int i=0;!m_bHaveFindSecond&&pDoc->m_EllipseArcArray.GetSize();i++)
  316. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_RoundRectangleArray.GetSize();i++)
  317. {
  318. CRoundRectangle*L_pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
  319. L_pRoundRectangle->OnLButtonDown(&dc,this,point);
  320. }//******for(int i=0;!l_bHaveFinf&&i<pDoc->m_RoundRectangleArray.GetSize();i++)
  321. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_RoundArcArray.GetSize();i++)
  322. {
  323. CRoundArc*L_pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
  324. L_pRoundArc->OnLButtonDown(&dc,this,point);
  325. }//******for(i=0;!m_bHaveFindSecond&&i<pDoc->m_RoundArcArray.GetSize();i++)
  326. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_LiEllipseArray.GetSize();i++)
  327. {
  328. CLiEllipse*L_pLiEllipse=(CLiEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
  329. L_pLiEllipse->OnLButtonDown(&dc,this,point);
  330. } //******for(i=0;!l_bHaveFind&&i<pDoc->m_LiEllipseArray.GetSize();i++)
  331. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_EllipseArray.GetSize();i++)
  332. {
  333. CEllipse*L_pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
  334. L_pEllipse->OnLButtonDown(&dc,this,point);
  335. }//******for(i=0;!m_bHaveFindFirst&&i<pDoc->m_EllipseArray.GetSize();i++)
  336. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_RoundArray.GetSize();i++)
  337. {
  338. CRound*L_pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
  339. L_pRound->OnLButtonDown(&dc,this,point);
  340. }//******for(i=0;!m_bHaveFindFirst&&i<pDoc->m_RoundArray.GetSize();i++)
  341. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_DLineArray.GetSize();i++)
  342. {
  343. CDLine*L_pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
  344. L_pDLine->OnLButtonDown(&dc,this,point);
  345. } //******for(int i=0;!m_bHaveFindFirst&&i<pDoc->m_DLineArray.GetSize();i++)
  346. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_CurveArray.GetSize();i++)
  347. {
  348. CCurve*L_pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
  349. L_pCurve->OnLButtonDown(&dc,this,point);
  350. }//*****for(i=0;!m_bHaveFindFirst&&i<pDoc->m_CurveArray.GetSize();i++)
  351. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_RectangleArray.GetSize();i++)
  352. {
  353. CRectangle *L_pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
  354. L_pRectangle->OnLButtonDown(&dc,this,point);
  355. }//*****for(i=0;!m_bHaveFindFirst&&i<pDoc->m_RectangleArray.GetSize();i++)
  356. for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_PolygonArray.GetSize();i++)
  357. {
  358. CPolygon*L_pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
  359. L_pPolygon->OnLButtonDown(&dc,this,point);
  360. } //******for(i=0;!m_bHaveFindFirst&&i<pDoc->m_PolygonArray.GetSize();i++)
  361. } //******if((m_CurrentDrawStatus==Select_Status))
  362. //***************************************************************************************
  363. //***************************************************************************************
  364. if(m_CurrentDrawStatus==Draw_Status)
  365. {
  366. if(m_CurrentDrawTool==PolyBezier_Tool)
  367. {
  368. if(this->m_LBDownTimes==1)
  369. {
  370. m_pCurrentUnit=new CPolyBezier;
  371. pDoc->m_PolyBezierArray.Add((CPolyBezier*)m_pCurrentUnit);
  372. }
  373. this->m_FirstPoint=this->m_SecondPoint=point;
  374. m_pCurrentUnit->OnLButtonDown(&dc,this,point);
  375. }
  376. if(m_CurrentDrawTool==Text_Tool)
  377. {
  378. if(this->m_LBDownTimes==1)
  379. {
  380. m_pCurrentUnit=new CText;
  381. pDoc->m_TextArray.Add((CText*)m_pCurrentUnit);
  382. }
  383. m_pCurrentUnit->OnLButtonDown(&dc,this,point);
  384. }
  385. if(m_CurrentDrawTool==EllipseArc_Tool)
  386. {
  387. if(this->m_LBDownTimes==1)
  388. {
  389. m_pCurrentUnit=new CEllipseArc;
  390. pDoc->m_EllipseArcArray.Add((CEllipseArc*)m_pCurrentUnit);
  391. }
  392. if(this->m_LBDownTimes==2)
  393. {
  394. m_pCurrentUnit->ComputSloap(m_pCurrentUnit->m_FirstPoint,point);
  395. m_pCurrentUnit->m_CenterPoint=CPoint((m_pCurrentUnit->m_FirstPoint.x+point.x)/2,(m_pCurrentUnit->m_FirstPoint.y+point.y)/2);
  396. m_pCurrentUnit->ComputRadiusY(m_pCurrentUnit->m_CenterPoint,point);
  397. }
  398. if(this->m_LBDownTimes==3)
  399. {
  400. m_pCurrentUnit->m_FourthPoint=point;
  401. m_pCurrentUnit->m_FifthPoint=point;
  402. m_pCurrentUnit->ComputeIntersectionPointFirst(point);
  403. m_pCurrentUnit->ComputeIntersectionPointSecond(point);
  404. }
  405. }
  406. if(m_CurrentDrawTool==RoundArc_Tool)
  407. {
  408. if(this->m_LBDownTimes==1)
  409. {
  410. m_pCurrentUnit=new CRoundArc;
  411. pDoc->m_RoundArcArray.Add((CRoundArc*)m_pCurrentUnit);
  412. }
  413. if(this->m_LBDownTimes==2)
  414. {
  415. m_pCurrentUnit->m_SecondPoint=point;
  416. m_pCurrentUnit->ComputeSloap1(m_pCurrentUnit->m_FirstPoint,m_pCurrentUnit->m_SecondPoint);
  417. m_pCurrentUnit->m_ThirdPoint=m_pCurrentUnit->m_FirstPoint;
  418. }
  419. }//******if(m_CurrentDrawTool==RoundArc_Tool)
  420. if(m_CurrentDrawTool==Polygon_Tool)
  421. {
  422. if(this->m_LBDownTimes==1)
  423. {
  424. m_pCurrentUnit=new CPolygon;
  425. pDoc->m_PolygonArray.Add((CPolygon*)m_pCurrentUnit);
  426. m_pCurrentUnit->m_PointList->Add(point);
  427. }
  428. if(this->m_LBDownTimes!=0&&this->m_LBDownTimes!=1)
  429. {
  430. m_pCurrentUnit->m_PointList->Add(point);
  431. }
  432. }//******if(m_CurrentDrawTool==Polygon_Tool)
  433. if(m_CurrentDrawTool==Ellipse_Tool)
  434. {
  435. if(m_LBDownTimes==1)
  436. {
  437. m_pCurrentUnit=new CEllipse;
  438. pDoc->m_EllipseArray.Add((CEllipse*)m_pCurrentUnit);
  439. }
  440. if(m_LBDownTimes==2)
  441. {
  442. m_pCurrentUnit->ComputSloap(m_pCurrentUnit->m_FirstPoint,point);
  443. m_pCurrentUnit->m_CenterPoint=CPoint((m_pCurrentUnit->m_FirstPoint.x+point.x)/2,(m_pCurrentUnit->m_FirstPoint.y+point.y)/2);
  444. m_pCurrentUnit->ComputRadiusX(m_pCurrentUnit->m_CenterPoint,point);
  445. m_pCurrentUnit->ComputRadiusY(m_pCurrentUnit->m_CenterPoint,point);
  446. m_pCurrentUnit->ellipseMidpoint(&dc,m_pCurrentUnit->m_CenterPoint.x,m_pCurrentUnit->m_CenterPoint.y,m_pCurrentUnit->m_Xr,m_pCurrentUnit->m_Yr);
  447. }
  448. if(this->m_LBDownTimes==0)
  449. {
  450. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FirstPoint,m_pCurrentUnit->m_SecondPoint);
  451. }
  452. }//******if(m_CurrentDrawTool==Ellipse_Tool)
  453. if(m_CurrentDrawTool==Round_Tool)
  454. {
  455. if(m_LBDownTimes==1)
  456. {
  457. m_pCurrentUnit=new CRound;
  458. pDoc->m_RoundArray.Add((CRound*)m_pCurrentUnit);
  459. m_pCurrentUnit->m_CenterPoint=point;
  460. }
  461. if(m_LBDownTimes==0)
  462. {
  463. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_CenterPoint,point);
  464. }
  465. }
  466. if(m_CurrentDrawTool==RoundRectangle_Tool)
  467. {
  468. if(m_LBDownTimes==1)
  469. {
  470. m_pCurrentUnit=new CRoundRectangle;
  471. pDoc->m_RoundRectangleArray.Add((CRoundRectangle*)m_pCurrentUnit);
  472. }
  473. }
  474. if(m_CurrentDrawTool==LiEllipse_Tool)
  475. {
  476. if(m_LBDownTimes==1)
  477. {
  478. m_pCurrentUnit=new CLiEllipse;
  479. pDoc->m_LiEllipseArray.Add((CLiEllipse*)m_pCurrentUnit);
  480. }
  481. }
  482. if(m_CurrentDrawTool==DLine_Tool)
  483. {
  484. if(m_LBDownTimes==1)
  485. {
  486. m_pCurrentUnit=new CDLine;
  487. pDoc->m_DLineArray.Add((CDLine*)m_pCurrentUnit);
  488. }
  489. }
  490. if(m_CurrentDrawTool==Curve_Tool)
  491. {
  492. if(m_LBDownTimes==1)
  493. {
  494. m_pCurrentUnit=(CCurve*)new CCurve;
  495. pDoc->m_CurveArray.Add((CCurve*)m_pCurrentUnit);
  496. m_pCurrentUnit->m_PointList->Add(point);
  497. m_pCurrentUnit->m_PointList->Add(point);
  498. }
  499. }//******if(m_CurrentDrawTool==Curve_Tool)
  500. if(m_CurrentDrawTool==Rectangle_Tool)
  501. {
  502. if(m_LBDownTimes==1)
  503. {
  504. m_pCurrentUnit=(CRectangle*)new CRectangle;
  505. pDoc->m_RectangleArray.Add((CRectangle*)m_pCurrentUnit);
  506. }
  507. }//******if(m_CurrentDrawTool==Rectangle_Tool)
  508. }//*****if(m_CurrentDrawStatus==Draw_Status)
  509. if((m_CurrentDrawStatus==Draw_Status&&m_LBDownTimes==1)||(m_bHaveFindSecond&&!m_IsLocked))
  510. {
  511. m_DLineProperty->m_DLineDlg1->UpdateData();
  512. m_pCurrentUnit->m_FirstPoint=m_FirstPoint;
  513. m_pCurrentUnit->m_SecondPoint=m_SecondPoint;
  514. m_pCurrentUnit->m_PenStyle=m_DLineProperty->m_DLineDlg1->m_PenStyle;
  515. m_pCurrentUnit->m_PenWidth=m_DLineProperty->m_DLineDlg1->m_Edit_LineWidth;
  516. m_pCurrentUnit->m_PenColor=m_DLineProperty->m_DLineDlg2->m_PenColor;
  517. m_pCurrentUnit->m_BrushColor=m_DLineProperty->m_DLineDlg2->m_BrushColor;
  518. m_pCurrentUnit->m_BrushHatch=m_DLineProperty->m_DLineDlg1->m_BrushHatch;
  519. m_pCurrentUnit->m_BrushStyle=m_DLineProperty->m_DLineDlg1->m_BrushStyle;
  520. m_pCurrentUnit->m_BackgroundColor=m_DLineProperty->m_DLineDlg2->m_BackgroundColor;
  521. //if(m_DLineProperty->m_Mode->m_bMode)
  522. // m_pCurrentUnit->m_DrawingMode=m_DLineProperty->m_Mode->m_DrawingMode;
  523. //else
  524. m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
  525. m_pCurrentUnit->m_BkMode=m_DLineProperty->m_DLineDlg1->m_BKMode;//m_DLineProperty->m_Mode->m_BKMode;
  526. }//**********if(this->m_LBDownTimes==1&&m_bHaveFindFirst)
  527. if(m_bHaveFindSecond&&m_IsLocked)
  528. {
  529. m_DLineProperty->m_DLineDlg1->UpdateData();
  530. m_pCurrentUnit->m_FirstPoint=m_FirstPoint;
  531. m_pCurrentUnit->m_SecondPoint=m_SecondPoint;
  532. m_DLineProperty->m_DLineDlg1->m_PenStyle=m_pCurrentUnit->m_PenStyle;
  533. m_DLineProperty->m_DLineDlg1->m_Edit_LineWidth=m_pCurrentUnit->m_PenWidth;
  534. m_DLineProperty->m_DLineDlg2->m_PenColor=m_pCurrentUnit->m_PenColor;
  535. m_DLineProperty->m_DLineDlg2->m_BrushColor=m_pCurrentUnit->m_BrushColor;
  536. m_DLineProperty->m_DLineDlg1->m_BrushHatch=m_pCurrentUnit->m_BrushHatch;
  537. m_DLineProperty->m_DLineDlg1->m_BrushStyle=m_pCurrentUnit->m_BrushStyle;
  538. m_DLineProperty->m_DLineDlg2->m_BackgroundColor=m_pCurrentUnit->m_BackgroundColor;
  539. m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
  540. m_DLineProperty->m_DLineDlg1->m_BKMode=m_pCurrentUnit->m_BkMode;
  541. // if(m_DLineProperty->m_Mode->m_bMode)
  542. //m_DLineProperty->m_Mode->m_DrawingMode=m_pCurrentUnit->m_DrawingMode;
  543. m_DLineProperty->GetActivePage()->UpdateData(false);
  544. m_DLineProperty->GetActivePage()->Invalidate();
  545. }
  546. if(m_bHaveFindSecond)
  547. {
  548. m_pCurrentUnit->DrawStatic(&dc);
  549. }
  550. if(m_CurrentDrawStatus==Drag_Status)
  551. {
  552. m_FirstPoint=m_pCurrentUnit->m_FoundPoint;
  553. m_SecondPoint=m_pCurrentUnit->m_FoundPoint;
  554. }
  555. if(m_CurrentDrawStatus==Change_Status)//&&m_CurrentDrawTool==Ellipse_Tool)
  556. {
  557. m_FirstPoint=m_pCurrentUnit->m_FoundPoint;
  558. m_SecondPoint=m_pCurrentUnit->m_FoundPoint;
  559. if(this->m_CurrentDrawTool==Text_Tool)
  560. {
  561. m_pCurrentUnit->OnLButtonDown(&dc,this,point);
  562. }
  563. }
  564. if(m_IsMouseCap&&m_bHaveFindSecond)
  565. this->SetCapture();
  566. CScrollView::OnLButtonDown(nFlags, point);
  567. }
  568. //***************************************************************************************
  569. //***************************************************************************************
  570. //***************************************************************************************
  571. //***************************************************************************************
  572. void CEastDrawView::OnLButtonUp(UINT nFlags, CPoint point)
  573. {
  574. // TODO: Add your message handler code here and/or call default
  575. CPoint Devpoint=point;
  576. CClientDC dc(this);
  577. this->OnPrepareDC(&dc);
  578. dc.SetWindowOrg(m_CenterPoint);
  579. dc.DPtoLP(&point);
  580. dc.SetROP2(R2_NOTXORPEN);
  581. this->ComputeMinandMaxPoint(point);
  582. m_ChangeingPoint=point;
  583. this->SetMousePosText(point,Devpoint);
  584. if(m_DLineProperty->m_DLineDlg2->m_Draw_Status==Select_Color_Status)
  585. {
  586. m_DLineProperty->m_DLineDlg2->m_Color=dc.GetPixel(point);
  587. m_DLineProperty->m_DLineDlg2->OnChange(dc.GetPixel(point));
  588. m_CurrentDrawStatus=0;
  589. m_DLineProperty->m_DLineDlg2->m_Draw_Status=0;
  590. m_CurrentDrawTool=0;
  591. }
  592. if(m_IsMouseCap&&m_bHaveFindSecond)
  593. this->SetCapture();
  594. CScrollView::OnLButtonUp(nFlags, point);
  595. }
  596. //***************************************************************************************
  597. //***************************************************************************************
  598. //***************************************************************************************
  599. //***************************************************************************************
  600. //***************************************************************************************
  601. void CEastDrawView::OnMouseMove(UINT nFlags, CPoint point)
  602. {
  603. // TODO: Add your message handler code here and/or call default
  604. CPoint Devpoint=point;
  605. CClientDC dc(this);
  606. this->OnPrepareDC(&dc);
  607. dc.SetWindowOrg(m_CenterPoint);
  608. dc.DPtoLP(&point);
  609. dc.SetROP2(R2_NOTXORPEN);
  610. this->ComputeMinandMaxPoint(point);
  611. m_ChangeingPoint=point;
  612. this->SetMousePosText(point,Devpoint);
  613. if(m_DLineProperty->m_DLineDlg2->m_Draw_Status==Select_Color_Status)
  614. {
  615. m_DLineProperty->m_DLineDlg2->OnChange(dc.GetPixel(point));
  616. m_CurrentDrawStatus=Select_Color_Status;
  617. m_CurrentDrawTool=0;
  618. }
  619. if((m_LBDownTimes!=0)&&(m_CurrentDrawStatus==Draw_Status||m_CurrentDrawStatus==Change_Status))
  620. {
  621. if(m_CurrentDrawStatus==Change_Status)
  622. {
  623. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,m_SecondPoint);
  624. }
  625. m_pCurrentUnit->OnMouseMove(&dc,this,point);
  626. if(m_CurrentDrawStatus==Change_Status)
  627. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,point);
  628. }//*********if(m_IsDrawing&&(m_CurrentDrawStatus==Draw_Status||m_CurrentDrawStatus==Exchange_Status))
  629. if(m_CurrentDrawStatus==Drag_Status)
  630. {
  631. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,m_SecondPoint);
  632. dc.SetROP2(R2_NOTXORPEN);
  633. m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
  634. if(m_CurrentDrawTool!=EllipseArc_Tool)
  635. m_pCurrentUnit->DrawActive(&dc,point);
  636. m_FirstPoint=m_SecondPoint;
  637. m_SecondPoint=point;
  638. m_pCurrentUnit->OnMouseMove(&dc,this,point);
  639. m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
  640. if(m_CurrentDrawTool!=EllipseArc_Tool)
  641. m_pCurrentUnit->DrawActive(&dc,point);
  642. m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,point);
  643. }
  644. CScrollView::OnMouseMove(nFlags, point);
  645. }
  646. void CEastDrawView::OnBUTTONDLine()
  647. {
  648. CClientDC dc(this);
  649. OnPrepareDC(&dc);
  650. dc.SetWindowOrg(m_CenterPoint);
  651. // TODO: Add your command handler code here
  652. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  653. ResetSelectStatus();
  654. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  655. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  656. {
  657. pMainFrame->ShowFontBar(false);
  658. if(this->m_LBDownTimes==1)
  659. {
  660. this->m_LBDownTimes=2;
  661. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  662. }
  663. }
  664. m_CurrentDrawTool=DLine_Tool;
  665. m_CurrentDrawStatus=Draw_Status;
  666. this->m_LBDownTimes=0;
  667. }
  668. void CEastDrawView::OnBUTTON32774Move()
  669. {
  670. CClientDC dc(this);
  671. OnPrepareDC(&dc);
  672. dc.SetWindowOrg(m_CenterPoint);
  673. // TODO: Add your command handler code here
  674. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  675. ResetSelectStatus();
  676. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  677. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  678. {
  679. pMainFrame->ShowFontBar(false);
  680. if(this->m_LBDownTimes==1)
  681. {
  682. this->m_LBDownTimes=2;
  683. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  684. }
  685. }
  686. m_CurrentDrawTool=0;
  687. m_CurrentDrawStatus=Select_Status;
  688. m_LBDownTimes=0;
  689. }
  690. void CEastDrawView::OnBUTTON32775CircumRotate()
  691. {
  692. CClientDC dc(this);
  693. OnPrepareDC(&dc);
  694. dc.SetWindowOrg(m_CenterPoint);
  695. // TODO: Add your command handler code here
  696. //m_CurrentDrawStatus=Select_Status;
  697. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  698. ResetSelectStatus();
  699. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  700. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  701. {
  702. pMainFrame->ShowFontBar(false);
  703. if(this->m_LBDownTimes==1)
  704. {
  705. this->m_LBDownTimes=2;
  706. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  707. }
  708. }
  709. m_CurrentDrawTool=0;
  710. m_CurrentDrawStatus=Circumrotate_Status;
  711. }
  712. void CEastDrawView::OnBUTTON32777Curve()
  713. {
  714. CClientDC dc(this);
  715. OnPrepareDC(&dc);
  716. dc.SetWindowOrg(m_CenterPoint);
  717. // TODO: Add your command handler code here
  718. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  719. ResetSelectStatus();
  720. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  721. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  722. {
  723. pMainFrame->ShowFontBar(false);
  724. if(this->m_LBDownTimes==1)
  725. {
  726. this->m_LBDownTimes=2;
  727. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  728. }
  729. }
  730. m_CurrentDrawTool=Curve_Tool;
  731. m_LBDownTimes=0;
  732. m_CurrentDrawStatus=Draw_Status;
  733. }
  734. void CEastDrawView::OnBUTTON32776Rectangle()
  735. {
  736. CClientDC dc(this);
  737. OnPrepareDC(&dc);
  738. dc.SetWindowOrg(m_CenterPoint);
  739. // TODO: Add your command handler code here
  740. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  741. ResetSelectStatus();
  742. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  743. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  744. {
  745. pMainFrame->ShowFontBar(false);
  746. if(this->m_LBDownTimes==1)
  747. {
  748. this->m_LBDownTimes=2;
  749. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  750. }
  751. }
  752. m_CurrentDrawTool=Rectangle_Tool;
  753. m_LBDownTimes=0;
  754. m_CurrentDrawStatus=Draw_Status;
  755. }
  756. void CEastDrawView::OnBUTTON32778RoundRectangle()
  757. {
  758. CClientDC dc(this);
  759. OnPrepareDC(&dc);
  760. dc.SetWindowOrg(m_CenterPoint);
  761. // TODO: Add your command handler code here
  762. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  763. ResetSelectStatus();
  764. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  765. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  766. {
  767. pMainFrame->ShowFontBar(false);
  768. if(this->m_LBDownTimes==1)
  769. {
  770. this->m_LBDownTimes=2;
  771. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  772. }
  773. }
  774. m_CurrentDrawTool=RoundRectangle_Tool;
  775. m_CurrentDrawStatus=Draw_Status;
  776. m_LBDownTimes=0;
  777. }
  778. void CEastDrawView::OnBUTTON32779Ellipse()
  779. {
  780. CClientDC dc(this);
  781. OnPrepareDC(&dc);
  782. dc.SetWindowOrg(m_CenterPoint);
  783. // TODO: Add your command handler code here
  784. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  785. ResetSelectStatus();
  786. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  787. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  788. {
  789. pMainFrame->ShowFontBar(false);
  790. if(this->m_LBDownTimes==1)
  791. {
  792. this->m_LBDownTimes=2;
  793. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  794. }
  795. }
  796. m_CurrentDrawTool=Ellipse_Tool;
  797. m_CurrentDrawStatus=Draw_Status;
  798. m_LBDownTimes=0;
  799. }
  800. void CEastDrawView::OnBUTTON32780Round()
  801. {
  802. CClientDC dc(this);
  803. OnPrepareDC(&dc);
  804. dc.SetWindowOrg(m_CenterPoint);
  805. // TODO: Add your command handler code here
  806. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  807. ResetSelectStatus();
  808. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  809. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  810. {
  811. pMainFrame->ShowFontBar(false);
  812. if(this->m_LBDownTimes==1)
  813. {
  814. this->m_LBDownTimes=2;
  815. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  816. }
  817. }
  818. m_CurrentDrawTool=Round_Tool;
  819. m_CurrentDrawStatus=Draw_Status;
  820. this->m_LBDownTimes=0;
  821. }
  822. void CEastDrawView::OnBUTTON32791Polygon()
  823. {
  824. CClientDC dc(this);
  825. OnPrepareDC(&dc);
  826. dc.SetWindowOrg(m_CenterPoint);
  827. // TODO: Add your command handler code here
  828. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  829. ResetSelectStatus();
  830. m_IsPolygonFirst=true;
  831. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  832. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  833. {
  834. pMainFrame->ShowFontBar(false);
  835. if(this->m_LBDownTimes==1)
  836. {
  837. this->m_LBDownTimes=2;
  838. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  839. }
  840. }
  841. m_CurrentDrawTool=Polygon_Tool;
  842. m_CurrentDrawStatus=Draw_Status;
  843. this->m_LBDownTimes=0;
  844. }
  845. void CEastDrawView::OnLButtonDblClk(UINT nFlags, CPoint point)
  846. {
  847. // TODO: Add your message handler code here and/or call default
  848. CPoint Devpoint=point;
  849. CClientDC dc(this);
  850. this->OnPrepareDC(&dc);
  851. dc.SetWindowOrg(m_CenterPoint);
  852. dc.DPtoLP(&point);
  853. dc.SetROP2(R2_NOTXORPEN);
  854. this->ComputeMinandMaxPoint(point);
  855. m_ChangeingPoint=point;
  856. this->SetMousePosText(point,Devpoint);
  857. if(m_CurrentDrawStatus==Draw_Status&&m_CurrentDrawTool==Polygon_Tool)
  858. {
  859. m_pCurrentUnit->DrawEnd(&dc,point);
  860. this->m_LBDownTimes=0;
  861. this->ExchangeSave();
  862. if(m_IsMouseCap)
  863. ::ReleaseCapture();
  864. }
  865. CScrollView::OnLButtonDblClk(nFlags, point);
  866. }
  867. void CEastDrawView::OnSetFocus(CWnd* pOldWnd)
  868. {
  869. CScrollView::OnSetFocus(pOldWnd);
  870. // TODO: Add your message handler code here
  871. }
  872. void CEastDrawView::OnMENUITEM32794SetRegin()
  873. {
  874. // TODO: Add your command handler code here
  875. CReginSet setReginDlg;
  876. CClientDC dc(this);
  877. setReginDlg.m_Length=this->GetTotalSize().cx;
  878. setReginDlg.m_Width=this->GetTotalSize().cy;
  879. setReginDlg.m_X=m_CenterPoint.x;
  880. setReginDlg.m_Y=m_CenterPoint.y;
  881. setReginDlg.m_bIsViewReign=true;
  882. if(setReginDlg.DoModal()==IDOK)
  883. {
  884. CSize sizeTotal;
  885. sizeTotal.cx=setReginDlg.m_Length;
  886. sizeTotal.cy=setReginDlg.m_Width;
  887. SetScrollSizes(MM_TEXT, sizeTotal);
  888. OnPrepareDC(&dc);
  889. m_CenterPoint.x=setReginDlg.m_X;
  890. m_CenterPoint.y=setReginDlg.m_Y;
  891. dc.SetWindowOrg(m_CenterPoint);
  892. OnBUTTON32850ReDraw();
  893. CEastDrawDoc* pDoc = GetDocument();
  894. ASSERT_VALID(pDoc);
  895. pDoc->m_CenterPoint=m_CenterPoint;
  896. pDoc->m_TotalSize=sizeTotal;
  897. }
  898. }
  899. void CEastDrawView::OnBUTTONLiEllipse()
  900. {
  901. CClientDC dc(this);
  902. OnPrepareDC(&dc);
  903. dc.SetWindowOrg(m_CenterPoint);
  904. // TODO: Add your command handler code here
  905. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  906. ResetSelectStatus();
  907. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  908. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  909. {
  910. pMainFrame->ShowFontBar(false);
  911. if(this->m_LBDownTimes==1)
  912. {
  913. this->m_LBDownTimes=2;
  914. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  915. }
  916. }
  917. m_CurrentDrawTool=LiEllipse_Tool;
  918. m_CurrentDrawStatus=Draw_Status;
  919. this->m_LBDownTimes=0;
  920. }
  921. void CEastDrawView::ResetSelectStatus()
  922. {
  923. CEastDrawDoc* pDoc = GetDocument();
  924. ASSERT_VALID(pDoc);
  925. CClientDC dc(this);
  926. CClientDC*pDC=&dc;
  927. OnPrepareDC(pDC);
  928. dc.SetWindowOrg(m_CenterPoint);
  929. for(int i=0;i<pDoc->m_PolygonArray.GetSize();i++)
  930. {
  931. CPolygon*pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
  932. if(pPolygon->m_HaveFindFirst)
  933. {
  934. pPolygon->ShowSelectPoint(pDC);
  935. pPolygon->m_HaveFindFirst=false;
  936. }
  937. }
  938. for(i=0;i<pDoc->m_TextArray.GetSize();i++)
  939. {
  940. CText*pText=(CText*)pDoc->m_TextArray.GetAt(i);
  941. if(pText->m_HaveFindFirst)
  942. {
  943. pText->ShowSelectPoint(pDC);
  944. pText->m_HaveFindFirst=false;
  945. }
  946. }
  947. for(i=0;i<pDoc->m_EllipseArcArray.GetSize();i++)
  948. {
  949. CEllipseArc*pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
  950. if(pEllipseArc->m_HaveFindFirst)
  951. {
  952. pEllipseArc->ShowSelectPoint(pDC);
  953. pEllipseArc->m_HaveFindFirst=false;
  954. }
  955. }
  956. for(i=0;i<pDoc->m_DLineArray.GetSize();i++)
  957. {
  958. CDLine*pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
  959. if(pDLine->m_HaveFindFirst)
  960. { pDLine->m_HaveFindFirst=false;
  961. pDLine->ShowSelectPoint(pDC);
  962. }
  963. }
  964. for(i=0;i<pDoc->m_CurveArray.GetSize();i++)
  965. {
  966. CCurve*pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
  967. if(pCurve->m_HaveFindFirst)
  968. { pCurve->m_HaveFindFirst=false;
  969. pCurve->ShowSelectPoint(pDC);
  970. }
  971. }
  972. for(i=0;i<pDoc->m_RectangleArray.GetSize();i++)
  973. {
  974. CRectangle*pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
  975. if(pRectangle->m_HaveFindFirst)
  976. {
  977. pRectangle->m_HaveFindFirst=false;
  978. pRectangle->ShowSelectPoint(pDC);
  979. }
  980. }
  981. for(i=0;i<pDoc->m_RoundRectangleArray.GetSize();i++)
  982. {
  983. CRoundRectangle*pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
  984. if(pRoundRectangle->m_HaveFindFirst)
  985. { pRoundRectangle->m_HaveFindFirst=false;
  986. pRoundRectangle->ShowSelectPoint(pDC);
  987. }
  988. }
  989. for(i=0;i<pDoc->m_EllipseArray.GetSize();i++)
  990. {
  991. CEllipse*pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
  992. if(pEllipse->m_HaveFindFirst)
  993. {
  994. pEllipse->m_HaveFindFirst=false;
  995. pEllipse->ShowSelectPoint(pDC);
  996. }
  997. }
  998. for(i=0;i<pDoc->m_RoundArray.GetSize();i++)
  999. {
  1000. CRound*pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
  1001. if(pRound->m_HaveFindFirst)
  1002. { pRound->m_HaveFindFirst=false;
  1003. pRound->ShowSelectPoint(pDC);
  1004. }
  1005. }
  1006. for(i=0;i<pDoc->m_LiEllipseArray.GetSize();i++)
  1007. {
  1008. CEllipse*pLiEllipse=(CEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
  1009. if(pLiEllipse->m_HaveFindFirst)
  1010. {
  1011. pLiEllipse->m_HaveFindFirst=false;
  1012. pLiEllipse->ShowSelectPoint(pDC);
  1013. }
  1014. }
  1015. for(i=0;i<pDoc->m_RoundArcArray.GetSize();i++)
  1016. {
  1017. CRoundArc*pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
  1018. if(pRoundArc->m_HaveFindFirst)
  1019. {
  1020. pRoundArc->m_HaveFindFirst=false;
  1021. pRoundArc->ShowSelectPoint(pDC);
  1022. }
  1023. }
  1024. for(i=0;i<pDoc->m_PolyBezierArray.GetSize();i++)
  1025. {
  1026. CPolyBezier*pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
  1027. if(pPolyBezier->m_HaveFindFirst)
  1028. {
  1029. pPolyBezier->m_HaveFindFirst=false;
  1030. pPolyBezier->ShowSelectPoint(pDC);
  1031. }
  1032. }
  1033. }
  1034. void CEastDrawView::ComputeMinandMaxPoint(CPoint point)
  1035. {
  1036. m_MinPoint.x=min(m_MinPoint.x,point.x);
  1037. m_MinPoint.y=min(m_MinPoint.y,point.y);
  1038. m_MaxPoint.x=max(m_MaxPoint.x,point.x);
  1039. m_MaxPoint.y=max(m_MaxPoint.y,point.y);
  1040. m_InvalidRect.SetRect(m_MinPoint,m_MaxPoint);
  1041. }
  1042. void CEastDrawView::InvalidateMovingRect(CUnit *pMovingUnit)
  1043. {
  1044. /*pMovingUnit->GetBoundingRect();
  1045. m_InvalidRect.left=min(m_InvalidRect.left,pMovingUnit->m_BoundingRect.left);
  1046. m_InvalidRect.top=min(m_InvalidRect.top,pMovingUnit->m_BoundingRect.top);
  1047. m_InvalidRect.right=max(m_InvalidRect.right,pMovingUnit->m_BoundingRect.right);
  1048. m_InvalidRect.bottom=max(m_InvalidRect.bottom,pMovingUnit->m_BoundingRect.bottom);
  1049. m_InvalidRect.InflateRect(pMovingUnit->m_PenWidth,pMovingUnit->m_PenWidth);
  1050. //
  1051. CClientDC dc(this);
  1052. dc.Rectangle(m_InvalidRect);*/
  1053. //this->InvalidateRect(m_InvalidRect);
  1054. }
  1055. void CEastDrawView::OnBUTTON32800RoundArc()
  1056. {
  1057. CClientDC dc(this);
  1058. OnPrepareDC(&dc);
  1059. dc.SetWindowOrg(m_CenterPoint);
  1060. // TODO: Add your command handler code here
  1061. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  1062. ResetSelectStatus();
  1063. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  1064. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  1065. {
  1066. pMainFrame->ShowFontBar(false);
  1067. if(this->m_LBDownTimes==1)
  1068. {
  1069. this->m_LBDownTimes=2;
  1070. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  1071. }
  1072. }
  1073. m_CurrentDrawTool=RoundArc_Tool;
  1074. m_CurrentDrawStatus=Draw_Status;
  1075. this->m_LBDownTimes=0;
  1076. }
  1077. void CEastDrawView::OnBUTTON32805EllipseArc()
  1078. {
  1079. CClientDC dc(this);
  1080. OnPrepareDC(&dc);
  1081. dc.SetWindowOrg(m_CenterPoint);
  1082. // TODO: Add your command handler code here
  1083. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  1084. ResetSelectStatus();
  1085. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  1086. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  1087. {
  1088. pMainFrame->ShowFontBar(false);
  1089. if(this->m_LBDownTimes==1)
  1090. {
  1091. this->m_LBDownTimes=2;
  1092. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  1093. }
  1094. }
  1095. m_CurrentDrawTool=EllipseArc_Tool;
  1096. m_CurrentDrawStatus=Draw_Status;
  1097. this->m_LBDownTimes=0;
  1098. }
  1099. void CEastDrawView::OnBUTTON32807PolyBezier()
  1100. {
  1101. CClientDC dc(this);
  1102. OnPrepareDC(&dc);
  1103. dc.SetWindowOrg(m_CenterPoint);
  1104. // TODO: Add your command handler code here
  1105. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  1106. ResetSelectStatus();
  1107. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  1108. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  1109. {
  1110. pMainFrame->ShowFontBar(false);
  1111. if(this->m_LBDownTimes==1)
  1112. {
  1113. this->m_LBDownTimes=2;
  1114. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  1115. }
  1116. }
  1117. m_CurrentDrawTool=PolyBezier_Tool;
  1118. m_CurrentDrawStatus=Draw_Status;
  1119. this->m_LBDownTimes=0;
  1120. }
  1121. void CEastDrawView::OnBUTTON32809Text()
  1122. {
  1123. CClientDC dc(this);
  1124. OnPrepareDC(&dc);
  1125. dc.SetWindowOrg(m_CenterPoint);
  1126. // TODO: Add your command handler code here
  1127. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  1128. ResetSelectStatus();
  1129. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  1130. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  1131. {
  1132. pMainFrame->ShowFontBar(true);
  1133. if(this->m_LBDownTimes==1)
  1134. {
  1135. this->m_LBDownTimes=2;
  1136. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  1137. }
  1138. }
  1139. if(!pMainFrame->m_wndStyleBar.IsWindowVisible())
  1140. {
  1141. pMainFrame->ShowFontBar(true);
  1142. this->m_LBDownTimes=0;
  1143. }
  1144. //m_pTextEdit->ShowWindow(true);
  1145. m_CurrentDrawTool=Text_Tool;
  1146. m_CurrentDrawStatus=Draw_Status;
  1147. this->m_LBDownTimes=0;
  1148. }
  1149. void CEastDrawView::GetFontInfo(LPTSTR pszFaceName, int &nSize)
  1150. {
  1151. /// CHARFORMAT cf = GetCharFormatSelection ();
  1152. //::lstrcpy (pszFaceName, cf.dwMask & CFM_FACE ? cf.szFaceName : _T (""));
  1153. // nSize = cf.dwMask & CFM_SIZE ? cf.yHeight : -1;
  1154. }
  1155. void CEastDrawView::OnCharBold()
  1156. {
  1157. // TODO: Add your command handler code here
  1158. CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
  1159. pMainFrame->m_wndStyleBar.OnCharBold();
  1160. }
  1161. void CEastDrawView::OnCharItalic()
  1162. {
  1163. // TODO: Add your command handler code here
  1164. CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
  1165. pMainFrame->m_wndStyleBar.OnCharItalic();
  1166. }
  1167. void CEastDrawView::OnCharUnderline()
  1168. {
  1169. // TODO: Add your command handler code here
  1170. CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
  1171. pMainFrame->m_wndStyleBar.OnCharUnderline();
  1172. }
  1173. void CEastDrawView::OnContextMenu(CWnd* pWnd, CPoint point)
  1174. {
  1175. CClientDC dc(this);
  1176. this->OnPrepareDC(&dc);
  1177. dc.SetWindowOrg(m_CenterPoint);
  1178. //dc.DPtoLP(&point);
  1179. // TODO: Add your message handler code here
  1180. if(m_CurrentDrawStatus!=Select_Status)
  1181. m_pCurrentUnit->OnContextMenu(pWnd,point);
  1182. if(m_CurrentDrawStatus==Select_Status)
  1183. {
  1184. CMenu menuTextEdit;
  1185. menuTextEdit.LoadMenu(IDR_MENU_Delete);
  1186. menuTextEdit.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN,point.x,point.y,pWnd);
  1187. }
  1188. }
  1189. void CEastDrawView::OnMenuitemOk()
  1190. {
  1191. // TODO: Add your command handler code here
  1192. CClientDC dc(this);
  1193. OnPrepareDC(&dc);
  1194. dc.SetWindowOrg(m_CenterPoint);
  1195. m_pCurrentUnit->OnMenuitemOk(&dc,this);
  1196. }
  1197. BOOL CEastDrawView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
  1198. {
  1199. // TODO: Add your message handler code here and/or call default
  1200. if(m_CurrentDrawStatus==Draw_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Color_Status)
  1201. SetCursor(AfxGetApp()->LoadCursor(ID_Draw));
  1202. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Select_Status)
  1203. SetCursor(AfxGetApp()->LoadCursor(ID_Change));
  1204. return true;
  1205. //return CScrollView::OnSetCursor(pWnd, nHitTest, message);
  1206. }
  1207. void CEastDrawView::ShowFontBar(BOOL isShow)
  1208. {
  1209. CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
  1210. pMainFrame->ShowFontBar(isShow);
  1211. }
  1212. void CEastDrawView::OnCirCu()
  1213. {
  1214. // TODO: Add your command handler code here
  1215. CClientDC dc(this);
  1216. this->OnPrepareDC(&dc);
  1217. dc.SetWindowOrg(m_CenterPoint);
  1218. this->m_pCurrentUnit->OnMenuitemCirCu(&dc,this);
  1219. }
  1220. void CEastDrawView::OnUpdateCirCu(CCmdUI* pCmdUI)
  1221. {
  1222. // TODO: Add your command update UI handler code here
  1223. pCmdUI->SetCheck();
  1224. }
  1225. void CEastDrawView::SetMousePosText(CPoint Logpoint,CPoint Devpoint)
  1226. {
  1227. CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
  1228. pMainFrame->SetMousePosText(Logpoint,Devpoint);
  1229. }
  1230. void CEastDrawView::DrawAxis(CDC*pDC)
  1231. {
  1232. CPen pen;
  1233. pen.CreatePen(PS_SOLID,1,RGB(255,0,0));
  1234. CPen*OldPen=pDC->SelectObject(&pen);
  1235. int oldRop=pDC->SetROP2(R2_NOTXORPEN);
  1236. pDC->MoveTo(m_CenterPoint.x+2,0);
  1237. pDC->LineTo(GetTotalSize().cx+m_CenterPoint.x-2,0);
  1238. pDC->MoveTo(0,m_CenterPoint.y+2);
  1239. pDC->LineTo(0,GetTotalSize().cy+m_CenterPoint.y-2);
  1240. pDC->SelectObject(OldPen);
  1241. pDC->SetROP2(oldRop);
  1242. }
  1243. BOOL CEastDrawView::SaveDIB(CBitmap*pbitmap, CFile&file)
  1244. {
  1245. CClientDC dc(this);
  1246. OnPrepareDC(&dc);
  1247. dc.SetWindowOrg(m_CenterPoint);
  1248. CDC*pViewDC=&dc;
  1249. CEastDrawDoc* pDoc = GetDocument();
  1250. ASSERT_VALID(pDoc);
  1251. CBitmap*Oldmap;
  1252. CBitmap Bitmap;
  1253. CDC memDC;
  1254. Bitmap.CreateCompatibleBitmap(pViewDC,this->GetTotalSize().cx,this->GetTotalSize().cy);
  1255. memDC.CreateCompatibleDC(pViewDC);
  1256. memDC.SetMapMode(pViewDC->GetMapMode());
  1257. Oldmap=memDC.SelectObject(&Bitmap);
  1258. memDC.SetWindowOrg(m_CenterPoint);
  1259. memDC.PatBlt(m_CenterPoint.x,m_CenterPoint.y,GetTotalSize().cx,GetTotalSize().cy,WHITENESS);
  1260. this->DrawAll(&memDC);
  1261. if(this->m_HaveAxis)
  1262. this->DrawAxis(&memDC);
  1263. ::GdiFlush();
  1264. memDC.SelectObject(Oldmap);
  1265. memDC.DeleteDC();
  1266. BITMAPFILEHEADER bmfHdr;
  1267. bmfHdr.bfType=0x4d42;
  1268. int sizeHdr=sizeof(BITMAPINFOHEADER);
  1269. LPBITMAPINFOHEADER lpBI=( LPBITMAPINFOHEADER)::GlobalAlloc(LMEM_FIXED,sizeHdr);
  1270. if(!lpBI)
  1271. {
  1272. AfxMessageBox("内存申请失败,请稍后再试");
  1273. }
  1274. BYTE *pDib;
  1275. BYTE *pDib2;
  1276. pDib=(BYTE*)::GlobalAlloc(LMEM_FIXED,GetTotalSize().cx*GetTotalSize().cy*4);
  1277. if(!pDib)
  1278. {
  1279. AfxMessageBox("内存申请失败,请稍后再试");
  1280. }
  1281. lpBI->biSize=(LONG)sizeof(BITMAPINFOHEADER);
  1282. lpBI->biWidth=(LONG)this->GetTotalSize().cx;
  1283. lpBI->biHeight=(LONG)this->GetTotalSize().cy;
  1284. lpBI->biPlanes=1;
  1285. lpBI->biBitCount=32;
  1286. lpBI->biCompression=BI_RGB;
  1287. lpBI->biSizeImage=0;
  1288. lpBI->biXPelsPerMeter=0;
  1289. lpBI->biYPelsPerMeter=0;
  1290. lpBI->biClrUsed=0;
  1291. lpBI->biClrImportant=0;
  1292. Bitmap.GetBitmapBits(GetTotalSize().cx*GetTotalSize().cy*4,pDib);
  1293. pDib2=(BYTE*)::GlobalAlloc(LMEM_FIXED,GetTotalSize().cx*GetTotalSize().cy*4);
  1294. if(!pDib2)
  1295. {
  1296. AfxMessageBox("内存申请失败,请稍后再试");
  1297. }
  1298. for(int j=0;j<GetTotalSize().cy;j++)
  1299. for(int i=0;i<GetTotalSize().cx*4;i++)
  1300. {
  1301. pDib2[i+j*GetTotalSize().cx*4]=pDib[GetTotalSize().cx*(GetTotalSize().cy-1-j)*4+i];
  1302. }
  1303. ::GlobalFree(pDib);
  1304. bmfHdr.bfSize=(DWORD) (sizeof(BITMAPFILEHEADER) +
  1305. sizeHdr +GetTotalSize().cx*GetTotalSize().cy*4);
  1306. bmfHdr.bfReserved1=bmfHdr.bfReserved2=0;
  1307. bmfHdr.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeHdr;
  1308. try
  1309. {
  1310. file.Write((LPVOID)&bmfHdr,sizeof(BITMAPFILEHEADER));
  1311. file.Write((LPVOID)lpBI,sizeHdr);
  1312. file.WriteHuge((LPVOID)pDib2,GetTotalSize().cx*GetTotalSize().cy*4);
  1313. }
  1314. catch(CException*Fe)
  1315. {
  1316. Fe->ReportError();
  1317. Fe->Delete();
  1318. return false;
  1319. }
  1320. ::GlobalFree(lpBI);
  1321. ::GlobalFree(pDib2);
  1322. return true;
  1323. }
  1324. void CEastDrawView::DeleteSelect()
  1325. {
  1326. this->ExchangeSave();
  1327. CClientDC dc(this);
  1328. this->OnPrepareDC(&dc);
  1329. dc.SetWindowOrg(m_CenterPoint);
  1330. CDC*pDC=&dc;
  1331. CEastDrawDoc* pDoc = GetDocument();
  1332. ASSERT_VALID(pDoc);
  1333. int oldrop=pDC->SetROP2(R2_NOTXORPEN);
  1334. for(int i=0;i<pDoc->m_PolygonArray.GetSize();i++)
  1335. {
  1336. CPolygon*pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
  1337. if(pPolygon->m_HaveFindFirst)
  1338. {
  1339. pPolygon->ShowSelectPoint(pDC);
  1340. pPolygon->DrawStatic(pDC);
  1341. pDoc->m_PolygonArray.RemoveAt(i);
  1342. delete pPolygon;
  1343. i--;
  1344. }
  1345. }
  1346. for(i=0;i<pDoc->m_TextArray.GetSize();i++)
  1347. {
  1348. CText*pText=(CText*)pDoc->m_TextArray.GetAt(i);
  1349. if(pText->m_HaveFindFirst)
  1350. {
  1351. pText->ShowSelectPoint(pDC);
  1352. //pText->DrawStatic(pDC);
  1353. CPoint point=pText->m_PositionPoint;
  1354. pDC->LPtoDP(&point);
  1355. this->InvalidateRect(CRect(point,CPoint(point.x+pText->m_Width,point.y+pText->m_Hight)));
  1356. pDoc->m_TextArray.RemoveAt(i);
  1357. delete pText;
  1358. i--;
  1359. }
  1360. }
  1361. for(i=0;i<pDoc->m_PolyBezierArray.GetSize();i++)
  1362. {
  1363. CPolyBezier*pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
  1364. if(pPolyBezier->m_HaveFindFirst)
  1365. {
  1366. pPolyBezier->ShowSelectPoint(pDC);
  1367. pPolyBezier->DrawStatic(pDC);
  1368. pDoc->m_PolyBezierArray.RemoveAt(i);
  1369. delete pPolyBezier;
  1370. i--;
  1371. }
  1372. }
  1373. for(i=0;i<pDoc->m_DLineArray.GetSize();i++)
  1374. {
  1375. CDLine*pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
  1376. if(pDLine->m_HaveFindFirst)
  1377. { pDLine->ShowSelectPoint(pDC);
  1378. pDLine->DrawStatic(pDC);
  1379. pDoc->m_DLineArray.RemoveAt(i);
  1380. delete pDLine;
  1381. i--;
  1382. }
  1383. }
  1384. for(i=0;i<pDoc->m_CurveArray.GetSize();i++)
  1385. {
  1386. CCurve*pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
  1387. if(pCurve->m_HaveFindFirst)
  1388. {
  1389. pCurve->ShowSelectPoint(pDC);
  1390. pCurve->DrawStatic(pDC);
  1391. pDoc->m_CurveArray.RemoveAt(i);
  1392. delete pCurve;
  1393. i--;
  1394. }
  1395. }
  1396. for(i=0;i<pDoc->m_RectangleArray.GetSize();i++)
  1397. {
  1398. CRectangle*pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
  1399. if(pRectangle->m_HaveFindFirst)
  1400. {
  1401. pRectangle->ShowSelectPoint(pDC);
  1402. pRectangle->DrawStatic(pDC);
  1403. pDoc->m_RectangleArray.RemoveAt(i);
  1404. delete pRectangle;
  1405. i--;
  1406. }
  1407. }
  1408. for(i=0;i<pDoc->m_RoundRectangleArray.GetSize();i++)
  1409. {
  1410. CRoundRectangle*pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
  1411. if(pRoundRectangle->m_HaveFindFirst)
  1412. {
  1413. pRoundRectangle->ShowSelectPoint(pDC);
  1414. pRoundRectangle->DrawStatic(pDC);
  1415. pDoc->m_RoundRectangleArray.RemoveAt(i);
  1416. delete pRoundRectangle;
  1417. i--;
  1418. }
  1419. }
  1420. for(i=0;i<pDoc->m_EllipseArray.GetSize();i++)
  1421. {
  1422. CEllipse*pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
  1423. if(pEllipse->m_HaveFindFirst)
  1424. { pEllipse->ShowSelectPoint(pDC);
  1425. pEllipse->DrawStatic(pDC);
  1426. pDoc->m_EllipseArray.RemoveAt(i);
  1427. delete pEllipse;
  1428. i--;
  1429. }
  1430. }
  1431. for(i=0;i<pDoc->m_RoundArray.GetSize();i++)
  1432. {
  1433. CRound*pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
  1434. if(pRound->m_HaveFindFirst)
  1435. {
  1436. pRound->ShowSelectPoint(pDC);
  1437. pRound->DrawStatic(pDC);
  1438. pDoc->m_RoundArray.RemoveAt(i);
  1439. delete pRound;
  1440. i--;
  1441. }
  1442. }
  1443. for(i=0;i<pDoc->m_LiEllipseArray.GetSize();i++)
  1444. {
  1445. CEllipse*pLiEllipse=(CEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
  1446. if(pLiEllipse->m_HaveFindFirst)
  1447. {
  1448. pLiEllipse->ShowSelectPoint(pDC);
  1449. pLiEllipse->DrawStatic(pDC);
  1450. pDoc->m_LiEllipseArray.RemoveAt(i);
  1451. delete pLiEllipse;
  1452. i--;
  1453. }
  1454. }
  1455. for(i=0;i<pDoc->m_RoundArcArray.GetSize();i++)
  1456. {
  1457. CRoundArc*pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
  1458. if(pRoundArc->m_HaveFindFirst)
  1459. {
  1460. pRoundArc->ShowSelectPoint(pDC);
  1461. pRoundArc->DrawStatic(pDC);
  1462. pDoc->m_RoundArcArray.RemoveAt(i);
  1463. delete pRoundArc;
  1464. i--;
  1465. }
  1466. }
  1467. for(i=0;i<pDoc->m_EllipseArcArray.GetSize();i++)
  1468. {
  1469. CEllipseArc*pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
  1470. if(pEllipseArc->m_HaveFindFirst)
  1471. { pEllipseArc->ShowSelectPoint(pDC);
  1472. pEllipseArc->DrawStatic(pDC);
  1473. pDoc->m_EllipseArcArray.RemoveAt(i);
  1474. delete pEllipseArc;
  1475. i--;
  1476. }
  1477. }
  1478. pDC->SetROP2(oldrop);
  1479. }
  1480. void CEastDrawView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
  1481. {
  1482. // TODO: Add your message handler code here and/or call default
  1483. if(nChar==VK_DELETE)
  1484. this->DeleteSelect();
  1485. CScrollView::OnKeyUp(nChar, nRepCnt, nFlags);
  1486. }
  1487. void CEastDrawView::OnDelete()
  1488. {
  1489. // TODO: Add your command handler code here
  1490. this->DeleteSelect();
  1491. }
  1492. void CEastDrawView::OnBUTTON32830Lock()
  1493. {
  1494. // TODO: Add your command handler code here
  1495. m_IsLocked=!m_IsLocked;
  1496. }
  1497. void CEastDrawView::OnUpdateBUTTON32830Lock(CCmdUI* pCmdUI)
  1498. {
  1499. // TODO: Add your command update UI handler code here
  1500. pCmdUI->SetCheck(m_IsLocked?1:0);
  1501. }
  1502. void CEastDrawView::OnUpdateBUTTONDLine(CCmdUI* pCmdUI)
  1503. {
  1504. // TODO: Add your command update UI handler code here
  1505. pCmdUI->SetCheck(m_CurrentDrawTool==DLine_Tool?1:0);
  1506. }
  1507. void CEastDrawView::OnUpdateBUTTON32776Rectangle(CCmdUI* pCmdUI)
  1508. {
  1509. // TODO: Add your command update UI handler code here
  1510. pCmdUI->SetCheck(m_CurrentDrawTool==Rectangle_Tool?1:0);
  1511. }
  1512. void CEastDrawView::OnUpdateBUTTON32778RoundRectangle(CCmdUI* pCmdUI)
  1513. {
  1514. // TODO: Add your command update UI handler code here
  1515. pCmdUI->SetCheck(m_CurrentDrawTool==RoundRectangle_Tool?1:0);
  1516. }
  1517. void CEastDrawView::OnUpdateBUTTON32791Polygon(CCmdUI* pCmdUI)
  1518. {
  1519. // TODO: Add your command update UI handler code here
  1520. pCmdUI->SetCheck(m_CurrentDrawTool==Polygon_Tool?1:0);
  1521. }
  1522. void CEastDrawView::OnUpdateBUTTON32779Ellipse(CCmdUI* pCmdUI)
  1523. {
  1524. // TODO: Add your command update UI handler code here
  1525. pCmdUI->SetCheck(m_CurrentDrawTool==Ellipse_Tool?1:0);
  1526. }
  1527. void CEastDrawView::OnUpdateBUTTON32780Round(CCmdUI* pCmdUI)
  1528. {
  1529. // TODO: Add your command update UI handler code here
  1530. pCmdUI->SetCheck(m_CurrentDrawTool==Round_Tool?1:0);
  1531. }
  1532. void CEastDrawView::OnUpdateBUTTON32777Curve(CCmdUI* pCmdUI)
  1533. {
  1534. // TODO: Add your command update UI handler code here
  1535. pCmdUI->SetCheck(m_CurrentDrawTool==Curve_Tool?1:0);
  1536. }
  1537. void CEastDrawView::OnUpdateBUTTONLiEllipse(CCmdUI* pCmdUI)
  1538. {
  1539. // TODO: Add your command update UI handler code here
  1540. pCmdUI->SetCheck(m_CurrentDrawTool==LiEllipse_Tool?1:0);
  1541. }
  1542. void CEastDrawView::OnUpdateBUTTON32800RoundArc(CCmdUI* pCmdUI)
  1543. {
  1544. // TODO: Add your command update UI handler code here
  1545. pCmdUI->SetCheck(m_CurrentDrawTool==RoundArc_Tool?1:0);
  1546. }
  1547. void CEastDrawView::OnUpdateBUTTON32805EllipseArc(CCmdUI* pCmdUI)
  1548. {
  1549. // TODO: Add your command update UI handler code here
  1550. pCmdUI->SetCheck(m_CurrentDrawTool==EllipseArc_Tool?1:0);
  1551. }
  1552. void CEastDrawView::OnUpdateBUTTON32807PolyBezier(CCmdUI* pCmdUI)
  1553. {
  1554. // TODO: Add your command update UI handler code here
  1555. pCmdUI->SetCheck(m_CurrentDrawTool==PolyBezier_Tool?1:0);
  1556. }
  1557. void CEastDrawView::OnUpdateBUTTON32809Text(CCmdUI* pCmdUI)
  1558. {
  1559. // TODO: Add your command update UI handler code here
  1560. pCmdUI->SetCheck(m_CurrentDrawTool==Text_Tool?1:0);
  1561. }
  1562. void CEastDrawView::OnUpdateBUTTON32774Move(CCmdUI* pCmdUI)
  1563. {
  1564. // TODO: Add your command update UI handler code here
  1565. pCmdUI->SetCheck(m_CurrentDrawStatus!=Draw_Status&&m_CurrentDrawStatus!=0?1:0);
  1566. }
  1567. void CEastDrawView::OnBUTTON32845Axis()
  1568. {
  1569. // TODO: Add your command handler code here
  1570. CClientDC dc(this);
  1571. OnPrepareDC(&dc);
  1572. dc.SetWindowOrg(m_CenterPoint);
  1573. DrawAxis(&dc);
  1574. m_HaveAxis=!m_HaveAxis;
  1575. }
  1576. void CEastDrawView::OnUpdateBUTTON32845Axis(CCmdUI* pCmdUI)
  1577. {
  1578. // TODO: Add your command update UI handler code here
  1579. pCmdUI->SetCheck(m_HaveAxis?1:0);
  1580. }
  1581. void CEastDrawView::OnBUTTON32850ReDraw()
  1582. {
  1583. // TODO: Add your command handler code here
  1584. CEastDrawDoc* pDoc = GetDocument();
  1585. ASSERT_VALID(pDoc);
  1586. CClientDC dc(this);
  1587. this->OnPrepareDC(&dc);
  1588. dc.SetWindowOrg(m_CenterPoint);
  1589. CBitmap*Oldmap;
  1590. CBitmap Bitmap;
  1591. CDC memDC;
  1592. Bitmap.CreateCompatibleBitmap(&dc,this->GetTotalSize().cx,this->GetTotalSize().cy);
  1593. memDC.CreateCompatibleDC(&dc);
  1594. Oldmap=memDC.SelectObject(&Bitmap);
  1595. memDC.SetWindowOrg(m_CenterPoint);
  1596. CRect client;
  1597. CBrush br(RGB(255,0,255));
  1598. GetClientRect(client);
  1599. dc.DPtoLP(&client);
  1600. memDC.SetMapMode(dc.GetMapMode());
  1601. memDC.PatBlt(client.left,client.top,client.Width(),client.Height(),WHITENESS);
  1602. this->DrawAll(&memDC);
  1603. if(this->m_HaveAxis)
  1604. this->DrawAxis(&memDC);
  1605. dc.BitBlt(client.left,client.top,client.Width(),client.Height(),&memDC,client.left,client.top,SRCCOPY);
  1606. memDC.DeleteDC();
  1607. }
  1608. void CEastDrawView::DrawAll(CDC *pDrawDC)
  1609. {
  1610. CEastDrawDoc* pDoc = GetDocument();
  1611. ASSERT_VALID(pDoc);
  1612. CDC*pDC=pDrawDC;
  1613. for(int i=0;i<pDoc->m_PolygonArray.GetSize();i++)
  1614. {
  1615. CPolygon*pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
  1616. pPolygon->DrawStatic(pDC);
  1617. if(pPolygon->m_HaveFindFirst)
  1618. pPolygon->ShowSelectPoint(pDC);
  1619. }
  1620. for(i=0;i<pDoc->m_PolyBezierArray.GetSize();i++)
  1621. {
  1622. CPolyBezier*pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
  1623. pPolyBezier->DrawStatic(pDC);
  1624. if(pPolyBezier->m_HaveFindFirst)
  1625. pPolyBezier->ShowSelectPoint(pDC);
  1626. }
  1627. for(i=0;i<pDoc->m_DLineArray.GetSize();i++)
  1628. {
  1629. CDLine*pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
  1630. pDLine->DrawStatic(pDC);
  1631. if(pDLine->m_HaveFindFirst)
  1632. pDLine->ShowSelectPoint(pDC);
  1633. }
  1634. for(i=0;i<pDoc->m_CurveArray.GetSize();i++)
  1635. {
  1636. CCurve*pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
  1637. pCurve->DrawStatic(pDC);
  1638. if(pCurve->m_HaveFindFirst)
  1639. pCurve->ShowSelectPoint(pDC);
  1640. }
  1641. for(i=0;i<pDoc->m_RectangleArray.GetSize();i++)
  1642. {
  1643. CRectangle*pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
  1644. pRectangle->DrawStatic(pDC);
  1645. if(pRectangle->m_HaveFindFirst)
  1646. pRectangle->ShowSelectPoint(pDC);
  1647. }
  1648. for(i=0;i<pDoc->m_RoundRectangleArray.GetSize();i++)
  1649. {
  1650. CRoundRectangle*pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
  1651. pRoundRectangle->DrawStatic(pDC);
  1652. if(pRoundRectangle->m_HaveFindFirst)
  1653. pRoundRectangle->ShowSelectPoint(pDC);
  1654. }
  1655. for(i=0;i<pDoc->m_EllipseArray.GetSize();i++)
  1656. {
  1657. CEllipse*pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
  1658. pEllipse->DrawStatic(pDC);
  1659. if(pEllipse->m_HaveFindFirst)
  1660. pEllipse->ShowSelectPoint(pDC);
  1661. }
  1662. for(i=0;i<pDoc->m_RoundArray.GetSize();i++)
  1663. {
  1664. CRound*pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
  1665. pRound->DrawStatic(pDC);
  1666. if(pRound->m_HaveFindFirst)
  1667. pRound->ShowSelectPoint(pDC);
  1668. }
  1669. for(i=0;i<pDoc->m_LiEllipseArray.GetSize();i++)
  1670. {
  1671. CEllipse*pLiEllipse=(CEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
  1672. pLiEllipse->DrawStatic(pDC);
  1673. if(pLiEllipse->m_HaveFindFirst)
  1674. pLiEllipse->ShowSelectPoint(pDC);
  1675. }
  1676. for(i=0;i<pDoc->m_RoundArcArray.GetSize();i++)
  1677. {
  1678. CRoundArc*pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
  1679. pRoundArc->DrawStatic(pDC);
  1680. if(pRoundArc->m_HaveFindFirst)
  1681. pRoundArc->ShowSelectPoint(pDC);
  1682. }
  1683. for(i=0;i<pDoc->m_EllipseArcArray.GetSize();i++)
  1684. {
  1685. CEllipseArc*pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
  1686. pEllipseArc->DrawStatic(pDC);
  1687. if(pEllipseArc->m_HaveFindFirst)
  1688. pEllipseArc->ShowSelectPoint(pDC);
  1689. }
  1690. for(i=0;i<pDoc->m_TextArray.GetSize();i++)
  1691. {
  1692. CText*pText=(CText*)pDoc->m_TextArray.GetAt(i);
  1693. pText->DrawStatic(pDC);
  1694. if(pText->m_HaveFindFirst)
  1695. pText->ShowSelectPoint(pDC);
  1696. }
  1697. // TODO: add draw code for native data here
  1698. }
  1699. void CEastDrawView::OnBUTTON32856DONothing()
  1700. {
  1701. // TODO: Add your command handler code here
  1702. CClientDC dc(this);
  1703. OnPrepareDC(&dc);
  1704. dc.SetWindowOrg(m_CenterPoint);
  1705. // TODO: Add your command handler code here
  1706. if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
  1707. ResetSelectStatus();
  1708. CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
  1709. if(pMainFrame->m_wndStyleBar.IsWindowVisible())
  1710. {
  1711. pMainFrame->ShowFontBar(false);
  1712. if(this->m_LBDownTimes==1)
  1713. {
  1714. this->m_LBDownTimes=2;
  1715. this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
  1716. }
  1717. }
  1718. m_CurrentDrawTool=0;
  1719. m_CurrentDrawStatus=0;
  1720. m_LBDownTimes=0;
  1721. }
  1722. void CEastDrawView::AddTempFile()
  1723. {
  1724. CEastDrawDoc* pDoc = GetDocument();
  1725. ASSERT_VALID(pDoc);
  1726. pDoc->AddTempFile();
  1727. }
  1728. void CEastDrawView::AutoSave()
  1729. {
  1730. CEastDrawDoc* pDoc = GetDocument();
  1731. ASSERT_VALID(pDoc);
  1732. pDoc->AutoSave();
  1733. }
  1734. void CEastDrawView::ExchangeSave()
  1735. {
  1736. CEastDrawDoc* pDoc = GetDocument();
  1737. ASSERT_VALID(pDoc);
  1738. pDoc->SetModifiedFlag();
  1739. if(m_IsLastMove)
  1740. {
  1741. pDoc->Requeue(m_Index,m_Rtimes);
  1742. m_IsLastMove=false;
  1743. m_Index=0;
  1744. }
  1745. else
  1746. {
  1747. m_Index=0;
  1748. if(m_Rtimes<6)
  1749. m_Rtimes++;
  1750. }
  1751. pDoc->ExchangeSave(m_Index,m_Rtimes);
  1752. }
  1753. void CEastDrawView::OnBUTTON32858OnDo()
  1754. {
  1755. // TODO: Add your command handler code here
  1756. CEastDrawDoc* pDoc = GetDocument();
  1757. ASSERT_VALID(pDoc);
  1758. if(m_Index<5)
  1759. {
  1760. m_Index++;
  1761. this->m_IsLastMove=true;
  1762. pDoc->OnBUTTON32858OnDo(m_Index);
  1763. OnBUTTON32850ReDraw();
  1764. }
  1765. }
  1766. void CEastDrawView::OnBUTTON32859ReDo()
  1767. {
  1768. // TODO: Add your command handler code here
  1769. CEastDrawDoc* pDoc = GetDocument();
  1770. ASSERT_VALID(pDoc);
  1771. if(m_Index>0)
  1772. {
  1773. m_Index--;
  1774. pDoc->OnBUTTON32858OnDo(m_Index);
  1775. m_IsLastMove=true;
  1776. OnBUTTON32850ReDraw();
  1777. }
  1778. }
  1779. void CEastDrawView::OnUpdateBUTTON32858OnDo(CCmdUI* pCmdUI)
  1780. {
  1781. // TODO: Add your command update UI handler code here
  1782. pCmdUI->Enable(m_Index<5&&m_Index<m_Rtimes&&m_Rtimes!=0?true:false);
  1783. }
  1784. void CEastDrawView::OnUpdateBUTTON32859ReDo(CCmdUI* pCmdUI)
  1785. {
  1786. // TODO: Add your command update UI handler code here
  1787. pCmdUI->Enable(m_Index>0&&m_Rtimes!=0?true:false);
  1788. }
  1789. void CEastDrawView::ReMoveTemp()
  1790. {
  1791. CEastDrawDoc* pDoc = GetDocument();
  1792. ASSERT_VALID(pDoc);
  1793. pDoc->ReMoveTemp();
  1794. }
  1795. void CEastDrawView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
  1796. {
  1797. // TODO: Add your specialized code here and/or call the base class
  1798. CClientDC dc(this);
  1799. int nHorzSC = dc.GetDeviceCaps(LOGPIXELSX);
  1800. int nHorzPR = pDC->GetDeviceCaps(LOGPIXELSX);
  1801. int PhyToDis=nHorzPR/nHorzSC;
  1802. pDC->SetMapMode(MM_ANISOTROPIC);
  1803. pDC->SetWindowExt(GetTotalSize());
  1804. pDC->SetViewportExt(GetTotalSize().cx*PhyToDis,GetTotalSize().cy*PhyToDis);
  1805. pDC->SetWindowOrg(m_CenterPoint.x,m_CenterPoint.y);
  1806. this->DrawAll(pDC);
  1807. if(this->m_HaveAxis)
  1808. this->DrawAxis(pDC);
  1809. }
  1810. BOOL CEastDrawView::OnPreparePrinting(CPrintInfo* pInfo)
  1811. {
  1812. // TODO: call DoPreparePrinting to invoke the Print dialog box
  1813. return DoPreparePrinting(pInfo);
  1814. }
  1815. void CEastDrawView::SetBoxFont()
  1816. {
  1817. CMainFrame*pMainFrame=STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
  1818. pMainFrame->m_wndStyleBar.IniFont();
  1819. }
  1820. void CEastDrawView::OnMouseCapOn()
  1821. {
  1822. // TODO: Add your command handler code here
  1823. m_IsMouseCap=!m_IsMouseCap;
  1824. }
  1825. void CEastDrawView::OnUpdateMouseCapOn(CCmdUI* pCmdUI)
  1826. {
  1827. // TODO: Add your command update UI handler code here
  1828. pCmdUI->SetCheck(m_IsMouseCap?1:0);
  1829. }
  1830. void CEastDrawView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
  1831. {
  1832. // TODO: Add your message handler code here and/or call default
  1833. CSize size=this->GetTotalSize();
  1834. CRect rect;
  1835. this->GetClientRect(&rect);
  1836. switch(nChar)
  1837. {
  1838. case VK_UP:
  1839. if(rect.bottom<size.cy)
  1840. ScrollToPosition(CPoint(GetDeviceScrollPosition().x,GetDeviceScrollPosition().y-rect.Height()/2));
  1841. break;
  1842. case VK_DOWN:
  1843. if(rect.bottom<size.cy)
  1844. ScrollToPosition(CPoint(GetDeviceScrollPosition().x,GetDeviceScrollPosition().y+rect.Height()/2));
  1845. break;
  1846. case VK_LEFT:
  1847. ScrollToPosition(CPoint(GetDeviceScrollPosition().x-rect.Width()/2,GetDeviceScrollPosition().y));
  1848. break;
  1849. case VK_RIGHT:
  1850. ScrollToPosition(CPoint(GetDeviceScrollPosition().x+rect.Width()/2,GetDeviceScrollPosition().y));
  1851. break;
  1852. case VK_HOME:
  1853. ScrollToPosition(CPoint(0,0));
  1854. break;
  1855. }
  1856. CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
  1857. }