Commit f7265b0a authored by charras's avatar charras
Browse files

Eeschema: better ERC diags (work in progress)

3D view: fixed: mirrored texts incorrectly drawn
parent 8355c3ad
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -483,6 +483,9 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
    s_Text3DZPos  = g_Parm_3D_Visu.m_LayerZcoord[layer];
    s_Text3DWidth = text->m_Width * g_Parm_3D_Visu.m_BoardScale;
    glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
    wxSize size = text->m_Size;
    if( text->m_Mirror )
        NEGATE(size.x);
    if( text->m_MultilineAllowed )
    {
        wxPoint        pos  = text->m_Pos;
@@ -496,7 +499,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
        {
            wxString txt = list->Item( i );
            DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color,
                     txt, text->m_Orient, text->m_Size,
                     txt, text->m_Orient, size,
                     text->m_HJustify, text->m_VJustify,
                     text->m_Width, text->m_Italic,
                     true,
@@ -508,7 +511,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
    }
    else
        DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
                     text->m_Text, text->m_Orient, text->m_Size,
                     text->m_Text, text->m_Orient, size,
                     text->m_HJustify, text->m_VJustify,
                     text->m_Width, text->m_Italic,
                     true,
+65 −28
Original line number Diff line number Diff line
@@ -328,7 +328,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
    ReAnnotateComponents( ComponentsList );

    /* Final control (just in case ... )*/
    CheckAnnotate( parent, !annotateSchematic );
    parent->CheckAnnotate( NULL, !annotateSchematic );
    parent->DrawPanel->Refresh( true );
}

@@ -631,9 +631,9 @@ static int ExistUnit( int aObjet, int Unit,
}


/*******************************************************************/
int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
/*******************************************************************/
/***************************************************************************************/
int WinEDA_SchematicFrame::CheckAnnotate( wxTextCtrl* aMessageList, bool aOneSheetOnly )
/***************************************************************************************/

/**
 * Function CheckAnnotate
@@ -644,7 +644,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
 *          part number > number of parts
 *          different values between parts
 * @return errors count
 * @param oneSheetOnly : true = search is made only in the current sheet
 * @param aMessageList = a wxTextCtrl to display merssages. If NULL, they are displyed in a wxMessageBox
 * @param aOneSheetOnly : true = search is made only in the current sheet
 *                       false = search in whole hierarchy (usual search).
 */
{
@@ -657,17 +658,15 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )

    std::vector <OBJ_CMP_TO_LIST> ComponentsList;

    g_RootSheet->m_AssociatedScreen->SetModify();

    /* Build the list of components */
    if( !oneSheetOnly )
    if( !aOneSheetOnly )
    {
        DrawSheetPath* sheet;
        for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
            AddComponentsInSheetToList( ComponentsList, sheet );
    }
    else
        AddComponentsInSheetToList( ComponentsList, frame->GetSheet() );
        AddComponentsInSheetToList( ComponentsList, GetSheet() );

    sort( ComponentsList.begin(), ComponentsList.end(), AnnotateByValue );

@@ -699,7 +698,13 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
                Buff.Printf( _( "( unit %d)" ), ComponentsList[ii].m_Unit );
                msg << Buff;
            }
            DisplayError( frame, msg );
            if( aMessageList )
            {
                aMessageList->AppendText( msg );
                aMessageList->AppendText( wxT( "\n" ) );
            }
            else
                DisplayError( NULL, msg );
            error++;
            break;
        }
@@ -719,7 +724,13 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
            Buff.Printf( _( " unit %d and no more than %d parts" ),
                         ComponentsList[ii].m_Unit, ComponentsList[ii].m_Entry->m_UnitCount );
            msg << Buff;
            DisplayError( frame, msg );
            if( aMessageList )
            {
                aMessageList->AppendText( msg );
                aMessageList->AppendText( wxT( "\n" ) );
            }
            else
                DisplayError( NULL, msg );
            error++;
            break;
        }
@@ -756,7 +767,13 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
                Buff.Printf( _( " (unit %d)" ), ComponentsList[ii].m_Unit );
                msg << Buff;
            }
            DisplayError( frame, msg );
            if( aMessageList )
            {
                aMessageList->AppendText( msg );
                aMessageList->AppendText( wxT( "\n" ) );
            }
            else
                DisplayError( NULL, msg );
            error++;
            continue;
        }
@@ -780,7 +797,13 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
                msg << Buff;
            }

            DisplayError( frame, msg );
            if( aMessageList )
            {
                aMessageList->AppendText( msg );
                aMessageList->AppendText( wxT( "\n" ) );
            }
            else
                DisplayError( NULL, msg );
            error++;
        }

@@ -811,7 +834,13 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
                       ComponentsList[next].m_Value->GetData() );
#endif

            DisplayError( frame, msg );
            if( aMessageList )
            {
                aMessageList->AppendText( msg );
                aMessageList->AppendText( wxT( "\n" ) );
            }
            else
                DisplayError( NULL, msg );
            error++;
        }
    }
@@ -836,7 +865,13 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
                    full_path.GetData(),
                    cmpref.GetData(), ComponentsList[ii].m_NumRef,
                    nextcmpref.GetData(), ComponentsList[ii + 1].m_NumRef );
        DisplayError( frame, msg );
        if( aMessageList )
        {
            aMessageList->AppendText( msg );
            aMessageList->AppendText( wxT( "\n" ) );
        }
        else
            DisplayError( NULL, msg );
        error++;
    }

@@ -906,9 +941,11 @@ int ReplaceDuplicatedTimeStamps()
        if( item->m_TimeStamp == nextitem->m_TimeStamp )
        {
            errcount++;

            // for a component, update its Time stamp and its paths (m_PathsAndReferences field)
            if( item->Type() == TYPE_SCH_COMPONENT )
                ( (SCH_COMPONENT*) item )->SetTimeStamp( GetTimeStamp() );

            // for a sheet, update only its time stamp (annotation of its components will be lost)
            // TODO: see how to change sheet paths for its cmp list (can be possible in most cases)
            else
+18 −5
Original line number Diff line number Diff line
@@ -966,18 +966,31 @@ int LibDrawPin::ReturnPinDrawOrient( const int TransMat[2][2] )


/** Function ReturnPinStringNum
 * fill the buffer with pin num as a wxString
 *  Pin num is coded as a long
 * fill a buffer with pin num as a wxString
 *  Pin num is coded as a long or 4 ascii chars
 *  Used to print/draw the pin num
 * @param aStringBuffer = the wxString to store the pin num as an unicode string
 */
void LibDrawPin::ReturnPinStringNum( wxString& buffer ) const
void LibDrawPin::ReturnPinStringNum( wxString& aStringBuffer ) const
{
    aStringBuffer = ReturnPinStringNum( m_PinNum );
}

/** Function ReturnPinStringNum (static function)
 *  Pin num is coded as a long or 4 ascii chars
 * @param aPinNum = a long containing a pin num
 * @return aStringBuffer = the wxString to store the pin num as an unicode string
 */
wxString LibDrawPin::ReturnPinStringNum( long aPinNum )
{
    char ascii_buf[5];

    memcpy( ascii_buf, &m_PinNum, 4 );
    memcpy( ascii_buf, &aPinNum, 4 );
    ascii_buf[4] = 0;

    buffer = CONV_FROM_UTF8( ascii_buf );
    wxString buffer = CONV_FROM_UTF8( ascii_buf );

    return buffer;
}


+16 −1
Original line number Diff line number Diff line
@@ -265,7 +265,22 @@ public:
    wxPoint      ReturnPinEndPoint();

    int ReturnPinDrawOrient( const int TransMat[2][2] );
    void         ReturnPinStringNum( wxString& buffer ) const;

    /** Function ReturnPinStringNum
     * fill a buffer with pin num as a wxString
     *  Pin num is coded as a long or 4 ascii chars
     *  Used to print/draw the pin num
     * @param aStringBuffer = the wxString to store the pin num as an unicode string
     */
    void         ReturnPinStringNum( wxString& aStringBuffer ) const;

    /** Function ReturnPinStringNum (static function)
     * Pin num is coded as a long or 4 ascii chars
     * @param aPinNum = a long containing a pin num
     * @return aStringBuffer = the wxString to store the pin num as an unicode string
     */
    static wxString         ReturnPinStringNum( long aPinNum );

    void         SetPinNumFromString( wxString& buffer );

    /** Function GetPenSize
+7 −17
Original line number Diff line number Diff line
@@ -60,14 +60,13 @@ void DIALOG_ERC::Init()
	num.Printf(wxT("%d"), g_EESchemaVar.NbWarningErc);
	m_LastWarningCount->SetLabel(num);

    DisplayERC_MarkersList( );

	// Init Panel Matrix
	ReBuildMatrixPanel();
}

/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
 */

/* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS */
void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
/* Delete the old ERC markers, over the whole hierarchy
 */
@@ -77,30 +76,21 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
    m_Parent->DrawPanel->Refresh();
}

/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
 */

/* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */
void DIALOG_ERC::OnCancelClick( wxCommandEvent& event )
{
    EndModal(0);
}


/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RESET_MATRIX
 */

/* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RESET_MATRIX */
void DIALOG_ERC::OnResetMatrixClick( wxCommandEvent& event )
{
	ResetDefaultERCDiag(event);
}


/*!
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERC_CMP
 */

/* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERC_CMP */
void DIALOG_ERC::OnErcCmpClick( wxCommandEvent& event )
{
    m_MessagesList->Clear();
@@ -113,7 +103,7 @@ void DIALOG_ERC::OnErcCmpClick( wxCommandEvent& event )
void DIALOG_ERC::ReBuildMatrixPanel()
/*********************************************/

/* Build or rebuild the panel showing the ERC matrix
/* Build or rebuild the panel showing the ERC confict matrix
 */
{
    int           ii, jj, event_id, text_height;
Loading