Cleanup.
This commit is contained in:
parent
077159ac13
commit
23033451b1
|
@ -87,10 +87,6 @@ public:
|
||||||
|
|
||||||
FOOTPRINT* GetFootprint( const wxString& aFootprintName, REPORTER& aReporter );
|
FOOTPRINT* GetFootprint( const wxString& aFootprintName, REPORTER& aReporter );
|
||||||
|
|
||||||
void SaveCopyInUndoList( EDA_ITEM*, UNDO_REDO ) override {}
|
|
||||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO ) override {}
|
|
||||||
void AppendCopyToUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO ) override {}
|
|
||||||
|
|
||||||
SELECTION& GetCurrentSelection() override;
|
SELECTION& GetCurrentSelection() override;
|
||||||
|
|
||||||
void ReloadFootprint( FOOTPRINT* aFootprint ) override;
|
void ReloadFootprint( FOOTPRINT* aFootprint ) override;
|
||||||
|
|
|
@ -92,7 +92,6 @@ public:
|
||||||
void CloseLibraryViewer( wxCommandEvent& event );
|
void CloseLibraryViewer( wxCommandEvent& event );
|
||||||
void ReCreateHToolbar() override;
|
void ReCreateHToolbar() override;
|
||||||
void ReCreateVToolbar() override;
|
void ReCreateVToolbar() override;
|
||||||
void ReCreateOptToolbar() override {}
|
|
||||||
|
|
||||||
void ClickOnLibList( wxCommandEvent& event );
|
void ClickOnLibList( wxCommandEvent& event );
|
||||||
void ClickOnSymbolList( wxCommandEvent& event );
|
void ClickOnSymbolList( wxCommandEvent& event );
|
||||||
|
|
|
@ -200,9 +200,9 @@ public:
|
||||||
|
|
||||||
void EraseMsgBox();
|
void EraseMsgBox();
|
||||||
|
|
||||||
virtual void ReCreateHToolbar() = 0;
|
virtual void ReCreateHToolbar() { };
|
||||||
virtual void ReCreateVToolbar() = 0;
|
virtual void ReCreateVToolbar() { };
|
||||||
virtual void ReCreateOptToolbar() = 0;
|
virtual void ReCreateOptToolbar() { };
|
||||||
virtual void ReCreateAuxiliaryToolbar() { }
|
virtual void ReCreateAuxiliaryToolbar() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -477,8 +477,6 @@ protected:
|
||||||
|
|
||||||
void setupUnits( APP_SETTINGS_BASE* aCfg );
|
void setupUnits( APP_SETTINGS_BASE* aCfg );
|
||||||
|
|
||||||
void doReCreateMenuBar() override { }
|
|
||||||
|
|
||||||
std::vector<wxWindow*> findDialogs();
|
std::vector<wxWindow*> findDialogs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -219,7 +219,6 @@ public:
|
||||||
void ShowSolderMask();
|
void ShowSolderMask();
|
||||||
|
|
||||||
// General
|
// General
|
||||||
virtual void ReCreateOptToolbar() override { }
|
|
||||||
virtual void ShowChangedLanguage() override;
|
virtual void ShowChangedLanguage() override;
|
||||||
virtual void UpdateStatusBar() override;
|
virtual void UpdateStatusBar() override;
|
||||||
|
|
||||||
|
@ -315,7 +314,7 @@ public:
|
||||||
* @param aItemToCopy is the board item modified by the command to undo.
|
* @param aItemToCopy is the board item modified by the command to undo.
|
||||||
* @param aTypeCommand is the command type (see enum #UNDO_REDO).
|
* @param aTypeCommand is the command type (see enum #UNDO_REDO).
|
||||||
*/
|
*/
|
||||||
virtual void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand ) = 0;
|
virtual void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand ) {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new entry in undo list of commands.
|
* Creates a new entry in undo list of commands.
|
||||||
|
@ -324,13 +323,13 @@ public:
|
||||||
* @param aTypeCommand is the command type (see enum #UNDO_REDO)
|
* @param aTypeCommand is the command type (see enum #UNDO_REDO)
|
||||||
*/
|
*/
|
||||||
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||||
UNDO_REDO aTypeCommand ) = 0;
|
UNDO_REDO aTypeCommand ) {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As SaveCopyInUndoList, but appends the changes to the last undo item on the stack.
|
* As SaveCopyInUndoList, but appends the changes to the last undo item on the stack.
|
||||||
*/
|
*/
|
||||||
virtual void AppendCopyToUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
virtual void AppendCopyToUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||||
UNDO_REDO aTypeCommand ) = 0;
|
UNDO_REDO aTypeCommand ) {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,8 +54,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||||
|
|
||||||
void doReCreateMenuBar() override {}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnPaint( wxPaintEvent& aEvent );
|
void OnPaint( wxPaintEvent& aEvent );
|
||||||
void OnOK( wxCommandEvent& aEvent );
|
void OnOK( wxCommandEvent& aEvent );
|
||||||
|
@ -66,13 +64,6 @@ private:
|
||||||
WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) override;
|
WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||||
COLOR_SETTINGS* GetColorSettings( bool aForceRefresh ) const override;
|
COLOR_SETTINGS* GetColorSettings( bool aForceRefresh ) const override;
|
||||||
|
|
||||||
// Required pure-virtual methods
|
|
||||||
void ReCreateHToolbar() override {};
|
|
||||||
void ReCreateVToolbar() override {};
|
|
||||||
void SaveCopyInUndoList( EDA_ITEM*, UNDO_REDO ) override {}
|
|
||||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO ) override {}
|
|
||||||
void AppendCopyToUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO ) override {}
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
friend struct PCB::IFACE; // constructor called from here only
|
friend struct PCB::IFACE; // constructor called from here only
|
||||||
|
|
|
@ -113,7 +113,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
||||||
FOOTPRINT_VIEWER_FRAME_NAME ),
|
FOOTPRINT_VIEWER_FRAME_NAME ),
|
||||||
m_comp( LIB_ID(), wxEmptyString, wxEmptyString, KIID_PATH(), {} )
|
m_comp( LIB_ID(), wxEmptyString, wxEmptyString, KIID_PATH(), {} )
|
||||||
{
|
{
|
||||||
m_aboutTitle = _HKI( "KiCad Footprint Library Viewer" );
|
m_aboutTitle = _HKI( "KiCad Footprint Library Browser" );
|
||||||
|
|
||||||
// Force the items to always snap
|
// Force the items to always snap
|
||||||
m_magneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS;
|
m_magneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS;
|
||||||
|
@ -170,7 +170,9 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
||||||
m_fpList = new WX_LISTBOX( fpPanel, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize,
|
m_fpList = new WX_LISTBOX( fpPanel, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize,
|
||||||
0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
|
0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
|
||||||
|
|
||||||
m_fpList->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList ), nullptr, this );
|
m_fpList->Connect( wxEVT_LEFT_DCLICK,
|
||||||
|
wxMouseEventHandler( FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList ),
|
||||||
|
nullptr, this );
|
||||||
fpSizer->Add( m_fpList, 1, wxEXPAND, 5 );
|
fpSizer->Add( m_fpList, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
fpPanel->SetSizer( fpSizer );
|
fpPanel->SetSizer( fpSizer );
|
||||||
|
@ -301,13 +303,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
||||||
updateView();
|
updateView();
|
||||||
setupUnits( config() );
|
setupUnits( config() );
|
||||||
|
|
||||||
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
|
|
||||||
{
|
|
||||||
ReCreateFootprintList();
|
ReCreateFootprintList();
|
||||||
Raise(); // On some window managers, this is needed
|
Raise(); // On some window managers, this is needed
|
||||||
Show( true );
|
Show( true );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
|
FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
|
||||||
|
@ -320,7 +319,9 @@ FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
|
||||||
GetCanvas()->GetView()->Clear();
|
GetCanvas()->GetView()->Clear();
|
||||||
// Be sure any event cannot be fired after frame deletion:
|
// Be sure any event cannot be fired after frame deletion:
|
||||||
GetCanvas()->SetEvtHandlerEnabled( false );
|
GetCanvas()->SetEvtHandlerEnabled( false );
|
||||||
m_fpList->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList ), nullptr, this );
|
m_fpList->Disconnect( wxEVT_LEFT_DCLICK,
|
||||||
|
wxMouseEventHandler( FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList ),
|
||||||
|
nullptr, this );
|
||||||
setFPWatcher( nullptr );
|
setFPWatcher( nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,9 +336,7 @@ void FOOTPRINT_VIEWER_FRAME::UpdateMsgPanel()
|
||||||
{
|
{
|
||||||
EDA_DRAW_FRAME::UpdateMsgPanel();
|
EDA_DRAW_FRAME::UpdateMsgPanel();
|
||||||
|
|
||||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() );
|
if( FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() ) )
|
||||||
|
|
||||||
if( fp )
|
|
||||||
{
|
{
|
||||||
std::vector<MSG_PANEL_ITEM> msgItems;
|
std::vector<MSG_PANEL_ITEM> msgItems;
|
||||||
fp->GetMsgPanelInfo( this, msgItems );
|
fp->GetMsgPanelInfo( this, msgItems );
|
||||||
|
@ -392,20 +391,8 @@ void FOOTPRINT_VIEWER_FRAME::doCloseWindow()
|
||||||
|
|
||||||
GetCanvas()->StopDrawing();
|
GetCanvas()->StopDrawing();
|
||||||
|
|
||||||
if( IsModal() )
|
|
||||||
{
|
|
||||||
// Only dismiss a modal frame once, so that the return values set by
|
|
||||||
// the prior DismissModal() are not bashed for ShowModal().
|
|
||||||
if( !IsDismissed() )
|
|
||||||
DismissModal( false );
|
|
||||||
|
|
||||||
// window to be destroyed by the caller of KIWAY_PLAYER::ShowModal()
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
|
void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||||
|
@ -747,19 +734,7 @@ void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxMouseEvent& aEvent )
|
||||||
|
|
||||||
void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
|
void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( IsModal() )
|
if( GetBoard()->GetFirstFootprint() )
|
||||||
{
|
|
||||||
if( m_fpList->GetSelection() >= 0 )
|
|
||||||
{
|
|
||||||
LIB_ID fpid( getCurNickname(), m_fpList->GetStringSelection() );
|
|
||||||
DismissModal( true, fpid.Format() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DismissModal( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( GetBoard()->GetFirstFootprint() )
|
|
||||||
{
|
{
|
||||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
|
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||||
PCBNEW_SETTINGS* cfg = pcbframe->GetPcbNewSettings();
|
PCBNEW_SETTINGS* cfg = pcbframe->GetPcbNewSettings();
|
||||||
|
@ -1028,85 +1003,6 @@ void FOOTPRINT_VIEWER_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aParent )
|
|
||||||
{
|
|
||||||
if( aFootprint && !aFootprint->IsEmpty() )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
LIB_TABLE* fpTable = PROJECT_PCB::PcbFootprintLibs( &Prj() );
|
|
||||||
LIB_ID fpid;
|
|
||||||
|
|
||||||
fpid.Parse( *aFootprint, true );
|
|
||||||
|
|
||||||
if( fpid.IsValid() )
|
|
||||||
{
|
|
||||||
wxString libraryName = fpid.GetLibNickname();
|
|
||||||
wxHyperlinkCtrl* button = nullptr;
|
|
||||||
|
|
||||||
if( !fpTable->HasLibrary( fpid.GetLibNickname(), false )
|
|
||||||
|| !fpTable->HasLibrary( fpid.GetLibNickname(), true ) )
|
|
||||||
{
|
|
||||||
CreateInfoBar();
|
|
||||||
|
|
||||||
if( WX_INFOBAR* infobar = GetInfoBar() )
|
|
||||||
{
|
|
||||||
button = new wxHyperlinkCtrl( infobar, wxID_ANY,
|
|
||||||
_( "Manage footprint libraries" ),
|
|
||||||
wxEmptyString );
|
|
||||||
button->Bind( wxEVT_COMMAND_HYPERLINK,
|
|
||||||
[=]( wxHyperlinkEvent& aEvent )
|
|
||||||
{
|
|
||||||
InvokePcbLibTableEditor( &Kiway(), this );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !fpTable->HasLibrary( fpid.GetLibNickname(), false ) )
|
|
||||||
{
|
|
||||||
if( WX_INFOBAR* infobar = GetInfoBar() )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Footprint library not found. The current configuration does "
|
|
||||||
"not include library '%s'." ), libraryName );
|
|
||||||
infobar->RemoveAllButtons();
|
|
||||||
infobar->AddButton( button );
|
|
||||||
infobar->AddCloseButton();
|
|
||||||
infobar->ShowMessage( msg, wxICON_INFORMATION );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( !fpTable->HasLibrary( fpid.GetLibNickname(), true ) )
|
|
||||||
{
|
|
||||||
if( WX_INFOBAR* infobar = GetInfoBar() )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Footprint library not enabled. Library '%s' is not enabled "
|
|
||||||
"in the current configuration." ), libraryName );
|
|
||||||
infobar->RemoveAllButtons();
|
|
||||||
infobar->AddButton( button );
|
|
||||||
infobar->AddCloseButton();
|
|
||||||
infobar->ShowMessage( msg, wxICON_INFORMATION );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Update last selection:
|
|
||||||
setCurNickname( libraryName );
|
|
||||||
setCurFootprintName( fpid.GetLibItemName() );
|
|
||||||
m_libList->SetStringSelection( libraryName );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rebuild the fp list from the last selected library,
|
|
||||||
// and show the last selected footprint
|
|
||||||
ReCreateFootprintList();
|
|
||||||
SelectAndViewFootprint( NEW_PART );
|
|
||||||
|
|
||||||
bool retval = KIWAY_PLAYER::ShowModal( aFootprint, aParent );
|
|
||||||
|
|
||||||
m_libFilter->SetFocus();
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINT_VIEWER_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
|
void FOOTPRINT_VIEWER_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
|
||||||
{
|
{
|
||||||
wxString title = _( "3D Viewer" ) + wxT( " \u2014 " ) + getCurFootprintName();
|
wxString title = _( "3D Viewer" ) + wxT( " \u2014 " ) + getCurFootprintName();
|
||||||
|
|
|
@ -81,14 +81,6 @@ public:
|
||||||
///< @copydoc EDADRAW_FRAME::UpdateMsgPanel
|
///< @copydoc EDADRAW_FRAME::UpdateMsgPanel
|
||||||
void UpdateMsgPanel() override;
|
void UpdateMsgPanel() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the footprint viewer as a modal dialog.
|
|
||||||
*
|
|
||||||
* @param aFootprint an optional FPID string to initialize the viewer with and to
|
|
||||||
* return a selected footprint through.
|
|
||||||
*/
|
|
||||||
bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
|
|
||||||
|
|
||||||
COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
|
COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;
|
||||||
|
|
||||||
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
||||||
|
@ -170,10 +162,6 @@ private:
|
||||||
/// @copydoc PCB_BASE_FRAME::Update3DView
|
/// @copydoc PCB_BASE_FRAME::Update3DView
|
||||||
void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
|
void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
|
||||||
|
|
||||||
void SaveCopyInUndoList( EDA_ITEM*, UNDO_REDO ) override {}
|
|
||||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO ) override {}
|
|
||||||
void AppendCopyToUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO ) override {}
|
|
||||||
|
|
||||||
void updateView();
|
void updateView();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
|
@ -175,13 +175,6 @@ private:
|
||||||
/// @copydoc PCB_BASE_FRAME::Update3DView
|
/// @copydoc PCB_BASE_FRAME::Update3DView
|
||||||
void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
|
void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr ) override;
|
||||||
|
|
||||||
/*
|
|
||||||
* Not used here but needed by PCB_BASE_EDIT_FRAME.
|
|
||||||
*/
|
|
||||||
void SaveCopyInUndoList( EDA_ITEM*, UNDO_REDO ) override {}
|
|
||||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO ) override {}
|
|
||||||
void OnEditItemRequest( BOARD_ITEM* aItem ) override {}
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
* @param aDC the current device context.
|
* @param aDC the current device context.
|
||||||
* @param aItem a pointer to the BOARD_ITEM to edit.
|
* @param aItem a pointer to the BOARD_ITEM to edit.
|
||||||
*/
|
*/
|
||||||
virtual void OnEditItemRequest( BOARD_ITEM* aItem ) = 0;
|
virtual void OnEditItemRequest( BOARD_ITEM* aItem ) {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new entry in undo list of commands.
|
* Create a new entry in undo list of commands.
|
||||||
|
|
Loading…
Reference in New Issue