Cleanup.
This commit is contained in:
parent
077159ac13
commit
23033451b1
|
@ -87,10 +87,6 @@ public:
|
|||
|
||||
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;
|
||||
|
||||
void ReloadFootprint( FOOTPRINT* aFootprint ) override;
|
||||
|
|
|
@ -92,7 +92,6 @@ public:
|
|||
void CloseLibraryViewer( wxCommandEvent& event );
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateVToolbar() override;
|
||||
void ReCreateOptToolbar() override {}
|
||||
|
||||
void ClickOnLibList( wxCommandEvent& event );
|
||||
void ClickOnSymbolList( wxCommandEvent& event );
|
||||
|
|
|
@ -200,9 +200,9 @@ public:
|
|||
|
||||
void EraseMsgBox();
|
||||
|
||||
virtual void ReCreateHToolbar() = 0;
|
||||
virtual void ReCreateVToolbar() = 0;
|
||||
virtual void ReCreateOptToolbar() = 0;
|
||||
virtual void ReCreateHToolbar() { };
|
||||
virtual void ReCreateVToolbar() { };
|
||||
virtual void ReCreateOptToolbar() { };
|
||||
virtual void ReCreateAuxiliaryToolbar() { }
|
||||
|
||||
/**
|
||||
|
@ -477,8 +477,6 @@ protected:
|
|||
|
||||
void setupUnits( APP_SETTINGS_BASE* aCfg );
|
||||
|
||||
void doReCreateMenuBar() override { }
|
||||
|
||||
std::vector<wxWindow*> findDialogs();
|
||||
|
||||
/**
|
||||
|
|
|
@ -219,7 +219,6 @@ public:
|
|||
void ShowSolderMask();
|
||||
|
||||
// General
|
||||
virtual void ReCreateOptToolbar() override { }
|
||||
virtual void ShowChangedLanguage() override;
|
||||
virtual void UpdateStatusBar() override;
|
||||
|
||||
|
@ -315,7 +314,7 @@ public:
|
|||
* @param aItemToCopy is the board item modified by the command to undo.
|
||||
* @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.
|
||||
|
@ -324,13 +323,13 @@ public:
|
|||
* @param aTypeCommand is the command type (see enum #UNDO_REDO)
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
virtual void AppendCopyToUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||
UNDO_REDO aTypeCommand ) = 0;
|
||||
UNDO_REDO aTypeCommand ) {};
|
||||
|
||||
|
||||
/**
|
||||
|
@ -344,7 +343,7 @@ public:
|
|||
* @return the selected layer id.
|
||||
*/
|
||||
PCB_LAYER_ID SelectOneLayer( PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask = LSET(),
|
||||
wxPoint aDlgPosition = wxDefaultPosition );
|
||||
wxPoint aDlgPosition = wxDefaultPosition );
|
||||
|
||||
/**
|
||||
* Change the active layer in the frame
|
||||
|
|
|
@ -54,8 +54,6 @@ public:
|
|||
protected:
|
||||
FOOTPRINT_CHOOSER_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
void doReCreateMenuBar() override {}
|
||||
|
||||
private:
|
||||
void OnPaint( wxPaintEvent& aEvent );
|
||||
void OnOK( wxCommandEvent& aEvent );
|
||||
|
@ -66,13 +64,6 @@ private:
|
|||
WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) 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()
|
||||
|
||||
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 ),
|
||||
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
|
||||
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,
|
||||
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 );
|
||||
|
||||
fpPanel->SetSizer( fpSizer );
|
||||
|
@ -301,12 +303,9 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
updateView();
|
||||
setupUnits( config() );
|
||||
|
||||
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
|
||||
{
|
||||
ReCreateFootprintList();
|
||||
Raise(); // On some window managers, this is needed
|
||||
Show( true );
|
||||
}
|
||||
ReCreateFootprintList();
|
||||
Raise(); // On some window managers, this is needed
|
||||
Show( true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -320,7 +319,9 @@ FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
|
|||
GetCanvas()->GetView()->Clear();
|
||||
// Be sure any event cannot be fired after frame deletion:
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -335,9 +336,7 @@ void FOOTPRINT_VIEWER_FRAME::UpdateMsgPanel()
|
|||
{
|
||||
EDA_DRAW_FRAME::UpdateMsgPanel();
|
||||
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() );
|
||||
|
||||
if( fp )
|
||||
if( FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() ) )
|
||||
{
|
||||
std::vector<MSG_PANEL_ITEM> msgItems;
|
||||
fp->GetMsgPanelInfo( this, msgItems );
|
||||
|
@ -392,19 +391,7 @@ void FOOTPRINT_VIEWER_FRAME::doCloseWindow()
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -747,19 +734,7 @@ void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxMouseEvent& aEvent )
|
|||
|
||||
void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( IsModal() )
|
||||
{
|
||||
if( m_fpList->GetSelection() >= 0 )
|
||||
{
|
||||
LIB_ID fpid( getCurNickname(), m_fpList->GetStringSelection() );
|
||||
DismissModal( true, fpid.Format() );
|
||||
}
|
||||
else
|
||||
{
|
||||
DismissModal( false );
|
||||
}
|
||||
}
|
||||
else if( GetBoard()->GetFirstFootprint() )
|
||||
if( GetBoard()->GetFirstFootprint() )
|
||||
{
|
||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
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 )
|
||||
{
|
||||
wxString title = _( "3D Viewer" ) + wxT( " \u2014 " ) + getCurFootprintName();
|
||||
|
|
|
@ -81,14 +81,6 @@ public:
|
|||
///< @copydoc EDADRAW_FRAME::UpdateMsgPanel
|
||||
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;
|
||||
|
||||
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
||||
|
@ -170,10 +162,6 @@ private:
|
|||
/// @copydoc PCB_BASE_FRAME::Update3DView
|
||||
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();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
|
@ -175,13 +175,6 @@ private:
|
|||
/// @copydoc PCB_BASE_FRAME::Update3DView
|
||||
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()
|
||||
|
||||
protected:
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
* @param aDC the current device context.
|
||||
* @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.
|
||||
|
|
Loading…
Reference in New Issue