void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin ) { if( !GetParent()->m_showGridAxis || ( !aGridOrigin.x && !aGridOrigin.y ) ) return; EDA_COLOR_T color = GetParent()->GetGridColor(); wxSize pageSize = GetParent()->GetPageSizeIU(); GRSetDrawMode( aDC, aDrawMode ); // Draw the Y axis GRDashedLine( &m_ClipBox, aDC, aGridOrigin.x, -pageSize.y, aGridOrigin.x, pageSize.y, 0, color ); // Draw the X axis GRDashedLine( &m_ClipBox, aDC, -pageSize.x, aGridOrigin.y, pageSize.x, aGridOrigin.y, 0, color ); }
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode ) { wxPoint origin = GetParent()->GetAuxOrigin(); if( origin == wxPoint( 0, 0 ) ) return; EDA_COLOR_T color = DARKRED; wxSize pageSize = GetParent()->GetPageSizeIU(); GRSetDrawMode( aDC, aDrawMode ); // Draw the Y axis GRDashedLine( &m_ClipBox, aDC, origin.x, -pageSize.y, origin.x, pageSize.y, 0, color ); // Draw the X axis GRDashedLine( &m_ClipBox, aDC, -pageSize.x, origin.y, pageSize.x, origin.y, 0, color ); }
void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC ) { EDA_COLOR_T axis_color = BLUE; GRSetDrawMode( DC, GR_COPY ); if( GetParent()->IsGridVisible() ) DrawGrid( DC ); // Draw axis if( GetParent()->m_showAxis ) { wxSize pageSize = GetParent()->GetPageSizeIU(); // Draw the Y axis GRDashedLine( &m_ClipBox, DC, 0, -pageSize.y, 0, pageSize.y, 0, axis_color ); // Draw the X axis GRDashedLine( &m_ClipBox, DC, -pageSize.x, 0, pageSize.x, 0, 0, axis_color ); } if( GetParent()->m_showOriginAxis ) DrawAuxiliaryAxis( DC, GR_COPY ); if( GetParent()->m_showGridAxis ) DrawGridAxis( DC, GR_COPY, GetParent()->GetGridOrigin() ); }
void LIB_ARC::drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int aColor ) { // The edit indicators only get drawn when a new arc is being drawn. if( !IsNew() ) return; // Use the last edit state so when the drawing switches from the end mode to the center // point mode, the last line between the center points gets erased. if( m_lastEditState == 1 ) { GRLine( aClipBox, aDC, m_ArcStart.x, -m_ArcStart.y, m_ArcEnd.x, -m_ArcEnd.y, 0, aColor ); } else { GRDashedLine( aClipBox, aDC, m_ArcStart.x, -m_ArcStart.y, m_Pos.x, -m_Pos.y, 0, aColor ); GRDashedLine( aClipBox, aDC, m_ArcEnd.x, -m_ArcEnd.y, m_Pos.x, -m_Pos.y, 0, aColor ); } }
void WinEDA_DrawPanel::m_Draw_Auxiliary_Axe(wxDC * DC, int drawmode) /********************************************************************/ { if ( m_Parent->m_Auxiliary_Axe_Position.x == 0 && m_Parent->m_Auxiliary_Axe_Position.y == 0 ) return; int Color = DARKRED; BASE_SCREEN * screen = GetScreen(); GRSetDrawMode(DC, drawmode); /* Trace de l'axe vertical */ GRDashedLine(&m_ClipBox, DC, m_Parent->m_Auxiliary_Axe_Position.x, -screen->ReturnPageSize().y, m_Parent->m_Auxiliary_Axe_Position.x, screen->ReturnPageSize().y, Color ); /* Trace de l'axe horizontal */ GRDashedLine(&m_ClipBox, DC, -screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axe_Position.y, screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axe_Position.y, Color ); }
static void SymbolDisplayDraw(WinEDA_DrawPanel * panel, wxDC * DC, bool erase) { int DrawMode = g_XorMode; int * ptpoly; int dx, dy; BASE_SCREEN * Screen = panel->m_Parent->m_CurrentScreen; int mx = Screen->m_Curseur.x, my = Screen->m_Curseur.y; GRSetDrawMode(DC, DrawMode); if( erase ) { if( StateDrawArc == 1 ) { int Color = ReturnLayerColor(LAYER_DEVICE); GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, Color); } else { DrawLibraryDrawStruct(panel, DC, CurrentLibEntry, 0 , 0, CurrentDrawItem, CurrentUnit, DrawMode); if(CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE) { int Color = ReturnLayerColor(LAYER_DEVICE); GRDashedLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ((LibDrawArc*)CurrentDrawItem)->m_Pos.x, - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y, Color); GRDashedLine(&panel->m_ClipBox, DC, ArcEndX, - ArcEndY, ((LibDrawArc*)CurrentDrawItem)->m_Pos.x, - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y, Color); } } } switch ( CurrentDrawItem->m_StructType ) { case COMPONENT_ARC_DRAW_TYPE: if( StateDrawArc == 1) { ArcEndX = mx; ArcEndY = - my; } if( StateDrawArc == 2) { ComputeArc((LibDrawArc*)CurrentDrawItem, Screen->m_Curseur); } ((LibDrawArc*)CurrentDrawItem)->m_Fill = FlSymbol_Fill; break; case COMPONENT_CIRCLE_DRAW_TYPE: dx = ((LibDrawCircle*)CurrentDrawItem)->m_Pos.x - mx; dy = ((LibDrawCircle*)CurrentDrawItem)->m_Pos.y + my; ((LibDrawCircle*)CurrentDrawItem)->m_Rayon = (int)sqrt( (dx*dx) + (dy*dy) ); ((LibDrawCircle*)CurrentDrawItem)->m_Fill = FlSymbol_Fill; break; case COMPONENT_RECT_DRAW_TYPE: ((LibDrawSquare*)CurrentDrawItem)->m_End.x = mx; ((LibDrawSquare*)CurrentDrawItem)->m_End.y = - my; ((LibDrawSquare*)CurrentDrawItem)->m_Fill = FlSymbol_Fill; break; case COMPONENT_POLYLINE_DRAW_TYPE: ptpoly = ((LibDrawPolyline*)CurrentDrawItem)->PolyList; ptpoly += 2 * (((LibDrawPolyline*)CurrentDrawItem)->n - 1); ptpoly[0] = mx; ptpoly[1] = - my; ((LibDrawPolyline*)CurrentDrawItem)->m_Fill = FlSymbol_Fill; break; case COMPONENT_LINE_DRAW_TYPE: ((LibDrawSegment*)CurrentDrawItem)->m_End.x = mx; ((LibDrawSegment*)CurrentDrawItem)->m_End.y = - my; break; case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: /* Traite par des routines specifiques */ break; } if( StateDrawArc == 1 ) { int Color = ReturnLayerColor(LAYER_DEVICE); GRLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ArcEndX, - ArcEndY, Color); } else { DrawLibraryDrawStruct(panel, DC, CurrentLibEntry, 0 , 0, CurrentDrawItem, CurrentUnit, DrawMode); if(CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE) { int Color = ReturnLayerColor(LAYER_DEVICE); GRDashedLine(&panel->m_ClipBox, DC, ArcStartX, - ArcStartY, ((LibDrawArc*)CurrentDrawItem)->m_Pos.x, - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y, Color); GRDashedLine(&panel->m_ClipBox, DC, ArcEndX, - ArcEndY, ((LibDrawArc*)CurrentDrawItem)->m_Pos.x, - ((LibDrawArc*)CurrentDrawItem)->m_Pos.y, Color); } } }
void WinEDA_DrawPanel::DrawBackGround(wxDC * DC) /***********************************************/ /* Trace les axes X et Y et la grille La grille n'est affichee que si elle peut etre facilement visible La grille passe toujours par le centre de l'ecran */ { int Color = BLUE; BASE_SCREEN * screen = GetScreen(); int ii,jj ,xg , yg , color; wxSize pas_grille_affichee; bool drawgrid = FALSE; int zoom = GetZoom(); wxSize size; wxPoint org; double pasx, pasy; color = screen->m_GridColor; GRSetDrawMode(DC, GR_COPY); /* le pas d'affichage doit etre assez grand pour avoir une grille visible */ drawgrid = m_Parent->m_Draw_Grid; pas_grille_affichee = screen->GetGrid(); ii = pas_grille_affichee.x / zoom; if (ii < 5 ) { pas_grille_affichee.x *= 2 ; ii *= 2; } if( ii < 5 ) drawgrid = FALSE; // grille trop petite ii = pas_grille_affichee.y / zoom; if (ii < 5 ) { pas_grille_affichee.y *= 2 ; ii *= 2; } if( ii < 5 ) drawgrid = FALSE; // grille trop petite GetViewStart(&org.x, &org.y); GetScrollPixelsPerUnit(&ii, &jj); org.x *= ii; org.y *= jj; screen->m_StartVisu = org; org.x *= zoom; org.y *= zoom; org.x += screen->m_DrawOrg.x; org.y += screen->m_DrawOrg.y; size = GetClientSize(); size.x *= zoom; size.y *= zoom; pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits; pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits; if ( screen->m_UserGridUnit != INCHES ) { pasx /= 25.4; pasy /= 25.4; } if( drawgrid) { m_Parent->PutOnGrid(&org) ; GRSetColorPen(DC, color ); for ( ii = 0 ; ; ii++ ) { xg = screen->m_UserGridIsON ? (int)( (ii * pasx) + 0.5) :ii * pas_grille_affichee.x; int xpos = org.x + xg; for ( jj = 0 ; ; jj++ ) { yg = screen->m_UserGridIsON ? (int)( (jj * pasy) + 0.5) : jj * pas_grille_affichee.y; GRPutPixel(&m_ClipBox, DC, xpos, org.y + yg, color); if ( yg > size.y ) break; } if ( xg > size.x ) break; } } /* trace des axes principaux */ if ( m_Parent->m_Draw_Axes ) { /* Trace de l'axe vertical */ GRDashedLine(&m_ClipBox, DC, 0, -screen->ReturnPageSize().y, 0, screen->ReturnPageSize().y, Color ); /* Trace de l'axe horizontal */ GRDashedLine(&m_ClipBox, DC, -screen->ReturnPageSize().x, 0, screen->ReturnPageSize().x, 0, Color ); } /* trace des axes auxiliaires */ if ( m_Parent->m_Draw_Auxiliary_Axe) { m_Draw_Auxiliary_Axe(DC, FALSE); } }