Loading pcbnew/class_pad_draw_functions.cpp +13 −14 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin wxPoint tpos0 = wxPoint( ux0, uy0 ); // Position of the centre of text wxPoint tpos = tpos0; wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x int len; int shortname_len = m_ShortNetname.Len(); if( GetShape() == PAD_CIRCLE ) angle = 0; AreaSize = m_Size; Loading @@ -410,7 +410,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin AreaSize.y = m_Size.x; } if( !m_Netname.IsEmpty() ) // if there is a netname, provides room to display this netname if( shortname_len > 0 ) // if there is a netname, provides room to display this netname { AreaSize.y /= 2; // Text used only the upper area of the pad. The lower area displays the net name tpos.y -= AreaSize.y / 2; Loading @@ -424,32 +424,31 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin NORMALIZE_ANGLE_90( t_angle ); /* Note: in next calculations, texte size is calculated for 3 or more chars. Of course, pads nimbers and nets names can have less than 3 chars. Of course, pads numbers and nets names can have less than 3 chars. but after some tries, i found this is gives the best look */ #define MIN_CHAR_COUNT 3 wxString buffer; ReturnStringPadName( buffer ); len = buffer.Len(); len = MAX( len, MIN_CHAR_COUNT); int numpad_len = buffer.Len(); numpad_len = MAX( numpad_len, MIN_CHAR_COUNT); int tsize = min( AreaSize.y, AreaSize.x / len ); int tsize = min( AreaSize.y, AreaSize.x / numpad_len ); #define CHAR_SIZE_MIN 5 if( (tsize / zoom) >= CHAR_SIZE_MIN ) // Not drawable in size too small. if( (tsize / zoom) >= CHAR_SIZE_MIN ) // Not drawable when size too small. { tsize = (int) (tsize * 0.8); // reserve room for marges and segments thickness DrawGraphicText( panel, DC, tpos, WHITE, buffer, t_angle, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 8 ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7 ); } // display the short netname len = m_ShortNetname.Len(); if (len == 0 ) // display the short netnam, if exists if (shortname_len == 0 ) return; len = MAX( len, MIN_CHAR_COUNT); tsize = min( AreaSize.y, AreaSize.x / len ); shortname_len = MAX( shortname_len, MIN_CHAR_COUNT); tsize = min( AreaSize.y, AreaSize.x / shortname_len ); if( (tsize / zoom) >= CHAR_SIZE_MIN ) // Not drawable in size too small. { Loading @@ -460,7 +459,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin tsize = (int) (tsize * 0.8); // reserve room for marges and segments thickness DrawGraphicText( panel, DC, tpos, WHITE, m_ShortNetname, t_angle, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 8 ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7 ); } } pcbnew/class_track.cpp +10 −8 Original line number Diff line number Diff line Loading @@ -773,15 +773,17 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi return; int len = net->GetShortNetname().Len(); // calculate a good size for the text (fixed to 9 pixels, if possible) if ( len > 0 ) { // calculate a good size for the text int tsize = m_Width / len; if( ( tsize / zoom) >= 6 ) { tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via DrawGraphicText( panel, DC, m_Start, WHITE, net->GetShortNetname(), 0, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 8 ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7 ); } } } Loading Loading
pcbnew/class_pad_draw_functions.cpp +13 −14 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin wxPoint tpos0 = wxPoint( ux0, uy0 ); // Position of the centre of text wxPoint tpos = tpos0; wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x int len; int shortname_len = m_ShortNetname.Len(); if( GetShape() == PAD_CIRCLE ) angle = 0; AreaSize = m_Size; Loading @@ -410,7 +410,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin AreaSize.y = m_Size.x; } if( !m_Netname.IsEmpty() ) // if there is a netname, provides room to display this netname if( shortname_len > 0 ) // if there is a netname, provides room to display this netname { AreaSize.y /= 2; // Text used only the upper area of the pad. The lower area displays the net name tpos.y -= AreaSize.y / 2; Loading @@ -424,32 +424,31 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin NORMALIZE_ANGLE_90( t_angle ); /* Note: in next calculations, texte size is calculated for 3 or more chars. Of course, pads nimbers and nets names can have less than 3 chars. Of course, pads numbers and nets names can have less than 3 chars. but after some tries, i found this is gives the best look */ #define MIN_CHAR_COUNT 3 wxString buffer; ReturnStringPadName( buffer ); len = buffer.Len(); len = MAX( len, MIN_CHAR_COUNT); int numpad_len = buffer.Len(); numpad_len = MAX( numpad_len, MIN_CHAR_COUNT); int tsize = min( AreaSize.y, AreaSize.x / len ); int tsize = min( AreaSize.y, AreaSize.x / numpad_len ); #define CHAR_SIZE_MIN 5 if( (tsize / zoom) >= CHAR_SIZE_MIN ) // Not drawable in size too small. if( (tsize / zoom) >= CHAR_SIZE_MIN ) // Not drawable when size too small. { tsize = (int) (tsize * 0.8); // reserve room for marges and segments thickness DrawGraphicText( panel, DC, tpos, WHITE, buffer, t_angle, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 8 ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7 ); } // display the short netname len = m_ShortNetname.Len(); if (len == 0 ) // display the short netnam, if exists if (shortname_len == 0 ) return; len = MAX( len, MIN_CHAR_COUNT); tsize = min( AreaSize.y, AreaSize.x / len ); shortname_len = MAX( shortname_len, MIN_CHAR_COUNT); tsize = min( AreaSize.y, AreaSize.x / shortname_len ); if( (tsize / zoom) >= CHAR_SIZE_MIN ) // Not drawable in size too small. { Loading @@ -460,7 +459,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin tsize = (int) (tsize * 0.8); // reserve room for marges and segments thickness DrawGraphicText( panel, DC, tpos, WHITE, m_ShortNetname, t_angle, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 8 ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7 ); } }
pcbnew/class_track.cpp +10 −8 Original line number Diff line number Diff line Loading @@ -773,15 +773,17 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi return; int len = net->GetShortNetname().Len(); // calculate a good size for the text (fixed to 9 pixels, if possible) if ( len > 0 ) { // calculate a good size for the text int tsize = m_Width / len; if( ( tsize / zoom) >= 6 ) { tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via DrawGraphicText( panel, DC, m_Start, WHITE, net->GetShortNetname(), 0, wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 8 ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7 ); } } } Loading