Commit 1886082f authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema: Erc dialog: enhancement. Now not modal.

Pcbnew: Drc dialog: fix a old very minor bug.
Added: single click on an item in marker list moves the board  graphic cursor on the corresponding marker location on the board
Double clicking is not modified.
parent 4a26d543
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
@@ -41,7 +41,6 @@
#include <sch_marker.h>
#include <sch_sheet.h>
#include <lib_pin.h>
#include <protos.h>

#include <dialog_erc.h>
#include <dialog_erc_listbox.h>
@@ -67,6 +66,10 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
    Centre();
}

DIALOG_ERC::~DIALOG_ERC()
{
}


void DIALOG_ERC::Init()
{
@@ -101,8 +104,6 @@ void DIALOG_ERC::Init()
    m_buttonERC->SetDefault();
}


/* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS */
/* Delete the old ERC markers, over the whole hierarchy
 */
void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
@@ -115,10 +116,16 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
}


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

void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& event )
{
    Destroy();
}


@@ -179,6 +186,9 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxCommandEvent& event )
    if( notFound ) // Error
    {
        wxMessageBox( _( "Marker not found" ) );

        // The marker was deleted, so rebuild marker list
        DisplayERC_MarkersList();
        return;
    }

@@ -210,8 +220,9 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxCommandEvent& event )
        // ( the button is released after closing this dialog and will generate
        // an unwanted event in  parent frame)
        m_parent->SkipNextLeftButtonReleaseEvent();
        EndModal( 1 );
    }

    Close();
}


+5 −12
Original line number Diff line number Diff line
@@ -39,25 +39,18 @@ private:
    static bool     m_writeErcFile;

public:

    /// Constructors
    DIALOG_ERC( SCH_EDIT_FRAME* parent );
    ~DIALOG_ERC();

private:
    void Init();

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERC_CMP
    // from DIALOG_ERC_BASE:
	void OnCloseErcDialog( wxCloseEvent& event );
    void OnErcCmpClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ERASE_DRC_MARKERS
    void OnEraseDrcMarkersClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
    void OnCancelClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RESET_MATRIX
    void OnButtonCloseClick( wxCommandEvent& event );
    void OnResetMatrixClick( wxCommandEvent& event );

    // Single click on a marker info:
    void OnLeftClickMarkersList( wxCommandEvent& event );

    // Double click on a marker info:
+3 −2
Original line number Diff line number Diff line
@@ -10,9 +10,10 @@
///////////////////////////////////////////////////////////////////////////

BEGIN_EVENT_TABLE( DIALOG_ERC_BASE, DIALOG_SHIM )
	EVT_CLOSE( DIALOG_ERC_BASE::_wxFB_OnCloseErcDialog )
	EVT_BUTTON( ID_ERC_CMP, DIALOG_ERC_BASE::_wxFB_OnErcCmpClick )
	EVT_BUTTON( ID_ERASE_DRC_MARKERS, DIALOG_ERC_BASE::_wxFB_OnEraseDrcMarkersClick )
	EVT_BUTTON( wxID_CANCEL, DIALOG_ERC_BASE::_wxFB_OnCancelClick )
	EVT_BUTTON( wxID_CANCEL, DIALOG_ERC_BASE::_wxFB_OnButtonCloseClick )
	EVT_LISTBOX( ID_MAKER_HTMLLISTBOX, DIALOG_ERC_BASE::_wxFB_OnLeftClickMarkersList )
	EVT_LISTBOX_DCLICK( ID_MAKER_HTMLLISTBOX, DIALOG_ERC_BASE::_wxFB_OnLeftDblClickMarkersList )
	EVT_BUTTON( ID_RESET_MATRIX, DIALOG_ERC_BASE::_wxFB_OnResetMatrixClick )
@@ -106,7 +107,7 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
	bercSizer->Add( m_textMarkers, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	
	m_MarkersList = new ERC_HTML_LISTBOX( m_PanelERC, ID_MAKER_HTMLLISTBOX, wxDefaultPosition, wxDefaultSize, 0, NULL, 0|wxSIMPLE_BORDER ); 
	m_MarkersList->SetMinSize( wxSize( 450,250 ) );
	m_MarkersList->SetMinSize( wxSize( 500,250 ) );
	
	bercSizer->Add( m_MarkersList, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
+3 −3
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@
            <event name="OnAuiPaneRestore"></event>
            <event name="OnAuiRender"></event>
            <event name="OnChar"></event>
            <event name="OnClose"></event>
            <event name="OnClose">OnCloseErcDialog</event>
            <event name="OnEnterWindow"></event>
            <event name="OnEraseBackground"></event>
            <event name="OnHibernate"></event>
@@ -1335,7 +1335,7 @@
                                                            <property name="window_extra_style"></property>
                                                            <property name="window_name"></property>
                                                            <property name="window_style"></property>
                                                            <event name="OnButtonClick">OnCancelClick</event>
                                                            <event name="OnButtonClick">OnButtonCloseClick</event>
                                                            <event name="OnChar"></event>
                                                            <event name="OnEnterWindow"></event>
                                                            <event name="OnEraseBackground"></event>
@@ -1486,7 +1486,7 @@
                                            <property name="maximum_size"></property>
                                            <property name="min_size"></property>
                                            <property name="minimize_button">0</property>
                                            <property name="minimum_size">450,250</property>
                                            <property name="minimum_size">500,250</property>
                                            <property name="moveable">1</property>
                                            <property name="name">m_MarkersList</property>
                                            <property name="pane_border">1</property>
+14 −12
Original line number Diff line number Diff line
@@ -43,9 +43,10 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
	private:
		
		// Private event handlers
		void _wxFB_OnCloseErcDialog( wxCloseEvent& event ){ OnCloseErcDialog( event ); }
		void _wxFB_OnErcCmpClick( wxCommandEvent& event ){ OnErcCmpClick( event ); }
		void _wxFB_OnEraseDrcMarkersClick( wxCommandEvent& event ){ OnEraseDrcMarkersClick( event ); }
		void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
		void _wxFB_OnButtonCloseClick( wxCommandEvent& event ){ OnButtonCloseClick( event ); }
		void _wxFB_OnLeftClickMarkersList( wxCommandEvent& event ){ OnLeftClickMarkersList( event ); }
		void _wxFB_OnLeftDblClickMarkersList( wxCommandEvent& event ){ OnLeftDblClickMarkersList( event ); }
		void _wxFB_OnResetMatrixClick( wxCommandEvent& event ){ OnResetMatrixClick( event ); }
@@ -81,9 +82,10 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
		wxPanel* m_matrixPanel;
		
		// Virtual event handlers, overide them in your derived class
		virtual void OnCloseErcDialog( wxCloseEvent& event ) { event.Skip(); }
		virtual void OnErcCmpClick( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnEraseDrcMarkersClick( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnLeftClickMarkersList( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnLeftDblClickMarkersList( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnResetMatrixClick( wxCommandEvent& event ) { event.Skip(); }
Loading