Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major frame with a "change language" menu can change the language for all KIWAY_PLAYERs in the whole KIWAY. Multiple KIWAYs are not supported yet. *) Simplify "modal wxFrame" support, and add that support exclusively to KIWAY_PLAYER where it is inherited by all derivatives. The function KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable. *) Remove the requirements and assumptions that the wxFrame hierarchy always had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers and editors. This is no longer the case, nor required. *) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame quickly. It also gives control to the KIWAY as to frame hierarchical relationships. *) Change single_top to use the KIWAY for loading a KIFACE and instantiating the single KIWAY_PLAYER, see bullet immediately above. *) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this gives the KIFACEs a chance to save their final configuration dope to disk. *) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and these modal frames are distinctly different than their non-modal equivalents. KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor, so this is another important reason for having a dedicated FRAME_T for each modal wxFrame. On balance, more lines were deleted than were added to achieve all this.
This commit is contained in:
parent
5688a87212
commit
991926d320
|
@ -14,7 +14,7 @@ set( BITMAP2COMPONENT_SRCS
|
|||
)
|
||||
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=0"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_BM2CMP"
|
||||
)
|
||||
set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "COMPILING_DLL"
|
||||
|
|
|
@ -169,12 +169,8 @@ void EDA_BASE_FRAME::ReCreateMenuBar()
|
|||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
void EDA_BASE_FRAME::ShowChangedLanguage()
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
||||
Pgm().SetLanguageIdentifier( id );
|
||||
Pgm().SetLanguage();
|
||||
ReCreateMenuBar();
|
||||
GetMenuBar()->Refresh();
|
||||
}
|
||||
|
@ -717,27 +713,3 @@ void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::SetModalMode( bool aModal )
|
||||
{
|
||||
// Disable all other windows
|
||||
#if wxCHECK_VERSION(2, 9, 4)
|
||||
if( IsTopLevel() )
|
||||
{
|
||||
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
||||
|
||||
while( node )
|
||||
{
|
||||
wxWindow* win = node->GetData();
|
||||
|
||||
if( win != this )
|
||||
win->Enable( !aModal );
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Deprecated since wxWidgets 2.9.4
|
||||
MakeModal( aModal );
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -122,6 +122,7 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 )
|
|||
// First easy thing: a black gives always the other colour
|
||||
if( aColor1 == BLACK )
|
||||
return aColor2;
|
||||
|
||||
if( aColor2 == BLACK)
|
||||
return aColor1;
|
||||
|
||||
|
|
|
@ -556,12 +556,6 @@ bool EDA_DRAW_FRAME::HandleBlockEnd( wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
{
|
||||
EDA_BASE_FRAME::SetLanguage( event );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::UpdateStatusBar()
|
||||
{
|
||||
wxString Line;
|
||||
|
|
|
@ -62,6 +62,7 @@ const char* EndsWithRev( const char* start, const char* tail, char separator )
|
|||
}
|
||||
|
||||
|
||||
#if 0 // Not used
|
||||
int RevCmp( const char* s1, const char* s2 )
|
||||
{
|
||||
int r = strncmp( s1, s2, 3 );
|
||||
|
@ -76,6 +77,7 @@ int RevCmp( const char* s1, const char* s2 )
|
|||
|
||||
return -(rnum1 - rnum2); // swap the sign, higher revs first
|
||||
}
|
||||
#endif
|
||||
|
||||
//----<Policy and field test functions>-------------------------------------
|
||||
|
||||
|
@ -116,7 +118,7 @@ void FPID::clear()
|
|||
}
|
||||
|
||||
|
||||
int FPID::Parse( const std::string& aId )
|
||||
int FPID::Parse( const UTF8& aId )
|
||||
{
|
||||
clear();
|
||||
|
||||
|
@ -171,12 +173,6 @@ int FPID::Parse( const std::string& aId )
|
|||
}
|
||||
|
||||
|
||||
int FPID::Parse( const wxString& aId )
|
||||
{
|
||||
return Parse( std::string( TO_UTF8( aId ) ) );
|
||||
}
|
||||
|
||||
|
||||
FPID::FPID( const std::string& aId ) throw( PARSE_ERROR )
|
||||
{
|
||||
int offset = Parse( aId );
|
||||
|
@ -194,14 +190,14 @@ FPID::FPID( const std::string& aId ) throw( PARSE_ERROR )
|
|||
|
||||
FPID::FPID( const wxString& aId ) throw( PARSE_ERROR )
|
||||
{
|
||||
std::string id = TO_UTF8( aId );
|
||||
UTF8 id = aId;
|
||||
|
||||
int offset = Parse( id );
|
||||
|
||||
if( offset != -1 )
|
||||
{
|
||||
THROW_PARSE_ERROR( _( "Illegal character found in FPID string" ),
|
||||
wxString::FromUTF8( id.c_str() ),
|
||||
aId,
|
||||
id.c_str(),
|
||||
0,
|
||||
offset );
|
||||
|
@ -209,7 +205,7 @@ FPID::FPID( const wxString& aId ) throw( PARSE_ERROR )
|
|||
}
|
||||
|
||||
|
||||
int FPID::SetLibNickname( const std::string& aLogical )
|
||||
int FPID::SetLibNickname( const UTF8& aLogical )
|
||||
{
|
||||
int offset = okLogical( aLogical );
|
||||
|
||||
|
@ -222,15 +218,9 @@ int FPID::SetLibNickname( const std::string& aLogical )
|
|||
}
|
||||
|
||||
|
||||
int FPID::SetLibNickname( const wxString& aLogical )
|
||||
int FPID::SetFootprintName( const UTF8& aFootprintName )
|
||||
{
|
||||
return SetLibNickname( std::string( TO_UTF8( aLogical ) ) );
|
||||
}
|
||||
|
||||
|
||||
int FPID::SetFootprintName( const std::string& aFootprintName )
|
||||
{
|
||||
int separation = int( aFootprintName.find_first_of( "/" ) );
|
||||
int separation = int( aFootprintName.find_first_of( "/" ) );
|
||||
|
||||
if( separation != -1 )
|
||||
{
|
||||
|
@ -246,13 +236,7 @@ int FPID::SetFootprintName( const std::string& aFootprintName )
|
|||
}
|
||||
|
||||
|
||||
int FPID::SetFootprintName( const wxString& aFootprintName )
|
||||
{
|
||||
return SetFootprintName( std::string( TO_UTF8( aFootprintName ) ) );
|
||||
}
|
||||
|
||||
|
||||
int FPID::SetRevision( const std::string& aRevision )
|
||||
int FPID::SetRevision( const UTF8& aRevision )
|
||||
{
|
||||
int offset = okRevision( aRevision );
|
||||
|
||||
|
@ -301,8 +285,10 @@ UTF8 FPID::GetFootprintNameAndRev() const
|
|||
}
|
||||
|
||||
|
||||
UTF8 FPID::Format( const std::string& aLogicalLib, const std::string& aFootprintName,
|
||||
const std::string& aRevision )
|
||||
#if 0 // this is broken, it does not output aFootprintName for some reason
|
||||
|
||||
UTF8 FPID::Format( const UTF8& aLogicalLib, const UTF8& aFootprintName,
|
||||
const UTF8& aRevision )
|
||||
throw( PARSE_ERROR )
|
||||
{
|
||||
UTF8 ret;
|
||||
|
@ -344,6 +330,7 @@ UTF8 FPID::Format( const std::string& aLogicalLib, const std::string& aFootprint
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int FPID::compare( const FPID& aFPID ) const
|
||||
|
|
|
@ -23,14 +23,16 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include <macros.h>
|
||||
#include <kiway.h>
|
||||
#include <kiway_player.h>
|
||||
#include <kiway_express.h>
|
||||
#include <pgm_base.h>
|
||||
#include <config.h>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <id.h>
|
||||
|
||||
|
||||
KIFACE* KIWAY::m_kiface[KIWAY_FACE_COUNT];
|
||||
|
@ -38,22 +40,24 @@ int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
|
|||
|
||||
|
||||
|
||||
KIWAY::KIWAY( PGM_BASE* aProgram, wxFrame* aTop ):
|
||||
KIWAY::KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop ):
|
||||
m_program( aProgram ),
|
||||
m_ctl( aCtlBits ),
|
||||
m_top( 0 )
|
||||
{
|
||||
SetTop( aTop ); // hook playerDestroyHandler() into aTop.
|
||||
SetTop( aTop ); // hook player_destroy_handler() into aTop.
|
||||
|
||||
memset( m_player, 0, sizeof( m_player ) );
|
||||
}
|
||||
|
||||
|
||||
// Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are
|
||||
// propogated upwards to parent windows if not handled below. Therefor the
|
||||
// m_top window should receive all wxWindowDestroyEvents originating from
|
||||
// KIWAY_PLAYERs. It does anyways, but now playerDestroyHandler eavesdrops
|
||||
// KIWAY_PLAYERs. It does anyways, but now player_destroy_handler eavesdrops
|
||||
// on that event stream looking for KIWAY_PLAYERs being closed.
|
||||
|
||||
void KIWAY::playerDestroyHandler( wxWindowDestroyEvent& event )
|
||||
void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
|
||||
{
|
||||
wxWindow* w = event.GetWindow();
|
||||
|
||||
|
@ -62,7 +66,7 @@ void KIWAY::playerDestroyHandler( wxWindowDestroyEvent& event )
|
|||
// if destroying one of our flock, then mark it as deceased.
|
||||
if( (wxWindow*) m_player[i] == w )
|
||||
{
|
||||
// DBG(printf( "%s: marking m_player[%d] as destroyed\n", __func__, i );)
|
||||
DBG(printf( "%s: marking m_player[%d] as destroyed\n", __func__, i );)
|
||||
m_player[i] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -73,12 +77,12 @@ void KIWAY::SetTop( wxFrame* aTop )
|
|||
{
|
||||
if( m_top )
|
||||
{
|
||||
m_top->Disconnect( wxEVT_DESTROY, wxWindowDestroyEventHandler( KIWAY::playerDestroyHandler ), NULL, this );
|
||||
m_top->Disconnect( wxEVT_DESTROY, wxWindowDestroyEventHandler( KIWAY::player_destroy_handler ), NULL, this );
|
||||
}
|
||||
|
||||
if( aTop )
|
||||
{
|
||||
aTop->Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler( KIWAY::playerDestroyHandler ), NULL, this );
|
||||
aTop->Connect( wxEVT_DESTROY, wxWindowDestroyEventHandler( KIWAY::player_destroy_handler ), NULL, this );
|
||||
}
|
||||
|
||||
m_top = aTop;
|
||||
|
@ -91,13 +95,13 @@ const wxString KIWAY::dso_full_path( FACE_T aFaceId )
|
|||
|
||||
switch( aFaceId )
|
||||
{
|
||||
case FACE_SCH: name = KIFACE_PREFIX wxT( "eeschema" ); break;
|
||||
case FACE_PCB: name = KIFACE_PREFIX wxT( "pcbnew" ); break;
|
||||
case FACE_CVPCB: name = KIFACE_PREFIX wxT( "cvpcb" ); break;
|
||||
case FACE_GERBVIEW: name = KIFACE_PREFIX wxT( "gerbview" ); break;
|
||||
case FACE_PL_EDITOR: name = KIFACE_PREFIX wxT( "pl_editor" ); break;
|
||||
|
||||
// case FACE_PCB_CALCULATOR: who knows.
|
||||
case FACE_SCH: name = KIFACE_PREFIX wxT( "eeschema" ); break;
|
||||
case FACE_PCB: name = KIFACE_PREFIX wxT( "pcbnew" ); break;
|
||||
case FACE_CVPCB: name = KIFACE_PREFIX wxT( "cvpcb" ); break;
|
||||
case FACE_GERBVIEW: name = KIFACE_PREFIX wxT( "gerbview" ); break;
|
||||
case FACE_PL_EDITOR: name = KIFACE_PREFIX wxT( "pl_editor" ); break;
|
||||
case FACE_PCB_CALCULATOR: name = KIFACE_PREFIX wxT( "pcb_calculator" ); break;
|
||||
case FACE_BMP2CMP: name = KIFACE_PREFIX wxT( "bitmap2component" ); break;
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
|
||||
|
@ -172,7 +176,7 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
|
|||
|
||||
// Give the DSO a single chance to do its "process level" initialization.
|
||||
// "Process level" specifically means stay away from any projects in there.
|
||||
if( kiface->OnKifaceStart( m_program, KFCTL_PROJECT_SUITE ) )
|
||||
if( kiface->OnKifaceStart( m_program, m_ctl ) )
|
||||
{
|
||||
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
|
||||
(void) dso.Detach();
|
||||
|
@ -214,12 +218,14 @@ KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType )
|
|||
case FRAME_SCH:
|
||||
case FRAME_SCH_LIB_EDITOR:
|
||||
case FRAME_SCH_VIEWER:
|
||||
case FRAME_SCH_VIEWER_MODAL:
|
||||
return FACE_SCH;
|
||||
|
||||
case FRAME_PCB:
|
||||
case FRAME_PCB_MODULE_EDITOR:
|
||||
case FRAME_PCB_MODULE_VIEWER:
|
||||
case FRAME_PCB_FOOTPRINT_WIZARD:
|
||||
case FRAME_PCB_MODULE_VIEWER_MODAL:
|
||||
case FRAME_PCB_FOOTPRINT_WIZARD_MODAL:
|
||||
case FRAME_PCB_DISPLAY3D:
|
||||
return FACE_PCB;
|
||||
|
||||
|
@ -233,6 +239,12 @@ KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType )
|
|||
case FRAME_PL_EDITOR:
|
||||
return FACE_PL_EDITOR;
|
||||
|
||||
case FRAME_CALC:
|
||||
return FACE_PCB_CALCULATOR;
|
||||
|
||||
case FRAME_BM2CMP:
|
||||
return FACE_BMP2CMP;
|
||||
|
||||
default:
|
||||
return FACE_T( -1 );
|
||||
}
|
||||
|
@ -266,7 +278,12 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
|
|||
|
||||
if( kiface )
|
||||
{
|
||||
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow( m_top, aFrameType, this, KFCTL_PROJECT_SUITE );
|
||||
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow(
|
||||
m_top,
|
||||
aFrameType,
|
||||
this,
|
||||
m_ctl // questionable need, these same flags where passed to the KIFACE::OnKifaceStart()
|
||||
);
|
||||
wxASSERT( frame );
|
||||
|
||||
return m_player[aFrameType] = frame;
|
||||
|
@ -327,6 +344,39 @@ void KIWAY::ExpressMail( FRAME_T aDestination,
|
|||
}
|
||||
|
||||
|
||||
void KIWAY::SetLanguage( int aLanguage )
|
||||
{
|
||||
Pgm().SetLanguageIdentifier( aLanguage );
|
||||
Pgm().SetLanguage();
|
||||
|
||||
#if 1
|
||||
// This is a risky hack that goes away if we allow the language to be
|
||||
// set only from the top most frame if !Kiface.IsSingle()
|
||||
|
||||
// Only for the C++ project manager, and not for the python one and not for
|
||||
// single_top do we look for the EDA_BASE_FRAME as the top level window.
|
||||
// For single_top this is not needed because that window is registered in
|
||||
// the array below.
|
||||
if( m_ctl & KFCTL_CPP_PROJECT_SUITE )
|
||||
{
|
||||
EDA_BASE_FRAME* top = (EDA_BASE_FRAME*) m_top;
|
||||
if( top )
|
||||
top->ShowChangedLanguage();
|
||||
}
|
||||
#endif
|
||||
|
||||
for( unsigned i=0; i < DIM( m_player ); ++i )
|
||||
{
|
||||
KIWAY_PLAYER* frame = m_player[i];
|
||||
|
||||
if( frame )
|
||||
{
|
||||
frame->ShowChangedLanguage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool KIWAY::ProcessEvent( wxEvent& aEvent )
|
||||
{
|
||||
KIWAY_EXPRESS* mail = dynamic_cast<KIWAY_EXPRESS*>( &aEvent );
|
||||
|
@ -351,3 +401,14 @@ bool KIWAY::ProcessEvent( wxEvent& aEvent )
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void KIWAY::OnKiwayEnd()
|
||||
{
|
||||
for( unsigned i=0; i < DIM( m_kiface ); ++i )
|
||||
{
|
||||
if( m_kiface[i] )
|
||||
m_kiface[i]->OnKifaceEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,28 +2,26 @@
|
|||
|
||||
#include <kiway_player.h>
|
||||
#include <kiway_express.h>
|
||||
#include <kiway.h>
|
||||
#include <id.h>
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( KIWAY_PLAYER, EDA_BASE_FRAME )
|
||||
/* have not been able to get this to work yet:
|
||||
EVT_KIWAY_EXPRESS( KIWAY_PLAYER::kiway_express )
|
||||
Use Connect() in constructor until this can be sorted out.
|
||||
|
||||
OK the problem is KIWAY_PLAYER::wxEVENT_ID not being unique accross all link images.
|
||||
*/
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, KIWAY_PLAYER::language_change )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
||||
KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aWdoName ) :
|
||||
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
KIWAY_HOLDER( aKiway )
|
||||
KIWAY_HOLDER( aKiway ),
|
||||
m_modal_dismissed( 0 )
|
||||
{
|
||||
DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
|
||||
Connect( KIWAY_EXPRESS::wxEVENT_ID, wxKiwayExressHandler( KIWAY_PLAYER::kiway_express ) );
|
||||
//Connect( KIWAY_EXPRESS::wxEVENT_ID, wxKiwayExressHandler( KIWAY_PLAYER::kiway_express ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,10 +29,125 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a
|
|||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName ) :
|
||||
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
KIWAY_HOLDER( 0 )
|
||||
KIWAY_HOLDER( 0 ),
|
||||
m_modal_dismissed( 0 )
|
||||
{
|
||||
DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
|
||||
Connect( KIWAY_EXPRESS::wxEVENT_ID, wxKiwayExressHandler( KIWAY_PLAYER::kiway_express ) );
|
||||
//Connect( KIWAY_EXPRESS::wxEVENT_ID, wxKiwayExressHandler( KIWAY_PLAYER::kiway_express ) );
|
||||
}
|
||||
|
||||
|
||||
KIWAY_PLAYER::~KIWAY_PLAYER(){}
|
||||
|
||||
|
||||
void KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent )
|
||||
{
|
||||
// override this in derived classes.
|
||||
}
|
||||
|
||||
|
||||
static void makeModal( wxFrame* aFrame, bool IsModal )
|
||||
{
|
||||
// disable or enable all other top level windows
|
||||
#if wxCHECK_VERSION(2, 9, 4)
|
||||
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
||||
|
||||
while( node )
|
||||
{
|
||||
wxWindow* win = node->GetData();
|
||||
|
||||
if( win != aFrame )
|
||||
win->Enable( !IsModal );
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
#else
|
||||
// Deprecated since wxWidgets 2.9.4
|
||||
aFrame->MakeModal( IsModal );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* toggle global wxFrame enable/disable state, does the re-enable part even
|
||||
* if an exception is thrown.
|
||||
*/
|
||||
struct ENABLE_DISABLE
|
||||
{
|
||||
wxFrame* m_frame;
|
||||
|
||||
ENABLE_DISABLE( wxFrame* aFrame ) :
|
||||
m_frame( aFrame )
|
||||
{
|
||||
makeModal( aFrame, true );
|
||||
}
|
||||
|
||||
~ENABLE_DISABLE()
|
||||
{
|
||||
// Re-enable all frames, (oops, even if they were previously inactive).
|
||||
// This is probably why this function was deprecated in wx.
|
||||
makeModal( m_frame, false );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool KIWAY_PLAYER::ShowModal( wxString* aResult )
|
||||
{
|
||||
/*
|
||||
This function has a nice interface but an unsightly implementation.
|
||||
Now it is encapsulated, making it easier to improve. I am not sure
|
||||
a wxSemaphore was needed, especially since no blocking happens. It seems
|
||||
like a volatile bool is sufficient.
|
||||
|
||||
It works in tandem with DismissModal(). But only ShowModal() is in the
|
||||
vtable and therefore cross-module capable.
|
||||
*/
|
||||
|
||||
volatile bool dismissed = false;
|
||||
|
||||
// disable all frames except the modal one, re-enable on exit, exception safe.
|
||||
ENABLE_DISABLE toggle( this );
|
||||
|
||||
m_modal_dismissed = &dismissed;
|
||||
|
||||
Show( true );
|
||||
Raise();
|
||||
|
||||
// Wait for the one and only active frame to call DismissModal() from
|
||||
// some concluding event.
|
||||
while( !dismissed )
|
||||
{
|
||||
wxYield();
|
||||
wxMilliSleep( 50 );
|
||||
}
|
||||
|
||||
// no longer modal, not to mention that the pointer would be invalid outside this scope.
|
||||
m_modal_dismissed = NULL;
|
||||
|
||||
if( aResult )
|
||||
*aResult = m_modal_string;
|
||||
|
||||
return m_modal_ret_val;
|
||||
}
|
||||
|
||||
|
||||
bool KIWAY_PLAYER::IsDismissed()
|
||||
{
|
||||
// if already dismissed, then m_modal_dismissed may be NULL, and if not,
|
||||
// it can still be dismissed if the bool is true.
|
||||
bool ret = !m_modal_dismissed || *m_modal_dismissed;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void KIWAY_PLAYER::DismissModal( bool aRetVal, const wxString& aResult )
|
||||
{
|
||||
m_modal_ret_val = aRetVal;
|
||||
m_modal_string = aResult;
|
||||
|
||||
if( m_modal_dismissed )
|
||||
*m_modal_dismissed = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,17 +155,20 @@ void KIWAY_PLAYER::kiway_express( KIWAY_EXPRESS& aEvent )
|
|||
{
|
||||
// logging support
|
||||
#if defined(DEBUG)
|
||||
const char* class_name = typeid(this).name();
|
||||
const char* class_name = typeid( this ).name();
|
||||
|
||||
printf( "%s: cmd:%d pay:'%s'\n", class_name,
|
||||
aEvent.GetEventType(), aEvent.GetPayload().c_str() );
|
||||
printf( "%s: received cmd:%d pay:'%s'\n", class_name,
|
||||
aEvent.Command(), aEvent.GetPayload().c_str() );
|
||||
#endif
|
||||
|
||||
KiwayMailIn( aEvent ); // call the virtual, overload in derived.
|
||||
KiwayMailIn( aEvent ); // call the virtual, override in derived.
|
||||
}
|
||||
|
||||
|
||||
void KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent )
|
||||
void KIWAY_PLAYER::language_change( wxCommandEvent& event )
|
||||
{
|
||||
// overload this.
|
||||
int id = event.GetId();
|
||||
|
||||
// tell all the KIWAY_PLAYERs about the language change.
|
||||
Kiway().SetLanguage( id );
|
||||
}
|
||||
|
|
|
@ -622,7 +622,7 @@ bool PGM_BASE::SetLanguage( bool first_time )
|
|||
|
||||
void PGM_BASE::SetLanguageIdentifier( int menu_id )
|
||||
{
|
||||
wxLogDebug( wxT( "Select language ID %d from %zd possible languages." ),
|
||||
wxLogDebug( wxT( "Select language ID %d from %d possible languages." ),
|
||||
menu_id, DIM( s_Languages ) );
|
||||
|
||||
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||
|
|
|
@ -121,7 +121,7 @@ static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
|
|||
|
||||
// Only a single KIWAY is supported in this single_top top level component,
|
||||
// which is dedicated to loading only a single DSO.
|
||||
KIWAY Kiway( &Pgm() );
|
||||
KIWAY Kiway( &Pgm(), KFCTL_STANDALONE );
|
||||
|
||||
|
||||
// implement a PGM_BASE and a wxApp side by side:
|
||||
|
@ -225,82 +225,6 @@ struct APP_SINGLE_TOP : public wxApp
|
|||
IMPLEMENT_APP( APP_SINGLE_TOP );
|
||||
|
||||
|
||||
/**
|
||||
* Function get_kiface_getter
|
||||
* returns a KIFACE_GETTER_FUNC for the current process's main implementation
|
||||
* link image.
|
||||
*
|
||||
* @param aDSOName is an absolute full path to the DSO to load and find
|
||||
* KIFACE_GETTER_FUNC within.
|
||||
*
|
||||
* @return KIFACE_GETTER_FUNC* - a pointer to a function which can be called to
|
||||
* get the KIFACE or NULL if the getter func was not found. If not found,
|
||||
* it is possibly not version compatible since the lookup is done by name and
|
||||
* the name contains the API version.
|
||||
*/
|
||||
static KIFACE_GETTER_FUNC* get_kiface_getter( const wxString& aDSOName )
|
||||
{
|
||||
#if defined(BUILD_KIWAY_DLL)
|
||||
|
||||
// Remember single_top only knows about a single DSO. Using an automatic
|
||||
// with a defeated destructor, see Detach() below, so that the DSO program
|
||||
// image stays in RAM until process termination, and specifically
|
||||
// beyond the point in time at which static destructors are run. Otherwise
|
||||
// a static wxDynamicLibrary's destructor might create an out of sequence
|
||||
// problem. This was never detected, so it's only a preventative strategy.
|
||||
wxDynamicLibrary dso;
|
||||
|
||||
void* addr = NULL;
|
||||
|
||||
if( !dso.Load( aDSOName, wxDL_VERBATIM | wxDL_NOW ) )
|
||||
{
|
||||
// Failure: error reporting UI was done via wxLogSysError().
|
||||
// No further reporting required here.
|
||||
}
|
||||
|
||||
else if( ( addr = dso.GetSymbol( wxT( KIFACE_INSTANCE_NAME_AND_VERSION ) ) ) == NULL )
|
||||
{
|
||||
// Failure: error reporting UI was done via wxLogSysError().
|
||||
// No further reporting required here.
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
|
||||
(void) dso.Detach();
|
||||
|
||||
return (KIFACE_GETTER_FUNC*) addr;
|
||||
}
|
||||
|
||||
// There is a file installation bug. We only look for KIFACE_I's which we know
|
||||
// to exist, and we did not find one. If we do not find one, this is an
|
||||
// installation bug.
|
||||
|
||||
wxString msg = wxString::Format( wxT(
|
||||
"Fatal Installation Bug\nmissing file:\n'%s'\n\nargv[0]:\n'%s'" ),
|
||||
GetChars( aDSOName ),
|
||||
GetChars( wxStandardPaths::Get().GetExecutablePath() )
|
||||
);
|
||||
|
||||
// This is a fatal error, one from which we cannot recover, nor do we want
|
||||
// to protect against in client code which would require numerous noisy
|
||||
// tests in numerous places. So we inform the user that the installation
|
||||
// is bad. This exception will likely not get caught until way up in the
|
||||
// wxApp derivative, at which point the process will exit gracefully.
|
||||
THROW_IO_ERROR( msg );
|
||||
|
||||
#else
|
||||
return &KIFACE_GETTER;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static KIFACE* kiface;
|
||||
static int kiface_version;
|
||||
|
||||
|
||||
|
||||
bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
|
||||
{
|
||||
// first thing: set m_wx_app
|
||||
|
@ -321,44 +245,27 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
|
|||
if( !initPgm() )
|
||||
return false;
|
||||
|
||||
wxString dname = dso_full_path( absoluteArgv0 );
|
||||
#if !defined(BUILD_KIWAY_DLL)
|
||||
// Get the getter, it is statically linked into this binary image.
|
||||
KIFACE_GETTER_FUNC* getter = &KIFACE_GETTER;
|
||||
|
||||
// Get the getter.
|
||||
KIFACE_GETTER_FUNC* getter = get_kiface_getter( dname );
|
||||
|
||||
if( !getter )
|
||||
{
|
||||
// get_kiface_getter() failed & already showed the UI message.
|
||||
// Return failure without any further UI.
|
||||
return false;
|
||||
}
|
||||
int kiface_version;
|
||||
|
||||
// Get the KIFACE.
|
||||
kiface = getter( &kiface_version, KIFACE_VERSION, this );
|
||||
KIFACE* kiface = getter( &kiface_version, KIFACE_VERSION, this );
|
||||
|
||||
// KIFACE_GETTER_FUNC function comment (API) says the non-NULL is unconditional.
|
||||
wxASSERT_MSG( kiface, wxT( "attempted DSO has a bug, failed to return a KIFACE*" ) );
|
||||
|
||||
// Give the DSO a single chance to do its "process level" initialization.
|
||||
// "Process level" specifically means stay away from any projects in there.
|
||||
if( !kiface->OnKifaceStart( this, KFCTL_STANDALONE ) )
|
||||
return false;
|
||||
|
||||
// Use KIFACE to create a top window that the KIFACE knows about.
|
||||
// TOP_FRAME is passed on compiler command line from CMake, and is one of
|
||||
// the types in FRAME_T.
|
||||
// KIFACE::CreateWindow() is a virtual so we don't need to link to it.
|
||||
// Remember its in the *.kiface DSO.
|
||||
#if 0
|
||||
// this pulls in EDA_DRAW_FRAME type info, which we don't want in
|
||||
// the single_top link image.
|
||||
KIWAY_PLAYER* frame = dynamic_cast<KIWAY_PLAYER*>( kiface->CreateWindow(
|
||||
NULL, TOP_FRAME, &Kiway, KFCTL_STANDALONE ) );
|
||||
#else
|
||||
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow(
|
||||
NULL, TOP_FRAME, &Kiway, KFCTL_STANDALONE );
|
||||
// Trick the KIWAY into thinking it loaded a KIFACE, by recording the KIFACE
|
||||
// in the KIWAY. It needs to be there for KIWAY::OnKiwayEnd() anyways.
|
||||
Kiway.set_kiface( KIWAY::KifaceType( TOP_FRAME ), kiface );
|
||||
#endif
|
||||
|
||||
// Use KIWAY to create a top window, which registers its existence also.
|
||||
// "TOP_FRAME" is a macro that is passed on compiler command line from CMake,
|
||||
// and is one of the types in FRAME_T.
|
||||
KIWAY_PLAYER* frame = Kiway.Player( TOP_FRAME, true );
|
||||
|
||||
Kiway.SetTop( frame );
|
||||
|
||||
App().SetTopWindow( frame ); // wxApp gets a face.
|
||||
|
||||
// Open project or file specified on the command line:
|
||||
|
@ -454,8 +361,7 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
|
|||
|
||||
void PGM_SINGLE_TOP::OnPgmExit()
|
||||
{
|
||||
if( kiface )
|
||||
kiface->OnKifaceEnd();
|
||||
Kiway.OnKiwayEnd();
|
||||
|
||||
saveCommonSettings();
|
||||
|
||||
|
|
|
@ -76,8 +76,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
|
|||
|
||||
EVT_MENU( ID_CVPCB_LIB_TABLE_EDIT, CVPCB_MAINFRAME::OnEditFootprintLibraryTable )
|
||||
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, CVPCB_MAINFRAME::SetLanguage )
|
||||
|
||||
// Toolbar events
|
||||
EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit )
|
||||
EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST, CVPCB_MAINFRAME::LoadNetList )
|
||||
|
@ -558,12 +556,6 @@ void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::SetLanguage( wxCommandEvent& event )
|
||||
{
|
||||
EDA_BASE_FRAME::SetLanguage( event );
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
|
||||
{
|
||||
GetAssociatedDocument( this, m_DocModulesFileName, &Kiface().KifaceSearch() );
|
||||
|
|
|
@ -123,12 +123,6 @@ public:
|
|||
|
||||
void ChangeFocus( bool aMoveRight );
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* is called on a language menu selection.
|
||||
*/
|
||||
void SetLanguage( wxCommandEvent& event );
|
||||
|
||||
void ToFirstNA( wxCommandEvent& event );
|
||||
void ToPreviousNA( wxCommandEvent& event );
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
|||
wxPoint move_offset;
|
||||
block = &screen->m_BlockLocate;
|
||||
|
||||
LIB_EDIT_FRAME* parent = ( LIB_EDIT_FRAME* ) aPanel->GetParent();
|
||||
LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) aPanel->GetParent();
|
||||
wxASSERT( parent != NULL );
|
||||
|
||||
LIB_COMPONENT* component = parent->GetComponent();
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <eda_dde.h>
|
||||
#include <wxEeschemaStruct.h>
|
||||
#include <libeditframe.h>
|
||||
#include <viewlib_frame.h>
|
||||
#include <eda_text.h>
|
||||
|
||||
#include <general.h>
|
||||
|
@ -104,6 +105,15 @@ static struct IFACE : public KIFACE_I
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case FRAME_SCH_VIEWER:
|
||||
case FRAME_SCH_VIEWER_MODAL:
|
||||
{
|
||||
LIB_VIEW_FRAME* frame = new LIB_VIEW_FRAME( aKiway, aParent, FRAME_T( aClassId ) );
|
||||
return frame;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,10 @@ EDA_COLOR_T GetInvisibleItemColor()
|
|||
|
||||
void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
|
||||
{
|
||||
InvokeEeschemaConfig( (SCH_EDIT_FRAME *)GetParent(), this );
|
||||
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
|
||||
wxASSERT( frame );
|
||||
|
||||
InvokeEeschemaConfig( frame, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,7 +137,9 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
|
|||
{
|
||||
int id = event.GetId();
|
||||
wxFileName fn;
|
||||
SCH_EDIT_FRAME* schFrame = ( SCH_EDIT_FRAME* ) GetParent();
|
||||
|
||||
SCH_EDIT_FRAME* schFrame = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
|
||||
wxASSERT( schFrame );
|
||||
|
||||
switch( id )
|
||||
{
|
||||
|
@ -143,20 +148,20 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_CONFIG_READ:
|
||||
{
|
||||
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
{
|
||||
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
|
||||
fn.GetFullName(), ProjectFileWildcard,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
|
||||
fn.GetFullName(), ProjectFileWildcard,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
break;
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
break;
|
||||
|
||||
schFrame->LoadProjectFile( dlg.GetPath(), true );
|
||||
}
|
||||
break;
|
||||
schFrame->LoadProjectFile( dlg.GetPath(), true );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// Hotkey IDs
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiway.h>
|
||||
#include <gr_basic.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <confirm.h>
|
||||
|
@ -55,18 +56,14 @@
|
|||
wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( LIB_ALIAS* aPreselectedAlias,
|
||||
int* aUnit, int* aConvert )
|
||||
{
|
||||
wxSemaphore semaphore( 0, 1 );
|
||||
wxString cmpname;
|
||||
|
||||
// Close the current Lib browser, if open, and open a new one, in "modal" mode:
|
||||
LIB_VIEW_FRAME* viewlibFrame = LIB_VIEW_FRAME::GetActiveLibraryViewer( this );
|
||||
// Close the any current non-modal Lib browser if open, and open a new one, in "modal" mode:
|
||||
LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
|
||||
if( viewlibFrame )
|
||||
viewlibFrame->Destroy();
|
||||
|
||||
viewlibFrame = new LIB_VIEW_FRAME( &Kiway(), this, NULL, &semaphore,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
|
||||
viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, true );
|
||||
|
||||
if ( aPreselectedAlias )
|
||||
if( aPreselectedAlias )
|
||||
{
|
||||
viewlibFrame->SetSelectedLibrary( aPreselectedAlias->GetLibraryName() );
|
||||
viewlibFrame->SetSelectedComponent( aPreselectedAlias->GetName() );
|
||||
|
@ -80,15 +77,9 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( LIB_ALIAS* aPreselectedA
|
|||
|
||||
viewlibFrame->Refresh();
|
||||
|
||||
// Show the library viewer frame until it is closed
|
||||
// Wait for viewer closing event:
|
||||
while( semaphore.TryWait() == wxSEMA_BUSY )
|
||||
{
|
||||
wxYield();
|
||||
wxMilliSleep( 50 );
|
||||
}
|
||||
wxString cmpname;
|
||||
|
||||
cmpname = viewlibFrame->GetSelectedComponent();
|
||||
viewlibFrame->ShowModal( &cmpname );
|
||||
|
||||
if( aUnit )
|
||||
*aUnit = viewlibFrame->GetUnit();
|
||||
|
@ -101,6 +92,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( LIB_ALIAS* aPreselectedA
|
|||
return cmpname;
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
|
||||
wxArrayString& aHistoryList,
|
||||
int& aHistoryLastUnit,
|
||||
|
|
|
@ -99,7 +99,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_SIZE( LIB_EDIT_FRAME::OnSize )
|
||||
EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate )
|
||||
|
||||
/* Main horizontal toolbar. */
|
||||
// Main horizontal toolbar.
|
||||
EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB, LIB_EDIT_FRAME::OnSaveActiveLibrary )
|
||||
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, LIB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_TOOL( ID_LIBEDIT_DELETE_PART, LIB_EDIT_FRAME::DeleteOnePart )
|
||||
|
@ -125,12 +125,12 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_COMBOBOX( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnSelectPart )
|
||||
EVT_COMBOBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias )
|
||||
|
||||
/* Right vertical toolbar. */
|
||||
// Right vertical toolbar.
|
||||
EVT_TOOL( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnSelectTool )
|
||||
EVT_TOOL_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||
LIB_EDIT_FRAME::OnSelectTool )
|
||||
|
||||
/* menubar commands */
|
||||
// menubar commands
|
||||
EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow )
|
||||
EVT_MENU( ID_LIBEDIT_SAVE_CURRENT_LIB_AS, LIB_EDIT_FRAME::OnSaveActiveLibrary )
|
||||
EVT_MENU( ID_LIBEDIT_GEN_PNG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
|
||||
|
@ -152,9 +152,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
|
||||
LIB_EDIT_FRAME::Process_Config )
|
||||
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, LIB_EDIT_FRAME::SetLanguage )
|
||||
|
||||
/* Context menu events and commands. */
|
||||
// Context menu events and commands.
|
||||
EVT_MENU( ID_LIBEDIT_EDIT_PIN, LIB_EDIT_FRAME::OnEditPin )
|
||||
EVT_MENU( ID_LIBEDIT_ROTATE_ITEM, LIB_EDIT_FRAME::OnRotateItem )
|
||||
|
||||
|
@ -165,7 +163,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||
LIB_EDIT_FRAME::Process_Special_Functions )
|
||||
|
||||
/* Update user interface elements. */
|
||||
// Update user interface elements.
|
||||
EVT_UPDATE_UI( ExportPartId, LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||
EVT_UPDATE_UI( CreateNewLibAndSavePartId, LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||
EVT_UPDATE_UI( ID_LIBEDIT_SAVE_CURRENT_PART, LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||
|
@ -193,7 +191,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, SCH_EDIT_FRAME* aParent ) :
|
|||
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
|
||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() )
|
||||
{
|
||||
wxASSERT( aParent ); // LIB_EDIT_FRAME needs a parent, since it peeks up there.
|
||||
wxASSERT( aParent );
|
||||
|
||||
m_FrameName = GetLibEditFrameName();
|
||||
m_showAxis = true; // true to draw axis
|
||||
|
@ -204,6 +202,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, SCH_EDIT_FRAME* aParent ) :
|
|||
m_tempCopyComponent = NULL;
|
||||
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
|
||||
m_editPinsPerPartOrConvert = false;
|
||||
|
||||
// Initialize grid id to the default value 50 mils:
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
||||
|
@ -293,12 +292,6 @@ const wxChar* LIB_EDIT_FRAME::GetLibEditFrameName()
|
|||
}
|
||||
|
||||
|
||||
LIB_EDIT_FRAME* LIB_EDIT_FRAME::GetActiveLibraryEditor()
|
||||
{
|
||||
return (LIB_EDIT_FRAME*) wxWindow::FindWindowByName(GetLibEditFrameName());
|
||||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||
{
|
||||
#if 0 // original
|
||||
|
@ -389,12 +382,12 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
|
||||
double LIB_EDIT_FRAME::BestZoom()
|
||||
{
|
||||
/* Please, note: wxMSW before version 2.9 seems have
|
||||
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
|
||||
* edit file <wxWidgets>/src/msw/dc.cpp
|
||||
* search for line static const int VIEWPORT_EXTENT = 1000;
|
||||
* and replace by static const int VIEWPORT_EXTENT = 10000;
|
||||
*/
|
||||
/* Please, note: wxMSW before version 2.9 seems have
|
||||
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
|
||||
* edit file <wxWidgets>/src/msw/dc.cpp
|
||||
* search for line static const int VIEWPORT_EXTENT = 1000;
|
||||
* and replace by static const int VIEWPORT_EXTENT = 10000;
|
||||
*/
|
||||
int dx, dy;
|
||||
wxSize size;
|
||||
EDA_RECT BoundaryBox;
|
||||
|
@ -750,23 +743,23 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
|
||||
{
|
||||
// Delete the last created segment, while creating a polyline draw item
|
||||
if( m_drawItem == NULL )
|
||||
break;
|
||||
{
|
||||
// Delete the last created segment, while creating a polyline draw item
|
||||
if( m_drawItem == NULL )
|
||||
break;
|
||||
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
|
||||
m_drawItem->ClearFlags();
|
||||
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL,
|
||||
DefaultTransform );
|
||||
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetCrossHairPosition( true ) );
|
||||
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL,
|
||||
DefaultTransform );
|
||||
m_drawItem->SetFlags( oldFlags );
|
||||
m_lastDrawItem = NULL;
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
|
||||
m_drawItem->ClearFlags();
|
||||
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL,
|
||||
DefaultTransform );
|
||||
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetCrossHairPosition( true ) );
|
||||
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL,
|
||||
DefaultTransform );
|
||||
m_drawItem->SetFlags( oldFlags );
|
||||
m_lastDrawItem = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ID_POPUP_LIBEDIT_DELETE_ITEM:
|
||||
if( m_drawItem )
|
||||
|
@ -918,17 +911,6 @@ void LIB_EDIT_FRAME::EnsureActiveLibExists()
|
|||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
{
|
||||
EDA_BASE_FRAME::SetLanguage( event );
|
||||
SCH_EDIT_FRAME *parent = (SCH_EDIT_FRAME *)GetParent();
|
||||
// Call parent->EDA_BASE_FRAME::SetLanguage and NOT
|
||||
// parent->SetLanguage because parent->SetLanguage call
|
||||
// LIB_EDIT_FRAME::SetLanguage
|
||||
parent->EDA_BASE_FRAME::SetLanguage( event );
|
||||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::TempCopyComponent()
|
||||
{
|
||||
if( m_tempCopyComponent )
|
||||
|
|
|
@ -133,13 +133,6 @@ public:
|
|||
*/
|
||||
static const wxChar* GetLibEditFrameName();
|
||||
|
||||
/**
|
||||
* Function GetActiveLibraryEditor (static)
|
||||
* @return a reference to the current opened Library editor
|
||||
* or NULL if no Library editor currently opened
|
||||
*/
|
||||
static LIB_EDIT_FRAME* GetActiveLibraryEditor();
|
||||
|
||||
void ReCreateMenuBar();
|
||||
|
||||
/**
|
||||
|
@ -149,12 +142,6 @@ public:
|
|||
*/
|
||||
static void EnsureActiveLibExists();
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* is called on a language menu selection
|
||||
*/
|
||||
void SetLanguage( wxCommandEvent& event );
|
||||
|
||||
void InstallConfigFrame( wxCommandEvent& event );
|
||||
void InstallDimensionsDialog( wxCommandEvent& event );
|
||||
void OnColorConfig( wxCommandEvent& aEvent );
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <viewlib_frame.h>
|
||||
#include <libeditframe.h>
|
||||
#include <base_units.h>
|
||||
#include <kiway.h>
|
||||
|
||||
|
||||
SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
|
@ -40,12 +41,10 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
|
||||
void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
|
||||
{
|
||||
LIB_VIEW_FRAME* viewlibFrame = LIB_VIEW_FRAME::GetActiveLibraryViewer( this );
|
||||
LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, true );
|
||||
|
||||
if( viewlibFrame )
|
||||
viewlibFrame->Show( true );
|
||||
else
|
||||
new LIB_VIEW_FRAME( &Kiway(), this );
|
||||
viewlibFrame->Show( true );
|
||||
viewlibFrame->Raise();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -664,7 +664,7 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
|||
{
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
|
||||
SCH_ITEM* item = screen->GetCurItem();
|
||||
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
|
||||
SCH_EDIT_FRAME* parent = (SCH_EDIT_FRAME*) aPanel->GetParent();
|
||||
|
||||
parent->SetRepeatItem( NULL );
|
||||
screen->SetCurItem( NULL );
|
||||
|
|
|
@ -96,8 +96,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig )
|
||||
EVT_TOOL( wxID_PREFERENCES, SCH_EDIT_FRAME::OnSetOptions )
|
||||
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::SetLanguage )
|
||||
|
||||
EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
|
||||
EVT_TOOL( ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP, SCH_EDIT_FRAME::OnOpenLibraryEditor )
|
||||
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
|
||||
|
@ -442,13 +440,20 @@ void SCH_EDIT_FRAME::SaveUndoItemInUndoList( SCH_ITEM* aItem )
|
|||
|
||||
void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
|
||||
{
|
||||
LIB_EDIT_FRAME * libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
|
||||
if( libeditFrame && !libeditFrame->Close() ) // Can close component editor?
|
||||
return;
|
||||
if( Kiface().IsSingle() )
|
||||
{
|
||||
LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
|
||||
if( libeditFrame && !libeditFrame->Close() ) // Can close component editor?
|
||||
return;
|
||||
|
||||
LIB_VIEW_FRAME* viewlibFrame = LIB_VIEW_FRAME::GetActiveLibraryViewer( this );
|
||||
if( viewlibFrame && !viewlibFrame->Close() ) // Can close component viewer?
|
||||
return;
|
||||
LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
|
||||
if( viewlibFrame && !viewlibFrame->Close() ) // Can close component viewer?
|
||||
return;
|
||||
|
||||
viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false );
|
||||
if( viewlibFrame && !viewlibFrame->Close() ) // Can close modal component viewer?
|
||||
return;
|
||||
}
|
||||
|
||||
SCH_SHEET_LIST SheetList;
|
||||
|
||||
|
@ -829,7 +834,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
|||
{
|
||||
SCH_ITEM* item = GetScreen()->GetCurItem();
|
||||
|
||||
if( (item == NULL) || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
|
||||
if( !item || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
|
||||
{
|
||||
wxMessageBox( _( "Error: not a component or no component" ) );
|
||||
return;
|
||||
|
@ -838,9 +843,21 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
|||
component = (SCH_COMPONENT*) item;
|
||||
}
|
||||
|
||||
// @todo: should be changed to use Kiway().Player()?
|
||||
LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false );
|
||||
if( !libeditFrame )
|
||||
{
|
||||
libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, true );
|
||||
libeditFrame->Show( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
// if( libeditFrame->IsIconized() )
|
||||
// libeditFrame->Iconize( false );
|
||||
}
|
||||
|
||||
LIB_EDIT_FRAME* libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
|
||||
libeditFrame->Raise();
|
||||
|
||||
#if 0
|
||||
if( libeditFrame )
|
||||
{
|
||||
if( libeditFrame->IsIconized() )
|
||||
|
@ -855,6 +872,8 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
|||
wxWindow* w = kf.CreateWindow( this, FRAME_SCH_LIB_EDITOR, &Kiway(), kf.StartFlags() );
|
||||
libeditFrame = dynamic_cast<LIB_EDIT_FRAME*>( w );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if( component )
|
||||
{
|
||||
|
@ -875,16 +894,6 @@ void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
{
|
||||
EDA_BASE_FRAME::SetLanguage( event );
|
||||
|
||||
LIB_EDIT_FRAME * libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
|
||||
if( libeditFrame )
|
||||
libeditFrame->EDA_BASE_FRAME::SetLanguage( event );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn;
|
||||
|
|
|
@ -283,7 +283,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
|||
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
|
||||
SCH_ITEM* item = screen->GetCurItem();
|
||||
|
||||
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
|
||||
SCH_EDIT_FRAME* parent = (SCH_EDIT_FRAME*) aPanel->GetParent();
|
||||
|
||||
if( (item == NULL) || (item->Type() != SCH_SHEET_T) || (parent == NULL) )
|
||||
return;
|
||||
|
|
|
@ -116,9 +116,9 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
|
|||
_( "View component documents" ) );
|
||||
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
|
||||
|
||||
if( m_semaphore )
|
||||
// if library browser is modal
|
||||
if( m_Ident == FRAME_SCH_VIEWER_MODAL )
|
||||
{
|
||||
// The library browser is called from a "load component" command
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
|
||||
wxEmptyString, KiBitmap( export_xpm ),
|
||||
|
|
|
@ -47,28 +47,25 @@
|
|||
*/
|
||||
wxString LIB_VIEW_FRAME::m_libraryName;
|
||||
wxString LIB_VIEW_FRAME::m_entryName;
|
||||
|
||||
int LIB_VIEW_FRAME::m_unit = 1;
|
||||
int LIB_VIEW_FRAME::m_convert = 1;
|
||||
|
||||
|
||||
/// When the viewer is used to select a component in schematic, the selected component is here.
|
||||
wxString LIB_VIEW_FRAME::m_exportToEeschemaCmpName;
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
|
||||
/* Window events */
|
||||
// Window events
|
||||
EVT_CLOSE( LIB_VIEW_FRAME::OnCloseWindow )
|
||||
EVT_SIZE( LIB_VIEW_FRAME::OnSize )
|
||||
EVT_ACTIVATE( LIB_VIEW_FRAME::OnActivate )
|
||||
|
||||
/* Toolbar events */
|
||||
// Toolbar events
|
||||
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
|
||||
LIB_VIEW_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
|
||||
EVT_COMBOBOX( ID_LIBVIEW_SELECT_PART_NUMBER, LIB_VIEW_FRAME::Process_Special_Functions )
|
||||
|
||||
/* listbox events */
|
||||
// listbox events
|
||||
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, LIB_VIEW_FRAME::ClickOnLibList )
|
||||
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::ClickOnCmpList )
|
||||
EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::DClickOnCmpList )
|
||||
|
@ -95,11 +92,17 @@ static wxAcceleratorEntry accels[] =
|
|||
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
|
||||
#define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" )
|
||||
|
||||
LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, SCH_BASE_FRAME* aParent,
|
||||
CMP_LIBRARY* aLibrary, wxSemaphore* aSemaphore, long aStyle ) :
|
||||
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_VIEWER, _( "Library Browser" ),
|
||||
wxDefaultPosition, wxDefaultSize, aStyle, GetLibViewerFrameName() )
|
||||
LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
CMP_LIBRARY* aLibrary ) :
|
||||
SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
aFrameType==FRAME_SCH_VIEWER ?
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE :
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT,
|
||||
GetLibViewerFrameName() )
|
||||
{
|
||||
wxASSERT( aFrameType==FRAME_SCH_VIEWER || aFrameType==FRAME_SCH_VIEWER_MODAL );
|
||||
|
||||
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
|
||||
|
||||
m_FrameName = GetLibViewerFrameName();
|
||||
|
@ -114,12 +117,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, SCH_BASE_FRAME* aParent,
|
|||
m_HotkeysZoomAndGridList = s_Viewlib_Hokeys_Descr;
|
||||
m_cmpList = NULL;
|
||||
m_libList = NULL;
|
||||
m_semaphore = aSemaphore;
|
||||
|
||||
if( m_semaphore )
|
||||
SetModalMode( true );
|
||||
|
||||
m_exportToEeschemaCmpName.Empty();
|
||||
|
||||
SetScreen( new SCH_SCREEN() );
|
||||
GetScreen()->m_Center = true; // Axis origin centered on screen.
|
||||
|
@ -139,10 +136,10 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, SCH_BASE_FRAME* aParent,
|
|||
|
||||
wxPoint win_pos( 0, 0 );
|
||||
|
||||
if( aLibrary == NULL )
|
||||
if( !aLibrary )
|
||||
{
|
||||
// Creates the libraries window display
|
||||
m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST,
|
||||
m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST,
|
||||
wxPoint( 0, 0 ), wxSize(m_libListWidth, -1),
|
||||
0, NULL, wxLB_HSCROLL );
|
||||
}
|
||||
|
@ -243,25 +240,19 @@ const wxChar* LIB_VIEW_FRAME::GetLibViewerFrameName()
|
|||
}
|
||||
|
||||
|
||||
LIB_VIEW_FRAME* LIB_VIEW_FRAME::GetActiveLibraryViewer( const wxWindow* aParent )
|
||||
{
|
||||
return (LIB_VIEW_FRAME*) wxWindow::FindWindowByName( GetLibViewerFrameName(), aParent );
|
||||
}
|
||||
|
||||
|
||||
void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
if( m_semaphore )
|
||||
{
|
||||
m_semaphore->Post();
|
||||
// This window will be destroyed by the calling function,
|
||||
// if needed
|
||||
SetModalMode( false );
|
||||
}
|
||||
else
|
||||
if( !IsModal() )
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
else if( !IsDismissed() )
|
||||
{
|
||||
// only dismiss modal frame if not already dismissed.
|
||||
DismissModal( false );
|
||||
|
||||
// Modal frame will be destroyed by the calling function.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -283,12 +274,13 @@ void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
|||
|
||||
double LIB_VIEW_FRAME::BestZoom()
|
||||
{
|
||||
/* Please, note: wxMSW before version 2.9 seems have
|
||||
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
|
||||
* edit file <wxWidgets>/src/msw/dc.cpp
|
||||
* search for line static const int VIEWPORT_EXTENT = 1000;
|
||||
* and replace by static const int VIEWPORT_EXTENT = 10000;
|
||||
*/
|
||||
/* Please, note: wxMSW before version 2.9 seems have
|
||||
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
|
||||
* edit file <wxWidgets>/src/msw/dc.cpp
|
||||
* search for line static const int VIEWPORT_EXTENT = 1000;
|
||||
* and replace by static const int VIEWPORT_EXTENT = 10000;
|
||||
*/
|
||||
|
||||
LIB_COMPONENT* component = NULL;
|
||||
double bestzoom = 16.0; // default value for bestzoom
|
||||
CMP_LIBRARY* lib = CMP_LIBRARY::FindLibrary( m_libraryName );
|
||||
|
@ -344,8 +336,8 @@ void LIB_VIEW_FRAME::ReCreateListLib()
|
|||
}
|
||||
else
|
||||
{
|
||||
/* If not found, clear current library selection because it can be
|
||||
* deleted after a config change. */
|
||||
// If not found, clear current library selection because it can be
|
||||
// deleted after a config change.
|
||||
m_libraryName = wxEmptyString;
|
||||
m_entryName = wxEmptyString;
|
||||
m_unit = 1;
|
||||
|
@ -417,6 +409,7 @@ void LIB_VIEW_FRAME::SetSelectedLibrary( const wxString& aLibraryName )
|
|||
m_canvas->Refresh();
|
||||
DisplayLibInfos();
|
||||
ReCreateHToolbar();
|
||||
|
||||
// Ensure the corresponding line in m_libList is selected
|
||||
// (which is not necessary the case if SetSelectedLibrary is called
|
||||
// by an other caller than ClickOnLibList.
|
||||
|
@ -440,9 +433,10 @@ void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName )
|
|||
if( m_entryName.CmpNoCase( aComponentName ) != 0 )
|
||||
{
|
||||
m_entryName = aComponentName;
|
||||
|
||||
// Ensure the corresponding line in m_cmpList is selected
|
||||
// (which is not necessary the case if SetSelectedComponent is called
|
||||
// by an other caller than ClickOnCmpList.
|
||||
// (which is not necessarily the case if SetSelectedComponent is called
|
||||
// by another caller than ClickOnCmpList.
|
||||
m_cmpList->SetStringSelection( aComponentName, true );
|
||||
DisplayLibInfos();
|
||||
m_unit = 1;
|
||||
|
@ -456,14 +450,21 @@ void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName )
|
|||
|
||||
void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
|
||||
{
|
||||
if( m_semaphore )
|
||||
if( IsModal() )
|
||||
{
|
||||
ExportToSchematicLibraryPart( event );
|
||||
|
||||
// Prevent the double click from being as a single click in the parent
|
||||
// window which would cause the part to be parked rather than staying
|
||||
// in drag mode.
|
||||
((SCH_BASE_FRAME*) GetParent())->SkipNextLeftButtonReleaseEvent();
|
||||
// The schematic editor might not be the parent of the library viewer.
|
||||
// It could be a python window.
|
||||
SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
||||
|
||||
if( schframe )
|
||||
{
|
||||
// Prevent the double click from being as a single click in the parent
|
||||
// window which would cause the part to be parked rather than staying
|
||||
// in drag mode.
|
||||
schframe->SkipNextLeftButtonReleaseEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,9 +474,17 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
|
|||
int ii = m_cmpList->GetSelection();
|
||||
|
||||
if( ii >= 0 )
|
||||
m_exportToEeschemaCmpName = m_cmpList->GetString( ii );
|
||||
{
|
||||
wxString part_name = m_cmpList->GetString( ii );
|
||||
|
||||
// a selection was made, pass true
|
||||
DismissModal( true, part_name );
|
||||
}
|
||||
else
|
||||
m_exportToEeschemaCmpName.Empty();
|
||||
{
|
||||
// no selection was made, pass false
|
||||
DismissModal( false );
|
||||
}
|
||||
|
||||
Close( true );
|
||||
}
|
||||
|
@ -524,10 +533,6 @@ void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
|
|||
{
|
||||
EDA_DRAW_FRAME::OnActivate( event );
|
||||
|
||||
// Ensure we do not have old selection:
|
||||
if( m_FrameIsActive )
|
||||
m_exportToEeschemaCmpName.Empty();
|
||||
|
||||
if( m_libList )
|
||||
ReCreateListLib();
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
class wxSashLayoutWindow;
|
||||
class wxListBox;
|
||||
class wxSemaphore;
|
||||
class CMP_LIBRARY;
|
||||
|
||||
|
||||
|
@ -48,9 +47,14 @@ class CMP_LIBRARY;
|
|||
class LIB_VIEW_FRAME : public SCH_BASE_FRAME
|
||||
{
|
||||
public:
|
||||
LIB_VIEW_FRAME( KIWAY* aKiway, SCH_BASE_FRAME* aParent,
|
||||
CMP_LIBRARY* aLibrary = NULL, wxSemaphore* aSemaphore = NULL,
|
||||
long aStyle = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param aFrameType must be given either FRAME_SCH_LIB_VIEWER or
|
||||
* FRAME_SCH_LIB_VIEWER_MODAL
|
||||
*/
|
||||
LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
FRAME_T aFrameType, CMP_LIBRARY* aLibrary = NULL );
|
||||
|
||||
~LIB_VIEW_FRAME();
|
||||
|
||||
|
@ -61,13 +65,6 @@ public:
|
|||
*/
|
||||
static const wxChar* GetLibViewerFrameName();
|
||||
|
||||
/**
|
||||
* Function GetActiveLibraryViewer (static)
|
||||
* @return a reference to the current opened Library viewer
|
||||
* or NULL if no Library viewer currently opened
|
||||
*/
|
||||
static LIB_VIEW_FRAME* GetActiveLibraryViewer( const wxWindow* aParent );
|
||||
|
||||
void OnSize( wxSizeEvent& event );
|
||||
|
||||
/**
|
||||
|
@ -109,7 +106,6 @@ public:
|
|||
* @param the alias name of the component to be selected.
|
||||
*/
|
||||
void SetSelectedComponent( const wxString& aComponentName );
|
||||
const wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; }
|
||||
|
||||
void SetUnit( int aUnit ) { m_unit = aUnit; }
|
||||
int GetUnit( void ) { return m_unit; }
|
||||
|
@ -147,8 +143,6 @@ private:
|
|||
wxListBox* m_cmpList; // The list of components
|
||||
int m_cmpListWidth; // Last width of the window
|
||||
|
||||
// Flags
|
||||
wxSemaphore* m_semaphore; // != NULL if the frame must emulate a modal dialog
|
||||
wxString m_configPath; // subpath for configuration
|
||||
|
||||
// TODO(hzeller): looks like these members were chosen to be static to survive different
|
||||
|
@ -156,11 +150,8 @@ private:
|
|||
// ugly hack, and should be solved differently.
|
||||
static wxString m_libraryName;
|
||||
|
||||
// TODO(hzeller): figure out what the difference between these is and the motivation to
|
||||
// have this distinction. Shouldn't these essentially be the same ?
|
||||
static wxString m_entryName;
|
||||
static wxString m_exportToEeschemaCmpName; // When the viewer is used to select a component
|
||||
// in schematic, the selected component is here
|
||||
|
||||
static int m_unit;
|
||||
static int m_convert;
|
||||
|
||||
|
|
|
@ -52,8 +52,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
|
|||
GERBVIEW_FRAME::OnSelectOptionToolbar )
|
||||
EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::InstallGerberOptionsDialog )
|
||||
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EDA_DRAW_FRAME::SetLanguage )
|
||||
|
||||
// menu Postprocess
|
||||
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions )
|
||||
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, GERBVIEW_FRAME::OnShowGerberSourceFile )
|
||||
|
@ -209,9 +207,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Selects the active DCode for the current active layer.
|
||||
* Items using this DCode are hightlighted
|
||||
*/
|
||||
void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event )
|
||||
{
|
||||
GERBER_IMAGE* gerber_image = g_GERBER_List[getActiveLayer()];
|
||||
|
@ -228,10 +223,7 @@ void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
/* Selects the active layer:
|
||||
* - if a file is loaded, it is loaded in this layer
|
||||
* _ this layer is displayed on top of other layers
|
||||
*/
|
||||
|
||||
void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
|
||||
{
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
|
@ -246,9 +238,6 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Call preferred editor to show (and edit) the gerber source file
|
||||
* loaded in the active layer
|
||||
*/
|
||||
void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
|
||||
{
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
|
@ -275,9 +264,6 @@ void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Function OnSelectDisplayMode: called to select display mode
|
||||
* (fast display, or exact mode with stacked images or with transparency
|
||||
*/
|
||||
void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event )
|
||||
{
|
||||
int oldMode = GetDisplayMode();
|
||||
|
@ -301,20 +287,20 @@ void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event )
|
|||
m_canvas->Refresh();
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::OnQuit( wxCommandEvent& event )
|
||||
{
|
||||
Close( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
* Update Layer manager title and tabs texts
|
||||
*/
|
||||
void GERBVIEW_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
|
||||
void GERBVIEW_FRAME::ShowChangedLanguage()
|
||||
{
|
||||
EDA_DRAW_FRAME::SetLanguage( event );
|
||||
// call my base class
|
||||
EDA_DRAW_FRAME::ShowChangedLanguage();
|
||||
|
||||
m_LayersManager->SetLayersManagerTabsText();
|
||||
|
||||
wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_LayersManager );
|
||||
pane_info.Caption( _( "Visibles" ) );
|
||||
m_auimgr.Update();
|
||||
|
@ -322,14 +308,12 @@ void GERBVIEW_FRAME::SetLanguage( wxCommandEvent& event )
|
|||
ReFillLayerWidget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function OnSelectOptionToolbar
|
||||
* called to validate current choices
|
||||
*/
|
||||
|
||||
void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
bool state;
|
||||
int id = event.GetId();
|
||||
bool state;
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG:
|
||||
|
@ -374,6 +358,7 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
|
||||
|
||||
// show/hide auxiliary Vertical layers and visibility manager toolbar
|
||||
m_show_layer_manager_tools = state;
|
||||
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
|
||||
|
|
|
@ -462,11 +462,7 @@ public:
|
|||
|
||||
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
*/
|
||||
virtual void SetLanguage( wxCommandEvent& event );
|
||||
void ShowChangedLanguage(); // override EDA_BASE_FRAME virtual
|
||||
|
||||
void Process_Special_Functions( wxCommandEvent& event );
|
||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||
|
|
|
@ -281,13 +281,6 @@ public:
|
|||
void EraseMsgBox();
|
||||
void Process_PageSettings( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
* when using a derived function, do not forget to call this one
|
||||
*/
|
||||
virtual void SetLanguage( wxCommandEvent& event );
|
||||
|
||||
virtual void ReCreateHToolbar() = 0;
|
||||
virtual void ReCreateVToolbar() = 0;
|
||||
virtual void ReCreateMenuBar();
|
||||
|
|
|
@ -80,9 +80,7 @@ public:
|
|||
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset into
|
||||
* aId at which an error was detected.
|
||||
*/
|
||||
int Parse( const std::string& aId );
|
||||
|
||||
int Parse( const wxString& aId );
|
||||
int Parse( const UTF8& aId );
|
||||
|
||||
/**
|
||||
* Function GetLibNickname
|
||||
|
@ -100,9 +98,7 @@ public:
|
|||
* into the parameter at which an error was detected, usually because it
|
||||
* contained '/' or ':'.
|
||||
*/
|
||||
int SetLibNickname( const std::string& aNickname );
|
||||
|
||||
int SetLibNickname( const wxString& aNickname );
|
||||
int SetLibNickname( const UTF8& aNickname );
|
||||
|
||||
/**
|
||||
* Function GetFootprintName
|
||||
|
@ -114,11 +110,9 @@ public:
|
|||
* Function SetFootprintName
|
||||
* overrides the footprint name portion of the FPID to @a aFootprintName
|
||||
*/
|
||||
int SetFootprintName( const std::string& aFootprintName );
|
||||
int SetFootprintName( const UTF8& aFootprintName );
|
||||
|
||||
int SetFootprintName( const wxString& aFootprintName );
|
||||
|
||||
int SetRevision( const std::string& aRevision );
|
||||
int SetRevision( const UTF8& aRevision );
|
||||
|
||||
const UTF8& GetRevision() const { return revision; }
|
||||
|
||||
|
@ -136,10 +130,10 @@ public:
|
|||
* aLibNickname, aFootprintName, and aRevision.
|
||||
*
|
||||
* @throw PARSE_ERROR if any of the pieces are illegal.
|
||||
*/
|
||||
static UTF8 Format( const std::string& aLibNickname, const std::string& aFootprintName,
|
||||
const std::string& aRevision )
|
||||
static UTF8 Format( const UTF8& aLibNickname, const UTF8& aFootprintName,
|
||||
const UTF8& aRevision = "" )
|
||||
throw( PARSE_ERROR );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function IsValid
|
||||
|
|
|
@ -11,22 +11,35 @@ enum FRAME_T
|
|||
FRAME_SCH,
|
||||
FRAME_SCH_LIB_EDITOR,
|
||||
FRAME_SCH_VIEWER,
|
||||
FRAME_SCH_VIEWER_MODAL,
|
||||
|
||||
FRAME_PCB,
|
||||
FRAME_PCB_MODULE_EDITOR,
|
||||
FRAME_PCB_MODULE_VIEWER,
|
||||
FRAME_PCB_FOOTPRINT_WIZARD,
|
||||
FRAME_PCB_MODULE_VIEWER_MODAL,
|
||||
FRAME_PCB_FOOTPRINT_WIZARD_MODAL,
|
||||
FRAME_PCB_DISPLAY3D,
|
||||
|
||||
FRAME_CVPCB,
|
||||
FRAME_CVPCB_DISPLAY,
|
||||
|
||||
FRAME_GERBER,
|
||||
|
||||
KIWAY_PLAYER_COUNT, // counts subset of FRAME_T's tracked in class KIWAY
|
||||
|
||||
KICAD_MAIN_FRAME_T = KIWAY_PLAYER_COUNT,
|
||||
FRAME_PL_EDITOR,
|
||||
//TEXT_EDITOR_FRAME_T,
|
||||
|
||||
FRAME_BM2CMP,
|
||||
|
||||
FRAME_CALC,
|
||||
|
||||
KIWAY_PLAYER_COUNT, // counts subset of FRAME_T's which are KIWAY_PLAYER derivatives
|
||||
|
||||
// C++ project manager is not a KIWAY_PLAYER
|
||||
KICAD_MAIN_FRAME_T = KIWAY_PLAYER_COUNT,
|
||||
|
||||
FRAME_T_COUNT
|
||||
};
|
||||
|
||||
//TEXT_EDITOR_FRAME_T,
|
||||
|
||||
|
||||
#endif // FRAME_T_H_
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
}
|
||||
|
||||
VTBL_ENTRY wxWindow* CreateWindow( wxWindow* aParent,
|
||||
int aClassId, KIWAY* aKIWAY, int aCtlBits ) = 0;
|
||||
int aClassId, KIWAY* aKIWAY, int aCtlBits = 0 ) = 0;
|
||||
|
||||
VTBL_ENTRY void* IfaceOrAddress( int aDataId ) = 0;
|
||||
|
||||
|
|
|
@ -150,7 +150,8 @@ struct KIFACE
|
|||
// this interface.
|
||||
|
||||
#define KFCTL_STANDALONE (1<<0) ///< Am running as a standalone Top.
|
||||
#define KFCTL_PROJECT_SUITE (1<<1) ///< Am running under a project mgr, possibly with others
|
||||
#define KFCTL_CPP_PROJECT_SUITE (1<<1) ///< Am running under C++ project mgr, possibly with others
|
||||
#define KFCTL_PY_PROJECT_SUITE (1<<2) ///< Am running under python project mgr, possibly with others
|
||||
|
||||
|
||||
/**
|
||||
|
@ -201,7 +202,7 @@ struct KIFACE
|
|||
* not contained in the caller's link image.
|
||||
*/
|
||||
VTBL_ENTRY wxWindow* CreateWindow( wxWindow* aParent, int aClassId,
|
||||
KIWAY* aKIWAY, int aCtlBits ) = 0;
|
||||
KIWAY* aKIWAY, int aCtlBits = 0 ) = 0;
|
||||
|
||||
/**
|
||||
* Function IfaceOrAddress
|
||||
|
@ -249,6 +250,7 @@ struct KIFACE
|
|||
*/
|
||||
class KIWAY : public wxEvtHandler
|
||||
{
|
||||
friend class PGM_SINGLE_TOP; // can use set_kiface()
|
||||
|
||||
public:
|
||||
/// Known KIFACE implementations
|
||||
|
@ -257,16 +259,12 @@ public:
|
|||
FACE_SCH, ///< eeschema DSO
|
||||
FACE_PCB, ///< pcbnew DSO
|
||||
FACE_CVPCB,
|
||||
|
||||
/// count of those above here, which is the subset managed in a KIWAY.
|
||||
KIWAY_FACE_COUNT,
|
||||
|
||||
FACE_BMP2CMP = KIWAY_FACE_COUNT,
|
||||
FACE_GERBVIEW,
|
||||
FACE_PL_EDITOR,
|
||||
FACE_PCB_CALCULATOR,
|
||||
FACE_BMP2CMP,
|
||||
|
||||
FACE_COUNT
|
||||
KIWAY_FACE_COUNT
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -302,7 +300,7 @@ public:
|
|||
* @return KIWAY_PLAYER* - a valid opened KIWAY_PLAYER or NULL if there
|
||||
* is something wrong or doCreate was false and the player has yet to be created.
|
||||
*/
|
||||
VTBL_ENTRY KIWAY_PLAYER* Player( FRAME_T aFrameType, bool doCreate = true );
|
||||
VTBL_ENTRY KIWAY_PLAYER* Player( FRAME_T aFrameType, bool doCreate = true );
|
||||
|
||||
/**
|
||||
* Function PlayerClose
|
||||
|
@ -312,7 +310,7 @@ public:
|
|||
*
|
||||
* @return bool - true the window is closed and not vetoed, else false.
|
||||
*/
|
||||
VTBL_ENTRY bool PlayerClose( FRAME_T aFrameType, bool doForce );
|
||||
VTBL_ENTRY bool PlayerClose( FRAME_T aFrameType, bool doForce );
|
||||
|
||||
/**
|
||||
* Function PlayersClose
|
||||
|
@ -325,7 +323,14 @@ public:
|
|||
*/
|
||||
VTBL_ENTRY bool PlayersClose( bool doForce );
|
||||
|
||||
VTBL_ENTRY void ExpressMail( FRAME_T aDestination, MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource=NULL );
|
||||
/**
|
||||
* Function ExpressMail
|
||||
* send aPayload to aDestination from aSource. Recipient receives this in its
|
||||
* KIWAY_PLAYER::KiwayMailIn() function and can efficiently switch() based on
|
||||
* aCommand in there.
|
||||
*/
|
||||
VTBL_ENTRY void ExpressMail( FRAME_T aDestination, MAIL_T aCommand,
|
||||
const std::string& aPayload, wxWindow* aSource = NULL );
|
||||
|
||||
/**
|
||||
* Function Prj
|
||||
|
@ -335,11 +340,26 @@ public:
|
|||
*/
|
||||
VTBL_ENTRY PROJECT& Prj() const;
|
||||
|
||||
KIWAY( PGM_BASE* aProgram, wxFrame* aTop = NULL );
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs.
|
||||
*/
|
||||
VTBL_ENTRY void SetLanguage( int aLanguage );
|
||||
|
||||
/// In case aTop may not be known at time of KIWAY construction:
|
||||
KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop = NULL );
|
||||
|
||||
/**
|
||||
* Function SetTop
|
||||
* tells this KIWAY about the top most frame in the program and optionally
|
||||
* allows it to play the role of one of the KIWAY_PLAYERs if launched from
|
||||
* single_top.cpp.
|
||||
*
|
||||
* @param aTop is the top most wxFrame in the entire program.
|
||||
*/
|
||||
void SetTop( wxFrame* aTop );
|
||||
|
||||
void OnKiwayEnd();
|
||||
|
||||
bool ProcessEvent( wxEvent& aEvent ); // overload virtual
|
||||
|
||||
private:
|
||||
|
@ -348,12 +368,23 @@ private:
|
|||
static const wxString dso_full_path( FACE_T aFaceId );
|
||||
|
||||
/// hooked into m_top in SetTop(), marks child frame as closed.
|
||||
void playerDestroyHandler( wxWindowDestroyEvent& event );
|
||||
void player_destroy_handler( wxWindowDestroyEvent& event );
|
||||
|
||||
bool set_kiface( FACE_T aFaceType, KIFACE* aKiface )
|
||||
{
|
||||
if( unsigned( aFaceType ) < unsigned( KIWAY_FACE_COUNT ) )
|
||||
{
|
||||
m_kiface[aFaceType] = aKiface;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static KIFACE* m_kiface[KIWAY_FACE_COUNT];
|
||||
static int m_kiface_version[KIWAY_FACE_COUNT];
|
||||
|
||||
PGM_BASE* m_program;
|
||||
int m_ctl;
|
||||
wxFrame* m_top;
|
||||
|
||||
KIWAY_PLAYER* m_player[KIWAY_PLAYER_COUNT]; // from frame_type.h
|
||||
|
|
|
@ -35,6 +35,8 @@ class PROJECT;
|
|||
struct KIFACE;
|
||||
class KIFACE_I;
|
||||
|
||||
#define VTBL_ENTRY virtual
|
||||
|
||||
|
||||
/**
|
||||
* Class KIWAY_HOLDER
|
||||
|
@ -80,7 +82,7 @@ public:
|
|||
|
||||
private:
|
||||
// private, all setting is done through SetKiway().
|
||||
KIWAY* m_kiway; // no ownership.
|
||||
KIWAY* m_kiway; // no ownership.
|
||||
};
|
||||
|
||||
|
||||
|
@ -110,6 +112,9 @@ public:
|
|||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName = wxFrameNameStr );
|
||||
|
||||
~KIWAY_PLAYER();
|
||||
|
||||
//----<Cross Module API>-----------------------------------------------------
|
||||
|
||||
// For the aCtl argument of OpenProjectFiles()
|
||||
#define KICTL_OPEN_APPEND (1<<0) ///< append the data file, rather than replace
|
||||
|
@ -149,7 +154,7 @@ public:
|
|||
*
|
||||
* @return bool - true if all requested files were opened OK, else false.
|
||||
*/
|
||||
virtual bool OpenProjectFiles( const std::vector<wxString>& aFileList, int aCtl = 0 )
|
||||
VTBL_ENTRY bool OpenProjectFiles( const std::vector<wxString>& aFileList, int aCtl = 0 )
|
||||
{
|
||||
// overload me for your wxFrame type.
|
||||
|
||||
|
@ -161,6 +166,25 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function ShowModal
|
||||
* puts up this wxFrame as if it were a modal dialog, with all other instantiated
|
||||
* wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal().
|
||||
* That is, behavior is similar to a modal dialog window. Not all KIWAY_PLAYERs
|
||||
* use this interface, so don't call this unless the implementation knows how
|
||||
* to call DismissModal() on a button click or double click or some special
|
||||
* event which ends the modal behavior.
|
||||
*
|
||||
* @param aResult if not NULL, indicates a place to put a resultant string.
|
||||
*
|
||||
* @return bool - true if frame implementation called KIWAY_PLAYER::DismissModal()
|
||||
* with aRetVal of true.
|
||||
*/
|
||||
VTBL_ENTRY bool ShowModal( wxString* aResult );
|
||||
|
||||
//----</Cross Module API>----------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Function KiwayMailIn
|
||||
* receives KIWAY_EXPRESS messages from other players. Merely override it
|
||||
|
@ -168,12 +192,35 @@ public:
|
|||
*/
|
||||
virtual void KiwayMailIn( KIWAY_EXPRESS& aEvent );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
protected:
|
||||
|
||||
//private:
|
||||
bool IsModal() { return m_modal_dismissed; }
|
||||
|
||||
/// event handler, routes to virtual KiwayMailIn()
|
||||
/**
|
||||
* Function IsDismissed
|
||||
* returns false only if both the frame is acting in modal mode and it has not been
|
||||
* dismissed yet with DismissModal(). IOW, it will return true if the dialog is
|
||||
* not modal or if it is modal and has been dismissed.
|
||||
*/
|
||||
bool IsDismissed();
|
||||
|
||||
void DismissModal( bool aRetVal, const wxString& aResult = wxEmptyString );
|
||||
|
||||
/// event handler, routes to derivative specific virtual KiwayMailIn()
|
||||
void kiway_express( KIWAY_EXPRESS& aEvent );
|
||||
|
||||
/**
|
||||
* Function language_change
|
||||
* is an event handler called on a language menu selection.
|
||||
*/
|
||||
void language_change( wxCommandEvent& event );
|
||||
|
||||
// variables for modal behavior support, only used by a few derivatives.
|
||||
volatile bool* m_modal_dismissed; // points to "dismissed state", NULL means not modal
|
||||
wxString m_modal_string;
|
||||
bool m_modal_ret_val; // true if a selection was made
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -813,12 +813,6 @@ private:
|
|||
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
|
||||
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
*/
|
||||
void SetLanguage( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function UpdateTitle
|
||||
* sets the main window title bar text.
|
||||
|
|
|
@ -1666,11 +1666,7 @@ public:
|
|||
*/
|
||||
MODULE* Genere_Self( wxDC* DC );
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
*/
|
||||
virtual void SetLanguage( wxCommandEvent& event );
|
||||
void ShowChangedLanguage(); // override EDA_BASE_FRAME virtual
|
||||
|
||||
/**
|
||||
* Function UpdateTitle
|
||||
|
|
|
@ -113,7 +113,7 @@ class EDA_BASE_FRAME : public wxFrame
|
|||
void windowClosing( wxCloseEvent& event );
|
||||
|
||||
protected:
|
||||
FRAME_T m_Ident; ///< Id Type (pcb, schematic, library..)
|
||||
FRAME_T m_Ident; ///< Id Type (pcb, schematic, library..)
|
||||
wxPoint m_FramePos;
|
||||
wxSize m_FrameSize;
|
||||
|
||||
|
@ -302,13 +302,6 @@ public:
|
|||
*/
|
||||
void ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescList );
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
* when using a derived function, do not forget to call this one
|
||||
*/
|
||||
virtual void SetLanguage( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function GetFileFromHistory
|
||||
* fetches the file name from the file history list.
|
||||
|
@ -380,17 +373,10 @@ public:
|
|||
void CheckForAutoSaveFile( const wxFileName& aFileName, const wxString& aBackupFileExtension );
|
||||
|
||||
/**
|
||||
* Function SetModalMode
|
||||
* Disable or enable all other windows, to emulate a dialog behavior
|
||||
* Useful when the frame is used to show and selec items
|
||||
* (see FOOTPRINT_VIEWER_FRAME and LIB_VIEW_FRAME)
|
||||
*
|
||||
* @param aModal = true to disable all other opened windows (i.e.
|
||||
* this windows is in dialog mode
|
||||
* = false to enable other windows
|
||||
* This function is analog to MakeModal( aModal ), deprecated since wxWidgets 2.9.4
|
||||
* Function ShowChangedLanguage
|
||||
* redraws the menus and what not in current language.
|
||||
*/
|
||||
void SetModalMode( bool aModal );
|
||||
virtual void ShowChangedLanguage();
|
||||
};
|
||||
|
||||
|
||||
|
@ -415,7 +401,6 @@ public:
|
|||
* then after a //==// break has additional calls to anchor toolbars in a way that matches
|
||||
* present functionality.
|
||||
*/
|
||||
|
||||
class EDA_PANEINFO : public wxAuiPaneInfo
|
||||
{
|
||||
|
||||
|
|
|
@ -197,6 +197,8 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
|
|||
|
||||
void PGM_KICAD::OnPgmExit()
|
||||
{
|
||||
Kiway.OnKiwayEnd();
|
||||
|
||||
saveCommonSettings();
|
||||
|
||||
// write common settings to disk, and destroy everything in PGM_KICAD,
|
||||
|
@ -253,7 +255,7 @@ void PGM_KICAD::destroy()
|
|||
}
|
||||
|
||||
|
||||
KIWAY Kiway( &Pgm() );
|
||||
KIWAY Kiway( &Pgm(), KFCTL_CPP_PROJECT_SUITE );
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -140,6 +140,8 @@ public:
|
|||
private:
|
||||
int m_leftWinWidth;
|
||||
|
||||
void language_change( wxCommandEvent& event );
|
||||
|
||||
public:
|
||||
KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size );
|
||||
|
@ -202,7 +204,6 @@ public:
|
|||
*/
|
||||
void ClearMsg();
|
||||
|
||||
void SetLanguage( wxCommandEvent& event );
|
||||
void OnRefresh( wxCommandEvent& event );
|
||||
void OnSelectDefaultPdfBrowser( wxCommandEvent& event );
|
||||
void OnSelectPreferredPdfBrowser( wxCommandEvent& event );
|
||||
|
|
|
@ -361,6 +361,14 @@ void KICAD_MANAGER_FRAME::OnRefresh( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::language_change( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
||||
Kiway.SetLanguage( id );
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::ClearMsg()
|
||||
{
|
||||
m_MessagesBox->Clear();
|
||||
|
|
|
@ -33,20 +33,20 @@
|
|||
#include <menus_helpers.h>
|
||||
#include <tree_project_frame.h>
|
||||
|
||||
/* Menubar and toolbar event table */
|
||||
// Menubar and toolbar event table
|
||||
BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
|
||||
/* Window events */
|
||||
// Window events
|
||||
EVT_SIZE( KICAD_MANAGER_FRAME::OnSize )
|
||||
EVT_CLOSE( KICAD_MANAGER_FRAME::OnCloseWindow )
|
||||
|
||||
/* Toolbar events */
|
||||
// Toolbar events
|
||||
EVT_TOOL( ID_NEW_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject )
|
||||
EVT_TOOL( ID_NEW_PROJECT_FROM_TEMPLATE, KICAD_MANAGER_FRAME::OnLoadProject )
|
||||
EVT_TOOL( ID_LOAD_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject )
|
||||
EVT_TOOL( ID_SAVE_PROJECT, KICAD_MANAGER_FRAME::OnSaveProject )
|
||||
EVT_TOOL( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
|
||||
|
||||
/* Menu events */
|
||||
// Menu events
|
||||
EVT_MENU( ID_SAVE_PROJECT, KICAD_MANAGER_FRAME::OnSaveProject )
|
||||
EVT_MENU( wxID_EXIT, KICAD_MANAGER_FRAME::OnExit )
|
||||
EVT_MENU( ID_TO_EDITOR, KICAD_MANAGER_FRAME::OnOpenTextEditor )
|
||||
|
@ -63,16 +63,17 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
|
|||
EVT_MENU( wxID_INDEX, KICAD_MANAGER_FRAME::GetKicadHelp )
|
||||
EVT_MENU( wxID_ABOUT, KICAD_MANAGER_FRAME::GetKicadAbout )
|
||||
|
||||
/* Range menu events */
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, KICAD_MANAGER_FRAME::SetLanguage )
|
||||
// Range menu events
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, KICAD_MANAGER_FRAME::language_change )
|
||||
|
||||
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, KICAD_MANAGER_FRAME::OnFileHistory )
|
||||
|
||||
// Special functions
|
||||
#ifdef KICAD_USE_FILES_WATCHER
|
||||
#ifdef KICAD_USE_FILES_WATCHER
|
||||
EVT_MENU( ID_INIT_WATCHED_PATHS, KICAD_MANAGER_FRAME::OnChangeWatchedPaths )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Button events */
|
||||
// Button events
|
||||
EVT_BUTTON( ID_TO_PCB, KICAD_MANAGER_FRAME::OnRunPcbNew )
|
||||
EVT_BUTTON( ID_TO_CVPCB, KICAD_MANAGER_FRAME::OnRunCvpcb )
|
||||
EVT_BUTTON( ID_TO_EESCHEMA, KICAD_MANAGER_FRAME::OnRunEeschema )
|
||||
|
|
|
@ -88,8 +88,3 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
|
|||
Pgm().WritePdfBrowserInfos();
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
{
|
||||
EDA_BASE_FRAME::SetLanguage( event );
|
||||
}
|
||||
|
|
|
@ -70,12 +70,8 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( wxID_EXIT, PL_EDITOR_FRAME::OnQuit )
|
||||
|
||||
// menu Preferences
|
||||
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
|
||||
PL_EDITOR_FRAME::Process_Config )
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
|
||||
EDA_DRAW_FRAME::SetLanguage )
|
||||
EVT_MENU( ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR,
|
||||
EDA_BASE_FRAME::OnSelectPreferredEditor )
|
||||
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, PL_EDITOR_FRAME::Process_Config )
|
||||
EVT_MENU( ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR, EDA_BASE_FRAME::OnSelectPreferredEditor )
|
||||
EVT_MENU( wxID_PREFERENCES, PL_EDITOR_FRAME::Process_Config )
|
||||
EVT_MENU( ID_MENU_SWITCH_BGCOLOR, PL_EDITOR_FRAME::Process_Config )
|
||||
EVT_MENU( ID_MENU_GRID_ONOFF, PL_EDITOR_FRAME::Process_Config )
|
||||
|
@ -473,15 +469,6 @@ void PL_EDITOR_FRAME::OnQuit( wxCommandEvent& event )
|
|||
Close( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
* Update Layer manager title and tabs texts
|
||||
*/
|
||||
void PL_EDITOR_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
{
|
||||
EDA_DRAW_FRAME::SetLanguage( event );
|
||||
}
|
||||
|
||||
void PL_EDITOR_FRAME::ToPlotter(wxCommandEvent& event)
|
||||
{
|
||||
|
|
|
@ -198,12 +198,6 @@ public:
|
|||
|
||||
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
||||
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* called on a language menu selection
|
||||
*/
|
||||
virtual void SetLanguage( wxCommandEvent& event );
|
||||
|
||||
void Process_Special_Functions( wxCommandEvent& event );
|
||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ if( USE_KIWAY_DLLS )
|
|||
${PCB_CALCULATOR_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=0;BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_CALC;BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( pcb_calculator
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
|
@ -93,7 +93,6 @@ if( USE_KIWAY_DLLS )
|
|||
add_library( pcb_calculator_kiface MODULE
|
||||
pcb_calculator.cpp
|
||||
${PCB_CALCULATOR_SRCS}
|
||||
# ${PCB_CALCULATOR_RESOURCES}
|
||||
)
|
||||
set_target_properties( pcb_calculator_kiface PROPERTIES
|
||||
OUTPUT_NAME pcb_calculator
|
||||
|
|
|
@ -134,6 +134,7 @@ PCB_CALCULATOR_FRAME::~PCB_CALCULATOR_FRAME()
|
|||
this->Freeze();
|
||||
}
|
||||
|
||||
|
||||
void PCB_CALCULATOR_FRAME::OnClosePcbCalc( wxCloseEvent& event )
|
||||
{
|
||||
if( m_RegulatorListChanged )
|
||||
|
|
|
@ -306,7 +306,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
|||
bool aErase )
|
||||
{
|
||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||
FOOTPRINT_EDIT_FRAME* moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor( aPanel->GetParent() );
|
||||
FOOTPRINT_EDIT_FRAME* moduleEditFrame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( aPanel->GetParent() );
|
||||
|
||||
wxASSERT( moduleEditFrame );
|
||||
MODULE* currentModule = moduleEditFrame->GetBoard()->m_Modules;
|
||||
|
|
|
@ -190,21 +190,21 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_OPEN_MODULE_EDITOR:
|
||||
{
|
||||
FOOTPRINT_EDIT_FRAME* editor = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor( this );
|
||||
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, false );
|
||||
|
||||
if( !editor )
|
||||
{
|
||||
KIFACE_I& kf = Kiface();
|
||||
|
||||
editor = (FOOTPRINT_EDIT_FRAME*) kf.CreateWindow( this, FRAME_PCB_MODULE_EDITOR, &Kiway(), kf.StartFlags() );
|
||||
editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
|
||||
|
||||
editor->Show( true );
|
||||
editor->Zoom_Automatique( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* not needed on linux, other platforms need this?
|
||||
if( editor->IsIconized() )
|
||||
editor->Iconize( false );
|
||||
*/
|
||||
|
||||
editor->Raise();
|
||||
|
||||
|
@ -218,21 +218,21 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_OPEN_MODULE_VIEWER:
|
||||
{
|
||||
FOOTPRINT_VIEWER_FRAME* viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer( this );
|
||||
FOOTPRINT_VIEWER_FRAME* viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
|
||||
|
||||
if( !viewer )
|
||||
{
|
||||
KIFACE_I& kf = Kiface();
|
||||
|
||||
viewer = (FOOTPRINT_VIEWER_FRAME*) kf.CreateWindow( this, FRAME_PCB_MODULE_VIEWER, &Kiway(), kf.StartFlags() );
|
||||
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, true );
|
||||
|
||||
viewer->Show( true );
|
||||
viewer->Zoom_Automatique( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* not needed on linux, other platforms need this?
|
||||
if( viewer->IsIconized() )
|
||||
viewer->Iconize( false );
|
||||
*/
|
||||
|
||||
viewer->Raise();
|
||||
|
||||
|
@ -848,20 +848,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
{
|
||||
FOOTPRINT_EDIT_FRAME* editor = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor( this );
|
||||
|
||||
if( !editor )
|
||||
{
|
||||
KIFACE_I& kf = Kiface();
|
||||
|
||||
editor = (FOOTPRINT_EDIT_FRAME*) kf.CreateWindow( this, FRAME_PCB_MODULE_EDITOR, &Kiway(), kf.StartFlags() );
|
||||
}
|
||||
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
|
||||
|
||||
editor->Load_Module_From_BOARD( (MODULE*)GetCurItem() );
|
||||
SetCurItem( NULL ); // the current module could be deleted by
|
||||
|
||||
editor->Show( true );
|
||||
editor->Iconize( false );
|
||||
|
||||
editor->Raise(); // Iconize( false );
|
||||
}
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
break;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
#include <confirm.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcbnew.h>
|
||||
|
@ -74,20 +75,13 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
|
|||
|
||||
if( retvalue == 2 )
|
||||
{
|
||||
FOOTPRINT_EDIT_FRAME* editor = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor( this );
|
||||
|
||||
if( !editor )
|
||||
{
|
||||
KIFACE_I& kf = Kiface();
|
||||
|
||||
editor = (FOOTPRINT_EDIT_FRAME*) kf.CreateWindow( this, FRAME_PCB_MODULE_EDITOR, &Kiway(), kf.StartFlags() );
|
||||
}
|
||||
FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
|
||||
|
||||
editor->Load_Module_From_BOARD( Module );
|
||||
SetCurItem( NULL );
|
||||
|
||||
editor->Show( true );
|
||||
editor->Iconize( false );
|
||||
editor->Raise(); // Iconize( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ MODULE* FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint()
|
|||
{
|
||||
FOOTPRINT_WIZARD* footprintWizard = FOOTPRINT_WIZARDS::GetWizard( m_wizardName );
|
||||
|
||||
if( footprintWizard && m_exportRequest )
|
||||
if( footprintWizard && m_modal_ret_val )
|
||||
{
|
||||
return footprintWizard->GetModule();
|
||||
}
|
||||
|
|
|
@ -113,18 +113,18 @@ static wxAcceleratorEntry accels[] =
|
|||
|
||||
#define EXTRA_BORDER_SIZE 2
|
||||
|
||||
/* Function FOOTPRINT_WIZARD_FRAME
|
||||
* it's the constructor for the footprint wizard frame, it creates everything inside
|
||||
*/
|
||||
|
||||
#define FOOTPRINT_WIZARD_FRAME_NAME wxT( "FootprintWizard" )
|
||||
|
||||
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, FOOTPRINT_EDIT_FRAME* aParent,
|
||||
wxSemaphore* semaphore, long style ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, FRAME_PCB_FOOTPRINT_WIZARD,
|
||||
_( "Footprint Wizard" ),
|
||||
wxDefaultPosition, wxDefaultSize, style, FOOTPRINT_WIZARD_FRAME_NAME )
|
||||
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
||||
wxWindow* aParent, FRAME_T aFrameType ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT,
|
||||
FOOTPRINT_WIZARD_FRAME_NAME )
|
||||
{
|
||||
wxASSERT( aFrameType==FRAME_PCB_FOOTPRINT_WIZARD_MODAL );
|
||||
|
||||
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
|
||||
|
||||
m_FrameName = FOOTPRINT_WIZARD_FRAME_NAME;
|
||||
|
@ -137,14 +137,10 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, FOOTPRINT_EDIT_FR
|
|||
SetIcon( icon );
|
||||
|
||||
m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr;
|
||||
m_semaphore = semaphore;
|
||||
m_wizardName.Empty();
|
||||
m_exportRequest = false;
|
||||
|
||||
if( m_semaphore )
|
||||
SetModalMode( true );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
||||
// Ensure all layers and items are visible:
|
||||
GetBoard()->SetVisibleAlls();
|
||||
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
|
||||
|
@ -244,17 +240,14 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME()
|
|||
}
|
||||
|
||||
|
||||
/* Function OnCloseWindow
|
||||
* Handles the close event, saving settings an destroying or releasing a semaphore from caller
|
||||
*/
|
||||
void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
if( m_semaphore )
|
||||
if( IsModal() )
|
||||
{
|
||||
m_semaphore->Post();
|
||||
SetModalMode( false );
|
||||
// This window will be destroyed by the calling function,
|
||||
// to avoid side effects
|
||||
// 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 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -265,15 +258,11 @@ void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
|
||||
void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_exportRequest = true;
|
||||
DismissModal( true );
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
/* Function OnSize
|
||||
* It handles a dialog resize event, asking for an update
|
||||
*
|
||||
*/
|
||||
void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||
{
|
||||
if( m_auimgr.GetManagedWindow() )
|
||||
|
@ -283,10 +272,6 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
|
|||
}
|
||||
|
||||
|
||||
/* Function OnSetRelativeOffset
|
||||
* Updates the cursor position and the status bar
|
||||
*
|
||||
*/
|
||||
void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
||||
{
|
||||
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||
|
@ -294,10 +279,6 @@ void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* Function ReCreatePageList
|
||||
* It recreates the list of pages for a new loaded wizard
|
||||
*
|
||||
*/
|
||||
void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
|
||||
{
|
||||
if( m_pageList == NULL )
|
||||
|
@ -326,11 +307,6 @@ void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
|
|||
}
|
||||
|
||||
|
||||
/* Function ReCreateParameterList
|
||||
* It creates the parameter grid for a certain wizard page of the current wizard
|
||||
*
|
||||
*/
|
||||
|
||||
void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
|
||||
{
|
||||
if( m_parameterGrid == NULL )
|
||||
|
@ -620,7 +596,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
|
|||
{
|
||||
wxString msg;
|
||||
|
||||
if( m_mainToolBar == NULL )
|
||||
if( !m_mainToolBar )
|
||||
{
|
||||
m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
||||
|
@ -665,7 +641,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
|
|||
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
||||
KiBitmap( zoom_fit_in_page_xpm ), msg );
|
||||
|
||||
if( m_semaphore )
|
||||
if( m_Ident == FRAME_PCB_FOOTPRINT_WIZARD_MODAL )
|
||||
{
|
||||
// The library browser is called from a "load component" command
|
||||
m_mainToolBar->AddSeparator();
|
||||
|
|
|
@ -35,41 +35,37 @@
|
|||
#include <class_footprint_wizard.h>
|
||||
class wxSashLayoutWindow;
|
||||
class wxListBox;
|
||||
class wxSemaphore;
|
||||
class wxGrid;
|
||||
class wxGridEvent;
|
||||
class FOOTPRINT_EDIT_FRAME;
|
||||
|
||||
|
||||
/**
|
||||
* Component library viewer main window.
|
||||
* Class FOOTPRINT_WIZARD_FRAME
|
||||
*/
|
||||
class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_FRAME
|
||||
{
|
||||
private:
|
||||
wxListBox* m_pageList; // < The list of pages
|
||||
int m_pageListWidth; // < width of the window
|
||||
wxGrid* m_parameterGrid; // < The list of parameters
|
||||
int m_parameterGridWidth; // < size of the grid
|
||||
wxListBox* m_pageList; ///< The list of pages
|
||||
int m_pageListWidth; ///< width of the window
|
||||
wxGrid* m_parameterGrid; ///< The list of parameters
|
||||
int m_parameterGridWidth; ///< size of the grid
|
||||
|
||||
// Flags
|
||||
wxSemaphore* m_semaphore; // < != NULL if the frame must emulate a modal dialog
|
||||
wxString m_configPath; // < subpath for configuration
|
||||
bool m_exportRequest; // < true if the current footprint should be exported
|
||||
wxString m_configPath; ///< subpath for configuration
|
||||
|
||||
protected:
|
||||
wxString m_wizardName; // < name of the current wizard
|
||||
wxString m_wizardDescription; // < description of the wizard
|
||||
wxString m_wizardStatus; // < current wizard status
|
||||
wxString m_wizardName; ///< name of the current wizard
|
||||
wxString m_wizardDescription; ///< description of the wizard
|
||||
wxString m_wizardStatus; ///< current wizard status
|
||||
|
||||
public:
|
||||
FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
||||
FOOTPRINT_EDIT_FRAME* parent, wxSemaphore* semaphore = NULL,
|
||||
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||
|
||||
FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* parent, FRAME_T aFrameType );
|
||||
|
||||
~FOOTPRINT_WIZARD_FRAME();
|
||||
|
||||
MODULE* GetBuiltFootprint( void );
|
||||
MODULE* GetBuiltFootprint();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ void GPCB_FPL_CACHE::Load()
|
|||
MODULE* footprint = parseMODULE( &reader );
|
||||
|
||||
// The footprint name is the file name without the extension.
|
||||
footprint->SetFPID( fn.GetName() );
|
||||
footprint->SetFPID( FPID( fn.GetName() ) );
|
||||
m_modules.insert( name, new GPCB_FPL_CACHE_ITEM( footprint, fn.GetName() ) );
|
||||
|
||||
} while( dir.GetNext( &fpFileName ) );
|
||||
|
@ -299,7 +299,6 @@ void GPCB_FPL_CACHE::Load()
|
|||
|
||||
void GPCB_FPL_CACHE::Remove( const wxString& aFootprintName )
|
||||
{
|
||||
|
||||
std::string footprintName = TO_UTF8( aFootprintName );
|
||||
|
||||
MODULE_CITER it = m_modules.find( footprintName );
|
||||
|
|
|
@ -279,7 +279,7 @@ void FP_CACHE::Load()
|
|||
MODULE* footprint = (MODULE*) m_owner->m_parser->Parse();
|
||||
|
||||
// The footprint name is the file name without the extension.
|
||||
footprint->SetFPID( fullPath.GetName() );
|
||||
footprint->SetFPID( FPID( fullPath.GetName() ) );
|
||||
m_modules.insert( name, new FP_CACHE_ITEM( footprint, fullPath ) );
|
||||
|
||||
} while( dir.GetNext( &fpFileName ) );
|
||||
|
@ -657,14 +657,14 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
|
|||
|
||||
m_out->Print( aNestLevel, ")\n\n" );
|
||||
|
||||
// Save net codes and names
|
||||
// Save net codes and names
|
||||
for( NETINFO_MAPPING::iterator net = m_mapping->begin(), netEnd = m_mapping->end();
|
||||
net != netEnd; ++net )
|
||||
{
|
||||
m_out->Print( aNestLevel, "(net %d %s)\n",
|
||||
m_mapping->Translate( net->GetNet() ),
|
||||
m_out->Quotew( net->GetNetname() ).c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
m_out->Print( 0, "\n" );
|
||||
|
||||
|
|
|
@ -620,7 +620,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
|
|||
if( footprintName.IsEmpty() )
|
||||
{
|
||||
footprintName = wxT("noname");
|
||||
aModule->SetFPID( footprintName );
|
||||
aModule->SetFPID( FPID( footprintName ) );
|
||||
}
|
||||
|
||||
bool module_exists = false;
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <eda_doc.h>
|
||||
#include <kicad_string.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiway.h>
|
||||
//#include <frame_type.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <dialog_helpers.h>
|
||||
#include <filter_reader.h>
|
||||
|
@ -118,32 +120,21 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
|
|||
|
||||
wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser()
|
||||
{
|
||||
wxString fpname;
|
||||
wxString fpid;
|
||||
// Close the current non-modal Lib browser if opened, and open a new one, in "modal" mode:
|
||||
FOOTPRINT_VIEWER_FRAME* viewer;
|
||||
|
||||
wxSemaphore semaphore( 0, 1 );
|
||||
|
||||
// Close the current Lib browser, if opened, and open a new one, in "modal" mode:
|
||||
FOOTPRINT_VIEWER_FRAME* viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer( this );
|
||||
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
|
||||
|
||||
if( viewer )
|
||||
viewer->Destroy();
|
||||
|
||||
viewer = new FOOTPRINT_VIEWER_FRAME( &Kiway(), this, &semaphore );
|
||||
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true );
|
||||
|
||||
// Show the library viewer frame until it is closed
|
||||
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
|
||||
{
|
||||
wxYield();
|
||||
wxMilliSleep( 50 );
|
||||
}
|
||||
wxString fpid;
|
||||
|
||||
fpname = viewer->GetSelectedFootprint();
|
||||
viewer->ShowModal( &fpid );
|
||||
|
||||
if( !!fpname )
|
||||
{
|
||||
fpid = viewer->GetSelectedLibrary() + wxT( ":" ) + fpname;
|
||||
}
|
||||
//DBG(printf("%s: fpid:'%s'\n", __func__, TO_UTF8( fpid ) );)
|
||||
|
||||
viewer->Destroy();
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
|
@ -262,25 +263,19 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_OPEN_MODULE_VIEWER:
|
||||
{
|
||||
// Make a _project specific_ PCB_EDIT_FRAME be the start of the search in
|
||||
// FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
|
||||
|
||||
PCB_EDIT_FRAME* top_project = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
|
||||
wxASSERT( top_project ); // dynamic_cast returns NULL if class mismatch.
|
||||
|
||||
FOOTPRINT_VIEWER_FRAME* viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer( top_project );
|
||||
FOOTPRINT_VIEWER_FRAME* viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
|
||||
if( !viewer )
|
||||
{
|
||||
KIFACE_I& kf = Kiface();
|
||||
|
||||
viewer = (FOOTPRINT_VIEWER_FRAME*) kf.CreateWindow( this, FRAME_PCB_MODULE_VIEWER, &Kiway(), kf.StartFlags() );
|
||||
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, true );
|
||||
viewer->Show( true );
|
||||
viewer->Zoom_Automatique( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
if( viewer->IsIconized() )
|
||||
viewer->Iconize( false );
|
||||
*/
|
||||
|
||||
viewer->Raise();
|
||||
|
||||
|
@ -324,41 +319,37 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_MODEDIT_NEW_MODULE_FROM_WIZARD:
|
||||
{
|
||||
wxSemaphore semaphore( 0, 1 );
|
||||
FOOTPRINT_WIZARD_FRAME* wizard = (FOOTPRINT_WIZARD_FRAME*) Kiway().Player(
|
||||
FRAME_PCB_FOOTPRINT_WIZARD_MODAL, true );
|
||||
|
||||
FOOTPRINT_WIZARD_FRAME* wizard = new FOOTPRINT_WIZARD_FRAME( &Kiway(), this, &semaphore,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
|
||||
|
||||
wizard->Show( true );
|
||||
wizard->Zoom_Automatique( false );
|
||||
|
||||
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
|
||||
wxString not_used;
|
||||
|
||||
if( wizard->ShowModal( ¬_used ) )
|
||||
{
|
||||
wxYield();
|
||||
wxMilliSleep( 50 );
|
||||
}
|
||||
// Creates the new footprint from python script wizard
|
||||
MODULE* module = wizard->GetBuiltFootprint();
|
||||
|
||||
// Creates the new footprint from python script wizard
|
||||
MODULE* module = wizard->GetBuiltFootprint();
|
||||
if( module ) // i.e. if create module command not aborted
|
||||
{
|
||||
Clear_Pcb( true );
|
||||
GetScreen()->ClearUndoRedoList();
|
||||
SetCurItem( NULL );
|
||||
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||
|
||||
if( module ) // i.e. if create module command not aborted
|
||||
{
|
||||
Clear_Pcb( true );
|
||||
GetScreen()->ClearUndoRedoList();
|
||||
SetCurItem( NULL );
|
||||
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||
// Add the new object to board
|
||||
module->SetParent( (EDA_ITEM*)GetBoard() );
|
||||
GetBoard()->m_Modules.Append( module );
|
||||
|
||||
// Add the new object to board
|
||||
module->SetParent( (EDA_ITEM*)GetBoard() );
|
||||
GetBoard()->m_Modules.Append( module );
|
||||
|
||||
// Initialize data relative to nets and netclasses (for a new
|
||||
// module the defaults are used)
|
||||
// This is mandatory to handle and draw pads
|
||||
GetBoard()->BuildListOfNets();
|
||||
redraw = true;
|
||||
module->SetPosition( wxPoint( 0, 0 ) );
|
||||
module->ClearFlags();
|
||||
// Initialize data relative to nets and netclasses (for a new
|
||||
// module the defaults are used)
|
||||
// This is mandatory to handle and draw pads
|
||||
GetBoard()->BuildListOfNets();
|
||||
redraw = true;
|
||||
module->SetPosition( wxPoint( 0, 0 ) );
|
||||
module->ClearFlags();
|
||||
}
|
||||
}
|
||||
|
||||
wizard->Destroy();
|
||||
|
@ -378,7 +369,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
{
|
||||
// update module in the current board,
|
||||
// not just add it to the board with total disregard for the netlist...
|
||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) GetParent();
|
||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, true );
|
||||
|
||||
BOARD* mainpcb = pcbframe->GetBoard();
|
||||
MODULE* source_module = NULL;
|
||||
MODULE* module_in_edit = GetBoard()->m_Modules;
|
||||
|
|
|
@ -53,17 +53,6 @@ public:
|
|||
*/
|
||||
static const wxChar* GetFootprintEditorFrameName();
|
||||
|
||||
/**
|
||||
* Function GetActiveFootprintEditor (static)
|
||||
*
|
||||
* @param aTopOfProject is a PCB_EDIT_FRAME* window which anchors the search in
|
||||
* a project specific way.
|
||||
*
|
||||
* @return a reference to the current opened Footprint editor
|
||||
* or NULL if no Footprint editor currently opened
|
||||
*/
|
||||
static FOOTPRINT_EDIT_FRAME* GetActiveFootprintEditor( const wxWindow* aTopOfProject );
|
||||
|
||||
BOARD_DESIGN_SETTINGS& GetDesignSettings() const; // overload PCB_BASE_FRAME, get parent's
|
||||
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ); // overload
|
||||
|
||||
|
@ -415,7 +404,7 @@ public:
|
|||
protected:
|
||||
|
||||
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
|
||||
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, PCB_EDIT_FRAME* aParent );
|
||||
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
static BOARD* s_Pcb; ///< retain board across invocations of module editor
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ END_EVENT_TABLE()
|
|||
|
||||
#define FOOTPRINT_EDIT_FRAME_NAME wxT( "ModEditFrame" )
|
||||
|
||||
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, PCB_EDIT_FRAME* aParent ) :
|
||||
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
|
||||
|
@ -291,19 +291,6 @@ const wxChar* FOOTPRINT_EDIT_FRAME::GetFootprintEditorFrameName()
|
|||
}
|
||||
|
||||
|
||||
/* return a reference to the current opened Footprint editor
|
||||
* or NULL if no Footprint editor currently opened
|
||||
*/
|
||||
FOOTPRINT_EDIT_FRAME* FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor( const wxWindow* aParent )
|
||||
{
|
||||
// top_of_project!
|
||||
wxASSERT( dynamic_cast<const PCB_EDIT_FRAME*>( aParent ) );
|
||||
|
||||
wxWindow* ret = wxWindow::FindWindowByName( GetFootprintEditorFrameName(), aParent );
|
||||
return (FOOTPRINT_EDIT_FRAME*) ret;
|
||||
}
|
||||
|
||||
|
||||
BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const
|
||||
{
|
||||
// get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD.
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiway.h>
|
||||
#include <gr_basic.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <wxPcbStruct.h>
|
||||
|
@ -70,12 +71,12 @@ wxString FOOTPRINT_VIEWER_FRAME::m_selectedFootprintName;
|
|||
|
||||
|
||||
BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
|
||||
/* Window events */
|
||||
// Window events
|
||||
EVT_CLOSE( FOOTPRINT_VIEWER_FRAME::OnCloseWindow )
|
||||
EVT_SIZE( FOOTPRINT_VIEWER_FRAME::OnSize )
|
||||
EVT_ACTIVATE( FOOTPRINT_VIEWER_FRAME::OnActivate )
|
||||
|
||||
/* Toolbar events */
|
||||
// Toolbar events
|
||||
EVT_TOOL( ID_MODVIEW_SELECT_LIB,
|
||||
FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary )
|
||||
EVT_TOOL( ID_MODVIEW_SELECT_PART,
|
||||
|
@ -88,7 +89,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
|
|||
FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint )
|
||||
EVT_TOOL( ID_MODVIEW_SHOW_3D_VIEW, FOOTPRINT_VIEWER_FRAME::Show3D_Frame )
|
||||
|
||||
/* listbox events */
|
||||
// listbox events
|
||||
EVT_LISTBOX( ID_MODVIEW_LIB_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnLibList )
|
||||
EVT_LISTBOX( ID_MODVIEW_FOOTPRINT_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList )
|
||||
EVT_LISTBOX_DCLICK( ID_MODVIEW_FOOTPRINT_LIST, FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList )
|
||||
|
@ -118,14 +119,16 @@ static wxAcceleratorEntry accels[] =
|
|||
#define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" )
|
||||
|
||||
|
||||
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent, wxSemaphore* aSemaphore ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, FRAME_PCB_MODULE_VIEWER, _( "Footprint Library Browser" ),
|
||||
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Library Browser" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
!aSemaphore ?
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE :
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT,
|
||||
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT :
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||
GetFootprintViewerFrameName() )
|
||||
{
|
||||
wxASSERT( aFrameType==FRAME_PCB_MODULE_VIEWER || aFrameType==FRAME_PCB_MODULE_VIEWER_MODAL );
|
||||
|
||||
wxAcceleratorTable table( DIM( accels ), accels );
|
||||
|
||||
m_FrameName = GetFootprintViewerFrameName();
|
||||
|
@ -145,12 +148,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* a
|
|||
m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST,
|
||||
wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL );
|
||||
|
||||
m_semaphore = aSemaphore;
|
||||
m_selectedFootprintName.Empty();
|
||||
|
||||
if( m_semaphore )
|
||||
SetModalMode( true );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
||||
// Ensure all layers and items are visible:
|
||||
|
@ -237,7 +236,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* a
|
|||
}
|
||||
|
||||
#if 0 // no.
|
||||
|
||||
// Set min size (overwrite params read in LoadPerspective(), if any)
|
||||
m_auimgr.GetPane( m_libList ).MinSize( minsize );
|
||||
m_auimgr.GetPane( m_footprintList ).MinSize( minsize );
|
||||
|
@ -271,45 +269,16 @@ const wxChar* FOOTPRINT_VIEWER_FRAME::GetFootprintViewerFrameName()
|
|||
}
|
||||
|
||||
|
||||
FOOTPRINT_VIEWER_FRAME* FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer( const KIWAY_PLAYER* aParent )
|
||||
{
|
||||
wxASSERT( aParent );
|
||||
|
||||
// We search only within the current project, and do so by limiting
|
||||
// the search scope to a wxWindow hierarchy subset. Find the top most
|
||||
// KIWAY_PLAYER which is part of this PROJECT by matching its KIWAY* to the
|
||||
// most immediate parent's.
|
||||
|
||||
// NOTE: an open FOOTPRINT_VIEWER_FRAME may have either the PCB_EDIT_FRAME
|
||||
// or the FOOTPRINT_EDIT_FRAME as parent.
|
||||
|
||||
KIWAY* kiway = &aParent->Kiway();
|
||||
wxWindow* frame;
|
||||
|
||||
while( (frame = aParent->GetParent()) != NULL )
|
||||
{
|
||||
// will go NULL when we reach a non-KIWAY_PLAYER
|
||||
KIWAY_PLAYER* kwp = dynamic_cast<KIWAY_PLAYER*>( frame );
|
||||
|
||||
if( kwp && &kwp->Kiway() == kiway )
|
||||
aParent = kwp;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return (FOOTPRINT_VIEWER_FRAME*) wxWindow::FindWindowByName(
|
||||
GetFootprintViewerFrameName(), aParent );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
if( m_semaphore )
|
||||
if( IsModal() )
|
||||
{
|
||||
m_semaphore->Post();
|
||||
SetModalMode( false );
|
||||
// This window will be destroyed by the calling function,
|
||||
// to avoid side effects
|
||||
// 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 will be destroyed by the calling function.
|
||||
}
|
||||
else
|
||||
Destroy();
|
||||
|
@ -464,15 +433,23 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
|
|||
|
||||
void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event )
|
||||
{
|
||||
if( m_semaphore )
|
||||
if( IsModal() )
|
||||
{
|
||||
// @todo(DICK)
|
||||
ExportSelectedFootprint( event );
|
||||
|
||||
// Prevent the double click from being as a single mouse button release
|
||||
// event in the parent window which would cause the part to be parked
|
||||
// rather than staying in mode mode.
|
||||
// rather than staying in move mode.
|
||||
// Remember the mouse button will be released in the parent window
|
||||
// thus creating a mouse button release event which should be ignored
|
||||
((PCB_BASE_FRAME*)GetParent())->SkipNextLeftButtonReleaseEvent();
|
||||
PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
|
||||
|
||||
// The parent may not be the board editor:
|
||||
if( pcbframe )
|
||||
{
|
||||
pcbframe->SkipNextLeftButtonReleaseEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -482,9 +459,24 @@ void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event )
|
|||
int ii = m_footprintList->GetSelection();
|
||||
|
||||
if( ii >= 0 )
|
||||
m_selectedFootprintName = m_footprintList->GetString( ii );
|
||||
{
|
||||
wxString fp_name = m_footprintList->GetString( ii );
|
||||
|
||||
// @todo(DICK) assign to static now, later PROJECT retained string.
|
||||
m_selectedFootprintName = fp_name;
|
||||
|
||||
FPID fpid;
|
||||
|
||||
fpid.SetLibNickname( GetSelectedLibrary() );
|
||||
fpid.SetFootprintName( fp_name );
|
||||
|
||||
DismissModal( true, fpid.Format() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_selectedFootprintName.Empty();
|
||||
DismissModal( false );
|
||||
}
|
||||
|
||||
Close( true );
|
||||
}
|
||||
|
@ -580,25 +572,25 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
|||
screen->m_O_Curseur = GetCrossHairPosition();
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD8: /* cursor moved up */
|
||||
case WXK_NUMPAD8: // cursor moved up
|
||||
case WXK_UP:
|
||||
pos.y -= KiROUND( gridSize.y );
|
||||
m_canvas->MoveCursor( pos );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD2: /* cursor moved down */
|
||||
case WXK_NUMPAD2: // cursor moved down
|
||||
case WXK_DOWN:
|
||||
pos.y += KiROUND( gridSize.y );
|
||||
m_canvas->MoveCursor( pos );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD4: /* cursor moved left */
|
||||
case WXK_NUMPAD4: // cursor moved left
|
||||
case WXK_LEFT:
|
||||
pos.x -= KiROUND( gridSize.x );
|
||||
m_canvas->MoveCursor( pos );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD6: /* cursor moved right */
|
||||
case WXK_NUMPAD6: // cursor moved right
|
||||
case WXK_RIGHT:
|
||||
pos.x += KiROUND( gridSize.x );
|
||||
m_canvas->MoveCursor( pos );
|
||||
|
@ -621,7 +613,7 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
|||
}
|
||||
}
|
||||
|
||||
UpdateStatusBar(); /* Display new cursor coordinates */
|
||||
UpdateStatusBar(); // Display new cursor coordinates
|
||||
}
|
||||
|
||||
|
||||
|
@ -746,11 +738,13 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
|
|||
|
||||
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
|
||||
{
|
||||
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent();
|
||||
// The PCB_EDIT_FRAME may not be the FOOTPRINT_VIEW_FRAME's parent,
|
||||
// so use Kiway().Player() to fetch.
|
||||
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, true );
|
||||
|
||||
wxString libname = m_libraryName + wxT( "." ) + LegacyFootprintLibPathExtension;
|
||||
MODULE* oldmodule = GetBoard()->m_Modules;
|
||||
MODULE* module = LoadModuleFromLibrary( libname, parent->FootprintLibs(),
|
||||
false );
|
||||
MODULE* module = LoadModuleFromLibrary( libname, parent->FootprintLibs(), false );
|
||||
|
||||
if( module )
|
||||
{
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
class wxSashLayoutWindow;
|
||||
class wxListBox;
|
||||
class wxSemaphore;
|
||||
class FP_LIB_TABLE;
|
||||
|
||||
namespace PCB { struct IFACE; }
|
||||
|
@ -44,25 +43,13 @@ namespace PCB { struct IFACE; }
|
|||
*/
|
||||
class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME
|
||||
{
|
||||
friend struct PCB::IFACE;
|
||||
|
||||
private:
|
||||
wxListBox* m_libList; // The list of libs names
|
||||
wxListBox* m_footprintList; // The list of footprint names
|
||||
|
||||
// Flags
|
||||
wxSemaphore* m_semaphore; // != NULL if the frame emulates a modal dialog
|
||||
wxString m_configPath; // subpath for configuration
|
||||
friend struct PCB::IFACE; // constructor called from here only
|
||||
|
||||
protected:
|
||||
static wxString m_libraryName; // Current selected library
|
||||
static wxString m_footprintName; // Current selected footprint
|
||||
static wxString m_selectedFootprintName; // When the viewer is used to select a footprint
|
||||
// the selected footprint is here
|
||||
FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType );
|
||||
|
||||
|
||||
public:
|
||||
FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent, wxSemaphore* aSemaphore = NULL );
|
||||
|
||||
~FOOTPRINT_VIEWER_FRAME();
|
||||
|
||||
/**
|
||||
|
@ -72,17 +59,6 @@ public:
|
|||
*/
|
||||
static const wxChar* GetFootprintViewerFrameName();
|
||||
|
||||
/**
|
||||
* Function GetActiveFootprintViewer (static)
|
||||
*
|
||||
* @param aParent the KIWAY_PLAYER which is the parent of the calling wxWindow.
|
||||
* This is used to traverse the window hierarchy upwards to the topmost
|
||||
* KIWAY_PLAYER which is still part of the same project.
|
||||
*
|
||||
* @return Any currently opened Footprint viewer or NULL if none.
|
||||
*/
|
||||
static FOOTPRINT_VIEWER_FRAME* GetActiveFootprintViewer( const KIWAY_PLAYER* aParent );
|
||||
|
||||
wxString& GetSelectedFootprint( void ) const { return m_selectedFootprintName; }
|
||||
const wxString GetSelectedLibraryFullName();
|
||||
|
||||
|
@ -102,8 +78,19 @@ public:
|
|||
*/
|
||||
void ReCreateLibraryList();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
wxListBox* m_libList; // The list of libs names
|
||||
wxListBox* m_footprintList; // The list of footprint names
|
||||
|
||||
wxString m_configPath; // subpath for configuration
|
||||
|
||||
static wxString m_libraryName; // Current selected library
|
||||
static wxString m_footprintName; // Current selected footprint
|
||||
static wxString m_selectedFootprintName; // When the viewer is used to select a footprint
|
||||
|
||||
|
||||
void OnSize( wxSizeEvent& event );
|
||||
|
||||
void ReCreateFootprintList();
|
||||
|
@ -193,7 +180,6 @@ private:
|
|||
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) {}
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint &) {}
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -152,8 +152,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, PCB_EDIT_FRAME::InstallDisplayOptionsDialog )
|
||||
EVT_MENU( ID_PCB_USER_GRID_SETUP, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, PCB_EDIT_FRAME::SetLanguage )
|
||||
|
||||
// menu Postprocess
|
||||
EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, PCB_EDIT_FRAME::GenFootprintsPositionFile )
|
||||
EVT_MENU( ID_PCB_GEN_DRILL_FILE, PCB_EDIT_FRAME::InstallDrillFrame )
|
||||
|
@ -1024,9 +1022,11 @@ void PCB_EDIT_FRAME::SetVisibleAlls()
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
|
||||
void PCB_EDIT_FRAME::ShowChangedLanguage()
|
||||
{
|
||||
EDA_DRAW_FRAME::SetLanguage( event );
|
||||
// call my base class
|
||||
PCB_BASE_FRAME::ShowChangedLanguage();
|
||||
|
||||
m_Layers->SetLayersManagerTabsText();
|
||||
|
||||
wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_Layers );
|
||||
|
@ -1034,10 +1034,6 @@ void PCB_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
|
|||
pane_info.Caption( _( "Visibles" ) );
|
||||
m_auimgr.Update();
|
||||
ReFillLayerWidget();
|
||||
|
||||
FOOTPRINT_EDIT_FRAME* moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor( this );
|
||||
if( moduleEditFrame )
|
||||
moduleEditFrame->EDA_DRAW_FRAME::SetLanguage( event );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include <fp_lib_table.h>
|
||||
#include <module_editor_frame.h>
|
||||
#include <modview_frame.h>
|
||||
#include <footprint_wizard_frame.h>
|
||||
|
||||
|
||||
// Colors for layers and items
|
||||
|
@ -109,7 +110,6 @@ static struct IFACE : public KIFACE_I
|
|||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
|
||||
case FRAME_PCB:
|
||||
{
|
||||
PCB_EDIT_FRAME* frame = new PCB_EDIT_FRAME( aKiway, aParent );
|
||||
|
@ -132,11 +132,7 @@ static struct IFACE : public KIFACE_I
|
|||
|
||||
case FRAME_PCB_MODULE_EDITOR:
|
||||
{
|
||||
// yuck:
|
||||
PCB_EDIT_FRAME* editor = dynamic_cast<PCB_EDIT_FRAME*>( aParent );
|
||||
wxASSERT( editor );
|
||||
|
||||
FOOTPRINT_EDIT_FRAME* frame = new FOOTPRINT_EDIT_FRAME( aKiway, editor );
|
||||
FOOTPRINT_EDIT_FRAME* frame = new FOOTPRINT_EDIT_FRAME( aKiway, aParent );
|
||||
|
||||
frame->Zoom_Automatique( true );
|
||||
|
||||
|
@ -148,12 +144,10 @@ static struct IFACE : public KIFACE_I
|
|||
break;
|
||||
|
||||
case FRAME_PCB_MODULE_VIEWER:
|
||||
case FRAME_PCB_MODULE_VIEWER_MODAL:
|
||||
{
|
||||
// yuck:
|
||||
PCB_BASE_FRAME* editor = dynamic_cast<PCB_BASE_FRAME*>( aParent );
|
||||
wxASSERT( editor );
|
||||
|
||||
FOOTPRINT_VIEWER_FRAME* frame = new FOOTPRINT_VIEWER_FRAME( aKiway, editor );
|
||||
FOOTPRINT_VIEWER_FRAME* frame = new FOOTPRINT_VIEWER_FRAME(
|
||||
aKiway, aParent, FRAME_T( aClassId ) );
|
||||
|
||||
frame->Zoom_Automatique( true );
|
||||
|
||||
|
@ -164,6 +158,15 @@ static struct IFACE : public KIFACE_I
|
|||
}
|
||||
break;
|
||||
|
||||
case FRAME_PCB_FOOTPRINT_WIZARD_MODAL:
|
||||
{
|
||||
FOOTPRINT_WIZARD_FRAME* frame = new FOOTPRINT_WIZARD_FRAME(
|
||||
aKiway, aParent, FRAME_T( aClassId ) );
|
||||
|
||||
return frame;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
|
|||
|
||||
FOOTPRINT_VIEWER_FRAME* viewer;
|
||||
|
||||
if( tableChanged && (viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer( this )) != NULL )
|
||||
if( tableChanged && (viewer = (FOOTPRINT_VIEWER_FRAME*)Kiway().Player( FRAME_PCB_MODULE_VIEWER, false )) != NULL )
|
||||
{
|
||||
viewer->ReCreateLibraryList();
|
||||
}
|
||||
|
|
|
@ -95,9 +95,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
|
|||
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
||||
KiBitmap( zoom_fit_in_page_xpm ), msg );
|
||||
|
||||
// Enable this tool only if the library browser is called from
|
||||
// a "load component" command
|
||||
if( m_semaphore )
|
||||
// Enable this tool only if the library browser is intended for modal use.
|
||||
if( m_Ident == FRAME_PCB_MODULE_VIEWER_MODAL )
|
||||
{
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD, wxEmptyString,
|
||||
|
|
Loading…
Reference in New Issue