123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280 |
- // EastDrawView.cpp : implementation of the CEastDrawView class
- //
- #include "stdafx.h"
- #include "EastDraw.h"
- #include "EastDrawDoc.h"
- #include "EastDrawView.h"
- #include "ReginSet.h"
- #include "EditBox.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CEastDrawView
- IMPLEMENT_DYNCREATE(CEastDrawView, CScrollView)
- BEGIN_MESSAGE_MAP(CEastDrawView, CScrollView)
- //{{AFX_MSG_MAP(CEastDrawView)
- ON_WM_LBUTTONDOWN()
- ON_WM_LBUTTONUP()
- ON_WM_MOUSEMOVE()
- ON_COMMAND(ID_BUTTON_DLine, OnBUTTONDLine)
- ON_COMMAND(ID_BUTTON32774_Move, OnBUTTON32774Move)
- ON_COMMAND(ID_BUTTON32775_CircumRotate, OnBUTTON32775CircumRotate)
- ON_COMMAND(ID_BUTTON32777_Curve, OnBUTTON32777Curve)
- ON_COMMAND(ID_BUTTON32776_Rectangle, OnBUTTON32776Rectangle)
- ON_COMMAND(ID_BUTTON32778_RoundRectangle, OnBUTTON32778RoundRectangle)
- ON_COMMAND(ID_BUTTON32779_Ellipse, OnBUTTON32779Ellipse)
- ON_COMMAND(ID_BUTTON32780_Round, OnBUTTON32780Round)
- ON_COMMAND(ID_BUTTON32791_Polygon, OnBUTTON32791Polygon)
- ON_WM_LBUTTONDBLCLK()
- ON_WM_SETFOCUS()
- ON_COMMAND(ID_MENUITEM32794_SetRegin, OnMENUITEM32794SetRegin)
- ON_COMMAND(ID_BUTTON_LiEllipse, OnBUTTONLiEllipse)
- ON_COMMAND(ID_BUTTON32800_RoundArc, OnBUTTON32800RoundArc)
- ON_COMMAND(ID_BUTTON32805_EllipseArc, OnBUTTON32805EllipseArc)
- ON_COMMAND(ID_BUTTON32807_PolyBezier, OnBUTTON32807PolyBezier)
- ON_COMMAND(ID_BUTTON32809_Text, OnBUTTON32809Text)
- ON_COMMAND(ID_CHAR_BOLD, OnCharBold)
- ON_COMMAND(ID_CHAR_ITALIC, OnCharItalic)
- ON_COMMAND(ID_CHAR_UNDERLINE, OnCharUnderline)
- ON_WM_CONTEXTMENU()
- ON_COMMAND(ID_MENUITEM_OK, OnMenuitemOk)
- ON_WM_SETCURSOR()
- ON_COMMAND(ID_CirCu, OnCirCu)
- ON_UPDATE_COMMAND_UI(ID_CirCu, OnUpdateCirCu)
- ON_WM_KEYUP()
- ON_COMMAND(ID_Delete, OnDelete)
- ON_COMMAND(ID_BUTTON32830_Lock, OnBUTTON32830Lock)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32830_Lock, OnUpdateBUTTON32830Lock)
- ON_UPDATE_COMMAND_UI(ID_BUTTON_DLine, OnUpdateBUTTONDLine)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32776_Rectangle, OnUpdateBUTTON32776Rectangle)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32778_RoundRectangle, OnUpdateBUTTON32778RoundRectangle)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32791_Polygon, OnUpdateBUTTON32791Polygon)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32779_Ellipse, OnUpdateBUTTON32779Ellipse)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32780_Round, OnUpdateBUTTON32780Round)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32777_Curve, OnUpdateBUTTON32777Curve)
- ON_UPDATE_COMMAND_UI(ID_BUTTON_LiEllipse, OnUpdateBUTTONLiEllipse)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32800_RoundArc, OnUpdateBUTTON32800RoundArc)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32805_EllipseArc, OnUpdateBUTTON32805EllipseArc)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32807_PolyBezier, OnUpdateBUTTON32807PolyBezier)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32809_Text, OnUpdateBUTTON32809Text)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32774_Move, OnUpdateBUTTON32774Move)
- ON_COMMAND(ID_BUTTON32845_Axis, OnBUTTON32845Axis)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32845_Axis, OnUpdateBUTTON32845Axis)
- ON_COMMAND(ID_BUTTON32850_ReDraw, OnBUTTON32850ReDraw)
- ON_COMMAND(ID_BUTTON32856_DONothing, OnBUTTON32856DONothing)
- ON_COMMAND(ID_BUTTON32858_OnDo, OnBUTTON32858OnDo)
- ON_COMMAND(ID_BUTTON32859_ReDo, OnBUTTON32859ReDo)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32858_OnDo, OnUpdateBUTTON32858OnDo)
- ON_UPDATE_COMMAND_UI(ID_BUTTON32859_ReDo, OnUpdateBUTTON32859ReDo)
- ON_COMMAND(ID_MouseCap_On, OnMouseCapOn)
- ON_UPDATE_COMMAND_UI(ID_MouseCap_On, OnUpdateMouseCapOn)
- ON_WM_KEYDOWN()
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CEastDrawView construction/destruction
- #include "MainFrm.h"
- #include "CCurve.h"
- #include "CDLine.h"
- #include "CRectangle.h"
- #include "CRoundRectangle.h"
- #include "CEllipse.h"
- #include "CRound.h"
- #include "CPolygon.h"
- #include"CLiEllipse.h"
- #include"CRoundArc.h"
- #include"CEllipseArc.h"
- #include "CPolyBezier.h"
- //#include "TextEdit.h"
- #include "CText.h"
- CEastDrawView::CEastDrawView()
- {
- // TODO: add construction code here
- m_IsLastMove=false;
- m_Rtimes=0;
- m_Index=0;
- m_pCurrentUnit=new CUnit;
- m_HaveAxis=true;
- m_Bitmap=NULL;
- m_IsLocked=false;
- CMainFrame*pMainFrame=STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
- m_DLineProperty=pMainFrame->m_DLineProperty;
- m_IsMouseCap=true;
- }
- CEastDrawView::~CEastDrawView()
- {
- this->ReMoveTemp();
- }
- BOOL CEastDrawView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CScrollView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEastDrawView drawing
- void CEastDrawView::OnDraw(CDC* pDC)
- {
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- pDC->SetWindowOrg(m_CenterPoint);
- this->DrawAll(pDC);
-
- if(this->m_HaveAxis)
- this->DrawAxis(pDC);
-
- }
- void CEastDrawView::OnInitialUpdate()
- {
- CScrollView::OnInitialUpdate();
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- CSize sizeTotal;
- // TODO: calculate the total size of this view
- sizeTotal.cx = sizeTotal.cy =2000;
- SetScrollSizes(MM_TEXT,pDoc->m_TotalSize);
- m_CenterPoint=pDoc->m_CenterPoint;
- //SetScrollSizes(MM_HIENGLISH, sizeTotal);
- m_bHaveFindFirst=FALSE;
- m_bHaveFindSecond=false;
- m_LBDownTimes=0;
- m_CurrentDrawTool=0;
- m_CurrentDrawStatus=0;
- ScrollToPosition(CPoint(900,600));
-
- AddTempFile();
- AutoSave();
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEastDrawView printing
- void CEastDrawView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CEastDrawView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEastDrawView diagnostics
- #ifdef _DEBUG
- void CEastDrawView::AssertValid() const
- {
- CScrollView::AssertValid();
- }
- void CEastDrawView::Dump(CDumpContext& dc) const
- {
- CScrollView::Dump(dc);
- }
- CEastDrawDoc* CEastDrawView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEastDrawDoc)));
- return (CEastDrawDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CEastDrawView message handlers
- //******************************************************************************
- //******************************************************************************
- //**********void CEastDrawView::OnLButtonDown(UINT nFlags, CPoint point)********************************************************************
- //******************************************************************************
- //******************************************************************************
- void CEastDrawView::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
-
- CEastDrawDoc*pDoc=this->GetDocument();
- CPoint Devpoint=point;
- CClientDC dc(this);
- this->OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- dc.DPtoLP(&point);
- dc.SetROP2(R2_NOTXORPEN);
- this->ComputeMinandMaxPoint(point);
- m_ChangeingPoint=point;
- this->SetMousePosText(point,Devpoint);
-
-
- if(this->m_CurrentDrawStatus==Draw_Status)
- {
- if(this->m_CurrentDrawTool!=Polygon_Tool&&this->m_CurrentDrawTool!=PolyBezier_Tool)
- {
- if(this->m_CurrentDrawTool==EllipseArc_Tool)
- {
- if(m_LBDownTimes==3)
- {
- this->m_pCurrentUnit->DrawActive(&dc,point);
- this->m_pCurrentUnit->DrawStatic(&dc);
- this->m_LBDownTimes=-1;
- //if(m_DLineProperty->m_Mode->m_bMode)
- //this->m_pCurrentUnit->DrawStatic(&dc);
- }
-
- }
- if(this->m_CurrentDrawTool==Ellipse_Tool||m_CurrentDrawTool==RoundArc_Tool)
- {
- if(m_LBDownTimes==2)
- {
- this->ComputeMinandMaxPoint(point);
- this->m_pCurrentUnit->DrawActive(&dc,point);
- this->m_pCurrentUnit->DrawStatic(&dc);
- this->InvalidateMovingRect(m_pCurrentUnit);
- m_LBDownTimes=-1;
- //if(m_DLineProperty->m_Mode->m_bMode)
- //this->m_pCurrentUnit->DrawStatic(&dc);
- }
- }
- if(this->m_CurrentDrawTool!=Text_Tool&&this->m_CurrentDrawTool!=Ellipse_Tool&&this->m_CurrentDrawTool!=RoundArc_Tool&&this->m_CurrentDrawTool!=EllipseArc_Tool)
- {
- if(m_LBDownTimes==1)
- {
- //this->ComputeMinandMaxPoint(point);
- //this->InvalidateMovingRect(m_pCurrentUnit);
- m_LBDownTimes=-1;
- //if(m_DLineProperty->m_Mode->m_bMode)
- //this->m_pCurrentUnit->DrawStatic(&dc);
- }
- }//*****if(this->m_CurrentDrawTool!=Ellipse_Tool)
- }//*****if(this->m_CurrentDrawTool!=Polygon_Tool)
- }//*******if(this->m_CurrentDrawStatus==Draw_Status)
- if(this->m_CurrentDrawStatus==Select_Status)
- {
- m_LBDownTimes=0;
- this->m_CurrentDrawTool=0;
- }
-
- if(m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Drag_Status)
- {
-
- if((m_CurrentDrawTool==Round_Tool||m_CurrentDrawTool==Ellipse_Tool)&&m_CurrentDrawStatus==Change_Status)
- {
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_CenterPoint,m_pCurrentUnit->m_FoundPoint);
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_CenterPoint,point);
-
- }
-
- m_LBDownTimes=-1;
- m_bHaveFindFirst=false;
- m_CurrentDrawStatus=Select_Status;
- m_pCurrentUnit->ShowSelectPoint(&dc);
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,point);
- m_pCurrentUnit->DrawOldReferencePoint(&dc,m_pCurrentUnit->m_FoundPoint);
- this->ComputeMinandMaxPoint(point);
- this->InvalidateMovingRect(m_pCurrentUnit);
- if(m_CurrentDrawTool==RoundArc_Tool)
- {
- m_pCurrentUnit->DrawActive(&dc,point);
- m_pCurrentUnit->DrawStatic(&dc);
- }
- }
-
- if(m_LBDownTimes==-1||m_CurrentDrawTool==0||m_CurrentDrawTool==Text_Tool||m_CurrentDrawStatus==Select_Status)
- {
- if(m_IsMouseCap)
- ::ReleaseCapture();
-
- }
- if(m_LBDownTimes==-1)
- {
- ExchangeSave();
-
- }
- m_LBDownTimes++;
- m_bHaveFindSecond=false;
- m_bHaveFindFirst=false;
- m_LastDownPoint=point;
- L_iPointCount=-1;
- if(m_LBDownTimes==1&&m_CurrentDrawTool!=Text_Tool&&m_CurrentDrawStatus!=Select_Status)
- {
- m_FirstPoint=point;
- m_SecondPoint=point;
- m_MinPoint=point;
- this->m_MaxPoint=point;
- if(m_IsMouseCap)
- this->SetCapture();
- }
- this->ComputeMinandMaxPoint(point);
-
- if(m_DLineProperty->m_DLineDlg2->m_Draw_Status==Select_Color_Status)
- {
-
- m_DLineProperty->m_DLineDlg2->OnChange(dc.GetPixel(point));
- m_CurrentDrawStatus=Select_Color_Status;
- m_CurrentDrawTool=0;
- }
-
- //******************************************************************************
- //******************************************************************************
- dc.SetROP2(R2_NOTXORPEN);
- if((m_LBDownTimes==1)&&(m_CurrentDrawStatus==Select_Status))
- {
- for(int i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_PolyBezierArray.GetSize();i++)
- {
- CPolyBezier*L_pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
- L_pPolyBezier->OnLButtonDown(&dc,this,point);
- }
-
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_TextArray.GetSize();i++)
- {
- CText*L_pText=(CText*)pDoc->m_TextArray.GetAt(i);
- L_pText->OnLButtonDown(&dc,this,point);
- }
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_EllipseArcArray.GetSize();i++)
- {
- CEllipseArc*L_pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
- L_pEllipseArc->OnLButtonDown(&dc,this,point);
- }//for(int i=0;!m_bHaveFindSecond&&pDoc->m_EllipseArcArray.GetSize();i++)
-
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_RoundRectangleArray.GetSize();i++)
- {
- CRoundRectangle*L_pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
- L_pRoundRectangle->OnLButtonDown(&dc,this,point);
- }//******for(int i=0;!l_bHaveFinf&&i<pDoc->m_RoundRectangleArray.GetSize();i++)
-
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_RoundArcArray.GetSize();i++)
- {
- CRoundArc*L_pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
- L_pRoundArc->OnLButtonDown(&dc,this,point);
- }//******for(i=0;!m_bHaveFindSecond&&i<pDoc->m_RoundArcArray.GetSize();i++)
-
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_LiEllipseArray.GetSize();i++)
- {
- CLiEllipse*L_pLiEllipse=(CLiEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
- L_pLiEllipse->OnLButtonDown(&dc,this,point);
- } //******for(i=0;!l_bHaveFind&&i<pDoc->m_LiEllipseArray.GetSize();i++)
-
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_EllipseArray.GetSize();i++)
- {
- CEllipse*L_pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
- L_pEllipse->OnLButtonDown(&dc,this,point);
- }//******for(i=0;!m_bHaveFindFirst&&i<pDoc->m_EllipseArray.GetSize();i++)
-
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_RoundArray.GetSize();i++)
- {
- CRound*L_pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
- L_pRound->OnLButtonDown(&dc,this,point);
- }//******for(i=0;!m_bHaveFindFirst&&i<pDoc->m_RoundArray.GetSize();i++)
-
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_DLineArray.GetSize();i++)
- {
- CDLine*L_pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
- L_pDLine->OnLButtonDown(&dc,this,point);
- } //******for(int i=0;!m_bHaveFindFirst&&i<pDoc->m_DLineArray.GetSize();i++)
-
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_CurveArray.GetSize();i++)
- {
- CCurve*L_pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
- L_pCurve->OnLButtonDown(&dc,this,point);
-
- }//*****for(i=0;!m_bHaveFindFirst&&i<pDoc->m_CurveArray.GetSize();i++)
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_RectangleArray.GetSize();i++)
- {
- CRectangle *L_pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
- L_pRectangle->OnLButtonDown(&dc,this,point);
-
- }//*****for(i=0;!m_bHaveFindFirst&&i<pDoc->m_RectangleArray.GetSize();i++)
- for(i=0;!m_bHaveFindSecond&&!m_bHaveFindFirst&&i<pDoc->m_PolygonArray.GetSize();i++)
- {
- CPolygon*L_pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
- L_pPolygon->OnLButtonDown(&dc,this,point);
- } //******for(i=0;!m_bHaveFindFirst&&i<pDoc->m_PolygonArray.GetSize();i++)
- } //******if((m_CurrentDrawStatus==Select_Status))
- //***************************************************************************************
- //***************************************************************************************
- if(m_CurrentDrawStatus==Draw_Status)
- {
- if(m_CurrentDrawTool==PolyBezier_Tool)
- {
- if(this->m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CPolyBezier;
- pDoc->m_PolyBezierArray.Add((CPolyBezier*)m_pCurrentUnit);
- }
- this->m_FirstPoint=this->m_SecondPoint=point;
- m_pCurrentUnit->OnLButtonDown(&dc,this,point);
- }
- if(m_CurrentDrawTool==Text_Tool)
- {
- if(this->m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CText;
- pDoc->m_TextArray.Add((CText*)m_pCurrentUnit);
- }
- m_pCurrentUnit->OnLButtonDown(&dc,this,point);
- }
- if(m_CurrentDrawTool==EllipseArc_Tool)
- {
- if(this->m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CEllipseArc;
- pDoc->m_EllipseArcArray.Add((CEllipseArc*)m_pCurrentUnit);
- }
- if(this->m_LBDownTimes==2)
- {
- m_pCurrentUnit->ComputSloap(m_pCurrentUnit->m_FirstPoint,point);
- m_pCurrentUnit->m_CenterPoint=CPoint((m_pCurrentUnit->m_FirstPoint.x+point.x)/2,(m_pCurrentUnit->m_FirstPoint.y+point.y)/2);
- m_pCurrentUnit->ComputRadiusY(m_pCurrentUnit->m_CenterPoint,point);
-
- }
- if(this->m_LBDownTimes==3)
- {
- m_pCurrentUnit->m_FourthPoint=point;
- m_pCurrentUnit->m_FifthPoint=point;
- m_pCurrentUnit->ComputeIntersectionPointFirst(point);
- m_pCurrentUnit->ComputeIntersectionPointSecond(point);
- }
- }
- if(m_CurrentDrawTool==RoundArc_Tool)
- {
- if(this->m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CRoundArc;
- pDoc->m_RoundArcArray.Add((CRoundArc*)m_pCurrentUnit);
- }
- if(this->m_LBDownTimes==2)
- {
-
- m_pCurrentUnit->m_SecondPoint=point;
- m_pCurrentUnit->ComputeSloap1(m_pCurrentUnit->m_FirstPoint,m_pCurrentUnit->m_SecondPoint);
- m_pCurrentUnit->m_ThirdPoint=m_pCurrentUnit->m_FirstPoint;
-
- }
-
- }//******if(m_CurrentDrawTool==RoundArc_Tool)
-
- if(m_CurrentDrawTool==Polygon_Tool)
- {
- if(this->m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CPolygon;
- pDoc->m_PolygonArray.Add((CPolygon*)m_pCurrentUnit);
- m_pCurrentUnit->m_PointList->Add(point);
- }
- if(this->m_LBDownTimes!=0&&this->m_LBDownTimes!=1)
- {
- m_pCurrentUnit->m_PointList->Add(point);
- }
- }//******if(m_CurrentDrawTool==Polygon_Tool)
- if(m_CurrentDrawTool==Ellipse_Tool)
- {
- if(m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CEllipse;
- pDoc->m_EllipseArray.Add((CEllipse*)m_pCurrentUnit);
- }
- if(m_LBDownTimes==2)
- {
- m_pCurrentUnit->ComputSloap(m_pCurrentUnit->m_FirstPoint,point);
- m_pCurrentUnit->m_CenterPoint=CPoint((m_pCurrentUnit->m_FirstPoint.x+point.x)/2,(m_pCurrentUnit->m_FirstPoint.y+point.y)/2);
- m_pCurrentUnit->ComputRadiusX(m_pCurrentUnit->m_CenterPoint,point);
- m_pCurrentUnit->ComputRadiusY(m_pCurrentUnit->m_CenterPoint,point);
- m_pCurrentUnit->ellipseMidpoint(&dc,m_pCurrentUnit->m_CenterPoint.x,m_pCurrentUnit->m_CenterPoint.y,m_pCurrentUnit->m_Xr,m_pCurrentUnit->m_Yr);
- }
- if(this->m_LBDownTimes==0)
- {
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FirstPoint,m_pCurrentUnit->m_SecondPoint);
- }
-
- }//******if(m_CurrentDrawTool==Ellipse_Tool)
- if(m_CurrentDrawTool==Round_Tool)
- {
- if(m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CRound;
- pDoc->m_RoundArray.Add((CRound*)m_pCurrentUnit);
- m_pCurrentUnit->m_CenterPoint=point;
- }
- if(m_LBDownTimes==0)
- {
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_CenterPoint,point);
- }
- }
- if(m_CurrentDrawTool==RoundRectangle_Tool)
- {
- if(m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CRoundRectangle;
- pDoc->m_RoundRectangleArray.Add((CRoundRectangle*)m_pCurrentUnit);
- }
-
- }
- if(m_CurrentDrawTool==LiEllipse_Tool)
- {
- if(m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CLiEllipse;
- pDoc->m_LiEllipseArray.Add((CLiEllipse*)m_pCurrentUnit);
- }
-
- }
- if(m_CurrentDrawTool==DLine_Tool)
- {
- if(m_LBDownTimes==1)
- {
- m_pCurrentUnit=new CDLine;
- pDoc->m_DLineArray.Add((CDLine*)m_pCurrentUnit);
- }
- }
- if(m_CurrentDrawTool==Curve_Tool)
- {
- if(m_LBDownTimes==1)
- {
- m_pCurrentUnit=(CCurve*)new CCurve;
- pDoc->m_CurveArray.Add((CCurve*)m_pCurrentUnit);
- m_pCurrentUnit->m_PointList->Add(point);
- m_pCurrentUnit->m_PointList->Add(point);
- }
- }//******if(m_CurrentDrawTool==Curve_Tool)
- if(m_CurrentDrawTool==Rectangle_Tool)
- {
- if(m_LBDownTimes==1)
- {
- m_pCurrentUnit=(CRectangle*)new CRectangle;
- pDoc->m_RectangleArray.Add((CRectangle*)m_pCurrentUnit);
- }
- }//******if(m_CurrentDrawTool==Rectangle_Tool)
-
- }//*****if(m_CurrentDrawStatus==Draw_Status)
-
- if((m_CurrentDrawStatus==Draw_Status&&m_LBDownTimes==1)||(m_bHaveFindSecond&&!m_IsLocked))
- {
- m_DLineProperty->m_DLineDlg1->UpdateData();
- m_pCurrentUnit->m_FirstPoint=m_FirstPoint;
- m_pCurrentUnit->m_SecondPoint=m_SecondPoint;
- m_pCurrentUnit->m_PenStyle=m_DLineProperty->m_DLineDlg1->m_PenStyle;
- m_pCurrentUnit->m_PenWidth=m_DLineProperty->m_DLineDlg1->m_Edit_LineWidth;
- m_pCurrentUnit->m_PenColor=m_DLineProperty->m_DLineDlg2->m_PenColor;
- m_pCurrentUnit->m_BrushColor=m_DLineProperty->m_DLineDlg2->m_BrushColor;
- m_pCurrentUnit->m_BrushHatch=m_DLineProperty->m_DLineDlg1->m_BrushHatch;
- m_pCurrentUnit->m_BrushStyle=m_DLineProperty->m_DLineDlg1->m_BrushStyle;
- m_pCurrentUnit->m_BackgroundColor=m_DLineProperty->m_DLineDlg2->m_BackgroundColor;
- //if(m_DLineProperty->m_Mode->m_bMode)
-
- // m_pCurrentUnit->m_DrawingMode=m_DLineProperty->m_Mode->m_DrawingMode;
-
- //else
- m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
- m_pCurrentUnit->m_BkMode=m_DLineProperty->m_DLineDlg1->m_BKMode;//m_DLineProperty->m_Mode->m_BKMode;
-
- }//**********if(this->m_LBDownTimes==1&&m_bHaveFindFirst)
-
- if(m_bHaveFindSecond&&m_IsLocked)
- {
- m_DLineProperty->m_DLineDlg1->UpdateData();
- m_pCurrentUnit->m_FirstPoint=m_FirstPoint;
- m_pCurrentUnit->m_SecondPoint=m_SecondPoint;
- m_DLineProperty->m_DLineDlg1->m_PenStyle=m_pCurrentUnit->m_PenStyle;
- m_DLineProperty->m_DLineDlg1->m_Edit_LineWidth=m_pCurrentUnit->m_PenWidth;
- m_DLineProperty->m_DLineDlg2->m_PenColor=m_pCurrentUnit->m_PenColor;
- m_DLineProperty->m_DLineDlg2->m_BrushColor=m_pCurrentUnit->m_BrushColor;
- m_DLineProperty->m_DLineDlg1->m_BrushHatch=m_pCurrentUnit->m_BrushHatch;
- m_DLineProperty->m_DLineDlg1->m_BrushStyle=m_pCurrentUnit->m_BrushStyle;
- m_DLineProperty->m_DLineDlg2->m_BackgroundColor=m_pCurrentUnit->m_BackgroundColor;
- m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
- m_DLineProperty->m_DLineDlg1->m_BKMode=m_pCurrentUnit->m_BkMode;
- // if(m_DLineProperty->m_Mode->m_bMode)
- //m_DLineProperty->m_Mode->m_DrawingMode=m_pCurrentUnit->m_DrawingMode;
-
- m_DLineProperty->GetActivePage()->UpdateData(false);
- m_DLineProperty->GetActivePage()->Invalidate();
-
- }
-
- if(m_bHaveFindSecond)
- {
- m_pCurrentUnit->DrawStatic(&dc);
- }
- if(m_CurrentDrawStatus==Drag_Status)
- {
- m_FirstPoint=m_pCurrentUnit->m_FoundPoint;
- m_SecondPoint=m_pCurrentUnit->m_FoundPoint;
- }
- if(m_CurrentDrawStatus==Change_Status)//&&m_CurrentDrawTool==Ellipse_Tool)
- {
- m_FirstPoint=m_pCurrentUnit->m_FoundPoint;
- m_SecondPoint=m_pCurrentUnit->m_FoundPoint;
-
- if(this->m_CurrentDrawTool==Text_Tool)
- {
- m_pCurrentUnit->OnLButtonDown(&dc,this,point);
-
- }
- }
- if(m_IsMouseCap&&m_bHaveFindSecond)
- this->SetCapture();
- CScrollView::OnLButtonDown(nFlags, point);
- }
- //***************************************************************************************
- //***************************************************************************************
- //***************************************************************************************
- //***************************************************************************************
- void CEastDrawView::OnLButtonUp(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
-
- CPoint Devpoint=point;
- CClientDC dc(this);
- this->OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- dc.DPtoLP(&point);
- dc.SetROP2(R2_NOTXORPEN);
- this->ComputeMinandMaxPoint(point);
- m_ChangeingPoint=point;
- this->SetMousePosText(point,Devpoint);
- if(m_DLineProperty->m_DLineDlg2->m_Draw_Status==Select_Color_Status)
- {
- m_DLineProperty->m_DLineDlg2->m_Color=dc.GetPixel(point);
- m_DLineProperty->m_DLineDlg2->OnChange(dc.GetPixel(point));
- m_CurrentDrawStatus=0;
- m_DLineProperty->m_DLineDlg2->m_Draw_Status=0;
- m_CurrentDrawTool=0;
- }
- if(m_IsMouseCap&&m_bHaveFindSecond)
- this->SetCapture();
- CScrollView::OnLButtonUp(nFlags, point);
- }
- //***************************************************************************************
- //***************************************************************************************
- //***************************************************************************************
- //***************************************************************************************
- //***************************************************************************************
- void CEastDrawView::OnMouseMove(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- CPoint Devpoint=point;
- CClientDC dc(this);
- this->OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- dc.DPtoLP(&point);
- dc.SetROP2(R2_NOTXORPEN);
- this->ComputeMinandMaxPoint(point);
- m_ChangeingPoint=point;
- this->SetMousePosText(point,Devpoint);
-
-
- if(m_DLineProperty->m_DLineDlg2->m_Draw_Status==Select_Color_Status)
- {
-
- m_DLineProperty->m_DLineDlg2->OnChange(dc.GetPixel(point));
- m_CurrentDrawStatus=Select_Color_Status;
- m_CurrentDrawTool=0;
- }
- if((m_LBDownTimes!=0)&&(m_CurrentDrawStatus==Draw_Status||m_CurrentDrawStatus==Change_Status))
- {
-
- if(m_CurrentDrawStatus==Change_Status)
- {
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,m_SecondPoint);
- }
-
- m_pCurrentUnit->OnMouseMove(&dc,this,point);
-
- if(m_CurrentDrawStatus==Change_Status)
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,point);
- }//*********if(m_IsDrawing&&(m_CurrentDrawStatus==Draw_Status||m_CurrentDrawStatus==Exchange_Status))
- if(m_CurrentDrawStatus==Drag_Status)
- {
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,m_SecondPoint);
- dc.SetROP2(R2_NOTXORPEN);
-
- m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
- if(m_CurrentDrawTool!=EllipseArc_Tool)
- m_pCurrentUnit->DrawActive(&dc,point);
-
- m_FirstPoint=m_SecondPoint;
- m_SecondPoint=point;
- m_pCurrentUnit->OnMouseMove(&dc,this,point);
- m_pCurrentUnit->m_DrawingMode=dc.GetROP2();
-
- if(m_CurrentDrawTool!=EllipseArc_Tool)
- m_pCurrentUnit->DrawActive(&dc,point);
-
- m_pCurrentUnit->ShowMovingLine(&dc,m_pCurrentUnit->m_FoundPoint,point);
- }
- CScrollView::OnMouseMove(nFlags, point);
- }
- void CEastDrawView::OnBUTTONDLine()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=DLine_Tool;
- m_CurrentDrawStatus=Draw_Status;
- this->m_LBDownTimes=0;
- }
- void CEastDrawView::OnBUTTON32774Move()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
-
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=0;
- m_CurrentDrawStatus=Select_Status;
- m_LBDownTimes=0;
- }
- void CEastDrawView::OnBUTTON32775CircumRotate()
- {
-
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- //m_CurrentDrawStatus=Select_Status;
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=0;
- m_CurrentDrawStatus=Circumrotate_Status;
- }
- void CEastDrawView::OnBUTTON32777Curve()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=Curve_Tool;
- m_LBDownTimes=0;
- m_CurrentDrawStatus=Draw_Status;
- }
- void CEastDrawView::OnBUTTON32776Rectangle()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=Rectangle_Tool;
- m_LBDownTimes=0;
- m_CurrentDrawStatus=Draw_Status;
- }
- void CEastDrawView::OnBUTTON32778RoundRectangle()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=RoundRectangle_Tool;
- m_CurrentDrawStatus=Draw_Status;
- m_LBDownTimes=0;
- }
- void CEastDrawView::OnBUTTON32779Ellipse()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=Ellipse_Tool;
- m_CurrentDrawStatus=Draw_Status;
- m_LBDownTimes=0;
- }
- void CEastDrawView::OnBUTTON32780Round()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=Round_Tool;
- m_CurrentDrawStatus=Draw_Status;
- this->m_LBDownTimes=0;
- }
- void CEastDrawView::OnBUTTON32791Polygon()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
-
- m_IsPolygonFirst=true;
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=Polygon_Tool;
- m_CurrentDrawStatus=Draw_Status;
- this->m_LBDownTimes=0;
- }
- void CEastDrawView::OnLButtonDblClk(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
-
- CPoint Devpoint=point;
- CClientDC dc(this);
- this->OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- dc.DPtoLP(&point);
- dc.SetROP2(R2_NOTXORPEN);
- this->ComputeMinandMaxPoint(point);
- m_ChangeingPoint=point;
- this->SetMousePosText(point,Devpoint);
- if(m_CurrentDrawStatus==Draw_Status&&m_CurrentDrawTool==Polygon_Tool)
- {
- m_pCurrentUnit->DrawEnd(&dc,point);
- this->m_LBDownTimes=0;
- this->ExchangeSave();
- if(m_IsMouseCap)
- ::ReleaseCapture();
- }
-
- CScrollView::OnLButtonDblClk(nFlags, point);
- }
- void CEastDrawView::OnSetFocus(CWnd* pOldWnd)
- {
- CScrollView::OnSetFocus(pOldWnd);
-
- // TODO: Add your message handler code here
-
-
-
- }
- void CEastDrawView::OnMENUITEM32794SetRegin()
- {
- // TODO: Add your command handler code here
- CReginSet setReginDlg;
- CClientDC dc(this);
- setReginDlg.m_Length=this->GetTotalSize().cx;
- setReginDlg.m_Width=this->GetTotalSize().cy;
-
- setReginDlg.m_X=m_CenterPoint.x;
- setReginDlg.m_Y=m_CenterPoint.y;
- setReginDlg.m_bIsViewReign=true;
- if(setReginDlg.DoModal()==IDOK)
- {
- CSize sizeTotal;
- sizeTotal.cx=setReginDlg.m_Length;
- sizeTotal.cy=setReginDlg.m_Width;
- SetScrollSizes(MM_TEXT, sizeTotal);
- OnPrepareDC(&dc);
- m_CenterPoint.x=setReginDlg.m_X;
- m_CenterPoint.y=setReginDlg.m_Y;
- dc.SetWindowOrg(m_CenterPoint);
- OnBUTTON32850ReDraw();
-
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- pDoc->m_CenterPoint=m_CenterPoint;
- pDoc->m_TotalSize=sizeTotal;
- }
-
-
- }
- void CEastDrawView::OnBUTTONLiEllipse()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=LiEllipse_Tool;
- m_CurrentDrawStatus=Draw_Status;
- this->m_LBDownTimes=0;
- }
- void CEastDrawView::ResetSelectStatus()
- {
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- CClientDC dc(this);
- CClientDC*pDC=&dc;
- OnPrepareDC(pDC);
- dc.SetWindowOrg(m_CenterPoint);
- for(int i=0;i<pDoc->m_PolygonArray.GetSize();i++)
- {
- CPolygon*pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
-
- if(pPolygon->m_HaveFindFirst)
- {
- pPolygon->ShowSelectPoint(pDC);
- pPolygon->m_HaveFindFirst=false;
- }
- }
- for(i=0;i<pDoc->m_TextArray.GetSize();i++)
- {
- CText*pText=(CText*)pDoc->m_TextArray.GetAt(i);
- if(pText->m_HaveFindFirst)
- {
- pText->ShowSelectPoint(pDC);
-
- pText->m_HaveFindFirst=false;
-
- }
-
-
- }
- for(i=0;i<pDoc->m_EllipseArcArray.GetSize();i++)
- {
- CEllipseArc*pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
- if(pEllipseArc->m_HaveFindFirst)
- {
- pEllipseArc->ShowSelectPoint(pDC);
- pEllipseArc->m_HaveFindFirst=false;
- }
- }
- for(i=0;i<pDoc->m_DLineArray.GetSize();i++)
- {
- CDLine*pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
-
- if(pDLine->m_HaveFindFirst)
- { pDLine->m_HaveFindFirst=false;
- pDLine->ShowSelectPoint(pDC);
- }
- }
- for(i=0;i<pDoc->m_CurveArray.GetSize();i++)
- {
- CCurve*pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
-
- if(pCurve->m_HaveFindFirst)
- { pCurve->m_HaveFindFirst=false;
- pCurve->ShowSelectPoint(pDC);
- }
- }
- for(i=0;i<pDoc->m_RectangleArray.GetSize();i++)
- {
- CRectangle*pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
-
- if(pRectangle->m_HaveFindFirst)
- {
- pRectangle->m_HaveFindFirst=false;
- pRectangle->ShowSelectPoint(pDC);
- }
- }
- for(i=0;i<pDoc->m_RoundRectangleArray.GetSize();i++)
- {
- CRoundRectangle*pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
-
- if(pRoundRectangle->m_HaveFindFirst)
- { pRoundRectangle->m_HaveFindFirst=false;
- pRoundRectangle->ShowSelectPoint(pDC);
- }
- }
- for(i=0;i<pDoc->m_EllipseArray.GetSize();i++)
- {
- CEllipse*pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
-
- if(pEllipse->m_HaveFindFirst)
- {
- pEllipse->m_HaveFindFirst=false;
- pEllipse->ShowSelectPoint(pDC);
- }
- }
- for(i=0;i<pDoc->m_RoundArray.GetSize();i++)
- {
- CRound*pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
-
- if(pRound->m_HaveFindFirst)
- { pRound->m_HaveFindFirst=false;
- pRound->ShowSelectPoint(pDC);
- }
- }
- for(i=0;i<pDoc->m_LiEllipseArray.GetSize();i++)
- {
- CEllipse*pLiEllipse=(CEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
-
- if(pLiEllipse->m_HaveFindFirst)
- {
- pLiEllipse->m_HaveFindFirst=false;
- pLiEllipse->ShowSelectPoint(pDC);
- }
- }
- for(i=0;i<pDoc->m_RoundArcArray.GetSize();i++)
- {
- CRoundArc*pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
- if(pRoundArc->m_HaveFindFirst)
- {
- pRoundArc->m_HaveFindFirst=false;
- pRoundArc->ShowSelectPoint(pDC);
- }
- }
- for(i=0;i<pDoc->m_PolyBezierArray.GetSize();i++)
- {
- CPolyBezier*pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
- if(pPolyBezier->m_HaveFindFirst)
- {
- pPolyBezier->m_HaveFindFirst=false;
- pPolyBezier->ShowSelectPoint(pDC);
- }
- }
- }
- void CEastDrawView::ComputeMinandMaxPoint(CPoint point)
- {
- m_MinPoint.x=min(m_MinPoint.x,point.x);
- m_MinPoint.y=min(m_MinPoint.y,point.y);
- m_MaxPoint.x=max(m_MaxPoint.x,point.x);
- m_MaxPoint.y=max(m_MaxPoint.y,point.y);
- m_InvalidRect.SetRect(m_MinPoint,m_MaxPoint);
- }
- void CEastDrawView::InvalidateMovingRect(CUnit *pMovingUnit)
- {
- /*pMovingUnit->GetBoundingRect();
- m_InvalidRect.left=min(m_InvalidRect.left,pMovingUnit->m_BoundingRect.left);
- m_InvalidRect.top=min(m_InvalidRect.top,pMovingUnit->m_BoundingRect.top);
- m_InvalidRect.right=max(m_InvalidRect.right,pMovingUnit->m_BoundingRect.right);
- m_InvalidRect.bottom=max(m_InvalidRect.bottom,pMovingUnit->m_BoundingRect.bottom);
- m_InvalidRect.InflateRect(pMovingUnit->m_PenWidth,pMovingUnit->m_PenWidth);
- //
- CClientDC dc(this);
- dc.Rectangle(m_InvalidRect);*/
- //this->InvalidateRect(m_InvalidRect);
- }
- void CEastDrawView::OnBUTTON32800RoundArc()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=RoundArc_Tool;
- m_CurrentDrawStatus=Draw_Status;
- this->m_LBDownTimes=0;
- }
- void CEastDrawView::OnBUTTON32805EllipseArc()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=EllipseArc_Tool;
- m_CurrentDrawStatus=Draw_Status;
- this->m_LBDownTimes=0;
- }
- void CEastDrawView::OnBUTTON32807PolyBezier()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=PolyBezier_Tool;
- m_CurrentDrawStatus=Draw_Status;
- this->m_LBDownTimes=0;
- }
- void CEastDrawView::OnBUTTON32809Text()
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(true);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- if(!pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(true);
- this->m_LBDownTimes=0;
- }
- //m_pTextEdit->ShowWindow(true);
- m_CurrentDrawTool=Text_Tool;
- m_CurrentDrawStatus=Draw_Status;
- this->m_LBDownTimes=0;
- }
- void CEastDrawView::GetFontInfo(LPTSTR pszFaceName, int &nSize)
- {
- /// CHARFORMAT cf = GetCharFormatSelection ();
- //::lstrcpy (pszFaceName, cf.dwMask & CFM_FACE ? cf.szFaceName : _T (""));
- // nSize = cf.dwMask & CFM_SIZE ? cf.yHeight : -1;
- }
- void CEastDrawView::OnCharBold()
- {
- // TODO: Add your command handler code here
- CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
- pMainFrame->m_wndStyleBar.OnCharBold();
-
- }
- void CEastDrawView::OnCharItalic()
- {
- // TODO: Add your command handler code here
- CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
- pMainFrame->m_wndStyleBar.OnCharItalic();
- }
- void CEastDrawView::OnCharUnderline()
- {
- // TODO: Add your command handler code here
- CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
- pMainFrame->m_wndStyleBar.OnCharUnderline();
- }
- void CEastDrawView::OnContextMenu(CWnd* pWnd, CPoint point)
- {
- CClientDC dc(this);
- this->OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- //dc.DPtoLP(&point);
- // TODO: Add your message handler code here
- if(m_CurrentDrawStatus!=Select_Status)
- m_pCurrentUnit->OnContextMenu(pWnd,point);
-
- if(m_CurrentDrawStatus==Select_Status)
- {
- CMenu menuTextEdit;
- menuTextEdit.LoadMenu(IDR_MENU_Delete);
-
- menuTextEdit.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN,point.x,point.y,pWnd);
-
- }
- }
- void CEastDrawView::OnMenuitemOk()
- {
- // TODO: Add your command handler code here
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- m_pCurrentUnit->OnMenuitemOk(&dc,this);
- }
- BOOL CEastDrawView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
- {
- // TODO: Add your message handler code here and/or call default
- if(m_CurrentDrawStatus==Draw_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Color_Status)
- SetCursor(AfxGetApp()->LoadCursor(ID_Draw));
-
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Select_Status)
- SetCursor(AfxGetApp()->LoadCursor(ID_Change));
- return true;
- //return CScrollView::OnSetCursor(pWnd, nHitTest, message);
- }
- void CEastDrawView::ShowFontBar(BOOL isShow)
- {
- CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
- pMainFrame->ShowFontBar(isShow);
- }
- void CEastDrawView::OnCirCu()
- {
- // TODO: Add your command handler code here
- CClientDC dc(this);
- this->OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- this->m_pCurrentUnit->OnMenuitemCirCu(&dc,this);
- }
- void CEastDrawView::OnUpdateCirCu(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck();
- }
- void CEastDrawView::SetMousePosText(CPoint Logpoint,CPoint Devpoint)
- {
- CMainFrame*pMainFrame=(CMainFrame*)::AfxGetMainWnd();
- pMainFrame->SetMousePosText(Logpoint,Devpoint);
- }
- void CEastDrawView::DrawAxis(CDC*pDC)
- {
-
- CPen pen;
- pen.CreatePen(PS_SOLID,1,RGB(255,0,0));
- CPen*OldPen=pDC->SelectObject(&pen);
- int oldRop=pDC->SetROP2(R2_NOTXORPEN);
- pDC->MoveTo(m_CenterPoint.x+2,0);
- pDC->LineTo(GetTotalSize().cx+m_CenterPoint.x-2,0);
-
- pDC->MoveTo(0,m_CenterPoint.y+2);
- pDC->LineTo(0,GetTotalSize().cy+m_CenterPoint.y-2);
-
- pDC->SelectObject(OldPen);
- pDC->SetROP2(oldRop);
- }
- BOOL CEastDrawView::SaveDIB(CBitmap*pbitmap, CFile&file)
- {
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- CDC*pViewDC=&dc;
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- CBitmap*Oldmap;
- CBitmap Bitmap;
- CDC memDC;
- Bitmap.CreateCompatibleBitmap(pViewDC,this->GetTotalSize().cx,this->GetTotalSize().cy);
- memDC.CreateCompatibleDC(pViewDC);
- memDC.SetMapMode(pViewDC->GetMapMode());
- Oldmap=memDC.SelectObject(&Bitmap);
-
- memDC.SetWindowOrg(m_CenterPoint);
- memDC.PatBlt(m_CenterPoint.x,m_CenterPoint.y,GetTotalSize().cx,GetTotalSize().cy,WHITENESS);
-
- this->DrawAll(&memDC);
- if(this->m_HaveAxis)
- this->DrawAxis(&memDC);
- ::GdiFlush();
- memDC.SelectObject(Oldmap);
- memDC.DeleteDC();
-
- BITMAPFILEHEADER bmfHdr;
-
- bmfHdr.bfType=0x4d42;
- int sizeHdr=sizeof(BITMAPINFOHEADER);
-
- LPBITMAPINFOHEADER lpBI=( LPBITMAPINFOHEADER)::GlobalAlloc(LMEM_FIXED,sizeHdr);
- if(!lpBI)
- {
- AfxMessageBox("内存申请失败,请稍后再试");
-
- }
- BYTE *pDib;
- BYTE *pDib2;
- pDib=(BYTE*)::GlobalAlloc(LMEM_FIXED,GetTotalSize().cx*GetTotalSize().cy*4);
- if(!pDib)
- {
- AfxMessageBox("内存申请失败,请稍后再试");
-
- }
- lpBI->biSize=(LONG)sizeof(BITMAPINFOHEADER);
- lpBI->biWidth=(LONG)this->GetTotalSize().cx;
- lpBI->biHeight=(LONG)this->GetTotalSize().cy;
- lpBI->biPlanes=1;
- lpBI->biBitCount=32;
- lpBI->biCompression=BI_RGB;
- lpBI->biSizeImage=0;
- lpBI->biXPelsPerMeter=0;
- lpBI->biYPelsPerMeter=0;
- lpBI->biClrUsed=0;
- lpBI->biClrImportant=0;
-
- Bitmap.GetBitmapBits(GetTotalSize().cx*GetTotalSize().cy*4,pDib);
- pDib2=(BYTE*)::GlobalAlloc(LMEM_FIXED,GetTotalSize().cx*GetTotalSize().cy*4);
- if(!pDib2)
- {
- AfxMessageBox("内存申请失败,请稍后再试");
-
- }
-
- for(int j=0;j<GetTotalSize().cy;j++)
- for(int i=0;i<GetTotalSize().cx*4;i++)
- {
- pDib2[i+j*GetTotalSize().cx*4]=pDib[GetTotalSize().cx*(GetTotalSize().cy-1-j)*4+i];
- }
- ::GlobalFree(pDib);
-
- bmfHdr.bfSize=(DWORD) (sizeof(BITMAPFILEHEADER) +
- sizeHdr +GetTotalSize().cx*GetTotalSize().cy*4);
- bmfHdr.bfReserved1=bmfHdr.bfReserved2=0;
- bmfHdr.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeHdr;
-
- try
- {
-
- file.Write((LPVOID)&bmfHdr,sizeof(BITMAPFILEHEADER));
- file.Write((LPVOID)lpBI,sizeHdr);
- file.WriteHuge((LPVOID)pDib2,GetTotalSize().cx*GetTotalSize().cy*4);
- }
- catch(CException*Fe)
- {
- Fe->ReportError();
- Fe->Delete();
- return false;
- }
-
-
- ::GlobalFree(lpBI);
- ::GlobalFree(pDib2);
- return true;
-
- }
- void CEastDrawView::DeleteSelect()
- {
- this->ExchangeSave();
- CClientDC dc(this);
- this->OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- CDC*pDC=&dc;
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- int oldrop=pDC->SetROP2(R2_NOTXORPEN);
- for(int i=0;i<pDoc->m_PolygonArray.GetSize();i++)
- {
- CPolygon*pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
- if(pPolygon->m_HaveFindFirst)
- {
- pPolygon->ShowSelectPoint(pDC);
- pPolygon->DrawStatic(pDC);
- pDoc->m_PolygonArray.RemoveAt(i);
- delete pPolygon;
- i--;
- }
-
- }
- for(i=0;i<pDoc->m_TextArray.GetSize();i++)
- {
- CText*pText=(CText*)pDoc->m_TextArray.GetAt(i);
-
- if(pText->m_HaveFindFirst)
- {
- pText->ShowSelectPoint(pDC);
- //pText->DrawStatic(pDC);
- CPoint point=pText->m_PositionPoint;
- pDC->LPtoDP(&point);
- this->InvalidateRect(CRect(point,CPoint(point.x+pText->m_Width,point.y+pText->m_Hight)));
- pDoc->m_TextArray.RemoveAt(i);
- delete pText;
- i--;
- }
- }
- for(i=0;i<pDoc->m_PolyBezierArray.GetSize();i++)
- {
- CPolyBezier*pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
-
- if(pPolyBezier->m_HaveFindFirst)
- {
- pPolyBezier->ShowSelectPoint(pDC);
- pPolyBezier->DrawStatic(pDC);
- pDoc->m_PolyBezierArray.RemoveAt(i);
- delete pPolyBezier;
- i--;
- }
- }
- for(i=0;i<pDoc->m_DLineArray.GetSize();i++)
- {
- CDLine*pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
- if(pDLine->m_HaveFindFirst)
- { pDLine->ShowSelectPoint(pDC);
- pDLine->DrawStatic(pDC);
- pDoc->m_DLineArray.RemoveAt(i);
- delete pDLine;
- i--;
- }
-
- }
- for(i=0;i<pDoc->m_CurveArray.GetSize();i++)
- {
- CCurve*pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
-
- if(pCurve->m_HaveFindFirst)
- {
- pCurve->ShowSelectPoint(pDC);
- pCurve->DrawStatic(pDC);
- pDoc->m_CurveArray.RemoveAt(i);
- delete pCurve;
- i--;
- }
- }
- for(i=0;i<pDoc->m_RectangleArray.GetSize();i++)
- {
- CRectangle*pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
-
- if(pRectangle->m_HaveFindFirst)
- {
- pRectangle->ShowSelectPoint(pDC);
- pRectangle->DrawStatic(pDC);
- pDoc->m_RectangleArray.RemoveAt(i);
- delete pRectangle;
- i--;
- }
- }
- for(i=0;i<pDoc->m_RoundRectangleArray.GetSize();i++)
- {
- CRoundRectangle*pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
-
- if(pRoundRectangle->m_HaveFindFirst)
- {
- pRoundRectangle->ShowSelectPoint(pDC);
- pRoundRectangle->DrawStatic(pDC);
- pDoc->m_RoundRectangleArray.RemoveAt(i);
- delete pRoundRectangle;
- i--;
- }
- }
- for(i=0;i<pDoc->m_EllipseArray.GetSize();i++)
- {
- CEllipse*pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
-
- if(pEllipse->m_HaveFindFirst)
- { pEllipse->ShowSelectPoint(pDC);
- pEllipse->DrawStatic(pDC);
- pDoc->m_EllipseArray.RemoveAt(i);
- delete pEllipse;
- i--;
-
- }
- }
- for(i=0;i<pDoc->m_RoundArray.GetSize();i++)
- {
- CRound*pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
-
- if(pRound->m_HaveFindFirst)
- {
- pRound->ShowSelectPoint(pDC);
- pRound->DrawStatic(pDC);
- pDoc->m_RoundArray.RemoveAt(i);
- delete pRound;
- i--;
-
- }
- }
- for(i=0;i<pDoc->m_LiEllipseArray.GetSize();i++)
- {
- CEllipse*pLiEllipse=(CEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
- if(pLiEllipse->m_HaveFindFirst)
- {
- pLiEllipse->ShowSelectPoint(pDC);
- pLiEllipse->DrawStatic(pDC);
- pDoc->m_LiEllipseArray.RemoveAt(i);
- delete pLiEllipse;
- i--;
-
- }
- }
- for(i=0;i<pDoc->m_RoundArcArray.GetSize();i++)
- {
- CRoundArc*pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
-
- if(pRoundArc->m_HaveFindFirst)
- {
- pRoundArc->ShowSelectPoint(pDC);
- pRoundArc->DrawStatic(pDC);
- pDoc->m_RoundArcArray.RemoveAt(i);
- delete pRoundArc;
- i--;
- }
- }
-
- for(i=0;i<pDoc->m_EllipseArcArray.GetSize();i++)
- {
- CEllipseArc*pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
-
- if(pEllipseArc->m_HaveFindFirst)
- { pEllipseArc->ShowSelectPoint(pDC);
- pEllipseArc->DrawStatic(pDC);
- pDoc->m_EllipseArcArray.RemoveAt(i);
- delete pEllipseArc;
- i--;
- }
- }
- pDC->SetROP2(oldrop);
- }
- void CEastDrawView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
- {
- // TODO: Add your message handler code here and/or call default
- if(nChar==VK_DELETE)
- this->DeleteSelect();
- CScrollView::OnKeyUp(nChar, nRepCnt, nFlags);
- }
- void CEastDrawView::OnDelete()
- {
- // TODO: Add your command handler code here
- this->DeleteSelect();
- }
- void CEastDrawView::OnBUTTON32830Lock()
- {
- // TODO: Add your command handler code here
- m_IsLocked=!m_IsLocked;
- }
- void CEastDrawView::OnUpdateBUTTON32830Lock(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_IsLocked?1:0);
- }
- void CEastDrawView::OnUpdateBUTTONDLine(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==DLine_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32776Rectangle(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==Rectangle_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32778RoundRectangle(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==RoundRectangle_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32791Polygon(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==Polygon_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32779Ellipse(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==Ellipse_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32780Round(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==Round_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32777Curve(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==Curve_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTONLiEllipse(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==LiEllipse_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32800RoundArc(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==RoundArc_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32805EllipseArc(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==EllipseArc_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32807PolyBezier(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==PolyBezier_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32809Text(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawTool==Text_Tool?1:0);
- }
- void CEastDrawView::OnUpdateBUTTON32774Move(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_CurrentDrawStatus!=Draw_Status&&m_CurrentDrawStatus!=0?1:0);
- }
- void CEastDrawView::OnBUTTON32845Axis()
- {
- // TODO: Add your command handler code here
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- DrawAxis(&dc);
- m_HaveAxis=!m_HaveAxis;
- }
- void CEastDrawView::OnUpdateBUTTON32845Axis(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_HaveAxis?1:0);
-
- }
- void CEastDrawView::OnBUTTON32850ReDraw()
- {
- // TODO: Add your command handler code here
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- CClientDC dc(this);
- this->OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
-
- CBitmap*Oldmap;
- CBitmap Bitmap;
- CDC memDC;
- Bitmap.CreateCompatibleBitmap(&dc,this->GetTotalSize().cx,this->GetTotalSize().cy);
- memDC.CreateCompatibleDC(&dc);
- Oldmap=memDC.SelectObject(&Bitmap);
- memDC.SetWindowOrg(m_CenterPoint);
- CRect client;
- CBrush br(RGB(255,0,255));
- GetClientRect(client);
- dc.DPtoLP(&client);
- memDC.SetMapMode(dc.GetMapMode());
- memDC.PatBlt(client.left,client.top,client.Width(),client.Height(),WHITENESS);
- this->DrawAll(&memDC);
- if(this->m_HaveAxis)
- this->DrawAxis(&memDC);
- dc.BitBlt(client.left,client.top,client.Width(),client.Height(),&memDC,client.left,client.top,SRCCOPY);
- memDC.DeleteDC();
- }
- void CEastDrawView::DrawAll(CDC *pDrawDC)
- {
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- CDC*pDC=pDrawDC;
-
-
-
- for(int i=0;i<pDoc->m_PolygonArray.GetSize();i++)
- {
- CPolygon*pPolygon=(CPolygon*)pDoc->m_PolygonArray.GetAt(i);
- pPolygon->DrawStatic(pDC);
- if(pPolygon->m_HaveFindFirst)
- pPolygon->ShowSelectPoint(pDC);
- }
-
- for(i=0;i<pDoc->m_PolyBezierArray.GetSize();i++)
- {
- CPolyBezier*pPolyBezier=(CPolyBezier*)pDoc->m_PolyBezierArray.GetAt(i);
- pPolyBezier->DrawStatic(pDC);
- if(pPolyBezier->m_HaveFindFirst)
- pPolyBezier->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_DLineArray.GetSize();i++)
- {
- CDLine*pDLine=(CDLine*)pDoc->m_DLineArray.GetAt(i);
- pDLine->DrawStatic(pDC);
- if(pDLine->m_HaveFindFirst)
- pDLine->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_CurveArray.GetSize();i++)
- {
- CCurve*pCurve=(CCurve*)pDoc->m_CurveArray.GetAt(i);
- pCurve->DrawStatic(pDC);
- if(pCurve->m_HaveFindFirst)
- pCurve->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_RectangleArray.GetSize();i++)
- {
- CRectangle*pRectangle=(CRectangle*)pDoc->m_RectangleArray.GetAt(i);
- pRectangle->DrawStatic(pDC);
- if(pRectangle->m_HaveFindFirst)
- pRectangle->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_RoundRectangleArray.GetSize();i++)
- {
- CRoundRectangle*pRoundRectangle=(CRoundRectangle*)pDoc->m_RoundRectangleArray.GetAt(i);
- pRoundRectangle->DrawStatic(pDC);
- if(pRoundRectangle->m_HaveFindFirst)
- pRoundRectangle->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_EllipseArray.GetSize();i++)
- {
- CEllipse*pEllipse=(CEllipse*)pDoc->m_EllipseArray.GetAt(i);
- pEllipse->DrawStatic(pDC);
- if(pEllipse->m_HaveFindFirst)
- pEllipse->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_RoundArray.GetSize();i++)
- {
- CRound*pRound=(CRound*)pDoc->m_RoundArray.GetAt(i);
- pRound->DrawStatic(pDC);
- if(pRound->m_HaveFindFirst)
- pRound->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_LiEllipseArray.GetSize();i++)
- {
- CEllipse*pLiEllipse=(CEllipse*)pDoc->m_LiEllipseArray.GetAt(i);
- pLiEllipse->DrawStatic(pDC);
- if(pLiEllipse->m_HaveFindFirst)
- pLiEllipse->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_RoundArcArray.GetSize();i++)
- {
- CRoundArc*pRoundArc=(CRoundArc*)pDoc->m_RoundArcArray.GetAt(i);
- pRoundArc->DrawStatic(pDC);
- if(pRoundArc->m_HaveFindFirst)
- pRoundArc->ShowSelectPoint(pDC);
- }
-
- for(i=0;i<pDoc->m_EllipseArcArray.GetSize();i++)
- {
- CEllipseArc*pEllipseArc=(CEllipseArc*)pDoc->m_EllipseArcArray.GetAt(i);
- pEllipseArc->DrawStatic(pDC);
- if(pEllipseArc->m_HaveFindFirst)
- pEllipseArc->ShowSelectPoint(pDC);
- }
- for(i=0;i<pDoc->m_TextArray.GetSize();i++)
- {
- CText*pText=(CText*)pDoc->m_TextArray.GetAt(i);
- pText->DrawStatic(pDC);
- if(pText->m_HaveFindFirst)
- pText->ShowSelectPoint(pDC);
- }
-
- // TODO: add draw code for native data here
- }
- void CEastDrawView::OnBUTTON32856DONothing()
- {
- // TODO: Add your command handler code here
- CClientDC dc(this);
- OnPrepareDC(&dc);
- dc.SetWindowOrg(m_CenterPoint);
- // TODO: Add your command handler code here
-
- if(m_CurrentDrawStatus==Drag_Status||m_CurrentDrawStatus==Change_Status||m_CurrentDrawStatus==Select_Status)
- ResetSelectStatus();
-
-
- CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
- if(pMainFrame->m_wndStyleBar.IsWindowVisible())
- {
- pMainFrame->ShowFontBar(false);
- if(this->m_LBDownTimes==1)
- {
- this->m_LBDownTimes=2;
- this->m_pCurrentUnit->OnLButtonDown(&dc,this,0);
-
- }
- }
- m_CurrentDrawTool=0;
- m_CurrentDrawStatus=0;
- m_LBDownTimes=0;
- }
- void CEastDrawView::AddTempFile()
- {
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- pDoc->AddTempFile();
- }
- void CEastDrawView::AutoSave()
- {
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- pDoc->AutoSave();
- }
- void CEastDrawView::ExchangeSave()
- {
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- pDoc->SetModifiedFlag();
- if(m_IsLastMove)
- {
- pDoc->Requeue(m_Index,m_Rtimes);
- m_IsLastMove=false;
- m_Index=0;
-
- }
- else
- {
- m_Index=0;
- if(m_Rtimes<6)
- m_Rtimes++;
- }
- pDoc->ExchangeSave(m_Index,m_Rtimes);
-
-
-
- }
- void CEastDrawView::OnBUTTON32858OnDo()
- {
- // TODO: Add your command handler code here
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- if(m_Index<5)
- {
- m_Index++;
-
- this->m_IsLastMove=true;
- pDoc->OnBUTTON32858OnDo(m_Index);
- OnBUTTON32850ReDraw();
- }
- }
- void CEastDrawView::OnBUTTON32859ReDo()
- {
- // TODO: Add your command handler code here
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- if(m_Index>0)
- {
- m_Index--;
- pDoc->OnBUTTON32858OnDo(m_Index);
- m_IsLastMove=true;
- OnBUTTON32850ReDraw();
- }
- }
- void CEastDrawView::OnUpdateBUTTON32858OnDo(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_Index<5&&m_Index<m_Rtimes&&m_Rtimes!=0?true:false);
- }
- void CEastDrawView::OnUpdateBUTTON32859ReDo(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->Enable(m_Index>0&&m_Rtimes!=0?true:false);
- }
- void CEastDrawView::ReMoveTemp()
- {
- CEastDrawDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- pDoc->ReMoveTemp();
- }
- void CEastDrawView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
- {
- // TODO: Add your specialized code here and/or call the base class
- CClientDC dc(this);
- int nHorzSC = dc.GetDeviceCaps(LOGPIXELSX);
- int nHorzPR = pDC->GetDeviceCaps(LOGPIXELSX);
-
- int PhyToDis=nHorzPR/nHorzSC;
-
- pDC->SetMapMode(MM_ANISOTROPIC);
-
- pDC->SetWindowExt(GetTotalSize());
- pDC->SetViewportExt(GetTotalSize().cx*PhyToDis,GetTotalSize().cy*PhyToDis);
- pDC->SetWindowOrg(m_CenterPoint.x,m_CenterPoint.y);
- this->DrawAll(pDC);
- if(this->m_HaveAxis)
- this->DrawAxis(pDC);
- }
- BOOL CEastDrawView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // TODO: call DoPreparePrinting to invoke the Print dialog box
- return DoPreparePrinting(pInfo);
- }
- void CEastDrawView::SetBoxFont()
- {
- CMainFrame*pMainFrame=STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
- pMainFrame->m_wndStyleBar.IniFont();
- }
- void CEastDrawView::OnMouseCapOn()
- {
- // TODO: Add your command handler code here
-
- m_IsMouseCap=!m_IsMouseCap;
- }
- void CEastDrawView::OnUpdateMouseCapOn(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- pCmdUI->SetCheck(m_IsMouseCap?1:0);
- }
- void CEastDrawView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
- {
- // TODO: Add your message handler code here and/or call default
- CSize size=this->GetTotalSize();
- CRect rect;
- this->GetClientRect(&rect);
- switch(nChar)
- {
- case VK_UP:
- if(rect.bottom<size.cy)
- ScrollToPosition(CPoint(GetDeviceScrollPosition().x,GetDeviceScrollPosition().y-rect.Height()/2));
- break;
- case VK_DOWN:
- if(rect.bottom<size.cy)
- ScrollToPosition(CPoint(GetDeviceScrollPosition().x,GetDeviceScrollPosition().y+rect.Height()/2));
- break;
- case VK_LEFT:
- ScrollToPosition(CPoint(GetDeviceScrollPosition().x-rect.Width()/2,GetDeviceScrollPosition().y));
- break;
- case VK_RIGHT:
- ScrollToPosition(CPoint(GetDeviceScrollPosition().x+rect.Width()/2,GetDeviceScrollPosition().y));
- break;
- case VK_HOME:
- ScrollToPosition(CPoint(0,0));
- break;
-
- }
- CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
- }
|