diff --git a/change_log.txt b/change_log.txt index efbf21acd8..c7502fe323 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,13 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. + +2008-Sep-17 UPDATE Jean-Pierre Charras +================================================================================ ++eeschema: + code cleaning + PartTextStruct class name changed to a name : SCH_CMP_FIELD + 2008-Sep-14 UPDATE Jean-Pierre Charras ================================================================================ +pcbnew: diff --git a/common/basicframe.cpp b/common/basicframe.cpp index b920618095..625e9e790b 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -245,7 +245,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) DisplayError( this, msg ); } #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF - wxString fullfilename = FindKicadHelpPath() + _T("kicad.pdf"); + wxString fullfilename = FindKicadHelpPath() + m_Parent->m_HelpFileName; if ( wxFileExists(fullfilename) ) GetAssociatedDocument( this, wxEmptyString, fullfilename ); else // Try to find file in English format: diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 06f450b4aa..a8bc4099a5 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -229,11 +229,12 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) m_KicadEnv += UNIX_STRING_DIR_SEP; } - /* Prepare On Line Help */ + /* Prepare On Line Help. Use only lower case for help filenames, + * in order to avoid problems with upper/lower case filenames under windows and unix */ #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML - m_HelpFileName = name + wxT( ".html" ); + m_HelpFileName = name.Lower() + wxT( ".html" ); #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF - m_HelpFileName = name + wxT( ".pdf" ); + m_HelpFileName = name.Lower() + wxT( ".pdf" ); #else #error Help files format not defined #endif diff --git a/eeschema/classes_body_items.cpp b/eeschema/classes_body_items.cpp index 0d4fabaca7..d8eefd5956 100644 --- a/eeschema/classes_body_items.cpp +++ b/eeschema/classes_body_items.cpp @@ -25,7 +25,7 @@ LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) : * 0 if the item is common to all shapes */ m_Width = 0; /* Default value to draw lines or arc ... */ m_Fill = NO_FILL; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. - * has meaning only for some items */ + * has meaning only for some items */ } @@ -47,7 +47,7 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs wxPoint pos1, pos2, posc; int color = ReturnLayerColor( LAYER_DEVICE ); - int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); + int linewidth = MAX( m_Width, g_DrawMinimunLineWidth ); if( aColor < 0 ) // Used normal color or selected color { @@ -76,7 +76,7 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs if( fill == FILLED_WITH_BG_BODYCOLOR ) GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, - m_Rayon, LineWidth, color, + m_Rayon, linewidth, color, ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE && !aData ) GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, @@ -87,13 +87,13 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, - m_Rayon, LineWidth, color ); + m_Rayon, linewidth, color ); #else GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, - posc.x, posc.y, LineWidth, color ); + posc.x, posc.y, linewidth, color ); #endif } @@ -106,7 +106,7 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aO wxPoint pos1; int color = ReturnLayerColor( LAYER_DEVICE ); - int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); + int linewidth = MAX( m_Width, g_DrawMinimunLineWidth ); if( aColor < 0 ) // Used normal color or selected color { @@ -125,14 +125,14 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aO if( fill == FILLED_WITH_BG_BODYCOLOR ) GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, - m_Rayon, LineWidth, color, + m_Rayon, linewidth, color, ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE ) GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, m_Rayon, 0, color, color ); else GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, - m_Rayon, LineWidth, color ); + m_Rayon, linewidth, color ); } @@ -144,7 +144,7 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOff wxPoint pos1, pos2; int color = ReturnLayerColor( LAYER_DEVICE ); - int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); + int linewidth = MAX( m_Width, g_DrawMinimunLineWidth ); if( aColor < 0 ) // Used normal color or selected color { @@ -163,7 +163,7 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOff DrawGraphicText( aPanel, aDC, pos1, color, m_Text, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, linewidth ); } @@ -175,7 +175,7 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aO wxPoint pos1, pos2; int color = ReturnLayerColor( LAYER_DEVICE ); - int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); + int linewidth = MAX( m_Width, g_DrawMinimunLineWidth ); if( aColor < 0 ) // Used normal color or selected color { @@ -194,14 +194,14 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aO if( fill == FILLED_WITH_BG_BODYCOLOR && !aData ) GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, - color, LineWidth, + color, linewidth, ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( m_Fill == FILLED_SHAPE && !aData ) GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, color, color ); else GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, - LineWidth, color ); + linewidth, color ); } @@ -213,7 +213,7 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& a wxPoint pos1, pos2; int color = ReturnLayerColor( LAYER_DEVICE ); - int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); + int linewidth = MAX( m_Width, g_DrawMinimunLineWidth ); if( aColor < 0 ) // Used normal color or selected color { @@ -226,7 +226,7 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& a pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; pos2 = TransformCoordinate( aTransformMatrix, m_End ) + aOffset; - GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, LineWidth, color ); + GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, linewidth, color ); } @@ -240,7 +240,7 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, wxPoint pos1; int color = ReturnLayerColor( LAYER_DEVICE ); - int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); + int linewidth = MAX( m_Width, g_DrawMinimunLineWidth ); static int* Buf_Poly_Drawings = NULL; // Buffer used to store current corners coordinates for drawings static int Buf_Poly_Size = 0; // Buffer used to store current corners coordinates for drawings @@ -282,14 +282,14 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, if( fill == FILLED_WITH_BG_BODYCOLOR ) GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount, - Buf_Poly_Drawings, 1, LineWidth, color, + Buf_Poly_Drawings, 1, linewidth, color, ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE ) GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount, - Buf_Poly_Drawings, 1, LineWidth, color, color ); + Buf_Poly_Drawings, 1, linewidth, color, color ); else GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount, - Buf_Poly_Drawings, 0, LineWidth, color, color ); + Buf_Poly_Drawings, 0, linewidth, color, color ); } @@ -297,5 +297,46 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, int aDrawMode, void* aData, int aTransformMatrix[2][2] ) /*************************************************************************************************/ +/* if aData not NULL, adat must point a wxString which is used instead of the m_Text +*/ { + wxPoint text_pos; + + int color = aColor; + int linewidth = MAX( m_Width, g_DrawMinimunLineWidth ); + + if( aColor < 0 ) // Used normal color or selected color + { + if( (m_Selected & IS_SELECTED) ) + color = g_ItemSelectetColor; + } + else + color = aColor; + + if( color < 0 ) + { + switch( m_FieldId ) + { + case REFERENCE: + color = ReturnLayerColor( LAYER_REFERENCEPART ); + break; + + case VALUE: + color = ReturnLayerColor( LAYER_VALUEPART ); + break; + + default: + color = ReturnLayerColor( LAYER_FIELDS ); + break; + } + } + text_pos = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; + + wxString * text = aData ? (wxString *) aData : &m_Text; + GRSetDrawMode( aDC, aDrawMode ); + DrawGraphicText( aPanel, aDC, text_pos, + color, text->GetData(), + m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, + m_Size, + m_HJustify, m_VJustify, linewidth ); } diff --git a/eeschema/classes_body_items.h b/eeschema/classes_body_items.h index 86d61aa127..db6c333316 100644 --- a/eeschema/classes_body_items.h +++ b/eeschema/classes_body_items.h @@ -381,18 +381,21 @@ public: /* Fields , same as component fields. * can be defined in libraries (mandatory for ref and value, ca be useful for footprints) * 2 Fields are always defined : - * Prefix (U, IC..) with gives the reference in scxhematic) + * Prefix (U, IC..) with gives the reference in schematic) * Name (74LS00..) used to find the component in libraries, and give the default value in schematic */ class LibDrawField : public LibEDA_BaseStruct { public: - int m_FieldId; // 0 a 11 - // 0 = Name; 1 = Valeur; 2 .. 11 other fields + int m_FieldId; /* 0 a 11 + * 0 = Reference; 1 = Value + * 2 = Default footprint, 3 = subsheet (not used, reserved) + * .. 11 other fields + */ wxSize m_Size; int m_Orient; /* Orientation */ int m_Attributs; /* Attributes (Non visible ...) */ - int m_HJustify, m_VJustify; /* Horiz an Vert Texte Justifications */ + int m_HJustify, m_VJustify; /* Horiz and Vert Text Justifications */ wxString m_Text; /* Field Data */ wxString m_Name; /* Field Name */ diff --git a/eeschema/component_class.cpp b/eeschema/component_class.cpp index 96d341e20e..9f37e6967b 100644 --- a/eeschema/component_class.cpp +++ b/eeschema/component_class.cpp @@ -368,7 +368,7 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const /**************************************************************************/ -void PartTextStruct::SwapData( PartTextStruct* copyitem ) +void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem ) /**************************************************************************/ /* Used if undo / redo command: @@ -800,7 +800,7 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) /***************************************************************************/ -PartTextStruct::PartTextStruct( const wxPoint& pos, const wxString& text ) : +SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& pos, const wxString& text ) : SCH_ITEM( NULL, DRAW_PART_TEXT_STRUCT_TYPE ), EDA_TextStruct( text ) /***************************************************************************/ @@ -812,14 +812,14 @@ PartTextStruct::PartTextStruct( const wxPoint& pos, const wxString& text ) : /************************************/ -PartTextStruct::~PartTextStruct() +SCH_CMP_FIELD::~SCH_CMP_FIELD() /************************************/ { } /***********************************************************/ -void PartTextStruct::PartTextCopy( PartTextStruct* target ) +void SCH_CMP_FIELD::PartTextCopy( SCH_CMP_FIELD* target ) /***********************************************************/ { target->m_Text = m_Text; @@ -838,7 +838,7 @@ void PartTextStruct::PartTextCopy( PartTextStruct* target ) /*********************************/ -bool PartTextStruct::IsVoid() +bool SCH_CMP_FIELD::IsVoid() /*********************************/ /* return True if The field is void, i.e.: @@ -852,7 +852,7 @@ bool PartTextStruct::IsVoid() /********************************************/ -EDA_Rect PartTextStruct::GetBoundaryBox() const +EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const /********************************************/ /* return @@ -966,7 +966,7 @@ EDA_Rect PartTextStruct::GetBoundaryBox() const * @param aFile The FILE to write to. * @return bool - true if success writing else false. */ -bool PartTextStruct::Save( FILE* aFile ) const +bool SCH_CMP_FIELD::Save( FILE* aFile ) const { char hjustify = 'C'; @@ -1113,7 +1113,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) { - const PartTextStruct* field = &m_Field[ii]; + const SCH_CMP_FIELD* field = &m_Field[ii]; if( field->m_Text.IsEmpty() ) continue; if( !field->Save( f ) ) diff --git a/eeschema/component_class.h b/eeschema/component_class.h index fd53f89284..ce9a1b5202 100644 --- a/eeschema/component_class.h +++ b/eeschema/component_class.h @@ -37,7 +37,7 @@ enum NumFieldType { * component fields are texts attached to the component (not the graphic texts) * There are 2 major fields : Reference and Value */ -class PartTextStruct : public SCH_ITEM, +class SCH_CMP_FIELD : public SCH_ITEM, public EDA_TextStruct { public: @@ -47,21 +47,21 @@ public: bool m_AddExtraText; // Mainly for REFERENCE, add extar info (for REFERENCE: add part selection text public: - PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); - ~PartTextStruct(); + SCH_CMP_FIELD( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); + ~SCH_CMP_FIELD(); virtual wxString GetClass() const { - return wxT( "PartTextStruct" ); + return wxT( "SCH_CMP_FIELD" ); } - void PartTextCopy( PartTextStruct* target ); + void PartTextCopy( SCH_CMP_FIELD* target ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); EDA_Rect GetBoundaryBox() const; bool IsVoid(); - void SwapData( PartTextStruct* copyitem ); + void SwapData( SCH_CMP_FIELD* copyitem ); /** * Function Draw @@ -98,7 +98,7 @@ public: wxString m_PrefixString; /* C, R, U, Q etc - the first character which typically indicates what the component is. * determined, upon placement, from the library component. * determined, upon file load, by the first non-digits in the reference fields. */ - PartTextStruct m_Field[NUMBER_OF_FIELDS]; + SCH_CMP_FIELD m_Field[NUMBER_OF_FIELDS]; int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */ int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */ diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 039b7dd5f1..9b6ba2eb92 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -167,7 +167,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), FIELDCMPITEM ); if( DrawStruct ) { - PartTextStruct* Field = (PartTextStruct*) DrawStruct; + SCH_CMP_FIELD* Field = (SCH_CMP_FIELD*) DrawStruct; LibItem = (SCH_COMPONENT*) Field->m_Parent; LibItem->Display_Infos( this ); diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index f43e9351fa..bcfbe55eea 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -22,7 +22,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC ); static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); /* variables locales */ -static PartTextStruct* CurrentField; +static SCH_CMP_FIELD* CurrentField; static int Multiflag; static int TextFieldSize = DEFAULT_SIZE_TEXT; static wxPoint OldPos; @@ -439,7 +439,7 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent& /************************************************************************************/ -void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC ) +void WinEDA_SchematicFrame::StartMoveCmpField( SCH_CMP_FIELD* Field, wxDC* DC ) /************************************************************************************/ /* Prepare le deplacement du texte en cours d'edition @@ -508,7 +508,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC ) /**********************************************************************************/ -void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC ) +void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC ) /**********************************************************************************/ /* Edit the field Field (text, size) */ { @@ -654,7 +654,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC ) /*********************************************************************************/ -void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC ) +void WinEDA_SchematicFrame::RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC ) /*********************************************************************************/ { int FieldNumber, flag; @@ -698,7 +698,7 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC ) /*********************************************************************/ -void PartTextStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) +void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) /*********************************************************************/ { int FieldNumber; @@ -790,7 +790,7 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC ) if( Entry == NULL ) return; - PartTextStruct* TextField = &Cmp->m_Field[VALUE]; + SCH_CMP_FIELD* TextField = &Cmp->m_Field[VALUE]; msg = TextField->m_Text; if( Get_Message( _( "Value" ), msg, this ) ) @@ -827,7 +827,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC if( Entry == NULL ) return; - PartTextStruct* TextField = &Cmp->m_Field[FOOTPRINT]; + SCH_CMP_FIELD* TextField = &Cmp->m_Field[FOOTPRINT]; msg = TextField->m_Text; if(msg.IsEmpty() ) diff --git a/eeschema/eelibs_draw_components.cpp b/eeschema/eelibs_draw_components.cpp index ea5839b944..ab4f91527c 100644 --- a/eeschema/eelibs_draw_components.cpp +++ b/eeschema/eelibs_draw_components.cpp @@ -90,7 +90,7 @@ static void CreateDummyCmp() /*************************************************************/ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, EDA_LibComponentStruct* LibEntry, - int posX, int posY, + const wxPoint & aOffset, int Multi, int convert, int DrawMode, int Color ) /**************************************************************/ @@ -116,7 +116,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, TransMat[0][0] = 1; TransMat[1][1] = -1; TransMat[1][0] = TransMat[0][1] = 0; - DrawLibPartAux( panel, DC, NULL, LibEntry, wxPoint( posX, posY ), + DrawLibPartAux( panel, DC, NULL, LibEntry, aOffset, TransMat, Multi, convert, DrawMode, Color ); @@ -132,28 +132,15 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, else color = UNVISIBLE_COLOR; } - else - { - if( Color >= 0 ) - color = Color; - else - color = ReturnLayerColor( LAYER_REFERENCEPART ); - } + else color = Color; 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; - int LineWidth = MAX( LibEntry->m_Prefix.m_Width, g_DrawMinimunLineWidth ); if( (LibEntry->m_Prefix.m_Flags & IS_MOVED) == 0 ) - 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, LineWidth ); + LibEntry->m_Prefix.Draw( panel, DC, aOffset, color, DrawMode, &Prefix, TransMat ); if( LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE ) { @@ -162,23 +149,10 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, else color = UNVISIBLE_COLOR; } - else - { - if( Color >= 0 ) - color = Color; - else - color = ReturnLayerColor( LAYER_VALUEPART ); - } + else color = Color; - text_pos.x = LibEntry->m_Name.m_Pos.x + posX; - text_pos.y = posY - LibEntry->m_Name.m_Pos.y; - LineWidth = MAX( LibEntry->m_Name.m_Width, g_DrawMinimunLineWidth ); if( (LibEntry->m_Name.m_Flags & IS_MOVED) == 0 ) - 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, LineWidth ); + LibEntry->m_Name.Draw( panel, DC, aOffset, color, DrawMode, NULL, TransMat ); for( Field = LibEntry->Fields; Field != NULL; Field = (LibDrawField*) Field->Pnext ) { @@ -193,28 +167,14 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, 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; - LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth ); - 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, LineWidth ); + else color = Color; + Field->Draw( panel, DC, aOffset, color, DrawMode, NULL, TransMat ); } // Trace de l'ancre int len = 3 * panel->GetZoom(); - GRLine( &panel->m_ClipBox, DC, posX, posY - len, posX, posY + len, 0, color ); - GRLine( &panel->m_ClipBox, DC, posX - len, posY, posX + len, posY, 0, color ); + GRLine( &panel->m_ClipBox, DC, aOffset.x, aOffset.y - len, aOffset.x, aOffset.y + len, 0, color ); + GRLine( &panel->m_ClipBox, DC, aOffset.x - len, aOffset.y, aOffset.x + len, aOffset.y, 0, color ); } @@ -272,7 +232,7 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, /***********************************************************/ -void PartTextStruct::Draw( WinEDA_DrawPanel* panel, +void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int DrawMode, diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index dc05b57b0b..79970511a7 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -198,7 +198,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg) DrawPanel->DrawBackGround(DC); if( CurrentLibEntry) - DrawLibEntry(DrawPanel, DC, CurrentLibEntry, 0, 0, + DrawLibEntry(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), CurrentUnit, CurrentConvert, GR_DEFAULT_DRAWMODE); DrawPanel->CursorOn(DC); // reaffichage curseur @@ -362,7 +362,7 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart() /****************************************************/ /* Routine to create a new library component If an old component is currently in edit, it is deleted. -*/ +*/ { wxString msg; EDA_LibComponentStruct * NewStruct; diff --git a/eeschema/locate.cpp b/eeschema/locate.cpp index 751399da46..b0abd4a660 100644 --- a/eeschema/locate.cpp +++ b/eeschema/locate.cpp @@ -422,7 +422,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask, if( SearchMask & FIELDCMPITEM ) { - PartTextStruct* Field; + SCH_CMP_FIELD* Field; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList; for( i = REFERENCE; i < NUMBER_OF_FIELDS; i++ ) { diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index 0aec369468..161fbeca42 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -365,7 +365,7 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) break; case DRAW_PART_TEXT_STRUCT_TYPE: - EditCmpFieldText( (PartTextStruct*) DrawStruct, DC ); + EditCmpFieldText( (SCH_CMP_FIELD*) DrawStruct, DC ); DrawPanel->MouseToCursorSchema(); break; diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 3b512b24f1..abba28b671 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -33,7 +33,7 @@ static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label ); static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel ); static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel ); static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ); -static void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field ); +static void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field ); static void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction, WinEDA_SchematicFrame* frame ); @@ -173,7 +173,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, case DRAW_PART_TEXT_STRUCT_TYPE: { - AddMenusForComponentField( PopMenu, (PartTextStruct*) DrawStruct ); + AddMenusForComponentField( PopMenu, (SCH_CMP_FIELD*) DrawStruct ); if( flags ) break; @@ -236,7 +236,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, /*************************************************************************/ -void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field ) +void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field ) /*************************************************************************/ /* Add menu commands for a component field (like value, reference) diff --git a/eeschema/plot.cpp b/eeschema/plot.cpp index 5708440a5f..498eb51c57 100644 --- a/eeschema/plot.cpp +++ b/eeschema/plot.cpp @@ -375,7 +375,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem, { wxPoint textpos; /* Position des textes */ - PartTextStruct* Field = &DrawLibItem->m_Field[FieldNumber]; + SCH_CMP_FIELD* Field = &DrawLibItem->m_Field[FieldNumber]; int hjustify, vjustify; int orient, color = -1; diff --git a/eeschema/protos.h b/eeschema/protos.h index e094d60242..9deb84a92a 100644 --- a/eeschema/protos.h +++ b/eeschema/protos.h @@ -35,11 +35,9 @@ void InstallCmpeditFrame(WinEDA_SchematicFrame * parent, wxPoint & pos, SCH_COMPONENT * m_Cmp); - /**************/ - /* EELIBS_.CPP */ - /**************/ - -/* Functions common to all EELibs?.c modules: */ + /******************************/ + /* EELIBS_DRAW_COMPONENTS.CPP */ + /******************************/ int LibraryEntryCompare(EDA_LibComponentStruct *LE1, EDA_LibComponentStruct *LE2); int NumOfLibraries(); EDA_LibComponentStruct *FindLibPart(const wxChar *Name, const wxString & LibName, int Alias); @@ -50,7 +48,7 @@ void DrawingLibInGhost(WinEDA_DrawPanel * panel, wxDC * DC, EDA_LibComponentStru int Color, bool DrawPinText); void DrawLibEntry(WinEDA_DrawPanel * panel, wxDC * DC, - EDA_LibComponentStruct *LibEntry, int posX, int posY, + EDA_LibComponentStruct *LibEntry, const wxPoint & aOffset, int Multi, int convert, int DrawMode, int Color = -1); diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index a2ebf17029..e5acc1519a 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -311,11 +311,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ROTATE_FIELD: DrawPanel->MouseToCursorSchema(); - RotateCmpField( (PartTextStruct*) screen->GetCurItem(), &dc ); + RotateCmpField( (SCH_CMP_FIELD*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_EDIT_FIELD: - EditCmpFieldText( (PartTextStruct*) screen->GetCurItem(), &dc ); + EditCmpFieldText( (SCH_CMP_FIELD*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_DELETE_NODE: @@ -770,7 +770,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC ) break; case DRAW_PART_TEXT_STRUCT_TYPE: - StartMoveCmpField( (PartTextStruct*) DrawStruct, DC ); + StartMoveCmpField( (SCH_CMP_FIELD*) DrawStruct, DC ); break; case DRAW_MARKER_STRUCT_TYPE: diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index c87bd27c58..c8efdb5aeb 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -710,7 +710,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC ) MoveLibDrawItemAt( CurrentDrawItem, pos ); } - DrawLibEntry( DrawPanel, DC, CurrentLibEntry, 0, 0, CurrentUnit, + DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), CurrentUnit, CurrentConvert, GR_DEFAULT_DRAWMODE ); CurrentDrawItem->m_Flags = 0; diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index 2a85465d4e..2fa4fee969 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -321,7 +321,7 @@ wxString Msg; LibEntry->m_Name.m_Text = CmpName; if ( g_ViewUnit < 1 ) g_ViewUnit = 1; if ( g_ViewConvert < 1 ) g_ViewConvert = 1; - DrawLibEntry(DrawPanel, DC, LibEntry, 0, 0, + DrawLibEntry(DrawPanel, DC, LibEntry, wxPoint(0, 0), g_ViewUnit, g_ViewConvert, GR_DEFAULT_DRAWMODE); LibEntry->m_Name.m_Text = RealName; } @@ -330,7 +330,7 @@ wxString Msg; else { Msg.Printf( _("Current Part: <%s>"), ViewCmpEntry->m_Name.m_Text.GetData()); - DrawLibEntry(DrawPanel, DC, LibEntry, 0, 0, + DrawLibEntry(DrawPanel, DC, LibEntry, wxPoint(0, 0), g_ViewUnit, g_ViewConvert, GR_DEFAULT_DRAWMODE); } AfficheDoc(this, ViewCmpEntry->m_Doc, ViewCmpEntry->m_KeyWord); diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 42dcc85b0a..725d062953 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -10,6 +10,22 @@ class DrawPickedStruct; class SCH_ITEM; class DrawNoConnectStruct; +class LibraryStruct; +class EDA_LibComponentStruct; +class LibEDA_BaseStruct; +class EDA_BaseStruct; +class DrawBusEntryStruct; +class SCH_GLOBALLABEL; +class SCH_TEXT; +class EDA_DrawLineStruct; +class DrawSheetStruct; +class DrawSheetPath; +class Hierarchical_PIN_Sheet_Struct; +class SCH_COMPONENT; +class LibDrawField; +class SCH_CMP_FIELD; +class LibDrawPin; +class DrawJunctionStruct; /*******************************/ /* class WinEDA_SchematicFrame */ @@ -276,9 +292,9 @@ private: void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC ); void EditComponentFootprint( SCH_COMPONENT* DrawLibItem, wxDC* DC ); - void StartMoveCmpField( PartTextStruct* Field, wxDC* DC ); - void EditCmpFieldText( PartTextStruct* Field, wxDC* DC ); - void RotateCmpField( PartTextStruct* Field, wxDC* DC ); + void StartMoveCmpField( SCH_CMP_FIELD* Field, wxDC* DC ); + void EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC ); + void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC ); /* Operations sur bloc */ void PasteStruct( wxDC* DC ); diff --git a/include/wxstruct.h b/include/wxstruct.h index af711c017b..cd09a373ac 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -65,22 +65,6 @@ class WinEDAChoiceBox; #define WinEDA_MenuItem wxMenuItem // Used but not defined here: -class LibraryStruct; -class EDA_LibComponentStruct; -class LibEDA_BaseStruct; -class EDA_BaseStruct; -class DrawBusEntryStruct; -class SCH_GLOBALLABEL; -class SCH_TEXT; -class EDA_DrawLineStruct; -class DrawSheetStruct; -class DrawSheetPath; -class Hierarchical_PIN_Sheet_Struct; -class SCH_COMPONENT; -class LibDrawField; -class PartTextStruct; -class LibDrawPin; -class DrawJunctionStruct; class DRAWSEGMENT; class WinEDA3D_DrawFrame; class PARAM_CFG_BASE; diff --git a/libs.win b/libs.win index a277212084..ae69883bf1 100644 --- a/libs.win +++ b/libs.win @@ -24,7 +24,7 @@ ifndef WXWIN ifeq ($(DEBUG), 1) WXWIN=f:/wxMSW-2.8.9-debug else -WXWIN=f:/wxMSW-2.8.9-rc1 +WXWIN=f:/wxMSW-2.8.9 endif endif LIBVERSION = 2.8