Loading pcbnew/class_text_mod.cpp +44 −43 Original line number Original line Diff line number Diff line Loading @@ -241,27 +241,47 @@ EDA_RECT TEXTE_MODULE::GetBoundingBox() const void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& offset ) const wxPoint& offset ) { { int width, orient; MODULE* module = (MODULE*) m_Parent; wxSize size; wxPoint pos; // Center of text PCB_BASE_FRAME* frame; MODULE* module = (MODULE*) m_Parent; /* parent must *not* be null * (a module text without a footprint * parent has no sense) */ /* parent must *not* be NULL (a module text without a footprint parent has no sense) */ wxASSERT( module ); if( panel == NULL ) if( panel == NULL ) return; return; frame = (PCB_BASE_FRAME*) panel->GetParent(); BOARD* brd = GetBoard( ); EDA_COLOR_T color; // Determine the element color or suppress it element if hidden switch( module->GetLayer() ) { case LAYER_N_BACK: if( !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) ) return; color = brd->GetVisibleElementColor( MOD_TEXT_BK_VISIBLE ); break; pos.x = m_Pos.x - offset.x; case LAYER_N_FRONT: pos.y = m_Pos.y - offset.y; if( !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) ) return; color = brd->GetVisibleElementColor( MOD_TEXT_FR_VISIBLE ); break; size = m_Size; default: orient = GetDrawRotation(); color = brd->GetLayerColor( module->GetLayer() ); width = m_Thickness; } // 'Ghost' the element if forced show if( m_NoShow ) { if( !brd->IsElementVisible( MOD_TEXT_INVISIBLE ) ) return; color = brd->GetVisibleElementColor( MOD_TEXT_INVISIBLE ); } // Draw mode compensation for the width PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); int width = m_Thickness; if( ( frame->m_DisplayModText == LINE ) if( ( frame->m_DisplayModText == LINE ) || ( DC->LogicalToDeviceXRel( width ) < MIN_DRAW_WIDTH ) ) || ( DC->LogicalToDeviceXRel( width ) < MIN_DRAW_WIDTH ) ) width = 0; width = 0; Loading @@ -269,51 +289,32 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, width = -width; width = -width; GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode ); wxPoint pos( m_Pos.x - offset.x, m_Pos.y - offset.y); BOARD * brd = GetBoard( ); // Draw the text anchor point EDA_COLOR_T color; if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) { { color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); EDA_COLOR_T anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); int anchor_size = DC->DeviceToLogicalXRel( 2 ); int anchor_size = DC->DeviceToLogicalXRel( 2 ); GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC, pos.x - anchor_size, pos.y, pos.x - anchor_size, pos.y, pos.x + anchor_size, pos.y, 0, color ); pos.x + anchor_size, pos.y, 0, anchor_color ); GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC, pos.x, pos.y - anchor_size, pos.x, pos.y - anchor_size, pos.x, pos.y + anchor_size, 0, color ); pos.x, pos.y + anchor_size, 0, anchor_color ); } } color = brd->GetLayerColor(module->GetLayer()); // Draw the text proper, with the right attributes wxSize size = m_Size; int orient = GetDrawRotation(); if( module->GetLayer() == LAYER_N_BACK ) { if( brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false ) return; color = brd->GetVisibleElementColor(MOD_TEXT_BK_VISIBLE); } else if( module->GetLayer() == LAYER_N_FRONT ) { if( brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) return; color = brd->GetVisibleElementColor(MOD_TEXT_FR_VISIBLE); } if( m_NoShow ) { if( brd->IsElementVisible( MOD_TEXT_INVISIBLE ) == false ) return; color = brd->GetVisibleElementColor(MOD_TEXT_INVISIBLE); } /* If the text is mirrored : negate size.x (mirror / Y axis) */ // If the text is mirrored : negate size.x (mirror / Y axis) if( m_Mirror ) if( m_Mirror ) size.x = -size.x; size.x = -size.x; DrawGraphicText( panel, DC, pos, (enum EDA_COLOR_T) color, m_Text, orient, DrawGraphicText( panel, DC, pos, color, m_Text, orient, size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); } } Loading Loading
pcbnew/class_text_mod.cpp +44 −43 Original line number Original line Diff line number Diff line Loading @@ -241,27 +241,47 @@ EDA_RECT TEXTE_MODULE::GetBoundingBox() const void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& offset ) const wxPoint& offset ) { { int width, orient; MODULE* module = (MODULE*) m_Parent; wxSize size; wxPoint pos; // Center of text PCB_BASE_FRAME* frame; MODULE* module = (MODULE*) m_Parent; /* parent must *not* be null * (a module text without a footprint * parent has no sense) */ /* parent must *not* be NULL (a module text without a footprint parent has no sense) */ wxASSERT( module ); if( panel == NULL ) if( panel == NULL ) return; return; frame = (PCB_BASE_FRAME*) panel->GetParent(); BOARD* brd = GetBoard( ); EDA_COLOR_T color; // Determine the element color or suppress it element if hidden switch( module->GetLayer() ) { case LAYER_N_BACK: if( !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) ) return; color = brd->GetVisibleElementColor( MOD_TEXT_BK_VISIBLE ); break; pos.x = m_Pos.x - offset.x; case LAYER_N_FRONT: pos.y = m_Pos.y - offset.y; if( !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) ) return; color = brd->GetVisibleElementColor( MOD_TEXT_FR_VISIBLE ); break; size = m_Size; default: orient = GetDrawRotation(); color = brd->GetLayerColor( module->GetLayer() ); width = m_Thickness; } // 'Ghost' the element if forced show if( m_NoShow ) { if( !brd->IsElementVisible( MOD_TEXT_INVISIBLE ) ) return; color = brd->GetVisibleElementColor( MOD_TEXT_INVISIBLE ); } // Draw mode compensation for the width PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); int width = m_Thickness; if( ( frame->m_DisplayModText == LINE ) if( ( frame->m_DisplayModText == LINE ) || ( DC->LogicalToDeviceXRel( width ) < MIN_DRAW_WIDTH ) ) || ( DC->LogicalToDeviceXRel( width ) < MIN_DRAW_WIDTH ) ) width = 0; width = 0; Loading @@ -269,51 +289,32 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, width = -width; width = -width; GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode ); wxPoint pos( m_Pos.x - offset.x, m_Pos.y - offset.y); BOARD * brd = GetBoard( ); // Draw the text anchor point EDA_COLOR_T color; if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) { { color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); EDA_COLOR_T anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); int anchor_size = DC->DeviceToLogicalXRel( 2 ); int anchor_size = DC->DeviceToLogicalXRel( 2 ); GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC, pos.x - anchor_size, pos.y, pos.x - anchor_size, pos.y, pos.x + anchor_size, pos.y, 0, color ); pos.x + anchor_size, pos.y, 0, anchor_color ); GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC, pos.x, pos.y - anchor_size, pos.x, pos.y - anchor_size, pos.x, pos.y + anchor_size, 0, color ); pos.x, pos.y + anchor_size, 0, anchor_color ); } } color = brd->GetLayerColor(module->GetLayer()); // Draw the text proper, with the right attributes wxSize size = m_Size; int orient = GetDrawRotation(); if( module->GetLayer() == LAYER_N_BACK ) { if( brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false ) return; color = brd->GetVisibleElementColor(MOD_TEXT_BK_VISIBLE); } else if( module->GetLayer() == LAYER_N_FRONT ) { if( brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) return; color = brd->GetVisibleElementColor(MOD_TEXT_FR_VISIBLE); } if( m_NoShow ) { if( brd->IsElementVisible( MOD_TEXT_INVISIBLE ) == false ) return; color = brd->GetVisibleElementColor(MOD_TEXT_INVISIBLE); } /* If the text is mirrored : negate size.x (mirror / Y axis) */ // If the text is mirrored : negate size.x (mirror / Y axis) if( m_Mirror ) if( m_Mirror ) size.x = -size.x; size.x = -size.x; DrawGraphicText( panel, DC, pos, (enum EDA_COLOR_T) color, m_Text, orient, DrawGraphicText( panel, DC, pos, color, m_Text, orient, size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); } } Loading