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.
This commit is contained in:
jean-pierre charras 2012-12-10 20:08:09 +01:00
parent 4a26d543d5
commit 1886082fce
11 changed files with 85 additions and 44 deletions

View File

@ -1,9 +1,9 @@
/*
* 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();
}

View File

@ -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:

View File

@ -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 );

View File

@ -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>

View File

@ -41,16 +41,17 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
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 ); }
protected:
enum
{
@ -59,7 +60,7 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
ID_MAKER_HTMLLISTBOX,
ID_RESET_MATRIX
};
wxNotebook* m_NoteBook;
wxPanel* m_PanelERC;
wxStaticText* m_ErcTotalErrorsText;
@ -79,21 +80,22 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
wxPanel* m_PanelERCOptions;
wxButton* m_ResetOptButton;
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(); }
public:
DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EESchema Erc"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 519,392 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EESchema Erc"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 519,392 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_ERC_BASE();
};
#endif //__DIALOG_ERC_BASE_H__

View File

@ -616,8 +616,8 @@ void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
{
DIALOG_ERC* dlg = new DIALOG_ERC( this );
dlg->ShowModal();
dlg->Destroy();
dlg->Show( true );
// dlg->Destroy();
}

View File

@ -75,6 +75,8 @@ void DIALOG_DRC_CONTROL::InitValues()
AddUnitSymbol( *m_ViaMinTitle );
AddUnitSymbol( *m_MicroViaMinTitle );
m_DeleteCurrentMarkerButton->Enable( false );
/* this looks terrible! does not fit into text field, do it in wxformbuilder instead
m_SetClearance->SetValue( _("Netclasses values"));
*/
@ -493,6 +495,15 @@ void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event )
}
}
/* called when switching from Error list to Unconnected list
* To avoid mistakes, the current marker is selection is cleared
*/
void DIALOG_DRC_CONTROL::OnChangingMarkerList( wxNotebookEvent& event )
{
m_DeleteCurrentMarkerButton->Enable( false );
m_ClearanceListBox->SetSelection( -1 );
m_UnconnectedListBox->SetSelection( -1 );
}
void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
{
@ -502,6 +513,12 @@ void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
{
// until a MARKER is selected, this button is not enabled.
m_DeleteCurrentMarkerButton->Enable( true );
// Find the selected DRC_ITEM in the listbox, position cursor there,
// at the first of the two pads.
const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
if( item )
m_Parent->CursorGoto( item->GetPointA(), false );
}
event.Skip();
@ -516,6 +533,12 @@ void DIALOG_DRC_CONTROL::OnUnconnectedSelectionEvent( wxCommandEvent& event )
{
// until a MARKER is selected, this button is not enabled.
m_DeleteCurrentMarkerButton->Enable( true );
// Find the selected DRC_ITEM in the listbox, position cursor there,
// at the first of the two pads.
const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
if( item )
m_Parent->CursorGoto( item->GetPointA(), false );
}
event.Skip();
@ -533,6 +556,7 @@ void DIALOG_DRC_CONTROL::DelDRCMarkers()
m_Parent->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker
m_ClearanceListBox->DeleteAllItems();
m_UnconnectedListBox->DeleteAllItems();
m_DeleteCurrentMarkerButton->Enable( false );
}

View File

@ -111,6 +111,7 @@ private:
void OnMarkerSelectionEvent( wxCommandEvent& event );
void OnUnconnectedSelectionEvent( wxCommandEvent& event );
void OnChangingMarkerList( wxNotebookEvent& event );
void DelDRCMarkers();
void RedrawDrawPanel();

View File

@ -199,9 +199,12 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
m_buttonListUnconnected->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnListUnconnectedClick ), NULL, this );
m_DeleteAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
m_DeleteCurrentMarkerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_Notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_CONTROL_BASE::OnChangingMarkerList ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickClearance ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnMarkerSelectionEvent ), NULL, this );
m_ClearanceListBox->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpClearance ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickUnconnected ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnUnconnectedSelectionEvent ), NULL, this );
m_UnconnectedListBox->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpUnconnected ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnOkClick ), NULL, this );
@ -216,9 +219,12 @@ DIALOG_DRC_CONTROL_BASE::~DIALOG_DRC_CONTROL_BASE()
m_buttonListUnconnected->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnListUnconnectedClick ), NULL, this );
m_DeleteAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
m_DeleteCurrentMarkerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
m_Notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_CONTROL_BASE::OnChangingMarkerList ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickClearance ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnMarkerSelectionEvent ), NULL, this );
m_ClearanceListBox->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpClearance ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnLeftDClickUnconnected ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnUnconnectedSelectionEvent ), NULL, this );
m_UnconnectedListBox->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL_BASE::OnRightUpUnconnected ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnOkClick ), NULL, this );

View File

@ -1826,7 +1826,7 @@
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnNotebookPageChanged"></event>
<event name="OnNotebookPageChanged">OnChangingMarkerList</event>
<event name="OnNotebookPageChanging"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
@ -1989,7 +1989,7 @@
<event name="OnLeftDClick">OnLeftDClickClearance</event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnListBox"></event>
<event name="OnListBox">OnMarkerSelectionEvent</event>
<event name="OnListBoxDClick"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
@ -2163,7 +2163,7 @@
<event name="OnLeftDClick">OnLeftDClickUnconnected</event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnListBox"></event>
<event name="OnListBox">OnUnconnectedSelectionEvent</event>
<event name="OnListBoxDClick"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>

View File

@ -77,9 +77,12 @@ class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
virtual void OnListUnconnectedClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteAllClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteOneClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnChangingMarkerList( wxNotebookEvent& event ) { event.Skip(); }
virtual void OnLeftDClickClearance( wxMouseEvent& event ) { event.Skip(); }
virtual void OnMarkerSelectionEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRightUpClearance( wxMouseEvent& event ) { event.Skip(); }
virtual void OnLeftDClickUnconnected( wxMouseEvent& event ) { event.Skip(); }
virtual void OnUnconnectedSelectionEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRightUpUnconnected( wxMouseEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }