Loading CHANGELOG.txt +9 −0 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,15 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2009-june-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++Eeschema: Added text justification for graphic texts in libedit Minor bug 2803506 fixed (error when mirroring bus entries) Some code cleaning. Better locating algo for arcs in libedit 2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ================================================================================ ++Eeschema: ++Eeschema: Loading common/base_struct.cpp +10 −9 Original line number Original line Diff line number Diff line Loading @@ -250,8 +250,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) rect.SetSize( textsize ); rect.SetSize( textsize ); /* Now, calculate the rect origin, according to text justification /* Now, calculate the rect origin, according to text justification * At this point the area origin is the text origin (m_Pos). * At this point the rectangle origin is the text origin (m_Pos). * This is true only for left and top text justified texts. * This is true only for left and top text justified texts (using top to bottom Y axis orientation). * and must be recalculated for others justifications * and must be recalculated for others justifications * also, note the V justification is relative to the first line * also, note the V justification is relative to the first line */ */ Loading Loading @@ -290,13 +290,14 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) /*************************************************/ /*************************************************/ bool EDA_TextStruct::HitTest( const wxPoint& posref ) bool EDA_TextStruct::TextHitTest( const wxPoint& posref ) /*************************************************/ /*************************************************/ /* locate function /** * return: * Function TextHitTest (overlayed) * true if posref is inside the text area. * tests if the given point is inside this object. * false else. * @param posref point to test * @return bool - true if a hit, else false */ */ { { EDA_Rect rect = GetTextBox( -1 ); // Get the full text area. EDA_Rect rect = GetTextBox( -1 ); // Get the full text area. Loading @@ -310,13 +311,13 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref ) /** /** * Function HitTest (overlayed) * Function TextHitTest (overlayed) * tests if the given EDA_Rect intersect this object. * tests if the given EDA_Rect intersect this object. * @param refArea the given EDA_Rect to test * @param refArea the given EDA_Rect to test * @return bool - true if a hit, else false * @return bool - true if a hit, else false */ */ /*********************************************************/ /*********************************************************/ bool EDA_TextStruct::HitTest( EDA_Rect& refArea ) bool EDA_TextStruct::TextHitTest( EDA_Rect& refArea ) /*********************************************************/ /*********************************************************/ { { if( refArea.Inside( m_Pos ) ) if( refArea.Inside( m_Pos ) ) Loading eeschema/block.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -620,7 +620,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) static void MirrorYPoint( wxPoint& point, wxPoint& Center ) static void MirrorYPoint( wxPoint& point, wxPoint& Center ) { { point.x -= Center.x; point.x -= Center.x; point.x = -point.x; NEGATE(point.x); point.x += Center.x; point.x += Center.x; } } Loading Loading @@ -683,6 +683,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center ) case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE: DrawRaccord = (DrawBusEntryStruct*) DrawStruct; DrawRaccord = (DrawBusEntryStruct*) DrawStruct; MirrorYPoint( DrawRaccord->m_Pos, Center ); MirrorYPoint( DrawRaccord->m_Pos, Center ); NEGATE(DrawRaccord->m_Size.x); break; break; case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE: Loading eeschema/class_libentry_fields.cpp +15 −35 Original line number Original line Diff line number Diff line Loading @@ -254,44 +254,24 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, */ */ bool LibDrawField::HitTest( const wxPoint& refPos ) bool LibDrawField::HitTest( const wxPoint& refPos ) { { EDA_Rect bbox; // bounding box for the text int dx; // X size for the full text bbox.SetOrigin( m_Pos ); dx = m_Size.x * m_Text.Len(); // Reference designator text has one additional character (displays U?) // Reference designator text has one additional character (displays U?) if( m_FieldId == REFERENCE ) if( m_FieldId == REFERENCE ) dx += m_Size.x; m_Text.Append('?'); // if using TextHitTest() remember this function uses top to bottom y axis convention // spacing between characters is 0.1 the character size // and for lib items we are using bottom to top convention dx = (int) ( (double) dx * 10.0 / 9 ); // so for non center Y justification we use a trick. int dy = m_Size.y; GRTextVertJustifyType vJustify = m_VJustify; if ( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) if( m_Orient ) m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM; EXCHG( dx, dy ); // Swap X and Y size for a vertical text else if ( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) m_VJustify = GR_TEXT_VJUSTIFY_TOP; // adjust position of the left bottom corner according to the justification // pos is at this point correct for a left and top justified text // Horizontal justification if( m_HJustify == GR_TEXT_HJUSTIFY_CENTER ) bbox.Offset( -dx / 2, 0 ); else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) bbox.Offset( -dx, 0 ); // Vertical justification if( m_VJustify == GR_TEXT_VJUSTIFY_CENTER ) bbox.Offset( 0, -dy / 2 ); else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) bbox.Offset( 0, -dy ); bbox.SetSize( dx, dy ); bool hit = TextHitTest(refPos); m_VJustify = vJustify; if( bbox.Inside( refPos ) ) if( m_FieldId == REFERENCE ) return true; m_Text.RemoveLast( ); return hit; return false; } } Loading eeschema/class_sch_cmp_field.cpp +11 −2 Original line number Original line Diff line number Diff line Loading @@ -59,7 +59,16 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent; GRTextHorizJustifyType hjustify; GRTextHorizJustifyType hjustify; GRTextVertJustifyType vjustify; GRTextVertJustifyType vjustify; int LineWidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; int LineWidth = m_Width; if (LineWidth == 0) // Use default values for pen size { if ( m_Bold ) LineWidth = GetPenSizeForBold( m_Size.x ); else LineWidth = g_DrawDefaultLineThickness; } // Clip pen size for small texts: // Clip pen size for small texts: LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold ); LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold ); Loading Loading @@ -153,7 +162,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, { { DrawGraphicText( panel, DC, pos, color, m_Text, DrawGraphicText( panel, DC, pos, color, m_Text, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, m_Size, hjustify, vjustify, LineWidth, m_Italic, m_Bold, false ); m_Size, hjustify, vjustify, LineWidth, m_Italic, m_Bold ); } } else else { { Loading Loading
CHANGELOG.txt +9 −0 Original line number Original line Diff line number Diff line Loading @@ -4,6 +4,15 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2009-june-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++Eeschema: Added text justification for graphic texts in libedit Minor bug 2803506 fixed (error when mirroring bus entries) Some code cleaning. Better locating algo for arcs in libedit 2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2009-may-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ================================================================================ ++Eeschema: ++Eeschema: Loading
common/base_struct.cpp +10 −9 Original line number Original line Diff line number Diff line Loading @@ -250,8 +250,8 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) rect.SetSize( textsize ); rect.SetSize( textsize ); /* Now, calculate the rect origin, according to text justification /* Now, calculate the rect origin, according to text justification * At this point the area origin is the text origin (m_Pos). * At this point the rectangle origin is the text origin (m_Pos). * This is true only for left and top text justified texts. * This is true only for left and top text justified texts (using top to bottom Y axis orientation). * and must be recalculated for others justifications * and must be recalculated for others justifications * also, note the V justification is relative to the first line * also, note the V justification is relative to the first line */ */ Loading Loading @@ -290,13 +290,14 @@ EDA_Rect EDA_TextStruct::GetTextBox( int aLine ) /*************************************************/ /*************************************************/ bool EDA_TextStruct::HitTest( const wxPoint& posref ) bool EDA_TextStruct::TextHitTest( const wxPoint& posref ) /*************************************************/ /*************************************************/ /* locate function /** * return: * Function TextHitTest (overlayed) * true if posref is inside the text area. * tests if the given point is inside this object. * false else. * @param posref point to test * @return bool - true if a hit, else false */ */ { { EDA_Rect rect = GetTextBox( -1 ); // Get the full text area. EDA_Rect rect = GetTextBox( -1 ); // Get the full text area. Loading @@ -310,13 +311,13 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref ) /** /** * Function HitTest (overlayed) * Function TextHitTest (overlayed) * tests if the given EDA_Rect intersect this object. * tests if the given EDA_Rect intersect this object. * @param refArea the given EDA_Rect to test * @param refArea the given EDA_Rect to test * @return bool - true if a hit, else false * @return bool - true if a hit, else false */ */ /*********************************************************/ /*********************************************************/ bool EDA_TextStruct::HitTest( EDA_Rect& refArea ) bool EDA_TextStruct::TextHitTest( EDA_Rect& refArea ) /*********************************************************/ /*********************************************************/ { { if( refArea.Inside( m_Pos ) ) if( refArea.Inside( m_Pos ) ) Loading
eeschema/block.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -620,7 +620,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) static void MirrorYPoint( wxPoint& point, wxPoint& Center ) static void MirrorYPoint( wxPoint& point, wxPoint& Center ) { { point.x -= Center.x; point.x -= Center.x; point.x = -point.x; NEGATE(point.x); point.x += Center.x; point.x += Center.x; } } Loading Loading @@ -683,6 +683,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center ) case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE: DrawRaccord = (DrawBusEntryStruct*) DrawStruct; DrawRaccord = (DrawBusEntryStruct*) DrawStruct; MirrorYPoint( DrawRaccord->m_Pos, Center ); MirrorYPoint( DrawRaccord->m_Pos, Center ); NEGATE(DrawRaccord->m_Size.x); break; break; case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE: Loading
eeschema/class_libentry_fields.cpp +15 −35 Original line number Original line Diff line number Diff line Loading @@ -254,44 +254,24 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, */ */ bool LibDrawField::HitTest( const wxPoint& refPos ) bool LibDrawField::HitTest( const wxPoint& refPos ) { { EDA_Rect bbox; // bounding box for the text int dx; // X size for the full text bbox.SetOrigin( m_Pos ); dx = m_Size.x * m_Text.Len(); // Reference designator text has one additional character (displays U?) // Reference designator text has one additional character (displays U?) if( m_FieldId == REFERENCE ) if( m_FieldId == REFERENCE ) dx += m_Size.x; m_Text.Append('?'); // if using TextHitTest() remember this function uses top to bottom y axis convention // spacing between characters is 0.1 the character size // and for lib items we are using bottom to top convention dx = (int) ( (double) dx * 10.0 / 9 ); // so for non center Y justification we use a trick. int dy = m_Size.y; GRTextVertJustifyType vJustify = m_VJustify; if ( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) if( m_Orient ) m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM; EXCHG( dx, dy ); // Swap X and Y size for a vertical text else if ( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) m_VJustify = GR_TEXT_VJUSTIFY_TOP; // adjust position of the left bottom corner according to the justification // pos is at this point correct for a left and top justified text // Horizontal justification if( m_HJustify == GR_TEXT_HJUSTIFY_CENTER ) bbox.Offset( -dx / 2, 0 ); else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) bbox.Offset( -dx, 0 ); // Vertical justification if( m_VJustify == GR_TEXT_VJUSTIFY_CENTER ) bbox.Offset( 0, -dy / 2 ); else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) bbox.Offset( 0, -dy ); bbox.SetSize( dx, dy ); bool hit = TextHitTest(refPos); m_VJustify = vJustify; if( bbox.Inside( refPos ) ) if( m_FieldId == REFERENCE ) return true; m_Text.RemoveLast( ); return hit; return false; } } Loading
eeschema/class_sch_cmp_field.cpp +11 −2 Original line number Original line Diff line number Diff line Loading @@ -59,7 +59,16 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent; GRTextHorizJustifyType hjustify; GRTextHorizJustifyType hjustify; GRTextVertJustifyType vjustify; GRTextVertJustifyType vjustify; int LineWidth = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; int LineWidth = m_Width; if (LineWidth == 0) // Use default values for pen size { if ( m_Bold ) LineWidth = GetPenSizeForBold( m_Size.x ); else LineWidth = g_DrawDefaultLineThickness; } // Clip pen size for small texts: // Clip pen size for small texts: LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold ); LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold ); Loading Loading @@ -153,7 +162,7 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, { { DrawGraphicText( panel, DC, pos, color, m_Text, DrawGraphicText( panel, DC, pos, color, m_Text, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, m_Size, hjustify, vjustify, LineWidth, m_Italic, m_Bold, false ); m_Size, hjustify, vjustify, LineWidth, m_Italic, m_Bold ); } } else else { { Loading