Remove vestiages of old open-PCB-for-settings hack.
We used to have to open a PCB_EDIT_FRAME to get the settings for the footprint editor and footprint viewer. This necessitated some special processing when opening a PCB_EDIT_FRAME to actually edit a board as it might already be open but unloaded. Since the new settings architecture allows the footprint editor and footprint viewer to init themselves we no longer need the special- case code.
This commit is contained in:
parent
e325d2e18f
commit
9b92b275de
|
@ -602,10 +602,6 @@ void SCH_EDIT_FRAME::OnModify()
|
|||
|
||||
void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
|
||||
|
||||
fn.SetExt( PcbFileExtension );
|
||||
|
||||
if( Kiface().IsSingle() )
|
||||
{
|
||||
DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is opened"
|
||||
|
@ -614,17 +610,20 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
|
||||
// a pcb frame can be already existing, but not yet used.
|
||||
// this is the case when running the footprint editor, or the footprint viewer first
|
||||
// if the frame is not visible, the board is not yet loaded
|
||||
if( !frame->IsVisible() )
|
||||
if( !frame )
|
||||
{
|
||||
wxFileName fn = Prj().GetProjectFullName();
|
||||
fn.SetExt( PcbFileExtension );
|
||||
|
||||
frame = Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
||||
frame->Show( true );
|
||||
}
|
||||
|
||||
if( !frame->IsVisible() )
|
||||
frame->Show( true );
|
||||
|
||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
||||
if( frame->IsIconized() )
|
||||
frame->Iconize( false );
|
||||
|
@ -798,17 +797,17 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
|
|||
}
|
||||
else
|
||||
{
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
|
||||
// a pcb frame can be already existing, but not yet used.
|
||||
// this is the case when running the footprint editor, or the footprint viewer first
|
||||
// if the frame is not visible, the board is not yet loaded
|
||||
if( !frame->IsVisible() )
|
||||
if( !frame )
|
||||
{
|
||||
frame = Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
frame->OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
|
||||
frame->Show( true );
|
||||
}
|
||||
|
||||
if( !frame->IsVisible() )
|
||||
frame->Show( true );
|
||||
|
||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
||||
if( frame->IsIconized() )
|
||||
frame->Iconize( false );
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <sch_sheet_path.h>
|
||||
#include <schematic.h>
|
||||
#include <kiface_i.h>
|
||||
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
BACK_ANNOTATE::BACK_ANNOTATE( SCH_EDIT_FRAME* aFrame, REPORTER& aReporter,
|
||||
bool aProcessFootprints, bool aProcessValues,
|
||||
|
@ -97,7 +97,17 @@ bool BACK_ANNOTATE::FetchNetlistFromPCB( std::string& aNetlist )
|
|||
return false;
|
||||
}
|
||||
|
||||
m_frame->Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
|
||||
if( !frame )
|
||||
{
|
||||
wxFileName fn( m_frame->Prj().GetProjectFullName() );
|
||||
fn.SetExt( PcbFileExtension );
|
||||
|
||||
frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
||||
}
|
||||
|
||||
m_frame->Kiway().ExpressMail( FRAME_PCB_EDITOR, MAIL_PCB_GET_NETLIST, aNetlist );
|
||||
return true;
|
||||
}
|
||||
|
@ -200,6 +210,7 @@ void BACK_ANNOTATE::getChangeList()
|
|||
// If module linked to multi unit symbol, we add all symbol's units to
|
||||
// the change list
|
||||
foundInMultiunit = true;
|
||||
|
||||
for( size_t i = 0; i < refList.GetCount(); ++i )
|
||||
{
|
||||
refList[i].GetComp()->ClearFlags( SKIP_STRUCT );
|
||||
|
|
|
@ -31,17 +31,12 @@
|
|||
|
||||
#include <wx/filename.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <kiway.h>
|
||||
#include <richio.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <systemdirsappend.h>
|
||||
#include <kiway_player.h>
|
||||
#include <stdexcept>
|
||||
#include "pgm_kicad.h"
|
||||
|
@ -114,7 +109,8 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
wxFileName pcb( sch );
|
||||
wxFileName pcb( sch );
|
||||
std::string packet;
|
||||
pro.SetExt( ProjectFileExtension );
|
||||
pcb.SetExt( LegacyPcbFileExtension ); // enforce extension
|
||||
|
||||
|
@ -126,67 +122,29 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
|
|||
|
||||
if( sch.FileExists() )
|
||||
{
|
||||
KIWAY_PLAYER* schframe = Kiway().Player( FRAME_SCH, false );
|
||||
KIWAY_PLAYER* schframe = Kiway().Player( FRAME_SCH, true );
|
||||
|
||||
if( !schframe )
|
||||
{
|
||||
try // SCH frame was not available, try to start it
|
||||
{
|
||||
schframe = Kiway().Player( FRAME_SCH, true );
|
||||
}
|
||||
catch( const IO_ERROR& err )
|
||||
{
|
||||
wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(),
|
||||
_( "KiCad Error" ), wxOK | wxICON_ERROR, this );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
std::string packet = StrPrintf( "%d\n%s", SCH_IO_MGR::SCH_EAGLE,
|
||||
TO_UTF8( sch.GetFullPath() ) );
|
||||
packet = StrPrintf( "%d\n%s", SCH_IO_MGR::SCH_EAGLE, TO_UTF8( sch.GetFullPath() ) );
|
||||
schframe->Kiway().ExpressMail( FRAME_SCH, MAIL_IMPORT_FILE, packet, this );
|
||||
|
||||
if( !schframe->IsShown() ) // the frame exists, (created by the dialog field editor)
|
||||
// but no project loaded.
|
||||
{
|
||||
if( !schframe->IsShown() )
|
||||
schframe->Show( true );
|
||||
}
|
||||
|
||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
||||
if( schframe->IsIconized() )
|
||||
schframe->Iconize( false );
|
||||
|
||||
schframe->Raise();
|
||||
}
|
||||
|
||||
|
||||
if( pcb.FileExists() )
|
||||
{
|
||||
KIWAY_PLAYER* pcbframe = Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
KIWAY_PLAYER* pcbframe = Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
|
||||
if( !pcbframe )
|
||||
{
|
||||
try // PCB frame was not available, try to start it
|
||||
{
|
||||
pcbframe = Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
}
|
||||
catch( const IO_ERROR& err )
|
||||
{
|
||||
wxMessageBox( _( "Pcbnew failed to load:\n" ) + err.What(), _( "KiCad Error" ),
|
||||
wxOK | wxICON_ERROR, this );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// a pcb frame can be already existing, but not yet used.
|
||||
// this is the case when running the footprint editor, or the footprint viewer first
|
||||
// if the frame is not visible, the board is not yet loaded
|
||||
if( !pcbframe->IsVisible() )
|
||||
{
|
||||
pcbframe->Show( true );
|
||||
}
|
||||
|
||||
std::string packet = StrPrintf( "%d\n%s", IO_MGR::EAGLE,
|
||||
TO_UTF8( pcb.GetFullPath() ) );
|
||||
packet = StrPrintf( "%d\n%s", IO_MGR::EAGLE, TO_UTF8( pcb.GetFullPath() ) );
|
||||
pcbframe->Kiway().ExpressMail( FRAME_PCB_EDITOR, MAIL_IMPORT_FILE, packet, this );
|
||||
|
||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
||||
|
|
|
@ -764,7 +764,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
|
|||
|
||||
if( pcbframe == NULL ) // happens when the board editor is not active (or closed)
|
||||
{
|
||||
DisplayErrorMessage( this, _("No board currently open." ) );
|
||||
DisplayErrorMessage( this, _( "No board currently open." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue