Commit 4aa28d82 authored by Mark Roszko's avatar Mark Roszko Committed by Wayne Stambaugh
Browse files

Eeschema dialog improvements.

* Use the proper verb Annotate in the Annotate dialog for the action button
* Used the proper verb Generate in the Netlist dialog for the action button
* Fix ERC dialog title to be "Electrical Rules Checker".
* Fix all usages of "Erc" to "ERC" consistently in ERC dialog.
* Move action buttons to bottom of ERC dialog and change Del Markers to
  Delete Markers.
* Add tooltips to ERC options matrix buttons to indicate their current state.
* Cleanup ERC options code that for some reason decided to delete the button
  and recreate it instead of just updating it's bitmap directly.
* Rename "Test ERC" to "Run" to describe what it's actually doing properly
parents b8d1789a c29ee59c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Jun  6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -205,7 +205,7 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con
	m_btnClear = new wxButton( this, ID_CLEAR_ANNOTATION_CMP, _("Clear Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
	bButtonsSizer->Add( m_btnClear, 0, wxALL|wxEXPAND, 5 );
	
	m_btnApply = new wxButton( this, wxID_APPLY, _("Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
	m_btnApply = new wxButton( this, wxID_APPLY, _("Annotate"), wxDefaultPosition, wxDefaultSize, 0 );
	bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 );
	
	
+5 −3
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
    <FileVersion major="1" minor="11" />
    <FileVersion major="1" minor="13" />
    <object class="Project" expanded="1">
        <property name="class_decoration"></property>
        <property name="code_generation">C++</property>
@@ -20,8 +20,10 @@
        <property name="path">.</property>
        <property name="precompiled_header"></property>
        <property name="relative_path">1</property>
        <property name="skip_lua_events">1</property>
        <property name="skip_php_events">1</property>
        <property name="skip_python_events">1</property>
        <property name="ui_table">UI</property>
        <property name="use_enum">0</property>
        <property name="use_microsoft_bom">0</property>
        <object class="Dialog" expanded="1">
@@ -42,7 +44,7 @@
            <property name="minimum_size"></property>
            <property name="name">DIALOG_ANNOTATE_BASE</property>
            <property name="pos"></property>
            <property name="size">432,454</property>
            <property name="size">432,550</property>
            <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
            <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
            <property name="title">Annotate Schematic</property>
@@ -2398,7 +2400,7 @@
                                        <property name="gripper">0</property>
                                        <property name="hidden">0</property>
                                        <property name="id">wxID_APPLY</property>
                                        <property name="label">Annotation</property>
                                        <property name="label">Annotate</property>
                                        <property name="max_size"></property>
                                        <property name="maximize_button">0</property>
                                        <property name="maximum_size"></property>
+4 −2
Original line number Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Jun  6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;

#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@@ -81,7 +83,7 @@ class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM
	
	public:
		
		DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Annotate Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 432,454 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 
		DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Annotate Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 432,550 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 
		~DIALOG_ANNOTATE_BASE();
	
};
+56 −54
Original line number Diff line number Diff line
@@ -88,18 +88,7 @@ void DIALOG_ERC::Init()
    m_WriteResultOpt->SetValue( m_writeErcFile );

    SCH_SCREENS screens;
    int markers = screens.GetMarkerCount();
    int warnings = screens.GetMarkerCount( WAR );

    wxString num;
    num.Printf( wxT( "%d" ), markers );
    m_TotalErrCount->SetLabel( num );

    num.Printf( wxT( "%d" ), markers - warnings );
    m_LastErrCount->SetLabel( num );

    num.Printf( wxT( "%d" ), warnings );
    m_LastWarningCount->SetLabel( num );
    updateMarkerCounts( &screens );

    DisplayERC_MarkersList();

@@ -110,6 +99,22 @@ void DIALOG_ERC::Init()
    m_buttonERC->SetDefault();
}

void DIALOG_ERC::updateMarkerCounts( SCH_SCREENS *screens )
{
    int markers = screens->GetMarkerCount();
    int warnings = screens->GetMarkerCount( WAR );

    wxString num;
    num.Printf( wxT( "%d" ), markers );
    m_TotalErrCount->SetValue( num );

    num.Printf( wxT( "%d" ), markers - warnings );
    m_LastErrCount->SetValue( num );

    num.Printf( wxT( "%d" ), warnings );
    m_LastWarningCount->SetValue( num );
}

/* Delete the old ERC markers, over the whole hierarchy
 */
void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
@@ -117,6 +122,8 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
    SCH_SCREENS ScreenList;

    ScreenList.DeleteAllMarkers( MARK_ERC );
    updateMarkerCounts( &ScreenList );

    m_MarkersList->ClearList();
    m_parent->GetCanvas()->Refresh();
}
@@ -289,34 +296,49 @@ void DIALOG_ERC::ReBuildMatrixPanel()
            }

            int event_id = ID_MATRIX_0 + ii + ( jj * PIN_NMAX );
            BITMAP_DEF bitmap_butt = erc_green_xpm;

            delete m_buttonList[ii][jj];
            m_buttonList[ii][jj] = new wxBitmapButton( m_matrixPanel,
                                                       event_id,
                                                       KiBitmap( bitmap_butt ),
                                                       wxPoint( x, y ) );
            setDRCMatrixButtonState( m_buttonList[ii][jj], diag );
        }
    }

    m_initialized = true;
}


void DIALOG_ERC::setDRCMatrixButtonState( wxBitmapButton *aButton, int aState )
{
    BITMAP_DEF bitmap_butt = NULL;
    wxString tooltip;

            // Add button on matrix
            switch( diag )
    switch( aState )
    {
    case OK:
        bitmap_butt = erc_green_xpm;
        tooltip = _("No error or warning");
        break;

    case WAR:
        bitmap_butt = ercwarn_xpm;
        tooltip = _("Generate warning");
        break;

            default:
    case ERR:
        bitmap_butt = ercerr_xpm;
        tooltip = _("Generate error");
        break;
    }
    
            delete m_buttonList[ii][jj];
            m_buttonList[ii][jj] = new wxBitmapButton( m_matrixPanel,
                                                       event_id,
                                                       KiBitmap( bitmap_butt ),
                                                       wxPoint( x, y ) );
        }
    if( bitmap_butt )
    {
        aButton->SetBitmap(KiBitmap( bitmap_butt ));
        aButton->SetToolTip(tooltip);
    }

    m_initialized = true;
}


@@ -359,7 +381,6 @@ void DIALOG_ERC::ResetDefaultERCDiag( wxCommandEvent& event )
void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
{
    int             id, level, ii, x, y;
    BITMAP_DEF      new_bitmap_butt = NULL;
    wxPoint         pos;

    id   = event.GetId();
@@ -371,34 +392,26 @@ void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )

    level = DiagErc[y][x];

    //change to the next error level
    switch( level )
    {
    case OK:
        level = WAR;
        new_bitmap_butt = ercwarn_xpm;
        break;

    case WAR:
        level = ERR;
        new_bitmap_butt = ercerr_xpm;
        break;

    case ERR:
        level = OK;
        new_bitmap_butt = erc_green_xpm;
        break;
    }

    if( new_bitmap_butt )
    {
        delete butt;
        butt = new wxBitmapButton( m_matrixPanel, id,
                                   KiBitmap( new_bitmap_butt ), pos );
    setDRCMatrixButtonState( butt, level);

        m_buttonList[y][x] = butt;
    DiagErc[y][x] = DiagErc[x][y] = level;
}
}


void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
@@ -515,18 +528,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
    }

    // Displays global results:
    wxString num;
    int markers = screens.GetMarkerCount();
    int warnings = screens.GetMarkerCount( WAR );

    num.Printf( wxT( "%d" ), markers );
    m_TotalErrCount->SetLabel( num );

    num.Printf( wxT( "%d" ), markers - warnings );
    m_LastErrCount->SetLabel( num );

    num.Printf( wxT( "%d" ), warnings );
    m_LastWarningCount->SetLabel( num );
    updateMarkerCounts(&screens);

    // Display diags:
    DisplayERC_MarkersList();
+2 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@ private:
    void ResetDefaultERCDiag( wxCommandEvent& event );
    void ChangeErrorLevel( wxCommandEvent& event );
    void ReBuildMatrixPanel();
    void setDRCMatrixButtonState( wxBitmapButton *aButton, int aState );
    void updateMarkerCounts( SCH_SCREENS *screens );
};


Loading