Loading CHANGELOG.txt +7 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,13 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with email address. 2009-may-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++pcbnew: Better dialog options for zones on technical layers. Zones on silk screen filled with segments are now plotted Better support of multiline texts (work in progress) 2009-apr-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++ Eeschema: Loading common/base_struct.cpp +29 −9 Original line number Diff line number Diff line Loading @@ -171,7 +171,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text ) m_Orient = 0; /* Orient in 0.1 degrees */ m_Attributs = 0; m_Mirror = false; // display mirror if true m_HJustify = GR_TEXT_HJUSTIFY_LEFT; m_HJustify = GR_TEXT_HJUSTIFY_CENTER; m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Justifications Horiz et Vert du texte */ m_Width = 0; /* thickness */ m_Italic = false; /* true = italic shape */ Loading Loading @@ -267,6 +267,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, /***************************************************************/ /** Function Draw * Draws this, that can be a multiline text * @param aPanel = the current DrawPanel * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) Loading @@ -279,11 +280,18 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, { wxPoint pos = m_Pos; wxArrayString* list = wxStringSplit( m_Text, '\n' ); wxPoint offset; offset.y = (int) (m_Size.y * 1.5 ); RotatePoint( &offset, m_Orient ); if( m_Mirror ) offset.x = -offset.x; for( unsigned i = 0; i<list->Count(); i++ ) { wxString txt = list->Item( i ); wxSize size = DrawOneLine( aPanel, DrawOneLineOfText( aPanel, aDC, aOffset, aColor, Loading @@ -292,18 +300,31 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, aAnchor_color, txt, pos ); pos.y += 1.5 * (size.y); pos += offset; } delete (list); } wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC, /** Function DrawOneLineOfText * Draw a single text line. * Used to draw each line of this EDA_TextStruct, that can be multiline * @param aPanel = the current DrawPanel * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) * @param EDA_Colors aColor = text color * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDisplayMode = FILAIRE, FILLED or SKETCH * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aText = the single line of text to draw. * @param EDA_Colors aPos = the position of this line ). */ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, EDA_Colors aColor, int aDrawMode, GRFillMode aDisplayMode, EDA_Colors aAnchor_color, wxString txt, wxPoint pos ) wxString& aText, wxPoint aPos ) { int width = m_Width; Loading @@ -319,8 +340,8 @@ wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC, int anchor_size = aPanel->GetScreen()->Unscale( 2 ); aAnchor_color = (EDA_Colors) (aAnchor_color & MASKCOLOR); int cX = pos.x + aOffset.x; int cY = pos.y + aOffset.y; int cX = aPos.x + aOffset.x; int cY = aPos.y + aOffset.y; GRLine( &aPanel->m_ClipBox, aDC, cX - anchor_size, cY, cX + anchor_size, cY, 0, aAnchor_color ); Loading @@ -339,10 +360,9 @@ wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC, DrawGraphicText( aPanel, aDC, aOffset + pos, aColor, txt, aOffset + aPos, aColor, aText, m_Orient, size, m_HJustify, m_VJustify, width, m_Italic ); return size; } Loading include/base_struct.h +19 −3 Original line number Diff line number Diff line Loading @@ -527,10 +527,26 @@ public: int aDisplayMode, GRFillMode aDisplay_mode = FILAIRE, EDA_Colors aAnchor_color = UNSPECIFIED_COLOR ); wxSize DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC, private: /** Function DrawOneLineOfText * Draw a single text line. * Used to draw each line of this EDA_TextStruct, that can be multiline * @param aPanel = the current DrawPanel * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) * @param EDA_Colors aColor = text color * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDisplayMode = FILAIRE, FILLED or SKETCH * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aText = the single line of text to draw. * @param EDA_Colors aPos = the position of this line ). */ void DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, EDA_Colors aColor, int aDisplayMode, GRFillMode aDisplay_mode = FILAIRE, EDA_Colors aAnchor_color = UNSPECIFIED_COLOR, wxString txt=wxString(),wxPoint pos=wxPoint(0,0) ); int aDisplayMode, GRFillMode aDisplay_mode, EDA_Colors aAnchor_color, wxString& aText, wxPoint aPos ); public: /** * Function HitTest * tests if the given wxPoint is within the bounds of this object. Loading pcbnew/class_pcb_text.cpp +77 −32 Original line number Diff line number Diff line Loading @@ -51,6 +51,28 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source ) /****************************************************************/ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) /****************************************************************/ /** Function ReadTextePcbDescr * Read a pcb text description * The format is like: * $TEXTPCB * Te "Text example" * Po 66750 53450 600 800 150 0 * De 24 1 0 Italic * $EndTEXTPCB * for a single line text * * or * * $TEXTPCB * Te "Text example" * nl "ligne 2" * Po 66750 53450 600 800 150 0 * De 24 1 0 Italic * $EndTEXTPCB * for a multi line text * nl "ligne nn" is a line added to the current text */ { char text[1024], Line[1024]; char style[256]; Loading @@ -59,20 +81,30 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) { if( strnicmp( Line, "$EndTEXTPCB", 11 ) == 0 ) return 0; if( strncmp( Line, "Te", 2 ) == 0 ) /* Texte */ if( strncmp( Line, "Te", 2 ) == 0 ) /* Text line (first line for multi line texts */ { ReadDelimitedText( text, Line + 2, sizeof(text) ); m_Text = CONV_FROM_UTF8( text ); continue; } if( strncmp( Line, "nl", 2 ) == 0 ) /* next line of the current text */ { ReadDelimitedText( text, Line + 2, sizeof(text) ); m_Text.Append( '\n' ); m_Text += CONV_FROM_UTF8( text ); continue; } if( strncmp( Line, "Po", 2 ) == 0 ) { sscanf( Line + 2, " %d %d %d %d %d %d", &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y, &m_Width, &m_Orient ); // Ensure the text has minimal size to see this text on screen: if ( m_Size.x < 5 ) m_Size.x = 5; if ( m_Size.y < 5 ) m_Size.y = 5; if( m_Size.x < 5 ) m_Size.x = 5; if( m_Size.y < 5 ) m_Size.y = 5; continue; } if( strncmp( Line, "De", 2 ) == 0 ) Loading Loading @@ -111,13 +143,23 @@ bool TEXTE_PCB::Save( FILE* aFile ) const if( m_Text.IsEmpty() ) return true; if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n") - 1 ) return false; bool rc = false; const char* style = m_Italic ? "Italic" : "Normal"; if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n")-1 ) goto out; wxArrayString* list = wxStringSplit( m_Text, '\n' ); for( unsigned ii = 0; ii < list->Count(); ii++ ) { wxString txt = list->Item( ii ); if ( ii == 0 ) fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( txt ) ); else fprintf( aFile, "nl \"%s\"\n", CONV_TO_UTF8( txt ) ); } delete (list); fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) ); fprintf( aFile, "Po %d %d %d %d %d %d\n", m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient ); fprintf( aFile, "De %d %d %lX %s\n", m_Layer, Loading @@ -125,16 +167,12 @@ bool TEXTE_PCB::Save( FILE* aFile ) const m_TimeStamp, style ); if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n") - 1 ) goto out; return false; rc = true; out: return rc; return true; } /**********************************************************************/ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode, const wxPoint& offset ) Loading @@ -149,13 +187,18 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( color & ITEM_NOT_SHOW ) return; EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color, DrawMode, (GRFillMode)DisplayOpt.DisplayDrawItems, (g_AnchorColor & ITEM_NOT_SHOW) ? UNSPECIFIED_COLOR : (EDA_Colors)g_AnchorColor ); EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color, DrawMode, (GRFillMode) DisplayOpt.DisplayDrawItems, (g_AnchorColor & ITEM_NOT_SHOW) ? UNSPECIFIED_COLOR : (EDA_Colors) g_AnchorColor ); } // see class_pcb_text.h void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame ) { Loading @@ -163,6 +206,7 @@ void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame ) BOARD* board; BOARD_ITEM* parent = (BOARD_ITEM*) m_Parent; wxASSERT( parent ); if( parent->Type() == TYPE_COTATION ) Loading Loading @@ -220,4 +264,5 @@ void TEXTE_PCB::Show( int nestLevel, std::ostream& os ) // NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; } #endif pcbnew/dialog_copper_zones.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -49,8 +49,6 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) { BOARD* board = m_Parent->GetBoard(); SetFont( *g_DialogFont ); SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key wxString msg; Loading Loading
CHANGELOG.txt +7 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,13 @@ KiCad ChangeLog 2009 Please add newer entries at the top, list the date and your name with email address. 2009-may-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++pcbnew: Better dialog options for zones on technical layers. Zones on silk screen filled with segments are now plotted Better support of multiline texts (work in progress) 2009-apr-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> ================================================================================ ++ Eeschema: Loading
common/base_struct.cpp +29 −9 Original line number Diff line number Diff line Loading @@ -171,7 +171,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text ) m_Orient = 0; /* Orient in 0.1 degrees */ m_Attributs = 0; m_Mirror = false; // display mirror if true m_HJustify = GR_TEXT_HJUSTIFY_LEFT; m_HJustify = GR_TEXT_HJUSTIFY_CENTER; m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Justifications Horiz et Vert du texte */ m_Width = 0; /* thickness */ m_Italic = false; /* true = italic shape */ Loading Loading @@ -267,6 +267,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, /***************************************************************/ /** Function Draw * Draws this, that can be a multiline text * @param aPanel = the current DrawPanel * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) Loading @@ -279,11 +280,18 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, { wxPoint pos = m_Pos; wxArrayString* list = wxStringSplit( m_Text, '\n' ); wxPoint offset; offset.y = (int) (m_Size.y * 1.5 ); RotatePoint( &offset, m_Orient ); if( m_Mirror ) offset.x = -offset.x; for( unsigned i = 0; i<list->Count(); i++ ) { wxString txt = list->Item( i ); wxSize size = DrawOneLine( aPanel, DrawOneLineOfText( aPanel, aDC, aOffset, aColor, Loading @@ -292,18 +300,31 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, aAnchor_color, txt, pos ); pos.y += 1.5 * (size.y); pos += offset; } delete (list); } wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC, /** Function DrawOneLineOfText * Draw a single text line. * Used to draw each line of this EDA_TextStruct, that can be multiline * @param aPanel = the current DrawPanel * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) * @param EDA_Colors aColor = text color * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDisplayMode = FILAIRE, FILLED or SKETCH * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aText = the single line of text to draw. * @param EDA_Colors aPos = the position of this line ). */ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, EDA_Colors aColor, int aDrawMode, GRFillMode aDisplayMode, EDA_Colors aAnchor_color, wxString txt, wxPoint pos ) wxString& aText, wxPoint aPos ) { int width = m_Width; Loading @@ -319,8 +340,8 @@ wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC, int anchor_size = aPanel->GetScreen()->Unscale( 2 ); aAnchor_color = (EDA_Colors) (aAnchor_color & MASKCOLOR); int cX = pos.x + aOffset.x; int cY = pos.y + aOffset.y; int cX = aPos.x + aOffset.x; int cY = aPos.y + aOffset.y; GRLine( &aPanel->m_ClipBox, aDC, cX - anchor_size, cY, cX + anchor_size, cY, 0, aAnchor_color ); Loading @@ -339,10 +360,9 @@ wxSize EDA_TextStruct::DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC, DrawGraphicText( aPanel, aDC, aOffset + pos, aColor, txt, aOffset + aPos, aColor, aText, m_Orient, size, m_HJustify, m_VJustify, width, m_Italic ); return size; } Loading
include/base_struct.h +19 −3 Original line number Diff line number Diff line Loading @@ -527,10 +527,26 @@ public: int aDisplayMode, GRFillMode aDisplay_mode = FILAIRE, EDA_Colors aAnchor_color = UNSPECIFIED_COLOR ); wxSize DrawOneLine( WinEDA_DrawPanel* aPanel, wxDC* aDC, private: /** Function DrawOneLineOfText * Draw a single text line. * Used to draw each line of this EDA_TextStruct, that can be multiline * @param aPanel = the current DrawPanel * @param aDC = the current Device Context * @param aOffset = draw offset (usually (0,0)) * @param EDA_Colors aColor = text color * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDisplayMode = FILAIRE, FILLED or SKETCH * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aText = the single line of text to draw. * @param EDA_Colors aPos = the position of this line ). */ void DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, EDA_Colors aColor, int aDisplayMode, GRFillMode aDisplay_mode = FILAIRE, EDA_Colors aAnchor_color = UNSPECIFIED_COLOR, wxString txt=wxString(),wxPoint pos=wxPoint(0,0) ); int aDisplayMode, GRFillMode aDisplay_mode, EDA_Colors aAnchor_color, wxString& aText, wxPoint aPos ); public: /** * Function HitTest * tests if the given wxPoint is within the bounds of this object. Loading
pcbnew/class_pcb_text.cpp +77 −32 Original line number Diff line number Diff line Loading @@ -51,6 +51,28 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source ) /****************************************************************/ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) /****************************************************************/ /** Function ReadTextePcbDescr * Read a pcb text description * The format is like: * $TEXTPCB * Te "Text example" * Po 66750 53450 600 800 150 0 * De 24 1 0 Italic * $EndTEXTPCB * for a single line text * * or * * $TEXTPCB * Te "Text example" * nl "ligne 2" * Po 66750 53450 600 800 150 0 * De 24 1 0 Italic * $EndTEXTPCB * for a multi line text * nl "ligne nn" is a line added to the current text */ { char text[1024], Line[1024]; char style[256]; Loading @@ -59,20 +81,30 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) { if( strnicmp( Line, "$EndTEXTPCB", 11 ) == 0 ) return 0; if( strncmp( Line, "Te", 2 ) == 0 ) /* Texte */ if( strncmp( Line, "Te", 2 ) == 0 ) /* Text line (first line for multi line texts */ { ReadDelimitedText( text, Line + 2, sizeof(text) ); m_Text = CONV_FROM_UTF8( text ); continue; } if( strncmp( Line, "nl", 2 ) == 0 ) /* next line of the current text */ { ReadDelimitedText( text, Line + 2, sizeof(text) ); m_Text.Append( '\n' ); m_Text += CONV_FROM_UTF8( text ); continue; } if( strncmp( Line, "Po", 2 ) == 0 ) { sscanf( Line + 2, " %d %d %d %d %d %d", &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y, &m_Width, &m_Orient ); // Ensure the text has minimal size to see this text on screen: if ( m_Size.x < 5 ) m_Size.x = 5; if ( m_Size.y < 5 ) m_Size.y = 5; if( m_Size.x < 5 ) m_Size.x = 5; if( m_Size.y < 5 ) m_Size.y = 5; continue; } if( strncmp( Line, "De", 2 ) == 0 ) Loading Loading @@ -111,13 +143,23 @@ bool TEXTE_PCB::Save( FILE* aFile ) const if( m_Text.IsEmpty() ) return true; if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n") - 1 ) return false; bool rc = false; const char* style = m_Italic ? "Italic" : "Normal"; if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n")-1 ) goto out; wxArrayString* list = wxStringSplit( m_Text, '\n' ); for( unsigned ii = 0; ii < list->Count(); ii++ ) { wxString txt = list->Item( ii ); if ( ii == 0 ) fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( txt ) ); else fprintf( aFile, "nl \"%s\"\n", CONV_TO_UTF8( txt ) ); } delete (list); fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) ); fprintf( aFile, "Po %d %d %d %d %d %d\n", m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient ); fprintf( aFile, "De %d %d %lX %s\n", m_Layer, Loading @@ -125,16 +167,12 @@ bool TEXTE_PCB::Save( FILE* aFile ) const m_TimeStamp, style ); if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n") - 1 ) goto out; return false; rc = true; out: return rc; return true; } /**********************************************************************/ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode, const wxPoint& offset ) Loading @@ -149,13 +187,18 @@ void TEXTE_PCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, if( color & ITEM_NOT_SHOW ) return; EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color, DrawMode, (GRFillMode)DisplayOpt.DisplayDrawItems, (g_AnchorColor & ITEM_NOT_SHOW) ? UNSPECIFIED_COLOR : (EDA_Colors)g_AnchorColor ); EDA_TextStruct::Draw( panel, DC, offset, (EDA_Colors) color, DrawMode, (GRFillMode) DisplayOpt.DisplayDrawItems, (g_AnchorColor & ITEM_NOT_SHOW) ? UNSPECIFIED_COLOR : (EDA_Colors) g_AnchorColor ); } // see class_pcb_text.h void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame ) { Loading @@ -163,6 +206,7 @@ void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame ) BOARD* board; BOARD_ITEM* parent = (BOARD_ITEM*) m_Parent; wxASSERT( parent ); if( parent->Type() == TYPE_COTATION ) Loading Loading @@ -220,4 +264,5 @@ void TEXTE_PCB::Show( int nestLevel, std::ostream& os ) // NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; } #endif
pcbnew/dialog_copper_zones.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -49,8 +49,6 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) { BOARD* board = m_Parent->GetBoard(); SetFont( *g_DialogFont ); SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key wxString msg; Loading