/* Copyright (C) 2019-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: WxdkdrawControlDraw.cpt */ /** @file WxdkdrawControlDraw.cpp The WxdkdrawControlDraw module. */ #line 10 "WxdkdrawControlDraw.cpt" #include "wxdkdraw.h" #ifndef WXDKDRAWAPPH_INCLUDED #include "WxdkdrawApp.h" #endif #ifndef WXDKDRAWFRAME_H_INCLUDED #include "WxdkdrawFrame.h" #endif #line 24 "WxdkdrawControlDraw.cpt" double WxdkdrawFrame::Control::MarkupPointRadius(uint16_t lw) { double back; double max; /* 2019-05-18 Modification For texts (linewidth is 0) use same size as for a linewidth 2 line */ if ((uint16_t)0U == lw) { lw = (uint16_t)2U; } if ((uint16_t)12U >= lw) { back = 1.75 * (double)(m_pParent->m_pDrw->baselw) * (double)lw; } else { back = (15.0 + 0.5 * ((double)lw)) * (double)(m_pParent->m_pDrw->baselw); } /* 2020-03-21 Modification For moving, adding and deleting points the point markups should not overlap */ if (0 != m_pParent->m_iv[IVI_REDUCE_MARKUP_POINTS]) { switch (m_pParent->m_iState) { case S_MOVEPT_SELECT : case S_ADDPT_SELECT : case S_DELPT : case S_MOD_SPLINE : { max = (double)m_uGridSnap / 2.0; if (back > max) { back = max; } } break; } } return back; } void WxdkdrawFrame::Control::DrawMarkupPoint( wxGraphicsContext *gc, int const *sc, double x, double y, uint16_t lw, Wxd_point_t const *pShift ) { double r; /* Half side length of markup square */ int32_t shiftx = 0L; /* X shift distance */ int32_t shifty = 0L; /* Y shift distance */ #line 82 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = pShift->x; shifty = pShift->y; } x = ConvX(x + (double)shiftx); y = ConvY(y + (double)shifty); r = ConvDist(MarkupPointRadius(lw)); wxColour fc(sc[0], sc[1], sc[2]); wxBrush br(fc); gc->SetBrush(br); gc->SetPen(wxNullPen); wxGraphicsPath p1 = gc->CreatePath(); p1.MoveToPoint((x - r), (y - r)); p1.AddLineToPoint((x + r), (y - r)); p1.AddLineToPoint((x + r), (y + r)); p1.AddLineToPoint((x - r), (y + r)); p1.AddLineToPoint((x - r), (y - r)); p1.CloseSubpath(); gc->FillPath(p1); gc->SetBrush(wxNullBrush); #line 100 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::DrawMarkupPoint( wxGraphicsContext *gc, int const *sc, int32_t x, int32_t y, uint16_t lw, Wxd_point_t const *pShift ) { #line 115 "WxdkdrawControlDraw.cpt" DrawMarkupPoint(gc, sc, (double)x, (double)y, lw, pShift); #line 117 "WxdkdrawControlDraw.cpt" } bool WxdkdrawFrame::Control::StateHasObjectsUnderModification(void) { bool back = false; #line 126 "WxdkdrawControlDraw.cpt" /* _STATE_ Do we have objects under modification which must be drawn in markup pass? */ switch (m_pParent->m_iState) { case S_MOVE_PLACE : case S_COPY_PLACE : case S_POLY_FURTHER : case S_SPLINE_FURTHER : case S_BOX_OPPOSITE : case S_CIRCLE_RADIUS : case S_ELLIPSE_CORNER : case S_ARC_2 : case S_ARC_3 : case S_LIBELEM_PLACE : case S_MOVEPT_PLACE : case S_ADDPT_PLACE : case S_DETAILS_2 : { back = true; } break; } #line 149 "WxdkdrawControlDraw.cpt" return back; } bool WxdkdrawFrame::Control::StateHasObjectsToHighlight(void) { bool back = false; #line 159 "WxdkdrawControlDraw.cpt" /* _STATE_ Do we have object to highlight? */ switch ( m_pParent->m_iState ) { case S_NOOP : { #line 164 "WxdkdrawControlDraw.cpt" back = true; } break; case S_DELETE : case S_REGION_DELETE : case S_MOVE_SELECT : case S_COPY_SELECT : case S_MOVEPT_SELECT : case S_DELPT : case S_ADDPT_SELECT : case S_FLIP : case S_GROUP_ONE : case S_UNGROUP : case S_DETAILS : case S_CONVERT : case S_ROTATE : case S_MOD_SPLINE : { back = true; } break; } #line 185 "WxdkdrawControlDraw.cpt" return back; } bool WxdkdrawFrame::Control::StateHasObjectsToHighlight2(void) { bool back = false; #line 195 "WxdkdrawControlDraw.cpt" switch (m_pParent->m_iState) { /* _STATE_ State has object to mark for grouping */ case S_GROUP_ONE : case S_GROUP_RECT_2 : { back = true; } break; } #line 205 "WxdkdrawControlDraw.cpt" return back; } bool WxdkdrawFrame::Control::StateUsesPlacementHelp(void) { bool back = false; #line 215 "WxdkdrawControlDraw.cpt" /* _STATE_ Does state use placement help? */ switch (m_pParent->m_iState) { case S_MOVE_PLACE : case S_COPY_PLACE : case S_POLY_FIRST : case S_POLY_FURTHER : case S_SPLINE_FIRST : case S_SPLINE_FURTHER : case S_BOX_FIRST : case S_BOX_OPPOSITE : case S_CIRCLE_CENTER : case S_CIRCLE_RADIUS : case S_ELLIPSE_CENTER : case S_ELLIPSE_CORNER : case S_ARC_1 : case S_ARC_2 : case S_ARC_3 : case S_DOT : case S_TEXT : case S_IMG_1 : case S_IMG_2 : case S_LIBELEM_PLACE : case S_MOVEPT_PLACE : case S_ADDPT_PLACE : case S_DRWSZ_PLACE : case S_GROUP_RECT_1 : case S_DELETE : { back = true; } break; } #line 249 "WxdkdrawControlDraw.cpt" return back; } bool WxdkdrawFrame::Control::CanDrawElement(Wxd_object_t const *pobj) { bool back = true; #line 259 "WxdkdrawControlDraw.cpt" switch (pobj->ot) { case WXD_OT_TEXT : { #line 261 "WxdkdrawControlDraw.cpt" if (NULL == (pobj->det).t.t) { #line 262 "WxdkdrawControlDraw.cpt" back = false; } if (0U == (pobj->det).t.fsz) { #line 265 "WxdkdrawControlDraw.cpt" back = false; } if (NULL == (pobj->det).t.font) { #line 268 "WxdkdrawControlDraw.cpt" back = false; } } break; case WXD_OT_POLYLINE : case WXD_OT_POLYGON : { if (NULL == (pobj->det).p.p) { back = false; } if (2U > (pobj->det).p.n) { back = false; } } break; case WXD_OT_O_SPLINE : case WXD_OT_C_SPLINE : { if (NULL == (pobj->det).s.p) { back = false; } if (2U > (pobj->det).s.n) { back = false; } } break; case WXD_OT_O_ARC : case WXD_OT_C_ARC : { } break; case WXD_OT_CIRCLE : { if (0U == (pobj->det).e.rx) { back = false; } } break; case WXD_OT_ELLIPSE : { if (0U == (pobj->det).e.rx) { back = false; } if (0U == (pobj->det).e.ry) { back = false; } } break; case WXD_OT_BOX : { } break; case WXD_OT_IMAGE : { if (NULL == (pobj->det).i.fn) { back = false; } } break; case WXD_OT_DOT_FILLED : case WXD_OT_DOT_WHITE : { if (0U == (pobj->det).d.d) { back = false; } } break; } #line 298 "WxdkdrawControlDraw.cpt" return back; } bool WxdkdrawFrame::Control::MustDrawElementInNormalPass( Wxd_object_t const *pobj ) { bool back = true; #line 310 "WxdkdrawControlDraw.cpt" /* _STATE_ Do we need to draw object in normal drawing pass? */ switch (m_pParent->m_iState) { case S_MOVE_PLACE : case S_POLY_FURTHER : case S_SPLINE_FURTHER : case S_BOX_OPPOSITE : case S_CIRCLE_RADIUS : case S_ELLIPSE_CORNER : case S_ARC_2 : case S_ARC_3 : case S_LIBELEM_PLACE : case S_MOVEPT_PLACE : case S_ADDPT_PLACE : case S_DETAILS_2 : { if (wxdobj_is_marked(pobj, OBJ_MARKER_1)) { back = false; } } break; } #line 333 "WxdkdrawControlDraw.cpt" return back; } bool WxdkdrawFrame::Control::MustDrawElementInMarkupPass( Wxd_object_t const *pobj ) { bool back = false; #line 345 "WxdkdrawControlDraw.cpt" /* _STATE_ Do we need to draw object in markup pass? */ switch (m_pParent->m_iState) { case S_MOVE_PLACE : case S_COPY_PLACE : case S_POLY_FURTHER : case S_SPLINE_FURTHER : case S_BOX_OPPOSITE : case S_CIRCLE_RADIUS : case S_ELLIPSE_CORNER : case S_ARC_2 : case S_ARC_3 : case S_LIBELEM_PLACE : case S_MOVEPT_PLACE : case S_ADDPT_PLACE : case S_DETAILS_2 : { if (wxdobj_is_marked(pobj, OBJ_MARKER_1)) { back = true; } } break; } #line 369 "WxdkdrawControlDraw.cpt" return back; } bool WxdkdrawFrame::Control::MustHighlightElementInMarkupPass( Wxd_object_t const *pobj ) { bool back = false; #line 381 "WxdkdrawControlDraw.cpt" if (wxdobj_is_marked(pobj, OBJ_MARKER_1)) { /* _STATE_ Do we need to highlight object in markup pass? */ switch (m_pParent->m_iState) { case S_NOOP : { back = true; } break; case S_DELETE : case S_REGION_DELETE : case S_MOVE_SELECT : case S_COPY_SELECT : case S_MOVEPT_SELECT : case S_DELPT : case S_ADDPT_SELECT : case S_FLIP : case S_GROUP_ONE : case S_UNGROUP : case S_DETAILS : case S_CONVERT : case S_ROTATE : case S_MOD_SPLINE : { back = true; } break; } } #line 409 "WxdkdrawControlDraw.cpt" return back; } bool WxdkdrawFrame::Control::MustHighlight2ElementInMarkupPass( Wxd_object_t const *pobj ) { bool back = false; #line 421 "WxdkdrawControlDraw.cpt" /* _STATE_ : Must highlight element with marker 2 in markup pass */ if (wxdobj_is_marked(pobj, OBJ_MARKER_2)) { switch (m_pParent->m_iState) { case S_GROUP_ONE : case S_GROUP_RECT_2 : { back = true; } break; } } #line 434 "WxdkdrawControlDraw.cpt" return back; } void WxdkdrawFrame::Control::ChooseStrokeColour( int *sc, Wxd_object_t const *pObj, int iMarkup ) { unsigned i; #line 448 "WxdkdrawControlDraw.cpt" switch (iMarkup) { case WXD_MARKUP_COPY : { DK4_MEMCPY(sc,&(m_pParent->m_iv[IVI_M_COPY_RED]),(3*sizeof(int))); } break; case WXD_MARKUP_MOVE : { DK4_MEMCPY(sc,&(m_pParent->m_iv[IVI_M_MOVE_RED]),(3*sizeof(int))); } break; case WXD_MARKUP_DELETE : { DK4_MEMCPY(sc,&(m_pParent->m_iv[IVI_M_DEL_RED]),(3*sizeof(int))); } break; case WXD_MARKUP_GROUP : { DK4_MEMCPY(sc,&(m_pParent->m_iv[IVI_M_GROUP_RED]),(3*sizeof(int))); } break; case WXD_MARKUP_PTMOVE : { DK4_MEMCPY(sc,&(m_pParent->m_iv[IVI_M_MOVE_RED]),(3*sizeof(int))); for (i = 0; i < 3; i++) { sc[i] = (sc[i] + 2 * 255) / 3; } } break; case WXD_MARKUP_IMGRES : { DK4_MEMCPY(sc,&(m_pParent->m_iv[IVI_M_MOVE_RED]),(3*sizeof(int))); } break; default : { sc[0] = (int)(pObj->sc[0]); sc[1] = (int)(pObj->sc[1]); sc[2] = (int)(pObj->sc[2]); } break; } #line 477 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::SetupPenForObject( wxPen & pen, Wxd_object_t const *pObj, wxDash *pDash, int *pNdash ) { #line 490 "WxdkdrawControlDraw.cpt" if (WXD_LS_SOLID != pObj->ls) { int ldash = (int)(pObj->sl); int ldots = 1; int lgaps = ((3 < ldash) ? (2) : (1)); if (WXD_LS_DOT == pObj->ls) { lgaps = ldots; } switch (pObj->cs) { case WXD_LC_PROJECTING : case WXD_LC_ROUNDED : { ldots = 0; lgaps++; } break; } switch (pObj->ls) { case WXD_LS_DASH_DOT_DOT_DOT : { pDash[0] = ldash; pDash[1] = lgaps; pDash[2] = ldots; pDash[3] = lgaps; pDash[4] = ldots; pDash[5] = lgaps; pDash[6] = ldots; pDash[7] = lgaps; *pNdash = 8; } break; case WXD_LS_DASH_DOT_DOT : { pDash[0] = ldash; pDash[1] = lgaps; pDash[2] = ldots; pDash[3] = lgaps; pDash[4] = ldots; pDash[5] = lgaps; *pNdash = 6; } break; case WXD_LS_DASH_DOT : { pDash[0] = ldash; pDash[1] = lgaps; pDash[2] = ldots; pDash[3] = lgaps; *pNdash = 4; } break; case WXD_LS_DOT : { pDash[0] = ldots; pDash[1] = lgaps; *pNdash = 2; } break; default : { /* dash */ pDash[0] = ldash; pDash[1] = lgaps; *pNdash = 2; } break; } #line 542 "WxdkdrawControlDraw.cpt" pen.SetStyle(wxPENSTYLE_USER_DASH); pen.SetDashes(*pNdash, pDash); } else { } switch (pObj->cs) { case WXD_LC_PROJECTING : { #line 550 "WxdkdrawControlDraw.cpt" pen.SetCap(wxCAP_PROJECTING); } break; case WXD_LC_ROUNDED : { #line 553 "WxdkdrawControlDraw.cpt" pen.SetCap(wxCAP_ROUND); } break; default : { #line 556 "WxdkdrawControlDraw.cpt" pen.SetCap(wxCAP_BUTT); } break; } switch ( (int)(pObj->ot) ) { case WXD_OT_O_ARC : case WXD_OT_C_ARC : case WXD_OT_CIRCLE : case WXD_OT_ELLIPSE : { pen.SetJoin(wxJOIN_ROUND); } break; default : { switch (pObj->js) { case WXD_LJ_BEVELED : { #line 567 "WxdkdrawControlDraw.cpt" pen.SetJoin(wxJOIN_BEVEL); } break; case WXD_LJ_ROUNDED : { #line 570 "WxdkdrawControlDraw.cpt" pen.SetJoin(wxJOIN_ROUND); } break; default : { #line 573 "WxdkdrawControlDraw.cpt" pen.SetJoin(wxJOIN_MITER); } break; } } break; } #line 579 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::DrawTextElement( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { int sc[3]; /* Stroke colour */ wxChar const *t = NULL; /* Text to show */ wxDouble tw(0.0); /* Text width in pixels */ wxDouble th(0.0); /* Text height in pixels */ wxDouble td(0.0); /* Text descender in pixels */ wxDouble el(0.0); /* External leader in pixels */ double w; /* Text width in pixels */ double h; /* Text height in pixels */ double d; /* Text descender in pixels */ double x; /* Text x position */ double y; /* Text y position */ double alpha; /* Text rotation in radians */ int32_t shiftx; /* X shift */ int32_t shifty; /* Y shift */ #line 606 "WxdkdrawControlDraw.cpt" shiftx = 0L; shifty = 0L; if (NULL != pShift) { shiftx = pShift->x; shifty = pShift->y; } t = ( (NULL != (pObj->det).t.tsc) ? ((pObj->det).t.tsc) : ((pObj->det).t.t) ); if ((NULL != t) && ((uint16_t)0 < (pObj->det).t.fsz)) { alpha = ((double)((pObj->det).t.a) * M_PI) / 180.0; if (NULL != (pObj->det).t.font) { if (NULL != ((pObj->det).t.font)->font) { ChooseStrokeColour(sc, pObj, iMarkup); wxColour fcol(sc[0], sc[1], sc[2]); gc->SetFont(*(((pObj->det).t.font)->font), fcol); gc->GetTextExtent(t, &tw, &th, &td, &el); w = (double)tw; h = (double)th; d = (double)td; x = ConvX((pObj->det).t.x + shiftx); y = ConvY((pObj->det).t.y + shifty); if ((int16_t)0 != (pObj->det).t.a) { switch ((pObj->det).t.al) { case WXD_TA_RIGHT : { x -= (w * cos(alpha)); y += (w * sin(alpha)); } break; case WXD_TA_CENTERED : { x -= ((w * cos(alpha)) / 2.0); y += ((w * sin(alpha)) / 2.0); } break; } x += ((d - h) * sin(alpha)); y += ((d - h) * cos(alpha)); gc->DrawText(t, x, y, alpha); } else { switch ((pObj->det).t.al) { case WXD_TA_RIGHT : { x -= w; } break; case WXD_TA_CENTERED : { x -= (w / 2.0); } break; } y += (d - h); gc->DrawText(t, x, y); } gc->SetFont(wxNullFont, wxNullColour); if (WXD_MARKUP_NONE != iMarkup) { DrawMarkupPoint( gc, sc, (pObj->det).t.x, (pObj->det).t.y, 0U, pShift ); } } #if TRACE_DEBUG else { #line 659 "WxdkdrawControlDraw.cpt" } #endif } #if TRACE_DEBUG else { #line 664 "WxdkdrawControlDraw.cpt" } #endif } #line 668 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PathPolyline( wxGraphicsPath & p, Wxd_object_t const *pObj, Wxd_point_t const *pShift ) { double shiftx = 0.0; /* X shift distance */ double shifty = 0.0; /* Y shift distance */ uint16_t i; /* Current point index */ #line 683 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = (double)(pShift->x); shifty = (double)(pShift->y); } for (i = 0U; i < (pObj->det).p.n; i++) { if (0U == i) { p.MoveToPoint( ConvX((double)(((pObj->det).p.p)[i].x) + shiftx), ConvY((double)(((pObj->det).p.p)[i].y) + shifty) ); } else { p.AddLineToPoint( ConvX((double)(((pObj->det).p.p)[i].x) + shiftx), ConvY((double)(((pObj->det).p.p)[i].y) + shifty) ); } } if (WXD_OT_POLYGON == pObj->ot) { p.AddLineToPoint( ConvX((double)(((pObj->det).p.p)[0].x) + shiftx), ConvY((double)(((pObj->det).p.p)[0].y) + shifty) ); p.CloseSubpath(); } #line 709 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::SplineSegment( wxGraphicsPath & p, Wxd_spline_point_t *pt, dk4_xsp_2d_t *xsp, uint16_t segno, size_t subsegs, double divisor, double shiftx, double shifty, uint16_t ib, uint16_t ic ) { #if 0 /* 2019-04-28 This deactivated section shows real variable names. The active section below uses and copies array members directly for performance reasons. */ double rp[4]; double x0; double y0; double dxdt0; double dydt0; double x1; double y1; double dxdt1; double dydt1; double t; size_t ss; if ((1.0e-7 > fabs(pt[ib].s)) && (1.0e-7 > fabs(pt[ic].s))) { if (0U == segno) { p.MoveToPoint( ConvX(pt[ib].x + shiftx), ConvY(pt[ib].y + shifty) ); } p.AddLineToPoint( ConvX(pt[ic].x + shiftx), ConvY(pt[ic].y + shifty) ); } else { dk4xsp2d_calculate_value_derivative(rp, xsp, 0.0, NULL); x0 = rp[0]; y0 = rp[2]; dxdt0 = rp[1] / divisor; dydt0 = rp[3] / divisor; if (0U == segno) { p.MoveToPoint( ConvX(x0 + shiftx), ConvY(y0 + shifty) ); } for (ss = 0; ss < subsegs; ss++) { if ((subsegs - (size_t)1U) == ss) { t = 1.0; } else { t = (double)(ss + (size_t)1U) / (double)subsegs; } dk4xsp2d_calculate_value_derivative(rp, xsp, t, NULL); x1 = rp[0]; y1 = rp[2]; dxdt1 = rp[1] / divisor; dydt1 = rp[3] / divisor; p.AddCurveToPoint( ConvX(x0 + dxdt0 + shiftx), ConvY(y0 + dydt0 + shifty), ConvX(x1 - dxdt1 + shiftx), ConvY(y1 - dydt1 + shifty), ConvX(x1 + shiftx), ConvY(y1 + shifty) ); x0 = x1; y0 = y1; dxdt0 = dxdt1; dydt0 = dydt1; } } #endif double rp0[4]; double rp1[4]; double t; size_t ss; if ((1.0e-7 > fabs(pt[ib].s)) && (1.0e-7 > fabs(pt[ic].s))) { /* Both start and end of segment have s=0 so we can draw a straight line. */ if (0U == segno) { p.MoveToPoint( ConvX(pt[ib].x + shiftx), ConvY(pt[ib].y + shifty) ); } p.AddLineToPoint( ConvX(pt[ic].x + shiftx), ConvY(pt[ic].y + shifty) ); } else { /* At least one from start and end has s!=0 so we must draw a spline sequence. */ dk4xsp2d_calculate_value_derivative(rp0, xsp, 0.0, NULL); rp0[1] = rp0[1] / divisor; rp0[3] = rp0[3] / divisor; if (0U == segno) { p.MoveToPoint( ConvX(rp0[0] + shiftx), ConvY(rp0[2] + shifty) ); } for (ss = 0; ss < subsegs; ss++) { if ((subsegs - (size_t)1U) == ss) { t = 1.0; } else { t = (double)(ss + (size_t)1U) / (double)subsegs; } dk4xsp2d_calculate_value_derivative(rp1, xsp, t, NULL); rp1[1] = rp1[1] / divisor; rp1[3] = rp1[3] / divisor; p.AddCurveToPoint( ConvX(rp0[0]+rp0[1]+shiftx), ConvY(rp0[2]+rp0[3]+shifty), ConvX(rp1[0]-rp1[1]+shiftx), ConvY(rp1[2]-rp1[3]+shifty), ConvX(rp1[0] + shiftx), ConvY(rp1[2] + shifty) ); DK4_MEMCPY(rp0,rp1,(sizeof(double)*4)); } } } void WxdkdrawFrame::Control::PathSpline( wxGraphicsPath & p, Wxd_object_t const *pObj, Wxd_point_t const *pShift ) { dk4_xsp_2d_t xsp; /* 2D X-spline */ Wxd_spline_point_t *pt; /* Address of spline points array */ double shiftx = 0.0; /* X shift distance */ double shifty = 0.0; /* Y shift distance */ double divisor; /* Divisor in calculations */ size_t subsegs; /* Number of subsegments */ uint16_t ia; /* Index of point A */ uint16_t ib; /* Index of point B */ uint16_t ic; /* Index of point C */ uint16_t id; /* Index of point D */ uint16_t segno; /* Current segment index */ uint16_t segments; /* Number of segments */ #line 854 "WxdkdrawControlDraw.cpt" dk4xsp2d_reset(&xsp); if (NULL != pShift) { shiftx = pShift->x; shifty = pShift->y; } segments = (pObj->det).s.n - (uint16_t)1U; pt = (pObj->det).s.p; subsegs = (size_t)(m_pParent->m_iv[IVI_XS_SUBSEGS]); if (1U > subsegs) { subsegs = 1U; } divisor = 3.0 * (double)subsegs; for (segno = 0U; segno < segments; segno++) { dk4xsp2d_reset_points(&xsp); ib = segno; ic = ib + 1; dk4xsp2d_set_point(&xsp, pt[ib].x, pt[ib].y, pt[ib].s, 1); dk4xsp2d_set_point(&xsp, pt[ic].x, pt[ic].y, pt[ic].s, 2); if (0U < ib) { ia = ib - (uint16_t)1U; dk4xsp2d_set_point(&xsp, pt[ia].x, pt[ia].y, pt[ia].s, 0); } else { if (WXD_OT_C_SPLINE == pObj->ot) { ia = segments; dk4xsp2d_set_point(&xsp, pt[ia].x, pt[ia].y, pt[ia].s, 0); } } if (ic < segments) { id = ic + (uint16_t)1U; dk4xsp2d_set_point(&xsp, pt[id].x, pt[id].y, pt[id].s, 3); } else { if (WXD_OT_C_SPLINE == pObj->ot) { id = 0; dk4xsp2d_set_point(&xsp, pt[id].x, pt[id].y, pt[id].s, 3); } } SplineSegment( p, pt, &xsp, segno, subsegs, divisor, shiftx, shifty, ib, ic ); } if (WXD_OT_C_SPLINE == pObj->ot) { dk4xsp2d_reset_points(&xsp); ia = segments - (uint16_t)1U; ib = segments; ic = 0U; id = 1U; dk4xsp2d_set_point(&xsp, pt[ia].x, pt[ia].y, pt[ia].s, 0); dk4xsp2d_set_point(&xsp, pt[ib].x, pt[ib].y, pt[ib].s, 1); dk4xsp2d_set_point(&xsp, pt[ic].x, pt[ic].y, pt[ic].s, 2); dk4xsp2d_set_point(&xsp, pt[id].x, pt[id].y, pt[id].s, 3); SplineSegment( p, pt, &xsp, segments, subsegs, divisor, shiftx, shifty, ib, ic ); p.CloseSubpath(); } #line 907 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PathArc( wxGraphicsPath & p, Wxd_object_t const *pObj, Wxd_point_t const *pShift ) { double shiftx = 0.0; /* X shift distance */ double shifty = 0.0; /* Y shift distance */ double deltaa; /* Difference start angle to end angle */ double x0; /* Segment start point X position */ double y0; /* Segment start point Y position */ double dxdt0; /* Segment start point X derivative */ double dydt0; /* Segment start point Y derivative */ double x1; /* Segment end point X position */ double y1; /* Segment end point Y position */ double dxdt1; /* Segment end point X derivative */ double dydt1; /* Segment end point Y derivative */ double cx0; /* Converted start point X */ double cy0; /* Converted start point Y */ double a0; /* Segment start angle */ double a1; /* Segment end angle */ double kappa; /* Kappa value for segment */ size_t segments; /* Number of segments */ size_t i; /* Index of current segment */ #line 937 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = pShift->x; shifty = pShift->y; } if ((int8_t)0 != (pObj->det).a.d) { segments = (size_t)dk4ma_rint( ceil( fabs((pObj->det).a.b - (pObj->det).a.a) / M_PI_2 ) ); a0 = (pObj->det).a.a; x0 = (pObj->det).a.x + (pObj->det).a.r * cos(a0) + shiftx; y0 = (pObj->det).a.y + (pObj->det).a.r * sin(a0) + shifty; cx0 = ConvX(x0); cy0 = ConvY(y0); p.MoveToPoint(cx0, cy0); deltaa = (pObj->det).a.b - (pObj->det).a.a; for (i = 0; i < segments; i++) { if (i >= (segments - 1)) { a1 = (pObj->det).a.b; } else { a1 = (pObj->det).a.a + ((double)(i + (size_t)1) * deltaa) / (double)segments; } kappa = dk4gratool_kappa_for_angle(fabs(a1 - a0)); dxdt0 = -1.0 * (a1 - a0) * (pObj->det).a.r * sin(a0); dydt0 = (a1 - a0) * (pObj->det).a.r * cos(a0); x1 = (pObj->det).a.x + (pObj->det).a.r * cos(a1) + shiftx; y1 = (pObj->det).a.y + (pObj->det).a.r * sin(a1) + shifty; dxdt1 = -1.0 * (a1 - a0) * (pObj->det).a.r * sin(a1); dydt1 = (a1 - a0) * (pObj->det).a.r * cos(a1); p.AddCurveToPoint( ConvX(x0 + kappa * dxdt0), ConvY(y0 + kappa * dydt0), ConvX(x1 - kappa * dxdt1), ConvY(y1 - kappa * dydt1), ConvX(x1), ConvY(y1) ); a0 = a1; x0 = x1; y0 = y1; } if (WXD_OT_C_ARC == pObj->ot) { p.AddLineToPoint( ConvX((pObj->det).a.x + shiftx), ConvY((pObj->det).a.y + shifty) ); p.AddLineToPoint(cx0, cy0); p.CloseSubpath(); } } else { x0 = (double)((pObj->det).a.x1) + shiftx; y0 = (double)((pObj->det).a.y1) + shifty; cx0 = ConvX(x0); cy0 = ConvY(y0); p.MoveToPoint(cx0, cy0); p.AddLineToPoint( ConvX((double)((pObj->det).a.x2) + shiftx), ConvY((double)((pObj->det).a.y2) + shifty) ); p.AddLineToPoint( ConvX((double)((pObj->det).a.x3) + shiftx), ConvY((double)((pObj->det).a.y3) + shifty) ); if (WXD_OT_C_ARC == pObj->ot) { p.AddLineToPoint(cx0, cy0); p.CloseSubpath(); } } #line 1002 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PathCircle( wxGraphicsPath & p, Wxd_object_t const *pObj, Wxd_point_t const *pShift ) { double shiftx = 0.0; /* X shift distance */ double shifty = 0.0; /* Y shift distance */ if (NULL != pShift) { shiftx = pShift->x; shifty = pShift->y; } #line 1017 "WxdkdrawControlDraw.cpt" p.AddCircle( ConvX((double)((pObj->det).e.x) + shiftx), ConvY((double)((pObj->det).e.y) + shifty), fabs(ConvDist((double)((pObj->det).e.rx))) ); #line 1023 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PathEllipse( wxGraphicsPath & p, Wxd_object_t const *pObj, Wxd_point_t const *pShift ) { dk4_gra_point_t pt[DK4_GRA_CIRCLE_POINTS]; /* Point set for circle */ dk4_er_t er; /* Error report */ double shiftx = 0.0; /* X shift distance */ double shifty = 0.0; /* Y shift distance */ size_t const szpt = DK4_SIZEOF(pt,dk4_gra_point_t); size_t i; /* Current segment index */ size_t c1; /* First ctrl pt index */ size_t c2; /* Second ctrl pt index */ size_t c3; /* Segment index */ int res; /* Intermediate result */ #line 1045 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = pShift->x; shifty = pShift->y; } if ((int16_t)0 != (pObj->det).e.a) { dk4error_init(&er); res = dk4gratool_points_for_ellipse( pt, szpt, ((double)((pObj->det).e.x) + shiftx), ((double)((pObj->det).e.y) + shifty), (double)((pObj->det).e.rx), (double)((pObj->det).e.ry), ((M_PI * (double)((pObj->det).e.a)) / 180.0), &er ); if (0 != res) { p.MoveToPoint(ConvX(pt[0].x), ConvY(pt[0].y)); for (i = 0; i < (szpt / (size_t)3U); i++) { c1 = 3 * i + 1; c2 = 3 * i + 2; c3 = 3 * i + 3; if (DK4_GRA_CIRCLE_POINTS <= c3) { c3 = 0; } p.AddCurveToPoint( ConvX(pt[c1].x), ConvY(pt[c1].y), ConvX(pt[c2].x), ConvY(pt[c2].y), ConvX(pt[c3].x), ConvY(pt[c3].y) ); } p.CloseSubpath(); } } else { p.AddEllipse( ConvX( (double)((pObj->det).e.x) - (double)((pObj->det).e.rx) + shiftx ), ConvY( (double)((pObj->det).e.y) + (double)((pObj->det).e.ry) + shifty ), ConvDist(2.0 * (pObj->det).e.rx), ConvDist(2.0 * (pObj->det).e.ry) ); } #line 1085 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PathBox( wxGraphicsPath & p, Wxd_object_t const *pObj, Wxd_point_t const *pShift ) { dk4_bb_t bb; /* Bounding box data */ double shiftx = 0.0; /* X shift distance */ double shifty = 0.0; /* Y shift distance */ double w; /* Box width */ double h; /* Box height */ double r; /* Corner radius */ #line 1103 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = pShift->x; shifty = pShift->y; } if ((pObj->det).b.b.xl <= (pObj->det).b.b.xr) { bb.xmin = (double)((pObj->det).b.b.xl); bb.xmax = (double)((pObj->det).b.b.xr); w = (double)((pObj->det).b.b.xr) - (double)((pObj->det).b.b.xl); } else { bb.xmax = (double)((pObj->det).b.b.xl); bb.xmin = (double)((pObj->det).b.b.xr); w = (double)((pObj->det).b.b.xl) - (double)((pObj->det).b.b.xr); } if ((pObj->det).b.b.yb <= (pObj->det).b.b.yt) { bb.ymin = (double)((pObj->det).b.b.yb); bb.ymax = (double)((pObj->det).b.b.yt); h = (double)((pObj->det).b.b.yt) - (double)((pObj->det).b.b.yb); } else { bb.ymax = (double)((pObj->det).b.b.yb); bb.ymin = (double)((pObj->det).b.b.yt); h = (double)((pObj->det).b.b.yb) - (double)((pObj->det).b.b.yt); } bb.xmin = ConvX(bb.xmin + shiftx); bb.xmax = ConvX(bb.xmax + shiftx); bb.ymin = ConvY(bb.ymin + shifty); bb.ymax = ConvY(bb.ymax + shifty); w = ConvDist(w); h = ConvDist(h); if ((uint32_t)0UL < (pObj->det).b.r) { r = ConvDist((double)((pObj->det).b.r)); if (r > (w / 2.0)) { r = w / 2.0; } if (r > (h / 2.0)) { r = h / 2.0; } p.AddRoundedRectangle(bb.xmin, bb.ymax, w, h, r); } else { p.AddRectangle(bb.xmin, bb.ymax, w, h); } #line 1140 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::MarkupPolyline( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { int sc[3]; /* Stroke colour components */ double r; /* Half markup point length (wxd) */ double shiftx = 0.0; /* X shift distance (wxd) */ double shifty = 0.0; /* Y shift distance (wxd) */ double xl; /* Left x value for markup square (pixels) */ double yt; /* Top y value for markup square (pixels) */ double w; /* Markup square width (pixels) */ uint16_t i; /* Current point index */ #line 1161 "WxdkdrawControlDraw.cpt" if ((NULL != (pObj->det).p.p) && (0 < (pObj->det).p.n)) { if (NULL != pShift) { shiftx = (double)(pShift->x); shifty = (double)(pShift->y); } ChooseStrokeColour(sc, pObj, iMarkup); r = MarkupPointRadius(pObj->lw); { wxColour cstroke(sc[0], sc[1], sc[2]); wxBrush brstr(cstroke); gc->SetBrush(brstr); gc->SetPen(wxNullPen); w = ConvDist(2.0 * r); for (i = 0; i < (pObj->det).p.n; i++) { #line 1176 "WxdkdrawControlDraw.cpt" wxGraphicsPath p = gc->CreatePath(); xl = ConvX((double)(((pObj->det).p.p)[i].x) + shiftx - r); yt = ConvY((double)(((pObj->det).p.p)[i].y) + shifty + r); #line 1180 "WxdkdrawControlDraw.cpt" #line 1181 "WxdkdrawControlDraw.cpt" #line 1182 "WxdkdrawControlDraw.cpt" p.AddRectangle(xl, yt, w, w); gc->FillPath(p); } gc->SetBrush(wxNullBrush); } } #line 1189 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::MarkupSpline( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { int sc[3]; /* Stroke colour components */ double r; /* Half width of markup square (wxd) */ double shiftx = 0.0; /* X shift distance (wxd) */ double shifty = 0.0; /* Y shift distance (wxd) */ double xl; /* Left x of markup square (pixels) */ double yt; /* Top y of markup square (pixels) */ double w; /* Markup square width (pixels) */ uint16_t i; /* Current point index */ #line 1210 "WxdkdrawControlDraw.cpt" if ((NULL != (pObj->det).s.p) && (0 < (pObj->det).s.n)) { if (NULL != pShift) { shiftx = (double)(pShift->x); shifty = (double)(pShift->y); } ChooseStrokeColour(sc, pObj, iMarkup); r = MarkupPointRadius(pObj->lw); { wxColour cstroke(sc[0], sc[1], sc[2]); wxBrush brstr(cstroke); gc->SetBrush(brstr); gc->SetPen(wxNullPen); w = ConvDist(2.0 * r); for (i = 0; i < (pObj->det).s.n; i++) { #line 1225 "WxdkdrawControlDraw.cpt" wxGraphicsPath p = gc->CreatePath(); xl = ConvX((double)(((pObj->det).s.p)[i].x) + shiftx - r); yt = ConvY((double)(((pObj->det).s.p)[i].y) + shifty + r); #line 1229 "WxdkdrawControlDraw.cpt" #line 1230 "WxdkdrawControlDraw.cpt" #line 1231 "WxdkdrawControlDraw.cpt" p.AddRectangle(xl, yt, w, w); gc->FillPath(p); } gc->SetBrush(wxNullBrush); } } #line 1238 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::MarkupArc( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { int sc[3]; /* Stroke colour components */ double r; /* Half width of markup square (wxd) */ double shiftx = 0.0; /* X shift distance (wxd) */ double shifty = 0.0; /* Y shift distance (wxd) */ double xl; /* Left x of markup square (pixels) */ double yt; /* Top y of markup square (pixels) */ double w; /* Markup square width (pixels) */ #line 1258 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = (double)(pShift->x); shifty = (double)(pShift->y); } ChooseStrokeColour(sc, pObj, iMarkup); r = MarkupPointRadius(pObj->lw); { wxColour cstroke(sc[0], sc[1], sc[2]); wxBrush brstr(cstroke); gc->SetBrush(brstr); gc->SetPen(wxNullPen); w = ConvDist(2.0 * r); { wxGraphicsPath p1 = gc->CreatePath(); xl = ConvX((double)((pObj->det).a.x1) + shiftx - r); yt = ConvY((double)((pObj->det).a.y1) + shifty + r); p1.AddRectangle(xl, yt, w, w); gc->FillPath(p1); } { wxGraphicsPath p2 = gc->CreatePath(); xl = ConvX((double)((pObj->det).a.x2) + shiftx - r); yt = ConvY((double)((pObj->det).a.y2) + shifty + r); p2.AddRectangle(xl, yt, w, w); gc->FillPath(p2); } { wxGraphicsPath p3 = gc->CreatePath(); xl = ConvX((double)((pObj->det).a.x3) + shiftx - r); yt = ConvY((double)((pObj->det).a.y3) + shifty + r); p3.AddRectangle(xl, yt, w, w); gc->FillPath(p3); } gc->SetBrush(wxNullBrush); } #line 1294 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::MarkupCircle( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { int sc[3]; /* Stroke colour components */ double r; /* Half width of markup square (wxd) */ double shiftx = 0.0; /* X shift distance (wxd) */ double shifty = 0.0; /* Y shift distance (wxd) */ double x; /* Markup point x (wxd) */ double y; /* Markup point y (wxd) */ double xl; /* Left x of markup square (pixels) */ double yt; /* Top y of markup square (pixels) */ double w; /* Markup square width (pixels) */ #line 1316 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = (double)(pShift->x); shifty = (double)(pShift->y); } ChooseStrokeColour(sc, pObj, iMarkup); r = MarkupPointRadius(pObj->lw); { wxColour cstroke(sc[0], sc[1], sc[2]); wxBrush brstr(cstroke); gc->SetBrush(brstr); gc->SetPen(wxNullPen); w = ConvDist(2.0 * r); { wxGraphicsPath p1 = gc->CreatePath(); x = (double)((pObj->det).e.x) - (double)((pObj->det).e.rx); y = (double)((pObj->det).e.y); xl = ConvX(x + shiftx - r); yt = ConvY(y + shifty + r); p1.AddRectangle(xl, yt, w, w); gc->FillPath(p1); } { wxGraphicsPath p2 = gc->CreatePath(); x = (double)((pObj->det).e.x) + (double)((pObj->det).e.rx); y = (double)((pObj->det).e.y); xl = ConvX(x + shiftx - r); yt = ConvY(y + shifty + r); p2.AddRectangle(xl, yt, w, w); gc->FillPath(p2); } { wxGraphicsPath p3 = gc->CreatePath(); x = (double)((pObj->det).e.x); y = (double)((pObj->det).e.y) - (double)((pObj->det).e.rx); xl = ConvX(x + shiftx - r); yt = ConvY(y + shifty + r); p3.AddRectangle(xl, yt, w, w); gc->FillPath(p3); } { wxGraphicsPath p4 = gc->CreatePath(); x = (double)((pObj->det).e.x); y = (double)((pObj->det).e.y) + (double)((pObj->det).e.rx); xl = ConvX(x + shiftx - r); yt = ConvY(y + shifty + r); p4.AddRectangle(xl, yt, w, w); gc->FillPath(p4); } gc->SetBrush(wxNullBrush); } #line 1367 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::MarkupEllipse( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { dk4_gra_point_t pt[5]; /* Ellipse key points to mark */ int sc[3]; /* Stroke colour components */ double shiftx = 0.0; /* X shift distance (wxd) */ double shifty = 0.0; /* Y shift distance (wxd) */ double xl; /* Left markup square x (pixels) */ double yt; /* Top markup square y (pixels) */ double w; /* Markup square width (pixels) */ double a; /* Rotation in radians */ double r; /* Half markup square width (wxd) */ size_t i; /* Current point index */ #line 1390 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = (double)(pShift->x); shifty = (double)(pShift->y); } ChooseStrokeColour(sc, pObj, iMarkup); r = MarkupPointRadius(pObj->lw); w = ConvDist(2.0 * r); pt[0].x = (double)((pObj->det).e.rx); pt[0].y = 0.0; pt[1].x = 0.0; pt[1].y = (double)((pObj->det).e.ry); pt[2].x = 0.0 - (double)((pObj->det).e.rx); pt[2].y = 0.0; pt[3].x = 0.0; pt[3].y = 0.0 - (double)((pObj->det).e.ry); a = (M_PI * (double)((pObj->det).e.a)) / 180.0; { wxColour fc(sc[0], sc[1], sc[2]); wxBrush br(fc); gc->SetBrush(br); gc->SetPen(wxNullPen); for (i = 0; i < 4; i++) { dk4gratool_rotate_point(&(pt[i]), a); pt[i].x += (double)((pObj->det).e.x); pt[i].y += (double)((pObj->det).e.y); { wxGraphicsPath p = gc->CreatePath(); xl = ConvX(pt[i].x + shiftx - r); yt = ConvY(pt[i].y + shifty + r); p.AddRectangle(xl, yt, w, w); gc->FillPath(p); } } gc->SetBrush(wxNullBrush); } #line 1425 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::MarkupBoundingBox( wxGraphicsContext *gc, Wxd_object_t const *pObj, Wxd_bb_t const *pbb, int iMarkup, Wxd_point_t const *pShift ) { int sc[3]; /* Stroke colour components */ double r; /* Half markup square width (wxd) */ double shiftx = 0.0; /* X shift distance (wxd) */ double shifty = 0.0; /* Y shift distance (wxd) */ double xl; /* Markup square left x (pixels) */ double yt; /* Markup square top y (pixels) */ double w; /* Markup square width (pixels) */ double dlw; /* Markup rectangle line width */ int lw; /* Markup rectangle line width */ #line 1448 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = (double)(pShift->x); shifty = (double)(pShift->y); } ChooseStrokeColour(sc, pObj, iMarkup); r = MarkupPointRadius(pObj->lw); if (WXD_OT_IMAGE == pObj->ot) { dlw = 2.0 * (double)(m_pParent->m_pDrw->baselw); lw = (int)dk4ma_rint(ConvDist(dlw)); if (1 > lw) { lw = 1; } } { wxColour cstroke(sc[0], sc[1], sc[2]); wxBrush brstr(cstroke); if (WXD_OT_IMAGE == pObj->ot) { wxPen penRect(cstroke, lw); wxGraphicsPath pathRect = gc->CreatePath(); gc->SetPen(penRect); gc->SetBrush(wxNullBrush); pathRect.AddRectangle( ConvX((double)(pbb->xl) + shiftx), ConvY((double)(pbb->yt) + shifty), ConvDist((double)(pbb->xr) - (double)(pbb->xl)), ConvDist((double)(pbb->yt) - (double)(pbb->yb)) ); gc->StrokePath(pathRect); gc->SetPen(wxNullPen); } gc->SetPen(wxNullPen); gc->SetBrush(brstr); switch (iMarkup) { case WXD_MARKUP_IMGRES : { } break; default : { w = ConvDist(2.0 * r); { wxGraphicsPath p1 = gc->CreatePath(); xl = ConvX((double)(pbb->xl) + shiftx - r); yt = ConvY((double)(pbb->yb) + shifty + r); p1.AddRectangle(xl, yt, w, w); gc->FillPath(p1); } { wxGraphicsPath p2 = gc->CreatePath(); xl = ConvX((double)(pbb->xr) + shiftx - r); yt = ConvY((double)(pbb->yb) + shifty + r); p2.AddRectangle(xl, yt, w, w); gc->FillPath(p2); } { wxGraphicsPath p3 = gc->CreatePath(); xl = ConvX((double)(pbb->xr) + shiftx - r); yt = ConvY((double)(pbb->yt) + shifty + r); p3.AddRectangle(xl, yt, w, w); gc->FillPath(p3); } { wxGraphicsPath p4 = gc->CreatePath(); xl = ConvX((double)(pbb->xl) + shiftx - r); yt = ConvY((double)(pbb->yt) + shifty + r); p4.AddRectangle(xl, yt, w, w); gc->FillPath(p4); } } break; } gc->SetBrush(wxNullBrush); } #line 1516 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::MarkupBox( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { #line 1529 "WxdkdrawControlDraw.cpt" MarkupBoundingBox(gc, pObj, &((pObj->det).b.b), iMarkup, pShift); #line 1531 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::DrawOpenPathElement( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { wxDash dash[8]; /* Dash length values array */ int sc[3]; /* Stroke colour */ int lw; /* Line width */ int nDash = 0; /* Number of dash elements */ bool bStroke = false; /* Flag: Stroke this element */ #line 1549 "WxdkdrawControlDraw.cpt" if (((uint16_t)0U != pObj->lw) || (WXD_MARKUP_NONE != iMarkup)) { bStroke = true; } if (bStroke) { wxGraphicsPath p = gc->CreatePath(); ChooseStrokeColour(sc, pObj, iMarkup); lw = LineWidthForObject(m_pParent->m_pDrw, pObj, iMarkup); switch (pObj->ot) { case WXD_OT_POLYLINE : { PathPolyline(p, pObj, pShift); } break; case WXD_OT_O_SPLINE : { PathSpline(p, pObj, pShift); } break; case WXD_OT_O_ARC : { PathArc(p, pObj, pShift); } break; } wxColour penc(sc[0], sc[1], sc[2]); wxPen pen(penc, lw); SetupPenForObject(pen, pObj, dash, &nDash); gc->SetPen(pen); gc->SetBrush(wxNullBrush); gc->StrokePath(p); gc->SetPen(wxNullPen); /* Arrowheads, if any */ AddArrowheads(gc, m_pParent->m_pDrw, pObj, sc, pShift); /* Markup */ if (WXD_MARKUP_NONE != iMarkup) { switch (pObj->ot) { case WXD_OT_POLYLINE : { MarkupPolyline(gc, pObj, iMarkup, pShift); } break; case WXD_OT_O_SPLINE : { MarkupSpline(gc, pObj, iMarkup, pShift); } break; case WXD_OT_O_ARC : { MarkupArc(gc, pObj, iMarkup, pShift); } break; } } } #line 1596 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::DrawClosedPathElement( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { wxDash dash[8]; /* Dash length values array */ int sc[3]; /* Stroke colour */ int nDash = 0; /* Number of dash values */ bool bFill = false; /* Flag: Fill element */ bool bStroke = false; /* Flag: Stroke element */ #line 1614 "WxdkdrawControlDraw.cpt" if ((uint8_t)(WXD_FS_NONE) != pObj->fs) { /* 2020-03-24 Modification Marked elements are drawned on top of other elements, so they can hide elements normally below them. */ if (WXD_MARKUP_NONE == iMarkup) { bFill = true; } } /* Stroke element if linewidth not 0 or any markup required */ if (((uint16_t)0U != pObj->lw) || (WXD_MARKUP_NONE != iMarkup)) { bStroke = true; } if (bFill || bStroke) { wxGraphicsPath p = gc->CreatePath(); switch (pObj->ot) { case WXD_OT_POLYGON : { PathPolyline(p, pObj, pShift); } break; case WXD_OT_C_SPLINE : { PathSpline(p, pObj, pShift); } break; case WXD_OT_C_ARC : { PathArc(p, pObj, pShift); } break; case WXD_OT_CIRCLE : { PathCircle(p, pObj, pShift); } break; case WXD_OT_ELLIPSE : { PathEllipse(p, pObj, pShift); } break; case WXD_OT_BOX : { PathBox(p, pObj, pShift); } break; } if (bFill) { gc->SetPen(wxNullPen); if ( ((uint8_t)(WXD_FS_PURE) < pObj->fs) && (NULL != pObj->psti) && (NULL != (pObj->psti)->bm) ) { wxBrush br(*((pObj->psti)->bm)); gc->SetBrush(br); gc->DrawPath(p); gc->SetBrush(wxNullBrush); } else { wxColour fc( (int)(pObj->fc[0]), (int)(pObj->fc[1]), (int)(pObj->fc[2]) ); wxBrush br(fc); gc->SetBrush(br); gc->DrawPath(p); gc->SetBrush(wxNullBrush); } } if (bStroke) { gc->SetBrush(wxNullBrush); ChooseStrokeColour(sc, pObj, iMarkup); wxColour penc(sc[0], sc[1], sc[2]); wxPen pen( penc, LineWidthForObject(m_pParent->m_pDrw, pObj, iMarkup) ); SetupPenForObject(pen, pObj, dash, &nDash); gc->SetPen(pen); gc->StrokePath(p); gc->SetPen(wxNullPen); } gc->SetPen(wxNullPen); gc->SetBrush(wxNullBrush); if (WXD_MARKUP_NONE != iMarkup) { switch (pObj->ot) { case WXD_OT_POLYGON : { MarkupPolyline(gc, pObj, iMarkup, pShift); } break; case WXD_OT_C_SPLINE : { MarkupSpline(gc, pObj, iMarkup, pShift); } break; case WXD_OT_C_ARC : { MarkupArc(gc, pObj, iMarkup, pShift); } break; case WXD_OT_CIRCLE : { MarkupCircle(gc, pObj, iMarkup, pShift); } break; case WXD_OT_ELLIPSE : { MarkupEllipse(gc, pObj, iMarkup, pShift); } break; case WXD_OT_BOX : { MarkupBox(gc, pObj, iMarkup, pShift); } break; } } } #line 1712 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::DrawImageRegion( wxGraphicsContext *gc ) { double xps; /* Start x coordinate */ double xpe; /* End x coordinate */ double yps; /* Start y coordinate */ double ype; /* End y coordinate */ wxColour co( m_pParent->m_iv[IVI_MISSIMG_RED], m_pParent->m_iv[IVI_MISSIMG_GREEN], m_pParent->m_iv[IVI_MISSIMG_BLUE] ); wxPen pen(co); gc->SetPen(pen); gc->SetBrush(wxNullBrush); xps = ConvX((double)((m_pParent->m_ptMouseMoveStart).x)); xpe = ConvX((double)((m_pParent->m_ptMousePosGrid).x)); yps = ConvY((double)((m_pParent->m_ptMouseMoveStart).y)); ype = ConvY((double)((m_pParent->m_ptMousePosGrid).y)); { wxGraphicsPath p = gc->CreatePath(); p.AddRectangle(xps, yps, (xpe-xps), (ype-yps)); gc->StrokePath(p); } gc->SetPen(wxNullPen); } void WxdkdrawFrame::Control::DrawImageElement( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { double shiftx = 0.0; /* X shift distance */ double shifty = 0.0; /* Y shift distance */ double xps; /* Start x coordinate */ double xpe; /* End x coordinate */ double yps; /* Start y coordinate */ double ype; /* End y coordinate */ #line 1763 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = (double)(pShift->x); shifty = (double)(pShift->y); } if (NULL != (pObj->det).i.bm) { #line 1768 "WxdkdrawControlDraw.cpt" gc->DrawBitmap( *((pObj->det).i.bm), ConvX((pObj->det).i.pl.xmin + shiftx), ConvY((pObj->det).i.pl.ymax + shifty), ( ConvX((pObj->det).i.pl.xmax + shiftx) - ConvX((pObj->det).i.pl.xmin + shiftx) ), ( ConvY((pObj->det).i.pl.ymin + shifty) - ConvY((pObj->det).i.pl.ymax + shifty) ) ); if (WXD_MARKUP_NONE != iMarkup) { MarkupBoundingBox(gc, pObj, &((pObj->det).i.br), iMarkup, pShift); } } else { #line 1785 "WxdkdrawControlDraw.cpt" wxColour co( m_pParent->m_iv[IVI_MISSIMG_RED], m_pParent->m_iv[IVI_MISSIMG_GREEN], m_pParent->m_iv[IVI_MISSIMG_BLUE] ); wxPen pen(co); gc->SetPen(pen); gc->SetBrush(wxNullBrush); xps = ConvX((double)((pObj->det).i.br.xl) + shiftx); xpe = ConvX((double)((pObj->det).i.br.xr) + shiftx); yps = ConvY((double)((pObj->det).i.br.yt) + shifty); ype = ConvY((double)((pObj->det).i.br.yb) + shifty); { wxGraphicsPath p = gc->CreatePath(); p.AddRectangle(xps, yps, (xpe-xps), (ype-yps)); gc->StrokePath(p); } #if 0 /* 2019-05-04 Test whether rectangle coordinates are correct. */ wxColour blue(0, 0, 127); wxPen pblue(blue); gc->SetPen(pblue); { wxGraphicsPath p = gc->CreatePath(); p.MoveToPoint(xps, yps); p.AddLineToPoint(xpe, yps); p.AddLineToPoint(xpe, ype); p.AddLineToPoint(xps, ype); p.AddLineToPoint(xps, yps); p.CloseSubpath(); gc->StrokePath(p); } #endif if (WXD_MARKUP_NONE != iMarkup) { MarkupBoundingBox(gc, pObj, &((pObj->det).i.br), iMarkup, pShift); } gc->SetPen(wxNullPen); } #line 1826 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::DrawDotElement( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { int sc[3]; /* Stroke colour */ double shiftx = 0.0; /* X shift distacne */ double shifty = 0.0; /* Y shift distance */ double r; /* Circle radius */ double dlw; /* Line width for markup as double */ int lw; /* Line width for markup as int */ #line 1845 "WxdkdrawControlDraw.cpt" if (NULL != pShift) { shiftx = pShift->x; shifty = pShift->y; } ChooseStrokeColour(sc, pObj, iMarkup); if (WXD_MARKUP_NONE != iMarkup) { dlw = 2.0 * (double)(m_pParent->m_pDrw->baselw); lw = (int)dk4ma_rint(ConvDist(dlw)); if (1 > lw) { lw = 1; } } if (WXD_OT_DOT_WHITE == pObj->ot) { wxColour fco(sc[0], sc[1], sc[2]); wxBrush br(fco); gc->SetBrush(br); gc->SetPen(wxNullPen); r = (double)((pObj->det).d.d) + (double)(pObj->lw); r = r * (double)(m_pParent->m_pDrw->baselw); r = r / 2.0; wxGraphicsPath p = gc->CreatePath(); p.AddCircle( ConvX((double)((pObj->det).d.x) + shiftx), ConvY((double)((pObj->det).d.y) + shifty), ConvDist(r) ); gc->FillPath(p); if (pObj->lw < m_pParent->m_pDrw->baselw) { wxBrush br2(*wxWHITE); gc->SetBrush(br2); r = (double)((pObj->det).d.d) - (double)(pObj->lw); r = r * (double)(m_pParent->m_pDrw->baselw); r = r / 2.0; wxGraphicsPath p2 = gc->CreatePath(); p2.AddCircle( ConvX((double)((pObj->det).d.x) + shiftx), ConvY((double)((pObj->det).d.y) + shifty), ConvDist(r) ); gc->FillPath(p2); } gc->SetBrush(wxNullBrush); if (WXD_MARKUP_NONE != iMarkup) { wxPen penMarkup(fco, lw); r = 8.0 + (double)((pObj->det).d.d) + (double)(pObj->lw); r = r * (double)(m_pParent->m_pDrw->baselw); r = r / 2.0; gc->SetPen(penMarkup); wxGraphicsPath pMarkup = gc->CreatePath(); pMarkup.AddCircle( ConvX((double)((pObj->det).d.x) + shiftx), ConvY((double)((pObj->det).d.y) + shifty), ConvDist(r) ); gc->StrokePath(pMarkup); gc->SetPen(wxNullPen); } } else { wxColour fco(sc[0], sc[1], sc[2]); wxBrush br(fco); gc->SetBrush(br); gc->SetPen(wxNullPen); r = (double)(m_pParent->m_pDrw->baselw) * (double)((pObj->det).d.d); r = r / 2.0; wxGraphicsPath p = gc->CreatePath(); p.AddCircle( ConvX((double)((pObj->det).d.x) + shiftx), ConvY((double)((pObj->det).d.y) + shifty), ConvDist(r) ); gc->FillPath(p); gc->SetBrush(wxNullBrush); if (WXD_MARKUP_NONE != iMarkup) { wxPen penMarkup(fco, lw); r = 8.0 + (double)((pObj->det).d.d); r = r * (double)(m_pParent->m_pDrw->baselw); r = r / 2.0; gc->SetPen(penMarkup); wxGraphicsPath pMarkup = gc->CreatePath(); pMarkup.AddCircle( ConvX((double)((pObj->det).d.x) + shiftx), ConvY((double)((pObj->det).d.y) + shifty), ConvDist(r) ); gc->StrokePath(pMarkup); gc->SetPen(wxNullPen); } } #line 1930 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::DrawElement( wxGraphicsContext *gc, Wxd_object_t const *pObj, int iMarkup, Wxd_point_t const *pShift ) { #line 1943 "WxdkdrawControlDraw.cpt" switch ( (int)(pObj->ot) ) { case WXD_OT_TEXT : { #line 1945 "WxdkdrawControlDraw.cpt" DrawTextElement(gc, pObj, iMarkup, pShift); } break; case WXD_OT_POLYLINE : case WXD_OT_O_SPLINE : case WXD_OT_O_ARC : { #line 1950 "WxdkdrawControlDraw.cpt" DrawOpenPathElement(gc, pObj, iMarkup, pShift); } break; case WXD_OT_POLYGON : case WXD_OT_C_SPLINE : case WXD_OT_C_ARC : case WXD_OT_CIRCLE : case WXD_OT_ELLIPSE : case WXD_OT_BOX : { #line 1958 "WxdkdrawControlDraw.cpt" DrawClosedPathElement(gc, pObj, iMarkup, pShift); } break; case WXD_OT_IMAGE : { #line 1961 "WxdkdrawControlDraw.cpt" DrawImageElement(gc, pObj, iMarkup, pShift); } break; case WXD_OT_DOT_FILLED : case WXD_OT_DOT_WHITE : { #line 1965 "WxdkdrawControlDraw.cpt" DrawDotElement(gc, pObj, iMarkup, pShift); } break; } #line 1969 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PaintOperationCanvas(wxGraphicsContext *gc) { int coco[3]; /* Colour components */ double xl; /* Left x */ double xr; /* Right x */ double yb; /* Bottom y */ double yt; /* Top y */ double xrmax; /* Maximum for right x */ double ybmax; /* Maximum for bottom y */ #line 1984 "WxdkdrawControlDraw.cpt" coco[0] = m_pParent->m_iv[IVI_BG_RED]; coco[1] = m_pParent->m_iv[IVI_BG_GREEN]; coco[2] = m_pParent->m_iv[IVI_BG_BLUE]; wxColour co(coco[0], coco[1], coco[2]); wxBrush br(co); xl = ConvX((m_pParent->m_pDrw->bb).xl); xr = ConvX((m_pParent->m_pDrw->bb).xr); yb = ConvY((m_pParent->m_pDrw->bb).yb); yt = ConvY((m_pParent->m_pDrw->bb).yt); #line 1994 "WxdkdrawControlDraw.cpt" #line 1995 "WxdkdrawControlDraw.cpt" #line 1996 "WxdkdrawControlDraw.cpt" #line 1997 "WxdkdrawControlDraw.cpt" xrmax = (double)(m_szDrawco.GetWidth()); ybmax = (double)(m_szDrawco.GetHeight()); if (0.0 > xl) { xl = 0.0; } if (xrmax < xr) { xr = xrmax; } if (0.0 > yt) { yt = 0.0; } if (ybmax < yb) { yb = ybmax; } #line 2004 "WxdkdrawControlDraw.cpt" #line 2005 "WxdkdrawControlDraw.cpt" #line 2006 "WxdkdrawControlDraw.cpt" #line 2007 "WxdkdrawControlDraw.cpt" gc->SetBrush(br); gc->SetPen(wxNullPen); wxGraphicsPath p1 = gc->CreatePath(); p1.MoveToPoint(xl, yb); p1.AddLineToPoint(xr, yb); p1.AddLineToPoint(xr, yt); p1.AddLineToPoint(xl, yt); p1.AddLineToPoint(xl, yb); p1.CloseSubpath(); gc->FillPath(p1); gc->SetBrush(wxNullBrush); #line 2019 "WxdkdrawControlDraw.cpt" } #if TRACE_DEBUG static void show_bb(Wxd_bb_t const *bbptr) { #line 2029 "WxdkdrawControlDraw.cpt" #line 2030 "WxdkdrawControlDraw.cpt" #line 2031 "WxdkdrawControlDraw.cpt" #line 2032 "WxdkdrawControlDraw.cpt" #line 2033 "WxdkdrawControlDraw.cpt" #line 2034 "WxdkdrawControlDraw.cpt" } #endif void WxdkdrawFrame::Control::PaintOperationBoundingBoxGrid( wxGraphicsContext *gc, Wxd_bb_t const & g_end ) { dk4_er_t er; /* Error report */ wxColour grco( m_pParent->m_iv[IVI_GRID_RED], m_pParent->m_iv[IVI_GRID_GREEN], m_pParent->m_iv[IVI_GRID_BLUE] ); /* Grid colour */ wxPen grpen(grco); /* Pen to draw grid */ #line 2053 "WxdkdrawControlDraw.cpt" double xps; /* Start x position (converted) */ double xpe; /* End x position (converted) */ double yps; /* Start y position (converted) */ double ype; /* End y position (converted) */ int32_t i; /* Current coordinate value */ int32_t xs; /* Start x position (WXD) */ #if 0 int32_t xe; #endif int32_t ys; /* Start y position (WXD) */ #if 0 int32_t ye; #endif dk4error_init(&er); gc->SetPen(grpen); gc->SetBrush(wxNullBrush); #line 2071 "WxdkdrawControlDraw.cpt" #line 2072 "WxdkdrawControlDraw.cpt" /* Horizontal lines */ ys = dk4ma_int32_t_add(g_end.yb, (int32_t)(m_uGridOptical), &er); xps = ConvX(g_end.xl); xpe = ConvX(g_end.xr); if (DK4_E_NONE == er.ec) { for (i = ys; i < g_end.yt; i += (int32_t)(m_uGridOptical)) { yps = ConvY(i); wxGraphicsPath p = gc->CreatePath(); p.MoveToPoint(xps, yps); p.AddLineToPoint(xpe, yps); gc->StrokePath(p); } } /* Vertical lines */ xs = dk4ma_int32_t_add(g_end.xl, (int32_t)(m_uGridOptical), &er); yps = ConvY(g_end.yb); ype = ConvY(g_end.yt); if (DK4_E_NONE == er.ec) { for (i = xs; i < g_end.xr; i += (int32_t)(m_uGridOptical)) { xps = ConvX(i); wxGraphicsPath p = gc->CreatePath(); p.MoveToPoint(xps, yps); p.AddLineToPoint(xps, ype); gc->StrokePath(p); } } /* Rectangle */ xps = ConvX(g_end.xl); xpe = ConvX(g_end.xr); { wxGraphicsPath p = gc->CreatePath(); p.AddRectangle(xps, yps, (xpe-xps), (ype-yps)); gc->StrokePath(p); } gc->SetPen(wxNullPen); #line 2114 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PaintOperationGrid(wxGraphicsContext *gc) { dk4_er_t er; /* Error report */ Wxd_bb_t g_drw; /* Grid size calculated from drawing */ Wxd_bb_t g_con; /* Grid size calculated from control */ Wxd_bb_t g_end; /* Final grid size */ bool ok; /* Flag: No errors */ #line 2127 "WxdkdrawControlDraw.cpt" /* Initialize error detection */ dk4error_init(&er); ok = true; /* Calculate grid borders from drawing size and borders */ g_drw.xl = dk4ma_int32_t_sub( (m_pParent->m_pDrw->bb).xl, (int32_t)(m_pParent->m_pDrw->bleft), &er ); g_drw.xr = dk4ma_int32_t_add( (m_pParent->m_pDrw->bb).xr, (int32_t)(m_pParent->m_pDrw->bright), &er ); g_drw.yb = dk4ma_int32_t_sub( (m_pParent->m_pDrw->bb).yb, (int32_t)(m_pParent->m_pDrw->bbottom), &er ); g_drw.yt = dk4ma_int32_t_add( (m_pParent->m_pDrw->bb).yt, (int32_t)(m_pParent->m_pDrw->btop), &er ); g_drw.xl = GridRoundDown(g_drw.xl, m_uGridOptical, ok); g_drw.xr = GridRoundUp(g_drw.xr, m_uGridOptical, ok); g_drw.yb = GridRoundDown(g_drw.yb, m_uGridOptical, ok); g_drw.yt = GridRoundUp(g_drw.yt, m_uGridOptical, ok); wxdobj_bb_correct(&g_drw); #line 2153 "WxdkdrawControlDraw.cpt" #line 2154 "WxdkdrawControlDraw.cpt" /* Calculate grid borders from control size and scrollbar positions and zoom factor */ if ((DK4_E_NONE == er.ec) && (ok)) { g_con.xl = InvX(0.0, ok); g_con.xr = InvX((double)(m_szDrawco.GetWidth()), ok); g_con.yb = InvY((double)(m_szDrawco.GetHeight()), ok); g_con.yt = InvY(0.0, ok); g_con.xl = GridRoundDown(g_con.xl, m_uGridOptical, ok, true); g_con.xr = GridRoundUp(g_con.xr, m_uGridOptical, ok, true); g_con.yb = GridRoundDown(g_con.yb, m_uGridOptical, ok, true); g_con.yt = GridRoundUp(g_con.yt, m_uGridOptical, ok, true); wxdobj_bb_correct(&g_con); #line 2169 "WxdkdrawControlDraw.cpt" #line 2170 "WxdkdrawControlDraw.cpt" if (ok) { if (wxdobj_bb_intersection(&g_end, &g_drw, &g_con)) { #line 2173 "WxdkdrawControlDraw.cpt" #line 2174 "WxdkdrawControlDraw.cpt" PaintOperationBoundingBoxGrid(gc, g_end); } } else { PaintOperationBoundingBoxGrid(gc, g_drw); } } #line 2182 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PaintOperation0(wxDC & dc) { int coco[3]; #line 2191 "WxdkdrawControlDraw.cpt" coco[0] = m_pParent->m_iv[IVI_BORDER_RED]; coco[1] = m_pParent->m_iv[IVI_BORDER_GREEN]; coco[2] = m_pParent->m_iv[IVI_BORDER_BLUE]; wxColour co(coco[0], coco[1], coco[2]); wxBrush br(co); wxPen pen(co); dc.SetBrush(br); dc.SetPen(pen); dc.DrawRectangle(0, 0, m_szDrawco.GetWidth(), m_szDrawco.GetHeight()); dc.SetBrush(wxNullBrush); dc.SetPen(wxNullPen); #line 2203 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PaintOperation1(wxGraphicsContext *gc) { #line 2211 "WxdkdrawControlDraw.cpt" PaintOperationCanvas(gc); if (m_pParent->cbGridOnOff->GetValue()) { PaintOperationGrid(gc); } #line 2216 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::PaintOperation2(wxGraphicsContext *gc) { Wxd_object_t *pobj; #line 2225 "WxdkdrawControlDraw.cpt" dk4sto_it_reset(m_pParent->m_pDrw->i_flat); do { pobj = (Wxd_object_t *)dk4sto_it_next(m_pParent->m_pDrw->i_flat); if (NULL != pobj) { if (wxdobj_is_active(pobj)) { if (MustDrawElementInNormalPass(pobj)) { if (CanDrawElement(pobj)) { DrawElement(gc, pobj, WXD_MARKUP_NONE); } } } } } while (NULL != pobj); #line 2239 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::GetPointFromBox( double & x, double & y, Wxd_bb_t const *pbb, uint16_t pno ) { #line 2251 "WxdkdrawControlDraw.cpt" if (3 == pno) { x = (double)(pbb->xl); y = (double)(pbb->yt); } else { if (2 == pno) { x = (double)(pbb->xr); y = (double)(pbb->yt); } else { if (1 == pno) { x = (double)(pbb->xr); y = (double)(pbb->yb); } else { x = (double)(pbb->xl); y = (double)(pbb->yb); } } } #line 2272 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::HighlightPointForOperation( wxGraphicsContext *gc, Wxd_object_t const *pobj, uint16_t pno, int ci ) { dk4_gra_point_t pta; int sc[3]; double x = 0.0; double y = 0.0; bool bCanHighlight = false; DK4_MEMCPY(sc,&(m_pParent->m_iv[ci]),(3*sizeof(int))); switch ( (int)(pobj->ot) ) { case WXD_OT_TEXT : { x = (double)((pobj->det).t.x); y = (double)((pobj->det).t.y); bCanHighlight = true; } break; case WXD_OT_POLYLINE : case WXD_OT_POLYGON : { if (NULL != (pobj->det).p.p) { if (pno < (pobj->det).p.n) { x = (double)(((pobj->det).p.p)[pno].x); y = (double)(((pobj->det).p.p)[pno].y); bCanHighlight = true; } } } break; case WXD_OT_O_SPLINE : case WXD_OT_C_SPLINE : { if (NULL != (pobj->det).s.p) { if (pno < (pobj->det).s.n) { x = (double)(((pobj->det).s.p)[pno].x); y = (double)(((pobj->det).s.p)[pno].y); bCanHighlight = true; } } } break; case WXD_OT_O_ARC : case WXD_OT_C_ARC : { if (2 == pno) { x = (double)((pobj->det).a.x3); y = (double)((pobj->det).a.y3); bCanHighlight = true; } else { if (1 == pno) { x = (double)((pobj->det).a.x2); y = (double)((pobj->det).a.y2); bCanHighlight = true; } else { x = (double)((pobj->det).a.x1); y = (double)((pobj->det).a.y1); bCanHighlight = true; } } } break; case WXD_OT_CIRCLE : { #line 2336 "WxdkdrawControlDraw.cpt" if (3 == pno) { pta.x = 0.0; pta.y = 0.0 - (double)((pobj->det).e.rx); } else { if (2 == pno) { pta.x = 0.0 - (double)((pobj->det).e.rx); pta.y = 0.0; } else { if (1 == pno) { pta.x = 0.0; pta.y = (double)((pobj->det).e.rx); } else { pta.x = (double)((pobj->det).e.rx); pta.y = 0.0; } } } x = pta.x + (double)((pobj->det).e.x); y = pta.y + (double)((pobj->det).e.y); bCanHighlight = true; } break; case WXD_OT_ELLIPSE : { #line 2362 "WxdkdrawControlDraw.cpt" if (3 == pno) { pta.x = 0.0; pta.y = 0.0 - (double)((pobj->det).e.ry); } else { if (2 == pno) { pta.x = 0.0 - (double)((pobj->det).e.rx); pta.y = 0.0; } else { if (1 == pno) { pta.x = 0.0; pta.y = (double)((pobj->det).e.ry); } else { pta.x = (double)((pobj->det).e.rx); pta.y = 0.0; } } } dk4gratool_rotate_point( &pta, ((M_PI * (double)((pobj->det).e.a)) / 180.0) ); x = pta.x + (double)((pobj->det).e.x); y = pta.y + (double)((pobj->det).e.y); bCanHighlight = true; } break; case WXD_OT_BOX : { GetPointFromBox(x, y, &((pobj->det).b.b), pno); bCanHighlight = true; } break; case WXD_OT_IMAGE : { GetPointFromBox(x, y, &((pobj->det).i.br), pno); bCanHighlight = true; } break; case WXD_OT_DOT_FILLED : case WXD_OT_DOT_WHITE : { x = (double)((pobj->det).d.x); y = (double)((pobj->det).d.y); bCanHighlight = true; } break; } if (bCanHighlight) { DrawMarkupPoint(gc, sc, x, y, pobj->lw, NULL); } } void WxdkdrawFrame::Control::HighlightLineToPoint( wxGraphicsContext *gc, Wxd_object_t const *pobj, uint16_t pno, int ci ) { double x1; double y1; double x2; double y2; int sc[3]; int lw; bool bCanDo = false; x1 = x2 = ConvX((m_pParent->m_ptMousePosRaw).x); y1 = y2 = ConvY((m_pParent->m_ptMousePosRaw).y); switch ( (int)(pobj->ot) ) { case WXD_OT_POLYLINE : case WXD_OT_POLYGON : { x2 = ConvX((double)(((pobj->det).p.p)[pno].x)); y2 = ConvY((double)(((pobj->det).p.p)[pno].y)); bCanDo = true; } break; case WXD_OT_O_SPLINE : case WXD_OT_C_SPLINE : { x2 = ConvX((double)(((pobj->det).s.p)[pno].x)); y2 = ConvY((double)(((pobj->det).s.p)[pno].y)); bCanDo = true; } break; } if (bCanDo) { DK4_MEMCPY(sc,&(m_pParent->m_iv[ci]),(3*sizeof(int))); lw = 1; } if (bCanDo) { wxColour col(sc[0], sc[1], sc[2]); wxPen pen(col, lw); wxGraphicsPath path = gc->CreatePath(); gc->SetPen(pen); gc->SetBrush(wxNullBrush); path.MoveToPoint(x1, y1); path.AddLineToPoint(x2, y2); gc->StrokePath(path); gc->SetPen(wxNullPen); } } void WxdkdrawFrame::Control::HighlightPointToMove( wxGraphicsContext *gc, Wxd_object_t const *pobj, uint16_t pno ) { HighlightPointForOperation(gc, pobj, pno, IVI_M_MOVE_RED); } void WxdkdrawFrame::Control::HighlightPointToDelete( wxGraphicsContext *gc, Wxd_object_t const *pobj, uint16_t pno ) { HighlightPointForOperation(gc, pobj, pno, IVI_M_DEL_RED); } void WxdkdrawFrame::Control::HighlightPointToAdd( wxGraphicsContext *gc, Wxd_object_t const *pobj, uint16_t pno, bool bAppend ) { uint16_t i; #line 2492 "WxdkdrawControlDraw.cpt" HighlightPointForOperation(gc, pobj, pno, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, pno, IVI_M_COPY_RED); switch ( (int)(pobj->ot) ) { case WXD_OT_POLYLINE : { if (bAppend) { if (((pobj->det).p.n - (uint16_t)1U) > pno) { i = pno + (uint16_t)1U; HighlightPointForOperation(gc, pobj, i, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, i, IVI_M_COPY_RED); } } else { if ((uint16_t)0U < pno) { i = pno - (uint16_t)1U; HighlightPointForOperation(gc, pobj, i, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, i, IVI_M_COPY_RED); } } } break; case WXD_OT_O_SPLINE : { if (bAppend) { if (((pobj->det).s.n - (uint16_t)1U) > pno) { i = pno + (uint16_t)1U; HighlightPointForOperation(gc, pobj, i, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, i, IVI_M_COPY_RED); } } else { if ((uint16_t)0U < pno) { i = pno - (uint16_t)1U; HighlightPointForOperation(gc, pobj, i, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, i, IVI_M_COPY_RED); } } } break; case WXD_OT_POLYGON : { if (bAppend) { if (((pobj->det).p.n - (uint16_t)1U) > pno) { i = pno + (uint16_t)1U; } else { i = (uint16_t)0U; } HighlightPointForOperation(gc, pobj, i, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, i, IVI_M_COPY_RED); } else { if ((uint16_t)0U < pno) { i = pno - (uint16_t)1U; } else { i = (pobj->det).p.n - (uint16_t)1U; } HighlightPointForOperation(gc, pobj, i, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, i, IVI_M_COPY_RED); } } break; case WXD_OT_C_SPLINE : { if (bAppend) { if (((pobj->det).s.n - (uint16_t)1U) > pno) { i = pno + (uint16_t)1U; } else { i = (uint16_t)0U; } HighlightPointForOperation(gc, pobj, i, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, i, IVI_M_COPY_RED); } else { if ((uint16_t)0U < pno) { i = pno - (uint16_t)1U; } else { i = (pobj->det).p.n - (uint16_t)1U; } HighlightPointForOperation(gc, pobj, i, IVI_M_COPY_RED); HighlightLineToPoint(gc, pobj, i, IVI_M_COPY_RED); } } break; } #line 2573 "WxdkdrawControlDraw.cpt" } void WxdkdrawFrame::Control::HighlightStylePoint( wxGraphicsContext *gc, double x, double y, double r, int const *sc ) { wxColour col(sc[0], sc[1], sc[2]); wxPen pen(col); wxGraphicsPath p = gc->CreatePath(); double xx = ConvX(x); double yy = ConvY(y); double r2 = 2.0 * r; if (10.0 < r) { r2 = r + 10.0; } gc->SetPen(pen); gc->SetBrush(wxNullBrush); p.AddRectangle((xx - r2 / 2.0), (yy - r2 / 2.0), r2, r2); gc->StrokePath(p); gc->SetPen(wxNullPen); } void WxdkdrawFrame::Control::HighlightStylePoint( wxGraphicsContext *gc, int32_t x, int32_t y, double r, int const *sc ) { HighlightStylePoint(gc, (double)x, (double)y, r, sc); } void WxdkdrawFrame::Control::HighlightStyleElement( wxGraphicsContext *gc, Wxd_object_t const *pobj ) { dk4_gra_point_t pt; int sc[3]; double r; double alpha; uint16_t i; DK4_MEMCPY(sc,&(m_pParent->m_iv[IVI_M_MOVE_RED]),(3*sizeof(int))); r = 2.0 * ConvDist(MarkupPointRadius(pobj->lw)); switch ( (int)(pobj->ot) ) { case WXD_OT_TEXT : { HighlightStylePoint( gc, (pobj->det).t.x, (pobj->det).t.y, r, sc ); } break; case WXD_OT_POLYLINE : case WXD_OT_POLYGON : { if ((NULL != (pobj->det).p.p) && ((uint16_t)0U < (pobj->det).p.n)) { for (i = (uint16_t)0U; i < (pobj->det).p.n; i++) { HighlightStylePoint( gc,((pobj->det).p.p)[i].x,((pobj->det).p.p)[i].y,r,sc ); } } } break; case WXD_OT_O_SPLINE : case WXD_OT_C_SPLINE : { if ((NULL != (pobj->det).s.p) && ((uint16_t)0U < (pobj->det).s.n)) { for (i = (uint16_t)0U; i < (pobj->det).s.n; i++) { HighlightStylePoint( gc,((pobj->det).s.p)[i].x,((pobj->det).s.p)[i].y,r,sc ); } } } break; case WXD_OT_O_ARC : case WXD_OT_C_ARC : { HighlightStylePoint( gc, (pobj->det).a.x1, (pobj->det).a.y1, r, sc ); HighlightStylePoint( gc, (pobj->det).a.x2, (pobj->det).a.y2, r, sc ); HighlightStylePoint( gc, (pobj->det).a.x3, (pobj->det).a.y3, r, sc ); } break; case WXD_OT_CIRCLE : { HighlightStylePoint( gc, ((double)((pobj->det).e.x) + (double)((pobj->det).e.rx)), (double)((pobj->det).e.y), r, sc ); HighlightStylePoint( gc, ((double)((pobj->det).e.x) - (double)((pobj->det).e.rx)), (double)((pobj->det).e.y), r, sc ); HighlightStylePoint( gc, (double)((pobj->det).e.x), ((double)((pobj->det).e.y) + (double)((pobj->det).e.rx)), r, sc ); HighlightStylePoint( gc, (double)((pobj->det).e.x), ((double)((pobj->det).e.y) - (double)((pobj->det).e.rx)), r, sc ); } break; case WXD_OT_ELLIPSE : { alpha = (M_PI * (double)((pobj->det).e.a)) / 180.0; pt.x = (double)((pobj->det).e.rx); pt.y = 0.0; dk4gratool_rotate_point(&pt, alpha); pt.x += (double)((pobj->det).e.x); pt.y += (double)((pobj->det).e.y); HighlightStylePoint(gc, pt.x, pt.y, r, sc); pt.x = 0.0; pt.y = (double)((pobj->det).e.ry); dk4gratool_rotate_point(&pt, alpha); pt.x += (double)((pobj->det).e.x); pt.y += (double)((pobj->det).e.y); HighlightStylePoint(gc, pt.x, pt.y, r, sc); pt.x = 0.0 - (double)((pobj->det).e.rx); pt.y = 0.0; dk4gratool_rotate_point(&pt, alpha); pt.x += (double)((pobj->det).e.x); pt.y += (double)((pobj->det).e.y); HighlightStylePoint(gc, pt.x, pt.y, r, sc); pt.x = 0.0; pt.y = 0.0 - (double)((pobj->det).e.ry); dk4gratool_rotate_point(&pt, alpha); pt.x += (double)((pobj->det).e.x); pt.y += (double)((pobj->det).e.y); HighlightStylePoint(gc, pt.x, pt.y, r, sc); } break; case WXD_OT_BOX : { HighlightStylePoint(gc,(pobj->det).b.b.xl,(pobj->det).b.b.yb,r,sc); HighlightStylePoint(gc,(pobj->det).b.b.xl,(pobj->det).b.b.yt,r,sc); HighlightStylePoint(gc,(pobj->det).b.b.xr,(pobj->det).b.b.yb,r,sc); HighlightStylePoint(gc,(pobj->det).b.b.xr,(pobj->det).b.b.yt,r,sc); } break; case WXD_OT_IMAGE : { HighlightStylePoint( gc, (pobj->det).i.br.xl, (pobj->det).i.br.yb, r, sc ); HighlightStylePoint( gc, (pobj->det).i.br.xl, (pobj->det).i.br.yt, r, sc ); HighlightStylePoint( gc, (pobj->det).i.br.xr, (pobj->det).i.br.yb, r, sc ); HighlightStylePoint( gc, (pobj->det).i.br.xr, (pobj->det).i.br.yt, r, sc ); } break; case WXD_OT_DOT_FILLED : case WXD_OT_DOT_WHITE : { r = 8.0 + (double)((pobj->det).d.d) + (double)(pobj->lw); r = r * (double)(m_pParent->m_pDrw->baselw); r = r / 2.0; r = ConvDist(r); HighlightStylePoint(gc, (pobj->det).d.x, (pobj->det).d.y, r, sc); } break; } } void WxdkdrawFrame::Control::PaintOperation3(wxGraphicsContext *gc) { Wxd_object_t *pobj = NULL; /* Current object */ double xcur = 0.0; /* Cursor x position */ double ycur = 0.0; /* Cursor y position */ double lcur = 0.0; /* Cursor length */ #line 2758 "WxdkdrawControlDraw.cpt" /* Top level bounding boxes */ #if 0 { wxColour bbgrey(127, 127, 127); wxPen bbpen(bbgrey); Wxd_object_t *po; double xl; double xr; double yb; double yt; #line 2771 "WxdkdrawControlDraw.cpt" gc->SetPen(bbpen); gc->SetBrush(wxNullBrush); dk4sto_it_reset(m_pParent->m_pDrw->i_stru); do { po = (Wxd_object_t *)dk4sto_it_next(m_pParent->m_pDrw->i_stru); if (NULL != po) { #line 2777 "WxdkdrawControlDraw.cpt" if ( (0 != dk4bb_have_x(&(po->bb))) && (0 != dk4bb_have_y(&(po->bb))) ) { wxGraphicsPath p = gc->CreatePath(); #line 2783 "WxdkdrawControlDraw.cpt" xl = ConvX(dk4bb_get_xmin(&(po->bb))); xr = ConvX(dk4bb_get_xmax(&(po->bb))); yb = ConvY(dk4bb_get_ymin(&(po->bb))); yt = ConvY(dk4bb_get_ymax(&(po->bb))); p.AddRectangle(xl, yt, (xr - xl), (yb - yt)); gc->StrokePath(p); } else { #line 2791 "WxdkdrawControlDraw.cpt" } } } while (NULL != po); gc->SetPen(wxNullPen); #line 2796 "WxdkdrawControlDraw.cpt" } #endif /* All bounding boxes */ #if 0 { wxColour bbgrey(127, 127, 127); wxPen bbpen(bbgrey); Wxd_object_t *po; double xl; double xr; double yb; double yt; gc->SetPen(bbpen); gc->SetBrush(wxNullBrush); dk4sto_it_reset(m_pParent->m_pDrw->i_flat); do { po = (Wxd_object_t *)dk4sto_it_next(m_pParent->m_pDrw->i_flat); if (NULL != po) { if ( (0 != dk4bb_have_x(&(po->bb))) && (0 != dk4bb_have_y(&(po->bb))) ) { wxGraphicsPath p = gc->CreatePath(); #line 2823 "WxdkdrawControlDraw.cpt" xl = ConvX(dk4bb_get_xmin(&(po->bb))); xr = ConvX(dk4bb_get_xmax(&(po->bb))); yb = ConvY(dk4bb_get_ymin(&(po->bb))); yt = ConvY(dk4bb_get_ymax(&(po->bb))); p.AddRectangle(xl, yt, (xr - xl), (yb - yt)); gc->StrokePath(p); } else { #line 2831 "WxdkdrawControlDraw.cpt" } } } while (NULL != po); gc->SetPen(wxNullPen); } #endif /* Calculate cursor position */ if (m_pParent->m_bMousePos) { xcur = ConvX((m_pParent->m_ptMousePosGrid).x); ycur = ConvY((m_pParent->m_ptMousePosGrid).y); lcur = ConvDist((int32_t)m_uGridSnap / (int32_t)2L); } /* Placement help */ #line 2849 "WxdkdrawControlDraw.cpt" if (m_pParent->m_bMousePos) { if (m_pParent->cbPH->GetValue()) { if (StateUsesPlacementHelp()) { wxColour gold( m_pParent->m_iv[WxdkdrawFrame::IVI_PH_RED], m_pParent->m_iv[WxdkdrawFrame::IVI_PH_GREEN], m_pParent->m_iv[WxdkdrawFrame::IVI_PH_BLUE] ); wxPen pen(gold); gc->SetPen(pen); gc->SetBrush(wxNullBrush); wxGraphicsPath p1 = gc->CreatePath(); p1.MoveToPoint(0.0, ycur); p1.AddLineToPoint((double)(m_szDrawco.GetWidth()), ycur); gc->StrokePath(p1); wxGraphicsPath p2 = gc->CreatePath(); p2.MoveToPoint(xcur, 0.0); p2.AddLineToPoint(xcur, (double)(m_szDrawco.GetHeight())); gc->StrokePath(p2); gc->SetPen(wxNullPen); } } } #line 2873 "WxdkdrawControlDraw.cpt" /* Objects under modification */ #line 2877 "WxdkdrawControlDraw.cpt" if (StateHasObjectsUnderModification()) { #line 2878 "WxdkdrawControlDraw.cpt" dk4sto_it_reset(m_pParent->m_pDrw->i_flat); do { pobj = (Wxd_object_t *)dk4sto_it_next(m_pParent->m_pDrw->i_flat); if (NULL != pobj) { #line 2882 "WxdkdrawControlDraw.cpt" if (wxdobj_is_active(pobj)) { #line 2883 "WxdkdrawControlDraw.cpt" if (wxdobj_is_marked(pobj, OBJ_MARKER_1)) { #line 2885 "WxdkdrawControlDraw.cpt" if (MustDrawElementInMarkupPass(pobj)) { #line 2887 "WxdkdrawControlDraw.cpt" if (CanDrawElement(pobj)) { #line 2889 "WxdkdrawControlDraw.cpt" switch (m_pParent->m_iState) { /* _STATE_ Do we need to draw the object shifted? */ case S_MOVE_PLACE : case S_COPY_PLACE : case S_LIBELEM_PLACE : { DrawElement( gc, pobj, WXD_MARKUP_NONE, &(m_pParent->m_ptMouseMoveDiff) ); } break; default : { DrawElement(gc, pobj, WXD_MARKUP_NONE); } break; } } else { #line 2909 "WxdkdrawControlDraw.cpt" } } else { #line 2912 "WxdkdrawControlDraw.cpt" } } else { #line 2915 "WxdkdrawControlDraw.cpt" } } else { #line 2918 "WxdkdrawControlDraw.cpt" } } } while (NULL != pobj); } #line 2923 "WxdkdrawControlDraw.cpt" /* Image object under construction */ switch ( m_pParent->m_iState ) { case S_IMG_2 : { DrawImageRegion(gc); } break; case S_MOVEPT_PLACE : { if ( (NULL != m_pParent->m_pCurrent) && (WXD_OT_IMAGE == m_pParent->m_pCurrent->ot) ) { #if 0 DrawObjectBoundingBox(m_pCurrent); #else MarkupBoundingBox( gc, m_pParent->m_pCurrent, &(((m_pParent->m_pCurrent)->det).i.br), WXD_MARKUP_IMGRES, NULL ); #endif } } break; } /* Objects to highlight as selected candidates for grouping */ #line 2954 "WxdkdrawControlDraw.cpt" if (StateHasObjectsToHighlight2()) { dk4sto_it_reset(m_pParent->m_pDrw->i_flat); do { pobj = (Wxd_object_t *)dk4sto_it_next(m_pParent->m_pDrw->i_flat); if (NULL != pobj) { #line 2959 "WxdkdrawControlDraw.cpt" if (wxdobj_is_active(pobj)) { if (wxdobj_is_marked(pobj, OBJ_MARKER_2)) { if (MustHighlight2ElementInMarkupPass(pobj)) { DrawElement(gc, pobj, WXD_MARKUP_GROUP); } else { #line 2965 "WxdkdrawControlDraw.cpt" } } else { #line 2968 "WxdkdrawControlDraw.cpt" } } else { #line 2971 "WxdkdrawControlDraw.cpt" } } } while (NULL != pobj); } #line 2976 "WxdkdrawControlDraw.cpt" /* Objects to highlight as candidate for copy, move, delete operation or to change grouping selection */ #line 2981 "WxdkdrawControlDraw.cpt" if (StateHasObjectsToHighlight()) { #line 2982 "WxdkdrawControlDraw.cpt" dk4sto_it_reset(m_pParent->m_pDrw->i_flat); do { pobj = (Wxd_object_t *)dk4sto_it_next(m_pParent->m_pDrw->i_flat); if (NULL != pobj) { #line 2986 "WxdkdrawControlDraw.cpt" if (wxdobj_is_active(pobj)) { if (MustHighlightElementInMarkupPass(pobj)) { #line 2988 "WxdkdrawControlDraw.cpt" if (CanDrawElement(pobj)) { #line 2989 "WxdkdrawControlDraw.cpt" /* _STATE_ Do we need to draw the object highlighted? */ switch (m_pParent->m_iState) { case S_NOOP : { DrawElement(gc, pobj, WXD_MARKUP_MOVE); } break; case S_DELETE : case S_REGION_DELETE : { DrawElement(gc, pobj, WXD_MARKUP_DELETE); } break; case S_DETAILS : case S_UNGROUP : case S_GROUP_ONE : case S_FLIP : case S_MOVE_SELECT : case S_CONVERT : case S_ROTATE : { DrawElement(gc, pobj, WXD_MARKUP_MOVE); } break; case S_COPY_SELECT : { DrawElement(gc, pobj, WXD_MARKUP_COPY); } break; case S_MOD_SPLINE : case S_MOVEPT_SELECT : { DrawElement(gc, pobj, WXD_MARKUP_PTMOVE); HighlightPointToMove( gc, pobj, m_pParent->m_uCurrent ); } break; case S_DELPT : { DrawElement(gc, pobj, WXD_MARKUP_PTMOVE); HighlightPointToDelete( gc, pobj, m_pParent->m_uCurrent ); } break; case S_ADDPT_SELECT : { DrawElement(gc, pobj, WXD_MARKUP_PTMOVE); HighlightPointToAdd( gc, pobj, m_pParent->m_uCurrent, m_pParent->m_bAppendPoint ); } break; } } } } } } while (NULL != pobj); } #line 3042 "WxdkdrawControlDraw.cpt" /* Selected object for style changes */ if ((S_NOOP == m_pParent->m_iState) && (NULL != m_pParent->m_pStyle)) { bool bStyleActive = true; if (NULL != m_pParent->m_pStyle->play) { if ((uint8_t)0U == m_pParent->m_pStyle->play->active) { bStyleActive = false; } } if (bStyleActive) { HighlightStyleElement(gc, m_pParent->m_pStyle); } } /* Drawing borders */ #line 3060 "WxdkdrawControlDraw.cpt" switch (m_pParent->m_iState) { case S_DRWSZ_SELECT : case S_DRWSZ_PLACE : { DK4_MEMCPY(\ &((m_pParent->m_oBorder).det.b.b),\ &(m_pParent->m_pDrw->bb),\ sizeof(Wxd_bb_t)\ ); DrawClosedPathElement( gc, &(m_pParent->m_oBorder), ( ( (S_DRWSZ_SELECT == m_pParent->m_iState) && (m_pParent->m_bHaveCornerPoint) ) ? (WXD_MARKUP_PTMOVE) : (WXD_MARKUP_NONE) ), NULL ); if ( (S_DRWSZ_SELECT == m_pParent->m_iState) && (m_pParent->m_bHaveCornerPoint) ) { MarkupBoundingBox( gc, &(m_pParent->m_oBorder), &((m_pParent->m_oBorder).det.b.b), WXD_MARKUP_PTMOVE, NULL ); switch ( (int)(m_pParent->m_uCurrent) ) { case 3 : { DrawMarkupPoint( gc, &(m_pParent->m_iv[IVI_M_MOVE_RED]), (m_pParent->m_pDrw->bb).xl, (m_pParent->m_pDrw->bb).yt, 2, NULL ); } break; case 2 : { DrawMarkupPoint( gc, &(m_pParent->m_iv[IVI_M_MOVE_RED]), (m_pParent->m_pDrw->bb).xr, (m_pParent->m_pDrw->bb).yt, 2, NULL ); } break; case 1 : { DrawMarkupPoint( gc, &(m_pParent->m_iv[IVI_M_MOVE_RED]), (m_pParent->m_pDrw->bb).xr, (m_pParent->m_pDrw->bb).yb, 2, NULL ); } break; default : { DrawMarkupPoint( gc, &(m_pParent->m_iv[IVI_M_MOVE_RED]), (m_pParent->m_pDrw->bb).xl, (m_pParent->m_pDrw->bb).yb, 2, NULL ); } break; } } } break; } #line 3126 "WxdkdrawControlDraw.cpt" #line 3127 "WxdkdrawControlDraw.cpt" switch (m_pParent->m_iState) { case S_REGION_DELETE : case S_GROUP_RECT_2 : { Wxd_bb_t ibb; int rgb[3]; double xl; double xr; double yb; double yt; ibb.xl = m_pParent->m_ptMouseMoveStart.x; ibb.xr = m_pParent->m_ptMousePosGrid.x; ibb.yb = m_pParent->m_ptMouseMoveStart.y; ibb.yt = m_pParent->m_ptMousePosGrid.y; wxdobj_bb_correct(&ibb); xl = ConvX(ibb.xl); xr = ConvX(ibb.xr); yb = ConvY(ibb.yb); yt = ConvY(ibb.yt); rgb[0] = 0; rgb[1] = 0; rgb[2] = 0; switch (m_pParent->m_iState) { case S_REGION_DELETE : { rgb[0] = m_pParent->m_iv[IVI_M_DEL_RED]; rgb[1] = m_pParent->m_iv[IVI_M_DEL_GREEN]; rgb[2] = m_pParent->m_iv[IVI_M_DEL_BLUE]; } break; } { wxColour black(rgb[0],rgb[1],rgb[2]); wxPen pen(black); wxGraphicsPath p = gc->CreatePath(); p.AddRectangle(xl, yt, (xr - xl), (yb - yt)); gc->SetPen(pen); gc->SetBrush(wxNullBrush); gc->StrokePath(p); gc->SetPen(wxNullPen); } } break; } #line 3169 "WxdkdrawControlDraw.cpt" /* Cursor */ #line 3173 "WxdkdrawControlDraw.cpt" if (m_pParent->m_bMousePos) { wxPen pen(*wxBLACK); gc->SetPen(pen); gc->SetBrush(wxNullBrush); wxGraphicsPath p1 = gc->CreatePath(); p1.MoveToPoint((xcur - lcur), ycur); p1.AddLineToPoint((xcur + lcur), ycur); gc->StrokePath(p1); wxGraphicsPath p2 = gc->CreatePath(); p2.MoveToPoint(xcur, (ycur - lcur)); p2.AddLineToPoint(xcur, (ycur + lcur)); gc->StrokePath(p2); gc->SetPen(wxNullPen); } #line 3188 "WxdkdrawControlDraw.cpt" #line 3189 "WxdkdrawControlDraw.cpt" } /* vim: set ai sw=4 ts=4 : */