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 LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ) { // Don't draw the arc until the end point is selected. Only the edit indicators // get drawn at this time. if( IsNew() && m_lastEditState == 1 ) return; wxPoint pos1, pos2, posc; int color = ReturnLayerColor( LAYER_DEVICE ); if( aColor < 0 ) // Used normal color or selected color { if( IsSelected() ) color = g_ItemSelectetColor; } else { color = aColor; } pos1 = aTransform.TransformCoordinate( m_ArcEnd ) + aOffset; pos2 = aTransform.TransformCoordinate( m_ArcStart ) + aOffset; posc = aTransform.TransformCoordinate( m_Pos ) + aOffset; int pt1 = m_t1; int pt2 = m_t2; bool swap = aTransform.MapAngles( &pt1, &pt2 ); if( swap ) { EXCHG( pos1.x, pos2.x ); EXCHG( pos1.y, pos2.y ); } GRSetDrawMode( aDC, aDrawMode ); FILL_T fill = aData ? NO_FILL : m_Fill; if( aColor >= 0 ) fill = NO_FILL; if( fill == FILLED_WITH_BG_BODYCOLOR ) { GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize( ), (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); } else if( fill == FILLED_SHAPE && !aData ) { GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color ); } else { #ifdef DRAW_ARC_WITH_ANGLE GRArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize(), color ); #else GRArc1( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, GetPenSize(), color ); #endif } /* Set to one (1) to draw bounding box around arc to validate bounding box * calculation. */ #if 0 EDA_RECT bBox = GetBoundingBox(); GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif }
void SCH_JUNCTION::Plot( PLOTTER* aPlotter ) { aPlotter->set_color( ReturnLayerColor( GetLayer() ) ); aPlotter->circle( m_pos, m_size.x, FILLED_SHAPE ); }
void WinEDA_PlotPSFrame::PlotOneSheetPS(const wxString & FileName, BASE_SCREEN * screen, Ki_PageDescr * sheet, int BBox[4], wxPoint plot_offset) /**********************************************************/ /* Trace en format PS. d'une feuille de dessin */ { wxString Line; EDA_BaseStruct *DrawList; EDA_SchComponentStruct *DrawLibItem; int x1=0, y1=0, x2=0, y2=0, layer; PlotOutput = wxFopen(FileName, wxT("wt")); if (PlotOutput == NULL) { Line = wxT("\n** "); Line += _("Unable to create ") + FileName + wxT(" **\n\n"); m_MsgBox->AppendText(Line); wxBell(); return ; } Line.Printf(_("Plot: %s\n"), FileName.GetData()) ; m_MsgBox->AppendText(Line); InitPlotParametresPS(plot_offset, sheet, g_PlotScaleX, g_PlotScaleY); SetDefaultLineWidthPS( s_DefaultPenWidth); /* Init : */ PrintHeaderPS(PlotOutput, wxT("EESchema-PS"), FileName, BBox); InitPlotParametresPS(plot_offset, sheet, 1.0, 1.0); if ( m_Plot_Sheet_Ref->GetValue() ) { if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) SetColorMapPS ( BLACK ); PlotWorkSheet(PLOT_FORMAT_POST, screen); } DrawList = screen->EEDrawList; while ( DrawList ) /* tracage */ { Plume('U'); layer = LAYER_NOTES; switch( DrawList->m_StructType ) { case DRAW_BUSENTRY_STRUCT_TYPE : /* Struct Raccord et Segment sont identiques */ #undef STRUCT #define STRUCT ((DrawBusEntryStruct*)DrawList) x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y; layer = STRUCT->m_Layer; case DRAW_SEGMENT_STRUCT_TYPE : #undef STRUCT #define STRUCT ((EDA_DrawLineStruct*)DrawList) if ( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE) { x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y; x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; layer = STRUCT->m_Layer; } if ( g_PlotPSColorOpt ) SetColorMapPS ( ReturnLayerColor(layer) ); switch (layer) { case LAYER_NOTES: /* Trace en pointilles */ fprintf(PlotOutput,"[50 50] 0 setdash\n"); Move_Plume( wxPoint(x1,y1), 'U'); Move_Plume( wxPoint(x2,y2), 'D'); fprintf(PlotOutput,"[] 0 setdash\n"); break; case LAYER_BUS: /* Trait large */ { fprintf(PlotOutput,"%d setlinewidth\n", s_DefaultPenWidth * 3); Move_Plume( wxPoint(x1,y1),'U'); Move_Plume( wxPoint(x2,y2),'D'); fprintf(PlotOutput,"%d setlinewidth\n", s_DefaultPenWidth); } break; default: Move_Plume( wxPoint(x1,y1),'U'); Move_Plume( wxPoint(x2,y2),'D'); break; } break; case DRAW_JUNCTION_STRUCT_TYPE : #undef STRUCT #define STRUCT ((DrawJunctionStruct*)DrawList) if ( g_PlotPSColorOpt ) SetColorMapPS (ReturnLayerColor(STRUCT->m_Layer) ); PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE); break; case DRAW_TEXT_STRUCT_TYPE : case DRAW_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE : PlotTextStruct(DrawList); break; case DRAW_LIB_ITEM_STRUCT_TYPE : DrawLibItem = (EDA_SchComponentStruct *) DrawList; PlotLibPart( DrawLibItem ); break; case DRAW_PICK_ITEM_STRUCT_TYPE : break; case DRAW_POLYLINE_STRUCT_TYPE : break; case DRAW_SHEETLABEL_STRUCT_TYPE: break; case DRAW_MARKER_STRUCT_TYPE : break; case DRAW_SHEET_STRUCT_TYPE : #undef STRUCT #define STRUCT ((DrawSheetStruct*)DrawList) PlotSheetStruct(STRUCT); break; case DRAW_NOCONNECT_STRUCT_TYPE: #undef STRUCT #define STRUCT ((DrawNoConnectStruct*)DrawList) if ( g_PlotPSColorOpt ) SetColorMapPS (ReturnLayerColor(LAYER_NOCONNECT) ); PlotNoConnectStruct(STRUCT); break; default: break; } Plume('U'); DrawList = DrawList->Pnext; } /* fin */ CloseFilePS(PlotOutput); m_MsgBox->AppendText( wxT("Ok\n")); }
void DIALOG_COLOR_CONFIG::CreateControls() { wxStaticText* label; int color; int buttonId = 1800; ButtonIndex* groups = buttonGroups; OuterBoxSizer = new wxBoxSizer( wxVERTICAL ); SetSizer( OuterBoxSizer ); MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT, 5 ); while( groups->m_Buttons != NULL ) { ColorButton* buttons = groups->m_Buttons; ColumnBoxSizer = new wxBoxSizer( wxVERTICAL ); MainBoxSizer->Add( ColumnBoxSizer, 1, wxALIGN_TOP | wxLEFT | wxTOP, 5 ); RowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); ColumnBoxSizer->Add( RowBoxSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); // Add a text string to identify the column of color select buttons. label = new wxStaticText( this, wxID_ANY, groups->m_Name ); // Make the column label font bold. wxFont font( label->GetFont() ); font.SetWeight( wxFONTWEIGHT_BOLD ); label->SetFont( font ); RowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); while( buttons->m_Layer >= 0 ) { RowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); ColumnBoxSizer->Add( RowBoxSizer, 0, wxGROW | wxALL, 0 ); wxMemoryDC iconDC; wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); iconDC.SelectObject( bitmap ); color = currentColors[ buttons->m_Layer ] = ReturnLayerColor( buttons->m_Layer ); iconDC.SetPen( *wxBLACK_PEN ); wxBrush brush; brush.SetColour( ColorRefs[ color ].m_Red, ColorRefs[ color ].m_Green, ColorRefs[ color ].m_Blue ); brush.SetStyle( wxSOLID ); iconDC.SetBrush( brush ); iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); BitmapButton = new wxBitmapButton( this, buttonId, bitmap, wxDefaultPosition, wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) ); BitmapButton->SetClientData( (void*) buttons ); RowBoxSizer->Add( BitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) ); RowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); buttonId += 1; buttons++; } groups++; } Connect( 1800, buttonId - 1, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_CONFIG::SetColor ) ); // Add a spacer to improve appearance. ColumnBoxSizer->AddSpacer( 5 ); wxArrayString m_SelBgColorStrings; m_SelBgColorStrings.Add( _( "White" ) ); m_SelBgColorStrings.Add( _( "Black" ) ); m_SelBgColor = new wxRadioBox( this, wxID_ANY, _( "Background Color" ), wxDefaultPosition, wxDefaultSize, m_SelBgColorStrings, 1, wxRA_SPECIFY_COLS ); m_SelBgColor->SetSelection( ( g_DrawBgColor == BLACK ) ? 1 : 0 ); ColumnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 ); // Provide a line to separate all of the controls added so far from the // "OK", "Cancel", and "Apply" buttons (which will be added after that // line). Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); OuterBoxSizer->Add( Line, 0, wxGROW | wxALL, 5 ); // Provide a StdDialogButtonSizer to accommodate the OK, Cancel, and Apply // buttons; using that type of sizer results in those buttons being // automatically located in positions appropriate for each (OS) version of // KiCad. StdDialogButtonSizer = new wxStdDialogButtonSizer; OuterBoxSizer->Add( StdDialogButtonSizer, 0, wxGROW | wxALL, 10 ); Button = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 ); StdDialogButtonSizer->AddButton( Button ); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); StdDialogButtonSizer->AddButton( Button ); Button->SetFocus(); Button = new wxButton( this, wxID_APPLY, _( "Apply" ), wxDefaultPosition, wxDefaultSize, 0 ); StdDialogButtonSizer->AddButton( Button ); Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnOkClick ) ); Connect( wxID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnCancelClick ) ); Connect( wxID_APPLY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnApplyClick ) ); StdDialogButtonSizer->Realize(); // Dialog now needs to be resized, but the associated command is found elsewhere. }
void DrawLibEntry(WinEDA_DrawPanel * panel,wxDC * DC, EDA_LibComponentStruct *LibEntry, int posX, int posY, int Multi, int convert, int DrawMode, int Color) /**************************************************************/ /* Routine de dessin d'un composant d'une librairie LibEntry = pointeur sur la description en librairie posX, posY = position du composant DrawMode = GrOR .. Color = 0 : dessin en vraies couleurs, sinon couleur = Color Une croix symbolise le point d'accrochage (ref position) du composant Le composant est toujours trace avec orientation 0 */ { int color; int TransMat[2][2]; wxString Prefix; LibDrawField * Field; wxPoint text_pos; /* Orientation normale */ TransMat[0][0] = 1; TransMat[1][1] = -1; TransMat[1][0] = TransMat[0][1] = 0; DrawLibPartAux(panel, DC, NULL, LibEntry, wxPoint(posX, posY), TransMat, Multi, convert, DrawMode, Color); /* Trace des 2 champs ref et value (Attention aux coord: la matrice de transformation change de signe les coord Y */ GRSetDrawMode(DC, DrawMode); if( LibEntry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE ) { if( Color >= 0 ) color = Color; else color = UNVISIBLE_COLOR; } else { if( Color >= 0) color = Color; else color = ReturnLayerColor(LAYER_REFERENCEPART); } if (LibEntry->m_UnitCount > 1) Prefix.Printf( wxT("%s?%c"),LibEntry->m_Prefix.m_Text.GetData(),Multi + 'A' - 1); else Prefix = LibEntry->m_Prefix.m_Text + wxT("?"); text_pos.x = LibEntry->m_Prefix.m_Pos.x + posX; text_pos.y = posY - LibEntry->m_Prefix.m_Pos.y; DrawGraphicText(panel, DC, text_pos, color,LibEntry->m_Prefix.m_Text.GetData(), LibEntry->m_Prefix.m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, LibEntry->m_Prefix.m_Size, LibEntry->m_Prefix.m_HJustify, LibEntry->m_Prefix.m_VJustify); if( LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE ) { if( Color >= 0) color = Color; else color = UNVISIBLE_COLOR; } else { if( Color >= 0 ) color = Color; else color = ReturnLayerColor(LAYER_VALUEPART); } text_pos.x = LibEntry->m_Name.m_Pos.x + posX; text_pos.y = posY - LibEntry->m_Name.m_Pos.y; DrawGraphicText(panel, DC, text_pos, color, LibEntry->m_Name.m_Text.GetData(), LibEntry->m_Name.m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, LibEntry->m_Name.m_Size, LibEntry->m_Name.m_HJustify, LibEntry->m_Name.m_VJustify); for( Field = LibEntry->Fields; Field != NULL; Field = (LibDrawField *)Field->Pnext ) { if( Field->m_Text.IsEmpty() ) return; if( Field->m_Attributs & TEXT_NO_VISIBLE ) { if( Color >= 0) color = Color; else color = UNVISIBLE_COLOR; } else { if( Color >= 0) color = Color; else color = ReturnLayerColor(LAYER_FIELDS); } text_pos.x = Field->m_Pos.x + posX; text_pos.y = posY - Field->m_Pos.y; DrawGraphicText(panel, DC, text_pos, color, Field->m_Text, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, Field->m_HJustify, Field->m_VJustify); } // Tracé de l'ancre int len = 3 * panel->GetZoom(); GRLine(&panel->m_ClipBox, DC, posX, posY - len, posX, posY + len, color); GRLine(&panel->m_ClipBox, DC, posX - len, posY, posX + len, posY, color); }
/* DrawMode = GrXOR, GrOR ..*/ void DrawLibPartAux(WinEDA_DrawPanel * panel,wxDC * DC, EDA_SchComponentStruct *Component, EDA_LibComponentStruct *Entry, const wxPoint & Pos, int TransMat[2][2], int Multi, int convert, int DrawMode, int Color, bool DrawPinText) { int i, x1, y1, x2, y2, t1, t2, orient; LibEDA_BaseStruct *DEntry = NULL; int CharColor; int fill_option; int SetHightColor; //#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color; #define GETCOLOR(l) Color < 0 ? SetHightColor ? s_ItemSelectColor : (ReturnLayerColor(l)| SetHightColor) : Color; if (Entry->m_Drawings == NULL) return; GRSetDrawMode(DC, DrawMode); for( DEntry = Entry->m_Drawings; DEntry != NULL;DEntry = DEntry->Next()) { /* Elimination des elements non relatifs a l'unite */ if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) ) continue; if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) continue; if ( DEntry->m_Flags & IS_MOVED ) continue; // Element en deplacement non trace SetHightColor = (DEntry->m_Selected & IS_SELECTED) ? HIGHT_LIGHT_FLAG : 0; switch (DEntry->m_StructType) { case COMPONENT_ARC_DRAW_TYPE: { int xc,yc, x2, y2; LibDrawArc * Arc = (LibDrawArc *) DEntry; CharColor = GETCOLOR(LAYER_DEVICE); xc = Pos.x + TransMat[0][0] * Arc->m_Pos.x + TransMat[0][1] * Arc->m_Pos.y; yc = Pos.y + TransMat[1][0] * Arc->m_Pos.x + TransMat[1][1] * Arc->m_Pos.y; x2 = Pos.x + TransMat[0][0] * Arc->m_Start.x + TransMat[0][1] * Arc->m_Start.y;; y2 = Pos.y + TransMat[1][0] * Arc->m_Start.x + TransMat[1][1] * Arc->m_Start.y; x1 = Pos.x + TransMat[0][0] * Arc->m_End.x + TransMat[0][1] * Arc->m_End.y;; y1 = Pos.y + TransMat[1][0] * Arc->m_End.x + TransMat[1][1] * Arc->m_End.y; t1 = Arc->t1; t2 = Arc->t2; bool swap = MapAngles(&t1, &t2, TransMat); if ( swap ) { EXCHG(x1,x2); EXCHG(y1, y2) } fill_option = Arc->m_Fill & (~g_PrintFillMask); if ( Color < 0 ) // Normal Color Layer { if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) GRFilledArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, Arc->m_Rayon, CharColor, ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); else if ( fill_option == FILLED_SHAPE) GRFilledArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, Arc->m_Rayon, CharColor, CharColor); #ifdef DRAW_ARC_WITH_ANGLE else GRArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, Arc->m_Rayon, CharColor); #else else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, xc, yc , CharColor); #endif } #ifdef DRAW_ARC_WITH_ANGLE else GRArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, Arc->m_Rayon, CharColor); #else else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, xc, yc, CharColor); #endif }
void DrawTextField(WinEDA_DrawPanel * panel,wxDC * DC, PartTextStruct * Field, int IsMulti, int DrawMode) /***********************************************************/ /* Routine de trace des textes type Field du composant. entree: IsMulti: flag Non Null si il y a plusieurs parts par boitier. n'est utile que pour le champ reference pour ajouter a celui ci l'identification de la part ( A, B ... ) DrawMode: mode de trace */ { int orient, color; wxPoint pos; /* Position des textes */ EDA_SchComponentStruct *DrawLibItem = (EDA_SchComponentStruct *) Field->m_Parent; int hjustify, vjustify; if( Field->m_Attributs & TEXT_NO_VISIBLE ) return; if( Field->IsVoid() ) return; GRSetDrawMode(DC, DrawMode); /* Calcul de la position des textes, selon orientation du composant */ orient = Field->m_Orient; hjustify = Field->m_HJustify; vjustify = Field->m_VJustify; pos.x = Field->m_Pos.x - DrawLibItem->m_Pos.x; pos.y = Field->m_Pos.y - DrawLibItem->m_Pos.y; pos = DrawLibItem->GetScreenCoord(pos); pos.x += DrawLibItem->m_Pos.x; pos.y += DrawLibItem->m_Pos.y; /* Y a t-il rotation (pour l'orientation, la justification)*/ if(DrawLibItem->m_Transform[0][1]) // Rotation du composant de 90deg { if ( orient == TEXT_ORIENT_HORIZ) orient = TEXT_ORIENT_VERT; else orient = TEXT_ORIENT_HORIZ; /* Y a t-il rotation, miroir (pour les justifications)*/ EXCHG(hjustify, vjustify); if (DrawLibItem->m_Transform[1][0] < 0 ) vjustify = - vjustify; if (DrawLibItem->m_Transform[1][0] > 0 ) hjustify = - hjustify; } else { /* Texte horizontal: Y a t-il miroir (pour les justifications)*/ if (DrawLibItem->m_Transform[0][0] < 0 ) hjustify = - hjustify; if (DrawLibItem->m_Transform[1][1] > 0 ) vjustify = - vjustify; } if( Field->m_FieldId == REFERENCE ) color = ReturnLayerColor(LAYER_REFERENCEPART); else if( Field->m_FieldId == VALUE ) color = ReturnLayerColor(LAYER_VALUEPART); else color = ReturnLayerColor(LAYER_FIELDS); if( !IsMulti || (Field->m_FieldId != REFERENCE) ) { DrawGraphicText(panel, DC, pos, color, Field->m_Text.GetData(), orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, hjustify, vjustify); } else /* Le champ est la reference, et il y a plusieurs parts par boitier */ {/* On ajoute alors A ou B ... a la reference */ wxString fulltext = Field->m_Text; fulltext.Append('A' - 1 + DrawLibItem->m_Multi); DrawGraphicText(panel, DC, pos, color, fulltext.GetData(), orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Size, hjustify, vjustify); } }