Commit 5f65d0da authored by Dick Hollenbeck's avatar Dick Hollenbeck

*) Add KIFACE_I::StartFlags() and IsSingle() so a KIFACE implementation can know

    if it is running under single_top.cpp or under a project manager.

*)  Test Kiface().IsSingle() when adding menus, some operations are not permitted
    when running under a project manager and the KIWAY_PLAYER is pegged to a
    specific project.

*)  Implemented KIWAY::KiFACE() so it loads *.kiface files.  They still have to be
    in the same directory as the main *.exe launcher, so this presents some difficulty
    when the binaries are not yet installed but rather the *.kiface files are still
    in their original build directories.  For today, I simply copied _pcbnew.kiface
    to build/kicad/.

*)  Add a test case to kicad/mainframe.cpp just to get an early peek at loading
    _pcbnew.kiface under the C++ project manager.  Got that working for one
    specific invocation just for proof of concept.  Surprise, it works.
parent e52d9342
...@@ -639,7 +639,7 @@ namespace BMP2CMP { ...@@ -639,7 +639,7 @@ namespace BMP2CMP {
static struct IFACE : public KIFACE_I static struct IFACE : public KIFACE_I
{ {
bool OnKifaceStart( PGM_BASE* aProgram ); bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
{ {
...@@ -706,8 +706,8 @@ PGM_BASE& Pgm() ...@@ -706,8 +706,8 @@ PGM_BASE& Pgm()
#endif #endif
bool IFACE::OnKifaceStart( PGM_BASE* aProgram ) bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{ {
return start_common(); return start_common( aCtlBits );
} }
...@@ -186,6 +186,7 @@ set( COMMON_SRCS ...@@ -186,6 +186,7 @@ set( COMMON_SRCS
msgpanel.cpp msgpanel.cpp
netlist_keywords.cpp netlist_keywords.cpp
newstroke_font.cpp newstroke_font.cpp
prependpath.cpp
project.cpp project.cpp
ptree.cpp ptree.cpp
reporter.cpp reporter.cpp
......
...@@ -94,8 +94,10 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId ) ...@@ -94,8 +94,10 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
} }
bool KIFACE_I::start_common() bool KIFACE_I::start_common( int aCtlBits )
{ {
m_start_flags = aCtlBits;
m_bm.Init(); m_bm.Init();
m_bm.m_config->Read( showPageLimitsKey, &g_ShowPageLimits ); m_bm.m_config->Read( showPageLimitsKey, &g_ShowPageLimits );
......
...@@ -22,15 +22,12 @@ ...@@ -22,15 +22,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <string.h>
#include <kiway.h> #include <kiway.h>
#include <config.h> #include <config.h>
#include <wx/debug.h> #include <wx/debug.h>
#include <string.h> #include <wx/stdpaths.h>
// one for each FACE_T
wxDynamicLibrary KIWAY::s_sch_dso;
wxDynamicLibrary KIWAY::s_pcb_dso;
KIWAY::KIWAY() KIWAY::KIWAY()
...@@ -39,20 +36,30 @@ KIWAY::KIWAY() ...@@ -39,20 +36,30 @@ KIWAY::KIWAY()
} }
/* const wxString KIWAY::dso_full_path( FACE_T aFaceId )
const wxString KIWAY::dso_name( FACE_T aFaceId )
{ {
const wxChar* name = wxT("");
switch( aFaceId ) switch( aFaceId )
{ {
case FACE_SCH: return KIFACE_PREFIX wxT( "eeschema" ) KIFACE_SUFFIX; case FACE_SCH: name = KIFACE_PREFIX wxT( "eeschema" ); break;
case FACE_PCB: return KIFACE_PREFIX wxT( "pcbnew" ) KIFACE_SUFFIX; case FACE_PCB: name = KIFACE_PREFIX wxT( "pcbnew" ); break;
default: default:
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) ); wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
return wxEmptyString; return wxEmptyString;
} }
wxFileName fn = wxStandardPaths::Get().GetExecutablePath();
fn.SetName( name );
// Here a "suffix" == an extension with a preceding '.',
// so skip the preceding '.' to get an extension
fn.SetExt( KIFACE_SUFFIX + 1 ); // + 1 => &KIFACE_SUFFIX[1]
return fn.GetFullPath();
} }
*/
PROJECT& KIWAY::Prj() const PROJECT& KIWAY::Prj() const
...@@ -61,14 +68,15 @@ PROJECT& KIWAY::Prj() const ...@@ -61,14 +68,15 @@ PROJECT& KIWAY::Prj() const
} }
KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad ) KIFACE* KIWAY::KiFACE( PGM_BASE* aProgram, FACE_T aFaceId, bool doLoad )
{ {
switch( aFaceId ) switch( aFaceId )
{ {
case FACE_SCH: // case FACE_SCH:
case FACE_PCB: case FACE_PCB:
if( m_kiface[aFaceId] ) if( m_kiface[aFaceId] )
return m_kiface[aFaceId]; return m_kiface[aFaceId];
break;
default: default:
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) ); wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
...@@ -78,17 +86,47 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad ) ...@@ -78,17 +86,47 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
// DSO with KIFACE has not been loaded yet, does user want to load it? // DSO with KIFACE has not been loaded yet, does user want to load it?
if( doLoad ) if( doLoad )
{ {
switch( aFaceId ) wxString dname = dso_full_path( aFaceId );
wxDynamicLibrary dso;
void* addr = NULL;
if( !dso.Load( dname, wxDL_VERBATIM | wxDL_NOW ) )
{ {
case FACE_SCH: // Failure: error reporting UI was done via wxLogSysError().
break; // No further reporting required here.
}
case FACE_PCB: else if( ( addr = dso.GetSymbol( wxT( KIFACE_INSTANCE_NAME_AND_VERSION ) ) ) == NULL )
break; {
// Failure: error reporting UI was done via wxLogSysError().
// No further reporting required here.
}
default: else
; {
KIFACE_GETTER_FUNC* getter = (KIFACE_GETTER_FUNC*) addr;
KIFACE* kiface = getter( &m_kiface_version[aFaceId], KIFACE_VERSION, aProgram );
// 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( aProgram, KFCTL_PROJECT_SUITE ) )
{
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
(void) dso.Detach();
return m_kiface[aFaceId] = kiface;
}
} }
// In any of the failure cases above, dso.Unload() should be called here
// by dso destructor.
} }
return NULL; return NULL;
......
#include <macros.h>
#include <fctsys.h>
#include <wx/filename.h>
#if !wxCHECK_VERSION( 3, 0, 0 )
// implement missing wx2.8 function until >= wx3.0 pervades.
static wxString wxJoin(const wxArrayString& arr, const wxChar sep,
const wxChar escape = '\\')
{
size_t count = arr.size();
if ( count == 0 )
return wxEmptyString;
wxString str;
// pre-allocate memory using the estimation of the average length of the
// strings in the given array: this is very imprecise, of course, but
// better than nothing
str.reserve(count*(arr[0].length() + arr[count-1].length()) / 2);
if ( escape == wxT('\0') )
{
// escaping is disabled:
for ( size_t i = 0; i < count; i++ )
{
if ( i )
str += sep;
str += arr[i];
}
}
else // use escape character
{
for ( size_t n = 0; n < count; n++ )
{
if ( n )
str += sep;
for ( wxString::const_iterator i = arr[n].begin(),
end = arr[n].end();
i != end;
++i )
{
const wxChar ch = *i;
if ( ch == sep )
str += escape; // escape this separator
str += ch;
}
}
}
str.Shrink(); // release extra memory if we allocated too much
return str;
}
#endif
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath )
{
wxPathList paths;
paths.AddEnvList( aEnvVar );
paths.Insert( aPriorityPath, 0 );
return wxJoin( paths, wxPATH_SEP[0] );
}
...@@ -43,14 +43,13 @@ PROJECT::PROJECT() ...@@ -43,14 +43,13 @@ PROJECT::PROJECT()
PROJECT::~PROJECT() PROJECT::~PROJECT()
{ {
/* @todo #if 1
careful here, this may work, but the virtual destructor may not // careful here, this may work, but the virtual destructor may not
be in the same link image as PROJECT. Won't enable this until // be in the same link image as PROJECT.
we're more stable and destructor is assuredly in same image, i.e.
libki.so
for( unsigned i = 0; i<DIM(m_elems); ++i ) for( unsigned i = 0; i<DIM(m_elems); ++i )
delete m_elems[i]; delete m_elems[i];
*/ #endif
} }
...@@ -305,7 +304,7 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString& ...@@ -305,7 +304,7 @@ wxConfigBase* PROJECT::configCreate( const SEARCH_STACK& aSList, const wxString&
void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aFileName, void PROJECT::ConfigSave( const SEARCH_STACK& aSList, const wxString& aFileName,
const wxString& aGroupName, const PARAM_CFG_ARRAY& aParams ) const wxString& aGroupName, const PARAM_CFG_ARRAY& aParams )
{ {
std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, FORCE_LOCAL_CONFIG ) ); std::auto_ptr<wxConfigBase> cfg( configCreate( aSList, aFileName, aGroupName, true ) );
if( !cfg.get() ) if( !cfg.get() )
{ {
...@@ -353,8 +352,7 @@ bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aFileName, ...@@ -353,8 +352,7 @@ bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aFileName,
wxString timestamp = cfg->Read( wxT( "update" ) ); wxString timestamp = cfg->Read( wxT( "update" ) );
if( doLoadOnlyIfNew && timestamp.size() && if( doLoadOnlyIfNew && timestamp.size() && timestamp == m_pro_date_and_time )
timestamp == m_pro_date_and_time )
{ {
return false; return false;
} }
......
...@@ -51,74 +51,8 @@ ...@@ -51,74 +51,8 @@
// The functions we use will cause the program launcher to pull stuff in // The functions we use will cause the program launcher to pull stuff in
// during linkage, keep the map file in mind to see what's going into it. // during linkage, keep the map file in mind to see what's going into it.
#if !wxCHECK_VERSION( 3, 0, 0 )
// implement missing wx2.8 function until >= wx3.0 pervades.
static wxString wxJoin(const wxArrayString& arr, const wxChar sep,
const wxChar escape = '\\')
{
size_t count = arr.size();
if ( count == 0 )
return wxEmptyString;
wxString str;
// pre-allocate memory using the estimation of the average length of the
// strings in the given array: this is very imprecise, of course, but
// better than nothing
str.reserve(count*(arr[0].length() + arr[count-1].length()) / 2);
if ( escape == wxT('\0') )
{
// escaping is disabled:
for ( size_t i = 0; i < count; i++ )
{
if ( i )
str += sep;
str += arr[i];
}
}
else // use escape character
{
for ( size_t n = 0; n < count; n++ )
{
if ( n )
str += sep;
for ( wxString::const_iterator i = arr[n].begin(),
end = arr[n].end();
i != end;
++i )
{
const wxChar ch = *i;
if ( ch == sep )
str += escape; // escape this separator
str += ch;
}
}
}
str.Shrink(); // release extra memory if we allocated too much
return str;
}
#endif
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath )
{
wxPathList paths;
paths.AddEnvList( aEnvVar );
paths.Insert( aPriorityPath, 0 );
return wxJoin( paths, wxPATH_SEP[0] );
}
/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it. /// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
void SetLibEnvVar( const wxString& aAbsoluteArgv0 ) static void set_lib_env_var( const wxString& aAbsoluteArgv0 )
{ {
// POLICY CHOICE 2: Keep same path, so that installer MAY put the // POLICY CHOICE 2: Keep same path, so that installer MAY put the
// "subsidiary DSOs" in the same directory as the kiway top process modules. // "subsidiary DSOs" in the same directory as the kiway top process modules.
...@@ -149,6 +83,7 @@ void SetLibEnvVar( const wxString& aAbsoluteArgv0 ) ...@@ -149,6 +83,7 @@ void SetLibEnvVar( const wxString& aAbsoluteArgv0 )
#endif #endif
} }
// POLICY CHOICE 1: return the full path of the DSO to load from single_top. // POLICY CHOICE 1: return the full path of the DSO to load from single_top.
static const wxString dso_full_path( const wxString& aAbsoluteArgv0 ) static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
{ {
...@@ -339,7 +274,7 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp ) ...@@ -339,7 +274,7 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
// Set LIB_ENV_VAR *before* loading the DSO, in case the top-level DSO holding the // Set LIB_ENV_VAR *before* loading the DSO, in case the top-level DSO holding the
// KIFACE has hard dependencies on subsidiary DSOs below it. // KIFACE has hard dependencies on subsidiary DSOs below it.
SetLibEnvVar( absoluteArgv0 ); set_lib_env_var( absoluteArgv0 );
if( !initPgm() ) if( !initPgm() )
return false; return false;
...@@ -364,7 +299,7 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp ) ...@@ -364,7 +299,7 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
// Give the DSO a single chance to do its "process level" initialization. // Give the DSO a single chance to do its "process level" initialization.
// "Process level" specifically means stay away from any projects in there. // "Process level" specifically means stay away from any projects in there.
if( !kiface->OnKifaceStart( this ) ) if( !kiface->OnKifaceStart( this, KFCTL_STANDALONE ) )
return false; return false;
// Use KIFACE to create a top window that the KIFACE knows about. // Use KIFACE to create a top window that the KIFACE knows about.
...@@ -418,8 +353,11 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp ) ...@@ -418,8 +353,11 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
if( !argv1.GetExt() ) if( !argv1.GetExt() )
argv1.SetExt( wxT( PGM_DATA_FILE_EXT ) ); argv1.SetExt( wxT( PGM_DATA_FILE_EXT ) );
argSet[0] = argv1.GetFullPath();
#endif #endif
argv1.MakeAbsolute();
argSet[0] = argv1.GetFullPath();
if( !Pgm().LockFile( argSet[0] ) ) if( !Pgm().LockFile( argSet[0] ) )
{ {
wxLogSysError( _( "This file is already open." ) ); wxLogSysError( _( "This file is already open." ) );
......
...@@ -100,7 +100,7 @@ static struct IFACE : public KIFACE_I ...@@ -100,7 +100,7 @@ static struct IFACE : public KIFACE_I
KIFACE_I( aName, aType ) KIFACE_I( aName, aType )
{} {}
bool OnKifaceStart( PGM_BASE* aProgram ); bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
void OnKifaceEnd(); void OnKifaceEnd();
...@@ -276,13 +276,13 @@ FP_LIB_TABLE GFootprintTable; ...@@ -276,13 +276,13 @@ FP_LIB_TABLE GFootprintTable;
// we skip setting KISYSMOD here for now. User should set the environment // we skip setting KISYSMOD here for now. User should set the environment
// variable. // variable.
bool IFACE::OnKifaceStart( PGM_BASE* aProgram ) bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{ {
// This is process level, not project level, initialization of the DSO. // This is process level, not project level, initialization of the DSO.
// Do nothing in here pertinent to a project! // Do nothing in here pertinent to a project!
start_common(); start_common( aCtlBits );
// Set 3D shape path from environment variable KISYS3DMOD // Set 3D shape path from environment variable KISYS3DMOD
set3DShapesPath( wxT("KISYS3DMOD") ); set3DShapesPath( wxT("KISYS3DMOD") );
......
...@@ -720,8 +720,7 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) ...@@ -720,8 +720,7 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
return 0; return 0;
} }
wxString msg; wxString msg = wxString::Format( _("File %s saved"), GetChars( fn.GetFullPath() ) );
msg.Printf( _("File %s saved"), GetChars( fn.GetFullPath() ) );
SetStatusText( msg ); SetStatusText( msg );
return 1; return 1;
} }
...@@ -68,7 +68,7 @@ static struct IFACE : public KIFACE_I ...@@ -68,7 +68,7 @@ static struct IFACE : public KIFACE_I
KIFACE_I( aName, aType ) KIFACE_I( aName, aType )
{} {}
bool OnKifaceStart( PGM_BASE* aProgram ); bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
void OnKifaceEnd( PGM_BASE* aProgram ) void OnKifaceEnd( PGM_BASE* aProgram )
{ {
...@@ -79,14 +79,6 @@ static struct IFACE : public KIFACE_I ...@@ -79,14 +79,6 @@ static struct IFACE : public KIFACE_I
{ {
switch( aClassId ) switch( aClassId )
{ {
case LIBEDITOR_FRAME_TYPE:
{
LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway,
dynamic_cast<SCH_EDIT_FRAME*>( aParent ) );
return frame;
}
break;
case SCHEMATIC_FRAME_TYPE: case SCHEMATIC_FRAME_TYPE:
{ {
SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent ); SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent );
...@@ -96,9 +88,19 @@ static struct IFACE : public KIFACE_I ...@@ -96,9 +88,19 @@ static struct IFACE : public KIFACE_I
// Read a default config file in case no project given on command line. // Read a default config file in case no project given on command line.
frame->LoadProjectFile( wxEmptyString, true ); frame->LoadProjectFile( wxEmptyString, true );
// @todo temporary if( Kiface().IsSingle() )
{
// only run this under single_top, not under a project manager.
CreateServer( frame, KICAD_SCH_PORT_SERVICE_NUMBER ); CreateServer( frame, KICAD_SCH_PORT_SERVICE_NUMBER );
}
return frame;
}
break;
case LIBEDITOR_FRAME_TYPE:
{
LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway,
dynamic_cast<SCH_EDIT_FRAME*>( aParent ) );
return frame; return frame;
} }
break; break;
...@@ -152,13 +154,13 @@ PGM_BASE& Pgm() ...@@ -152,13 +154,13 @@ PGM_BASE& Pgm()
} }
bool IFACE::OnKifaceStart( PGM_BASE* aProgram ) bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{ {
// This is process level, not project level, initialization of the DSO. // This is process level, not project level, initialization of the DSO.
// Do nothing in here pertinent to a project! // Do nothing in here pertinent to a project!
start_common(); start_common( aCtlBits );
// Give a default colour for all layers // Give a default colour for all layers
// (actual color will be initialized by config) // (actual color will be initialized by config)
......
...@@ -819,7 +819,9 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event ) ...@@ -819,7 +819,9 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
} }
else else
{ {
wxWindow* w = Kiface().CreateWindow( this, LIBEDITOR_FRAME_TYPE, &Kiway() ); KIFACE_I& kf = Kiface();
wxWindow* w = kf.CreateWindow( this, LIBEDITOR_FRAME_TYPE, &Kiway(), kf.StartFlags() );
libeditFrame = dynamic_cast<LIB_EDIT_FRAME*>( w ); libeditFrame = dynamic_cast<LIB_EDIT_FRAME*>( w );
} }
......
...@@ -73,7 +73,7 @@ static struct IFACE : public KIFACE_I ...@@ -73,7 +73,7 @@ static struct IFACE : public KIFACE_I
KIFACE_I( aName, aType ) KIFACE_I( aName, aType )
{} {}
bool OnKifaceStart( PGM_BASE* aProgram ); bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
void OnKifaceEnd(); void OnKifaceEnd();
...@@ -145,9 +145,9 @@ PGM_BASE& Pgm() ...@@ -145,9 +145,9 @@ PGM_BASE& Pgm()
} }
bool IFACE::OnKifaceStart( PGM_BASE* aProgram ) bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{ {
start_common(); start_common( aCtlBits );
// Must be called before creating the main frame in order to // Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips // display the real hotkeys in menus or tool tips
......
...@@ -610,4 +610,8 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ); ...@@ -610,4 +610,8 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack );
wxString SearchHelpFileFullPath( const SEARCH_STACK& aSearchStack, const wxString& aBaseName ); wxString SearchHelpFileFullPath( const SEARCH_STACK& aSearchStack, const wxString& aBaseName );
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath );
#endif // INCLUDE__COMMON_H_ #endif // INCLUDE__COMMON_H_
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#define CONFIG_VERSION 1 #define CONFIG_VERSION 1
#define FORCE_LOCAL_CONFIG true
/** /**
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
// see base class KIFACE in kiway.h for doxygen docs // see base class KIFACE in kiway.h for doxygen docs
VTBL_ENTRY bool OnKifaceStart( PGM_BASE* aProgram ) = 0; VTBL_ENTRY bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) = 0;
/* /*
{ {
typically call start_common() in your overload typically call start_common() in your overload
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
} }
VTBL_ENTRY wxWindow* CreateWindow( wxWindow* aParent, VTBL_ENTRY wxWindow* CreateWindow( wxWindow* aParent,
int aClassId, KIWAY* aKIWAY, int aCtlBits = 0 ) = 0; int aClassId, KIWAY* aKIWAY, int aCtlBits ) = 0;
VTBL_ENTRY void* IfaceOrAddress( int aDataId ) = 0; VTBL_ENTRY void* IfaceOrAddress( int aDataId ) = 0;
...@@ -76,7 +76,8 @@ public: ...@@ -76,7 +76,8 @@ public:
*/ */
KIFACE_I( const char* aKifaceName, KIWAY::FACE_T aId ) : KIFACE_I( const char* aKifaceName, KIWAY::FACE_T aId ) :
m_id( aId ), m_id( aId ),
m_bm( aKifaceName ) m_bm( aKifaceName ),
m_start_flags( 0 )
{ {
} }
...@@ -85,7 +86,7 @@ public: ...@@ -85,7 +86,7 @@ public:
protected: protected:
/// Common things to do for a top program module, during OnKifaceStart(). /// Common things to do for a top program module, during OnKifaceStart().
bool start_common(); bool start_common( int aCtlBits );
/// Common things to do for a top program module, during OnKifaceEnd(); /// Common things to do for a top program module, during OnKifaceEnd();
void end_common(); void end_common();
...@@ -100,6 +101,18 @@ public: ...@@ -100,6 +101,18 @@ public:
wxConfigBase* KifaceSettings() const { return m_bm.m_config; } wxConfigBase* KifaceSettings() const { return m_bm.m_config; }
/**
* Function StartFlags
* returns whatever was passed as @a aCtlBits to OnKifaceStart()
*/
int StartFlags() const { return m_start_flags; }
/**
* Function IsSingle
* is this KIFACE_I running under single_top?
*/
bool IsSingle() const { return m_start_flags & KFCTL_STANDALONE; }
/** /**
* Function GetHelpFileName * Function GetHelpFileName
* returns just the basename portion of the current help file. * returns just the basename portion of the current help file.
...@@ -116,6 +129,8 @@ private: ...@@ -116,6 +129,8 @@ private:
KIWAY::FACE_T m_id; KIWAY::FACE_T m_id;
BIN_MOD m_bm; BIN_MOD m_bm;
int m_start_flags; ///< flags provided in OnKifaceStart()
}; };
......
...@@ -112,25 +112,20 @@ as such! As such, it is OK to use UTF8 characters: ...@@ -112,25 +112,20 @@ as such! As such, it is OK to use UTF8 characters:
// be mangled. // be mangled.
#define KIFACE_INSTANCE_NAME_AND_VERSION "KIFACE_1" #define KIFACE_INSTANCE_NAME_AND_VERSION "KIFACE_1"
#if defined(__linux__) #if defined(__linux__)
#define LIB_ENV_VAR wxT( "LD_LIBRARY_PATH" ) #define LIB_ENV_VAR wxT( "LD_LIBRARY_PATH" )
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
#define LIB_ENV_VAR wxT( "DYLD_LIBRARY_PATH" ) #define LIB_ENV_VAR wxT( "DYLD_LIBRARY_PATH" )
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
#define LIB_ENV_VAR wxT( "PATH" ) #define LIB_ENV_VAR wxT( "PATH" )
#endif #endif
class wxConfigBase; class wxConfigBase;
class KIWAY;
class wxWindow; class wxWindow;
class PGM_BASE;
class wxConfigBase; class wxConfigBase;
class PGM_BASE;
class KIWAY;
/** /**
...@@ -151,6 +146,10 @@ struct KIFACE ...@@ -151,6 +146,10 @@ struct KIFACE
// order of functions in this listing unless you recompile all clients of // order of functions in this listing unless you recompile all clients of
// this interface. // 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
/** /**
* Function OnKifaceStart * Function OnKifaceStart
* is called just once shortly after the DSO is loaded. It is the second * is called just once shortly after the DSO is loaded. It is the second
...@@ -161,13 +160,15 @@ struct KIFACE ...@@ -161,13 +160,15 @@ struct KIFACE
* *
* @param aProgram is the process block: PGM_BASE* * @param aProgram is the process block: PGM_BASE*
* *
* @param aCtlBits consists of bit flags from the set of KFCTL_* \#defines above.
*
* @return bool - true if DSO initialized OK, false if not. When returning * @return bool - true if DSO initialized OK, false if not. When returning
* false, the loader may optionally decide to terminate the process or not, * false, the loader may optionally decide to terminate the process or not,
* but will not put out any UI because that is the duty of this function to say * but will not put out any UI because that is the duty of this function to say
* why it is returning false. Never return false without having reported * why it is returning false. Never return false without having reported
* to the UI why. * to the UI why.
*/ */
VTBL_ENTRY bool OnKifaceStart( PGM_BASE* aProgram ) = 0; VTBL_ENTRY bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) = 0;
/** /**
* Function OnKifaceEnd * Function OnKifaceEnd
...@@ -176,8 +177,6 @@ struct KIFACE ...@@ -176,8 +177,6 @@ struct KIFACE
*/ */
VTBL_ENTRY void OnKifaceEnd() = 0; VTBL_ENTRY void OnKifaceEnd() = 0;
#define KFCTL_STANDALONE (1<<0) ///< Am running as a standalone Top.
/** /**
* Function CreateWindow * Function CreateWindow
* creates a wxWindow for the current project. The caller * creates a wxWindow for the current project. The caller
...@@ -199,7 +198,7 @@ struct KIFACE ...@@ -199,7 +198,7 @@ struct KIFACE
* not contained in the caller's link image. * not contained in the caller's link image.
*/ */
VTBL_ENTRY wxWindow* CreateWindow( wxWindow* aParent, int aClassId, VTBL_ENTRY wxWindow* CreateWindow( wxWindow* aParent, int aClassId,
KIWAY* aKIWAY, int aCtlBits = 0 ) = 0; KIWAY* aKIWAY, int aCtlBits ) = 0;
/** /**
* Function IfaceOrAddress * Function IfaceOrAddress
...@@ -249,7 +248,7 @@ class KIWAY : public wxEvtHandler ...@@ -249,7 +248,7 @@ class KIWAY : public wxEvtHandler
{ {
public: public:
/// DSO players on *this* KIWAY /// Possible KIFACEs on *this* KIWAY
enum FACE_T enum FACE_T
{ {
FACE_SCH, ///< eeschema DSO FACE_SCH, ///< eeschema DSO
...@@ -257,6 +256,7 @@ public: ...@@ -257,6 +256,7 @@ public:
FACE_PCB, ///< pcbnew DSO FACE_PCB, ///< pcbnew DSO
// FACE_MOD, // FACE_MOD,
FACE_CVPCB, FACE_CVPCB,
FACE_BMP2CMP, FACE_BMP2CMP,
FACE_GERBVIEW, FACE_GERBVIEW,
FACE_PL_EDITOR, FACE_PL_EDITOR,
...@@ -265,41 +265,28 @@ public: ...@@ -265,41 +265,28 @@ public:
FACE_COUNT, ///< how many KIWAY player types FACE_COUNT, ///< how many KIWAY player types
}; };
/* from edaappl.h, now pgm_base.h, obsoleted by above FACE_T enum. // If you change the vtable, recompile all of KiCad.
enum PGM_BASE_T
{
APP_UNKNOWN,
APP_EESCHEMA,
APP_PCBNEW,
APP_CVPCB,
APP_GERBVIEW,
APP_KICAD,
APP_PL_EDITOR,
APP_BM2CMP,
};
*/
// Don't change the order of these VTBL_ENTRYs, add new ones at the end, /**
// unless you recompile all of KiCad. * Function KiFACE
* returns the KIFACE* given a FACE_T. If it is not already loaded, the
* KIFACE is loaded and initialized with a call to KIFACE::OnKifaceStart()
*/
VTBL_ENTRY KIFACE* KiFACE( PGM_BASE* aProgram,
FACE_T aFaceId, bool doLoad = true );
VTBL_ENTRY KIFACE* KiFACE( FACE_T aFaceId, bool doLoad );
VTBL_ENTRY PROJECT& Prj() const; VTBL_ENTRY PROJECT& Prj() const;
KIWAY(); KIWAY();
private: private:
/* /// Get the full path & name of the DSO holding the requested FACE_T.
/// Get the name of the DSO holding the requested FACE_T. static const wxString dso_full_path( FACE_T aFaceId );
static const wxString dso_name( FACE_T aFaceId );
*/
// one for each FACE_T
static wxDynamicLibrary s_sch_dso;
static wxDynamicLibrary s_pcb_dso;
//static wxDynamicLibrary s_cvpcb_dso; // will get merged into pcbnew
KIFACE* m_kiface[FACE_COUNT]; KIFACE* m_kiface[FACE_COUNT];
int m_kiface_version[FACE_COUNT];
PROJECT m_project; // do not assume this is here, use Prj(). PROJECT m_project; // do not assume this is here, use Prj().
}; };
......
#ifndef KIWAY_MGR_H_
#define KIWAY_MGR_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kiway.h>
#include <boost/ptr_container/ptr_vector.hpp>
/**
* Class KIWAY_MGR
* is a container for all KIWAYS [and PROJECTS]. This class needs to work both
* for a C++ project manager and an a wxPython one (after being moved into a
* header later).
*/
class KIWAY_MGR
{
public:
//KIWAY_MGR();
// ~KIWAY_MGR();
bool OnStart( wxApp* aProcess );
void OnEnd();
KIWAY& operator[]( int aIndex )
{
wxASSERT( m_kiways.size() ); // stuffed in OnStart()
return m_kiways[aIndex];
}
private:
// KIWAYs may not be moved once doled out, since window DNA depends on the
// pointer being good forever.
// boost_ptr::vector however never moves the object pointed to.
typedef boost::ptr_vector<KIWAY> KIWAYS;
KIWAYS m_kiways;
};
extern KIWAY_MGR Kiways;
#endif // KIWAY_MGR_H_
...@@ -130,7 +130,7 @@ public: ...@@ -130,7 +130,7 @@ public:
* <p> * <p>
* Each derived class should handle this in a way specific to its needs. * Each derived class should handle this in a way specific to its needs.
* No prompting is done inside here for any file or project. There should be * No prompting is done inside here for any file or project. There should be
* need to call this with aFileList which is empty. However, calling it with * no need to call this with aFileList which is empty. However, calling it with
* a single filename which does not exist should indicate to the implementor * a single filename which does not exist should indicate to the implementor
* that a new session is being started and that the given name is the desired * that a new session is being started and that the given name is the desired
* name for the data file at time of save. * name for the data file at time of save.
...@@ -166,4 +166,51 @@ public: ...@@ -166,4 +166,51 @@ public:
} }
}; };
// psuedo code for OpenProjectFiles
#if 0
bool OpenProjectFiles( const std::vector<wxString>& aFileList, int aCtl = 0 )
{
if( aFileList.size() != 1 )
{
complain via UI.
return false
}
assert( aFileList[0] is absolute ) // bug in single_top.cpp or project manager.
if (window does not support appending) || !(aCtl & KICTL_OPEN_APPEND)
{
close any currently open project files.
}
if( aFileList[0] does not exist )
{
notify user file does not exist.
create an empty project file
mark file as modified.
use the default project config file.
}
else
{
load aFileList[0]
use the project config file for project given by aFileList[0]s full path.
}
UpdateTitle();
show contents.
}
#endif
#endif // KIWAY_PLAYER_H_ #endif // KIWAY_PLAYER_H_
...@@ -59,7 +59,7 @@ int LAUNCHER_PANEL::GetPanelHeight() const ...@@ -59,7 +59,7 @@ int LAUNCHER_PANEL::GetPanelHeight() const
* Function CreateCommandToolbar * Function CreateCommandToolbar
* create the buttons to call Eeschema CvPcb, Pcbnew and GerbView * create the buttons to call Eeschema CvPcb, Pcbnew and GerbView
*/ */
void LAUNCHER_PANEL::CreateCommandToolbar( void ) void LAUNCHER_PANEL::CreateCommandToolbar()
{ {
wxBitmapButton* btn; wxBitmapButton* btn;
......
...@@ -28,10 +28,11 @@ ...@@ -28,10 +28,11 @@
*/ */
#include <macros.h>
#include <fctsys.h> #include <fctsys.h>
#include <wx/stdpaths.h>
#include <kicad.h> #include <kicad.h>
#include <kiway.h> #include <kiway_mgr.h>
#include <pgm_kicad.h> #include <pgm_kicad.h>
#include <tree_project_frame.h> #include <tree_project_frame.h>
#include <online_help.h> #include <online_help.h>
...@@ -40,6 +41,40 @@ ...@@ -40,6 +41,40 @@
#include <build_version.h> #include <build_version.h>
/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
static void set_lib_env_var( const wxString& aAbsoluteArgv0 )
{
// POLICY CHOICE 2: Keep same path, so that installer MAY put the
// "subsidiary DSOs" in the same directory as the kiway top process modules.
// A subsidiary shared library is one that is not a top level DSO, but rather
// some shared library that a top level DSO needs to even be loaded. It is
// a static link to a shared object from a top level DSO.
// This directory POLICY CHOICE 2 is not the only dir in play, since LIB_ENV_VAR
// has numerous path options in it, as does DSO searching on linux, windows, and OSX.
// See "man ldconfig" on linux. What's being done here is for quick installs
// into a non-standard place, and especially for Windows users who may not
// know what the PATH environment variable is or how to set it.
wxFileName fn( aAbsoluteArgv0 );
wxString ld_path( LIB_ENV_VAR );
wxString my_path = fn.GetPath();
wxString new_paths = PrePendPath( ld_path, my_path );
wxSetEnv( ld_path, new_paths );
#if defined(DEBUG)
{
wxString test;
wxGetEnv( ld_path, &test );
printf( "LIB_ENV_VAR:'%s'\n", TO_UTF8( test ) );
}
#endif
}
// a dummy to quiet linking with EDA_BASE_FRAME::config(); // a dummy to quiet linking with EDA_BASE_FRAME::config();
#include <kiface_i.h> #include <kiface_i.h>
KIFACE_I& Kiface() KIFACE_I& Kiface()
...@@ -62,7 +97,6 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp ) ...@@ -62,7 +97,6 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
m_bm.Init(); m_bm.Init();
#if 0 // copied from single_top.c, possibly for milestone B)
wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath(); wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
if( !wxIsAbsolutePath( absoluteArgv0 ) ) if( !wxIsAbsolutePath( absoluteArgv0 ) )
...@@ -71,10 +105,9 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp ) ...@@ -71,10 +105,9 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
return false; return false;
} }
// Set LIB_ENV_VAR *before* loading the DSO, in case the top-level DSO holding the // Set LIB_ENV_VAR *before* loading the KIFACE DSOs, in case they have hard
// KIFACE has hard dependencies on subsidiary DSOs below it. // dependencies on subsidiary DSOs below it.
SetLibEnvVar( absoluteArgv0 ); set_lib_env_var( absoluteArgv0 );
#endif
if( !initPgm() ) if( !initPgm() )
return false; return false;
...@@ -218,39 +251,7 @@ void PGM_KICAD::destroy() ...@@ -218,39 +251,7 @@ void PGM_KICAD::destroy()
} }
/** KIWAY_MGR Kiways;
* Class KIWAY_MGR
* is a container for all KIWAYS [and PROJECTS]. This class needs to work both
* for a C++ project manager and an a wxPython one (after being moved into a
* header later).
*/
class KIWAY_MGR
{
public:
//KIWAY_MGR();
// ~KIWAY_MGR();
bool OnStart( wxApp* aProcess );
void OnEnd();
KIWAY& operator[]( int aIndex )
{
wxASSERT( m_kiways.size() ); // stuffed in OnStart()
return m_kiways[aIndex];
}
private:
// KIWAYs may not be moved once doled out, since window DNA depends on the
// pointer being good forever.
// boost_ptr::vector however never moves the object pointed to.
typedef boost::ptr_vector<KIWAY> KIWAYS;
KIWAYS m_kiways;
};
static KIWAY_MGR kiways;
/** /**
...@@ -261,7 +262,7 @@ struct APP_KICAD : public wxApp ...@@ -261,7 +262,7 @@ struct APP_KICAD : public wxApp
{ {
bool OnInit() // overload wxApp virtual bool OnInit() // overload wxApp virtual
{ {
if( kiways.OnStart( this ) ) if( Kiways.OnStart( this ) )
{ {
return Pgm().OnPgmInit( this ); return Pgm().OnPgmInit( this );
} }
...@@ -270,7 +271,7 @@ struct APP_KICAD : public wxApp ...@@ -270,7 +271,7 @@ struct APP_KICAD : public wxApp
int OnExit() // overload wxApp virtual int OnExit() // overload wxApp virtual
{ {
kiways.OnEnd(); Kiways.OnEnd();
Pgm().OnPgmExit(); Pgm().OnPgmExit();
...@@ -296,7 +297,7 @@ IMPLEMENT_APP( APP_KICAD ); ...@@ -296,7 +297,7 @@ IMPLEMENT_APP( APP_KICAD );
// this link image need this function. // this link image need this function.
PROJECT& Prj() PROJECT& Prj()
{ {
return kiways[0].Prj(); return Kiways[0].Prj();
} }
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include <fctsys.h> #include <fctsys.h>
#include <pgm_kicad.h> #include <pgm_kicad.h>
#include <kiway_mgr.h>
#include <kiway_player.h>
#include <confirm.h> #include <confirm.h>
#include <gestfich.h> #include <gestfich.h>
#include <macros.h> #include <macros.h>
...@@ -238,10 +240,23 @@ void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event ) ...@@ -238,10 +240,23 @@ void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event )
legacy_board.SetExt( LegacyPcbFileExtension ); legacy_board.SetExt( LegacyPcbFileExtension );
kicad_board.SetExt( KiCadPcbFileExtension ); kicad_board.SetExt( KiCadPcbFileExtension );
if( !legacy_board.FileExists() || kicad_board.FileExists() ) wxFileName& board = ( !legacy_board.FileExists() || kicad_board.FileExists() ) ?
Execute( this, PCBNEW_EXE, QuoteFullPath( kicad_board ) ); kicad_board : legacy_board;
else
Execute( this, PCBNEW_EXE, QuoteFullPath( legacy_board ) );
#if 0 // it works!
KIFACE* kiface = Kiways[0].KiFACE( &Pgm(), KIWAY::FACE_PCB );
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow( this, PCB_FRAME_TYPE, &Kiways[0], KFCTL_PROJECT_SUITE );
frame->OpenProjectFiles( std::vector<wxString>( 1, board.GetFullPath() ) );
frame->Show( true );
frame->Raise();
#else
Execute( this, PCBNEW_EXE, QuoteFullPath( board ) );
#endif
} }
......
...@@ -54,7 +54,7 @@ static struct IFACE : public KIFACE_I ...@@ -54,7 +54,7 @@ static struct IFACE : public KIFACE_I
KIFACE_I( aName, aType ) KIFACE_I( aName, aType )
{} {}
bool OnKifaceStart( PGM_BASE* aProgram ); bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
void OnKifaceEnd(); void OnKifaceEnd();
...@@ -126,9 +126,9 @@ PGM_BASE& Pgm() ...@@ -126,9 +126,9 @@ PGM_BASE& Pgm()
} }
bool IFACE::OnKifaceStart( PGM_BASE* aProgram ) bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{ {
start_common(); start_common( aCtlBits );
// Must be called before creating the main frame in order to // Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips // display the real hotkeys in menus or tool tips
......
...@@ -55,7 +55,7 @@ static struct IFACE : public KIFACE_I ...@@ -55,7 +55,7 @@ static struct IFACE : public KIFACE_I
KIFACE_I( aName, aType ) KIFACE_I( aName, aType )
{} {}
bool OnKifaceStart( PGM_BASE* aProgram ); bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
void OnKifaceEnd(); void OnKifaceEnd();
...@@ -117,9 +117,9 @@ PGM_BASE& Pgm() ...@@ -117,9 +117,9 @@ PGM_BASE& Pgm()
} }
bool IFACE::OnKifaceStart( PGM_BASE* aProgram ) bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{ {
start_common(); start_common( aCtlBits );
return true; return true;
} }
......
...@@ -194,7 +194,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -194,7 +194,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( !editor ) if( !editor )
{ {
editor = (FOOTPRINT_EDIT_FRAME*) Kiface().CreateWindow( this, MODULE_EDITOR_FRAME_TYPE, &Kiway() ); KIFACE_I& kf = Kiface();
editor = (FOOTPRINT_EDIT_FRAME*) kf.CreateWindow( this, MODULE_EDITOR_FRAME_TYPE, &Kiway(), kf.StartFlags() );
editor->Show( true ); editor->Show( true );
editor->Zoom_Automatique( false ); editor->Zoom_Automatique( false );
...@@ -220,7 +222,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -220,7 +222,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( !viewer ) if( !viewer )
{ {
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiface().CreateWindow( this, MODULE_VIEWER_FRAME_TYPE, &Kiway() ); KIFACE_I& kf = Kiface();
viewer = (FOOTPRINT_VIEWER_FRAME*) kf.CreateWindow( this, MODULE_VIEWER_FRAME_TYPE, &Kiway(), kf.StartFlags() );
viewer->Show( true ); viewer->Show( true );
viewer->Zoom_Automatique( false ); viewer->Zoom_Automatique( false );
...@@ -839,7 +843,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -839,7 +843,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( !editor ) if( !editor )
{ {
editor = (FOOTPRINT_EDIT_FRAME*) Kiface().CreateWindow( this, MODULE_EDITOR_FRAME_TYPE, &Kiway() ); KIFACE_I& kf = Kiface();
editor = (FOOTPRINT_EDIT_FRAME*) kf.CreateWindow( this, MODULE_EDITOR_FRAME_TYPE, &Kiway(), kf.StartFlags() );
} }
editor->Load_Module_From_BOARD( (MODULE*)GetCurItem() ); editor->Load_Module_From_BOARD( (MODULE*)GetCurItem() );
......
...@@ -78,7 +78,9 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) ...@@ -78,7 +78,9 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
if( !editor ) if( !editor )
{ {
editor = (FOOTPRINT_EDIT_FRAME*) Kiface().CreateWindow( this, MODULE_EDITOR_FRAME_TYPE, &Kiway() ); KIFACE_I& kf = Kiface();
editor = (FOOTPRINT_EDIT_FRAME*) kf.CreateWindow( this, MODULE_EDITOR_FRAME_TYPE, &Kiway(), kf.StartFlags() );
} }
editor->Load_Module_From_BOARD( Module ); editor->Load_Module_From_BOARD( Module );
......
...@@ -39,9 +39,6 @@ ...@@ -39,9 +39,6 @@
#include <help_common_strings.h> #include <help_common_strings.h>
#include <menus_helpers.h> #include <menus_helpers.h>
/**
* Pcbnew mainframe menubar
*/
void PCB_EDIT_FRAME::ReCreateMenuBar() void PCB_EDIT_FRAME::ReCreateMenuBar()
{ {
wxString text; wxString text;
...@@ -49,7 +46,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -49,7 +46,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
wxFileHistory& fhist = Kiface().GetFileHistory(); wxFileHistory& fhist = Kiface().GetFileHistory();
if( ! menuBar ) if( !menuBar )
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
// Delete all existing menus so they can be rebuilt. // Delete all existing menus so they can be rebuilt.
...@@ -64,7 +61,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -64,7 +61,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
// Create File Menu // Create File Menu
wxMenu* filesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
// New if( Kiface().IsSingle() ) // not when under a project mgr
{
AddMenuItem( filesMenu, ID_NEW_BOARD, AddMenuItem( filesMenu, ID_NEW_BOARD,
_( "&New" ), _( "&New" ),
_( "Clear current board and initialize a new one" ), _( "Clear current board and initialize a new one" ),
...@@ -75,6 +73,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -75,6 +73,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( filesMenu, ID_LOAD_FILE, text, AddMenuItem( filesMenu, ID_LOAD_FILE, text,
_( "Delete current board and load new board" ), _( "Delete current board and load new board" ),
KiBitmap( open_brd_file_xpm ) ); KiBitmap( open_brd_file_xpm ) );
}
// Load Recent submenu // Load Recent submenu
static wxMenu* openRecentMenu; static wxMenu* openRecentMenu;
...@@ -89,44 +88,46 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -89,44 +88,46 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
fhist.UseMenu( openRecentMenu ); fhist.UseMenu( openRecentMenu );
fhist.AddFilesToMenu(); fhist.AddFilesToMenu();
if( Kiface().IsSingle() ) // not when under a project mgr
{
AddMenuItem( filesMenu, openRecentMenu, AddMenuItem( filesMenu, openRecentMenu,
-1, _( "Open &Recent" ), -1, _( "Open &Recent" ),
_( "Open a recent opened board" ), _( "Open a recent opened board" ),
KiBitmap( open_project_xpm ) ); KiBitmap( open_project_xpm ) );
}
// Pcbnew Board
AddMenuItem( filesMenu, ID_APPEND_FILE, AddMenuItem( filesMenu, ID_APPEND_FILE,
_( "&Append Board" ), _( "&Append Board" ),
_( "Append another Pcbnew board to the current loaded board" ), _( "Append another Pcbnew board to the current loaded board" ),
KiBitmap( import_xpm ) ); KiBitmap( import_xpm ) );
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
// Save
text = AddHotkeyName( _( "&Save" ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD ); text = AddHotkeyName( _( "&Save" ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD );
AddMenuItem( filesMenu, ID_SAVE_BOARD, text, AddMenuItem( filesMenu, ID_SAVE_BOARD, text,
_( "Save current board" ), _( "Save current board" ),
KiBitmap( save_xpm ) ); KiBitmap( save_xpm ) );
// Save As if( Kiface().IsSingle() ) // not when under a project mgr
{
text = AddHotkeyName( _( "Sa&ve As..." ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS ); text = AddHotkeyName( _( "Sa&ve As..." ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
AddMenuItem( filesMenu, ID_SAVE_BOARD_AS, text, AddMenuItem( filesMenu, ID_SAVE_BOARD_AS, text,
_( "Save the current board as..." ), _( "Save the current board as..." ),
KiBitmap( save_as_xpm ) ); KiBitmap( save_as_xpm ) );
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
}
// Revert
AddMenuItem( filesMenu, ID_MENU_READ_BOARD_BACKUP_FILE, AddMenuItem( filesMenu, ID_MENU_READ_BOARD_BACKUP_FILE,
_( "Revert to Last" ), _( "Revert to Last" ),
_( "Clear board and get previous backup version of board" ), _( "Clear board and get previous backup version of board" ),
KiBitmap( help_xpm ) ); KiBitmap( help_xpm ) );
// Rescue AddMenuItem( filesMenu, ID_MENU_RECOVER_BOARD_AUTOSAVE,
AddMenuItem( filesMenu, ID_MENU_RECOVER_BOARD_AUTOSAVE, _( "Rescue" ), _( "Rescue" ),
_( "Clear board and get last rescue file automatically saved by Pcbnew" ), _( "Clear board and get last rescue file automatically saved by Pcbnew" ),
KiBitmap( help_xpm ) ); KiBitmap( help_xpm ) );
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
/* Fabrication Outputs submenu */ //----- Fabrication Outputs submenu -----------------------------------------
wxMenu* fabricationOutputsMenu = new wxMenu; wxMenu* fabricationOutputsMenu = new wxMenu;
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_POS_MODULES_FILE, AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_POS_MODULES_FILE,
_( "&Modules Position (.pos) File" ), _( "&Modules Position (.pos) File" ),
...@@ -138,7 +139,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -138,7 +139,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Generate excellon2 drill file" ), _( "Generate excellon2 drill file" ),
KiBitmap( post_drill_xpm ) ); KiBitmap( post_drill_xpm ) );
// Module Report
AddMenuItem( fabricationOutputsMenu, ID_GEN_EXPORT_FILE_MODULE_REPORT, AddMenuItem( fabricationOutputsMenu, ID_GEN_EXPORT_FILE_MODULE_REPORT,
_( "&Module (.rpt) Report" ), _( "&Module (.rpt) Report" ),
_( "Create a report of all modules on the current board" ), _( "Create a report of all modules on the current board" ),
...@@ -149,29 +149,24 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -149,29 +149,24 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Generate IPC-D-356 netlist file" ), _( "Generate IPC-D-356 netlist file" ),
KiBitmap( netlist_xpm ) ); KiBitmap( netlist_xpm ) );
// Component File
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_CMP_FILE, AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_CMP_FILE,
_( "&Component (.cmp) File" ), _( "&Component (.cmp) File" ),
_( "(Re)create components file (*.cmp) for CvPcb" ), _( "(Re)create components file (*.cmp) for CvPcb" ),
KiBitmap( create_cmp_file_xpm ) ); KiBitmap( create_cmp_file_xpm ) );
// BOM File
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_BOM_FILE_FROM_BOARD, AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_BOM_FILE_FROM_BOARD,
_( "&BOM File" ), _( "&BOM File" ),
_( "Create a bill of materials from schematic" ), _( "Create a bill of materials from schematic" ),
KiBitmap( bom_xpm ) ); KiBitmap( bom_xpm ) );
// Fabrications Outputs submenu append
AddMenuItem( filesMenu, fabricationOutputsMenu, AddMenuItem( filesMenu, fabricationOutputsMenu,
-1, _( "&Fabrication Outputs" ), -1, _( "&Fabrication Outputs" ),
_( "Generate files for fabrication" ), _( "Generate files for fabrication" ),
KiBitmap( fabrication_xpm ) ); KiBitmap( fabrication_xpm ) );
//----- Import submenu ------------------------------------------------------
/** Import submenu **/
wxMenu* submenuImport = new wxMenu(); wxMenu* submenuImport = new wxMenu();
// Specctra Session
AddMenuItem( submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION, AddMenuItem( submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION,
_( "&Specctra Session" ), _( "&Specctra Session" ),
_( "Import a routed \"Specctra Session\" (*.ses) file" ), _( "Import a routed \"Specctra Session\" (*.ses) file" ),
...@@ -187,27 +182,23 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -187,27 +182,23 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Import files" ), KiBitmap( import_xpm ) ); _( "Import files" ), KiBitmap( import_xpm ) );
/** Export submenu **/ //----- Export submenu ------------------------------------------------------
wxMenu* submenuexport = new wxMenu(); wxMenu* submenuexport = new wxMenu();
// Specctra DSN
AddMenuItem( submenuexport, ID_GEN_EXPORT_SPECCTRA, AddMenuItem( submenuexport, ID_GEN_EXPORT_SPECCTRA,
_( "&Specctra DSN" ), _( "&Specctra DSN" ),
_( "Export the current board to a \"Specctra DSN\" file" ), _( "Export the current board to a \"Specctra DSN\" file" ),
KiBitmap( export_dsn_xpm ) ); KiBitmap( export_dsn_xpm ) );
// GenCAD
AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT, AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT,
_( "&GenCAD" ), _( "Export GenCAD format" ), _( "&GenCAD" ), _( "Export GenCAD format" ),
KiBitmap( export_xpm ) ); KiBitmap( export_xpm ) );
// VRML
AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_VRML, AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_VRML,
_( "&VRML" ), _( "&VRML" ),
_( "Export a VRML board representation" ), _( "Export a VRML board representation" ),
KiBitmap( three_d_xpm ) ); KiBitmap( three_d_xpm ) );
// IDF3
AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_IDF3, AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_IDF3,
_( "I&DFv3 Export" ), _( "IDFv3 board and component export" ), _( "I&DFv3 Export" ), _( "IDFv3 board and component export" ),
KiBitmap( export_idf_xpm ) ); KiBitmap( export_idf_xpm ) );
...@@ -218,24 +209,20 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -218,24 +209,20 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
// Page settings
AddMenuItem( filesMenu, ID_SHEET_SET, AddMenuItem( filesMenu, ID_SHEET_SET,
_( "Page s&ettings" ), _( "Page s&ettings" ),
_( "Page settings for paper size and texts" ), _( "Page settings for paper size and texts" ),
KiBitmap( sheetset_xpm ) ); KiBitmap( sheetset_xpm ) );
// Print
AddMenuItem( filesMenu, wxID_PRINT, AddMenuItem( filesMenu, wxID_PRINT,
_( "&Print" ), _( "Print board" ), _( "&Print" ), _( "Print board" ),
KiBitmap( print_button_xpm ) ); KiBitmap( print_button_xpm ) );
// Create SVG file
AddMenuItem( filesMenu, ID_GEN_PLOT_SVG, AddMenuItem( filesMenu, ID_GEN_PLOT_SVG,
_( "Export SV&G" ), _( "Export SV&G" ),
_( "Export a board file in Scalable Vector Graphics format" ), _( "Export a board file in Scalable Vector Graphics format" ),
KiBitmap( plot_svg_xpm ) ); KiBitmap( plot_svg_xpm ) );
// Plot
AddMenuItem( filesMenu, ID_GEN_PLOT, AddMenuItem( filesMenu, ID_GEN_PLOT,
_( "P&lot" ), _( "P&lot" ),
_( "Plot board in HPGL, PostScript or Gerber RS-274X format)" ), _( "Plot board in HPGL, PostScript or Gerber RS-274X format)" ),
...@@ -243,15 +230,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -243,15 +230,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
//----- archive submenu -----------------------------------------------------
wxMenu* submenuarchive = new wxMenu(); wxMenu* submenuarchive = new wxMenu();
// Archive New Footprints
AddMenuItem( submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES, AddMenuItem( submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES,
_( "&Archive New Footprints" ), _( "&Archive New Footprints" ),
_( "Archive new footprints only in a library (keep other footprints in this lib)" ), _( "Archive new footprints only in a library (keep other footprints in this lib)" ),
KiBitmap( library_update_xpm ) ); KiBitmap( library_update_xpm ) );
// Create FootPrint Archive
AddMenuItem( submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES, AddMenuItem( submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES,
_( "&Create Footprint Archive" ), _( "&Create Footprint Archive" ),
_( "Archive all footprints in a library (old library will be deleted)" ), _( "Archive all footprints in a library (old library will be deleted)" ),
...@@ -263,54 +249,45 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -263,54 +249,45 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Archive or add footprints in a library file" ), _( "Archive or add footprints in a library file" ),
KiBitmap( library_xpm ) ); KiBitmap( library_xpm ) );
// Quit
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
AddMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), _( "Quit Pcbnew" ), AddMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), _( "Quit Pcbnew" ),
KiBitmap( exit_xpm ) ); KiBitmap( exit_xpm ) );
/** Create Edit menu **/ //----- Edit menu -----------------------------------------------------------
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
// Undo
text = AddHotkeyName( _( "&Undo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_UNDO ); text = AddHotkeyName( _( "&Undo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_UNDO );
AddMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) ); AddMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) );
// Redo
text = AddHotkeyName( _( "&Redo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_REDO ); text = AddHotkeyName( _( "&Redo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_REDO );
AddMenuItem( editMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) ); AddMenuItem( editMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) );
// Delete
AddMenuItem( editMenu, ID_PCB_DELETE_ITEM_BUTT, AddMenuItem( editMenu, ID_PCB_DELETE_ITEM_BUTT,
_( "&Delete" ), _( "Delete items" ), _( "&Delete" ), _( "Delete items" ),
KiBitmap( delete_xpm ) ); KiBitmap( delete_xpm ) );
editMenu->AppendSeparator(); editMenu->AppendSeparator();
// Find
text = AddHotkeyName( _( "&Find" ), g_Pcbnew_Editor_Hokeys_Descr, HK_FIND_ITEM ); text = AddHotkeyName( _( "&Find" ), g_Pcbnew_Editor_Hokeys_Descr, HK_FIND_ITEM );
AddMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND , KiBitmap( find_xpm ) ); AddMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND , KiBitmap( find_xpm ) );
editMenu->AppendSeparator(); editMenu->AppendSeparator();
// Global Deletions
AddMenuItem( editMenu, ID_PCB_GLOBAL_DELETE, AddMenuItem( editMenu, ID_PCB_GLOBAL_DELETE,
_( "&Global Deletions" ), _( "&Global Deletions" ),
_( "Delete tracks, modules, texts... on board" ), _( "Delete tracks, modules, texts... on board" ),
KiBitmap( general_deletions_xpm ) ); KiBitmap( general_deletions_xpm ) );
// Cleanup Tracks and Vias
AddMenuItem( editMenu, ID_MENU_PCB_CLEAN, AddMenuItem( editMenu, ID_MENU_PCB_CLEAN,
_( "&Cleanup Tracks and Vias" ), _( "&Cleanup Tracks and Vias" ),
_( "Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias" ), _( "Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias" ),
KiBitmap( delete_xpm ) ); KiBitmap( delete_xpm ) );
// Swap Layers
AddMenuItem( editMenu, ID_MENU_PCB_SWAP_LAYERS, AddMenuItem( editMenu, ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers" ), _( "&Swap Layers" ),
_( "Swap tracks on copper layers or drawings on other layers" ), _( "Swap tracks on copper layers or drawings on other layers" ),
KiBitmap( swap_layer_xpm ) ); KiBitmap( swap_layer_xpm ) );
// Reset module reference sizes
AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES, AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
_( "&Reset Module Field Sizes" ), _( "&Reset Module Field Sizes" ),
_( "Reset text size and width of all module fields to current defaults" ), _( "Reset text size and width of all module fields to current defaults" ),
...@@ -323,7 +300,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -323,7 +300,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Interactive router push&shove tool." ), _( "Interactive router push&shove tool." ),
KiBitmap( ps_router_xpm ) ); KiBitmap( ps_router_xpm ) );
/** Create View menu **/ //----- View menu -----------------------------------------------------------
wxMenu* viewMenu = new wxMenu; wxMenu* viewMenu = new wxMenu;
/* Important Note for ZOOM IN and ZOOM OUT commands from menubar: /* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
...@@ -337,104 +314,84 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -337,104 +314,84 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
* in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators * in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
* for Zoom in and Zoom out sub menus * for Zoom in and Zoom out sub menus
*/ */
// Zoom In
text = AddHotkeyName( _( "Zoom &In" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "Zoom &In" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ZOOM_IN, IS_ACCELERATOR ); HK_ZOOM_IN, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
// Zoom Out
text = AddHotkeyName( _( "Zoom &Out" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "Zoom &Out" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ZOOM_OUT, IS_ACCELERATOR ); HK_ZOOM_OUT, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
// Fit on Screen
text = AddHotkeyName( _( "&Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "&Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ZOOM_AUTO ); HK_ZOOM_AUTO );
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT,
KiBitmap( zoom_fit_in_page_xpm ) ); KiBitmap( zoom_fit_in_page_xpm ) );
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
// Redraw
text = AddHotkeyName( _( "&Redraw" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_REDRAW ); text = AddHotkeyName( _( "&Redraw" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_REDRAW );
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text,
HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
// 3D Display
AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME,
_( "&3D Display" ),_( "Show board in 3D viewer" ), _( "&3D Display" ),_( "Show board in 3D viewer" ),
KiBitmap( three_d_xpm ) ); KiBitmap( three_d_xpm ) );
// List Nets
AddMenuItem( viewMenu, ID_MENU_LIST_NETS, AddMenuItem( viewMenu, ID_MENU_LIST_NETS,
_( "&List Nets" ), _( "View a list of nets with names and id's" ), _( "&List Nets" ), _( "View a list of nets with names and id's" ),
KiBitmap( tools_xpm ) ); KiBitmap( tools_xpm ) );
// Switching GAL-based canvas on/off
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
text = AddHotkeyName( _( "&Switch canvas to default" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "&Switch canvas to default" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_CANVAS_DEFAULT, IS_ACCELERATOR ); HK_CANVAS_DEFAULT, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_MENU_CANVAS_DEFAULT, AddMenuItem( viewMenu, ID_MENU_CANVAS_DEFAULT,
text, _( "Switch the canvas implementation to default" ), text, _( "Switch the canvas implementation to default" ),
KiBitmap( tools_xpm ) ); KiBitmap( tools_xpm ) );
text = AddHotkeyName( _( "&Switch canvas to OpenGL" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "&Switch canvas to OpenGL" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_CANVAS_OPENGL, IS_ACCELERATOR ); HK_CANVAS_OPENGL, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_MENU_CANVAS_OPENGL, AddMenuItem( viewMenu, ID_MENU_CANVAS_OPENGL,
text, _( "Switch the canvas implementation to OpenGL" ), text, _( "Switch the canvas implementation to OpenGL" ),
KiBitmap( tools_xpm ) ); KiBitmap( tools_xpm ) );
text = AddHotkeyName( _( "&Switch canvas to Cairo" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "&Switch canvas to Cairo" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_CANVAS_CAIRO, IS_ACCELERATOR ); HK_CANVAS_CAIRO, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_MENU_CANVAS_CAIRO, AddMenuItem( viewMenu, ID_MENU_CANVAS_CAIRO,
text, _( "Switch the canvas implementation to Cairo" ), text, _( "Switch the canvas implementation to Cairo" ),
KiBitmap( tools_xpm ) ); KiBitmap( tools_xpm ) );
/** Create Place Menu **/ //----- Place Menu ----------------------------------------------------------
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
// Module
text = AddHotkeyName( _( "&Module" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "&Module" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ADD_MODULE, IS_ACCELERATOR ); HK_ADD_MODULE, IS_ACCELERATOR );
AddMenuItem( placeMenu, ID_PCB_MODULE_BUTT, text, AddMenuItem( placeMenu, ID_PCB_MODULE_BUTT, text,
_( "Add modules" ), KiBitmap( module_xpm ) ); _( "Add modules" ), KiBitmap( module_xpm ) );
// Track
text = AddHotkeyName( _( "&Track" ), g_Pcbnew_Editor_Hokeys_Descr, text = AddHotkeyName( _( "&Track" ), g_Pcbnew_Editor_Hokeys_Descr,
HK_ADD_NEW_TRACK, IS_ACCELERATOR ); HK_ADD_NEW_TRACK, IS_ACCELERATOR );
AddMenuItem( placeMenu, ID_TRACK_BUTT, text, AddMenuItem( placeMenu, ID_TRACK_BUTT, text,
_( "Add tracks and vias" ), KiBitmap( add_tracks_xpm ) ); _( "Add tracks and vias" ), KiBitmap( add_tracks_xpm ) );
// Zone
AddMenuItem( placeMenu, ID_PCB_ZONES_BUTT, AddMenuItem( placeMenu, ID_PCB_ZONES_BUTT,
_( "&Zone" ), _( "Add filled zones" ), KiBitmap( add_zone_xpm ) ); _( "&Zone" ), _( "Add filled zones" ), KiBitmap( add_zone_xpm ) );
// Keepout areas
AddMenuItem( placeMenu, ID_PCB_KEEPOUT_AREA_BUTT, AddMenuItem( placeMenu, ID_PCB_KEEPOUT_AREA_BUTT,
_( "&Keepout Area" ), _( "Add keepout areas" ), KiBitmap( add_keepout_area_xpm ) ); _( "&Keepout Area" ), _( "Add keepout areas" ), KiBitmap( add_keepout_area_xpm ) );
// Text
AddMenuItem( placeMenu, ID_PCB_ADD_TEXT_BUTT, AddMenuItem( placeMenu, ID_PCB_ADD_TEXT_BUTT,
_( "Te&xt" ), _( "Add text on copper layers or graphic text" ), _( "Te&xt" ), _( "Add text on copper layers or graphic text" ),
KiBitmap( add_text_xpm ) ); KiBitmap( add_text_xpm ) );
// Graphic Arc
AddMenuItem( placeMenu, ID_PCB_ARC_BUTT, AddMenuItem( placeMenu, ID_PCB_ARC_BUTT,
_( "&Arc" ), _( "Add graphic arc" ),KiBitmap( add_arc_xpm ) ); _( "&Arc" ), _( "Add graphic arc" ),KiBitmap( add_arc_xpm ) );
// Graphic Circle
AddMenuItem( placeMenu, ID_PCB_CIRCLE_BUTT, AddMenuItem( placeMenu, ID_PCB_CIRCLE_BUTT,
_( "&Circle" ), _( "Add graphic circle" ), _( "&Circle" ), _( "Add graphic circle" ),
KiBitmap( add_circle_xpm ) ); KiBitmap( add_circle_xpm ) );
// Line or Polygon
AddMenuItem( placeMenu, ID_PCB_ADD_LINE_BUTT, AddMenuItem( placeMenu, ID_PCB_ADD_LINE_BUTT,
_( "&Line or Polygon" ), _( "&Line or Polygon" ),
_( "Add graphic line or polygon" ), _( "Add graphic line or polygon" ),
...@@ -442,34 +399,29 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -442,34 +399,29 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
// Dimension
AddMenuItem( placeMenu, ID_PCB_DIMENSION_BUTT, AddMenuItem( placeMenu, ID_PCB_DIMENSION_BUTT,
_( "&Dimension" ), _( "Add dimension" ), _( "&Dimension" ), _( "Add dimension" ),
KiBitmap( add_dimension_xpm ) ); KiBitmap( add_dimension_xpm ) );
// Layer alignment target
AddMenuItem( placeMenu, ID_PCB_MIRE_BUTT, AddMenuItem( placeMenu, ID_PCB_MIRE_BUTT,
_( "La&yer alignment target" ), _( "Add layer alignment target" ), _( "La&yer alignment target" ), _( "Add layer alignment target" ),
KiBitmap( add_mires_xpm ) ); KiBitmap( add_mires_xpm ) );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
// Drill & Place Offset
AddMenuItem( placeMenu, ID_PCB_PLACE_OFFSET_COORD_BUTT, AddMenuItem( placeMenu, ID_PCB_PLACE_OFFSET_COORD_BUTT,
_( "Drill and Place O&ffset" ), _( "Drill and Place O&ffset" ),
_( "Place the origin point for drill and place files" ), _( "Place the origin point for drill and place files" ),
KiBitmap( pcb_offset_xpm ) ); KiBitmap( pcb_offset_xpm ) );
// Grid Origin
AddMenuItem( placeMenu, ID_PCB_PLACE_GRID_COORD_BUTT, AddMenuItem( placeMenu, ID_PCB_PLACE_GRID_COORD_BUTT,
_( "&Grid Origin" ), _( "&Grid Origin" ),
_( "Set the origin point for the grid" ), _( "Set the origin point for the grid" ),
KiBitmap( grid_select_axis_xpm ) ); KiBitmap( grid_select_axis_xpm ) );
/* Create Preferences and configuration menu */ //----- Preferences and configuration menu------------------------------------
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
// Library
AddMenuItem( configmenu, ID_PCB_LIB_TABLE_EDIT, AddMenuItem( configmenu, ID_PCB_LIB_TABLE_EDIT,
_( "Li&brary Tables" ), _( "Setup footprint libraries" ), _( "Li&brary Tables" ), _( "Setup footprint libraries" ),
KiBitmap( library_table_xpm ) ); KiBitmap( library_table_xpm ) );
...@@ -487,7 +439,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -487,7 +439,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
HELP_SHOW_HIDE_MICROWAVE_TOOLS, HELP_SHOW_HIDE_MICROWAVE_TOOLS,
KiBitmap( mw_toolbar_xpm ) ); KiBitmap( mw_toolbar_xpm ) );
// General // General
#ifdef __WXMAC__ #ifdef __WXMAC__
configmenu->Append(wxID_PREFERENCES); configmenu->Append(wxID_PREFERENCES);
...@@ -497,52 +448,44 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -497,52 +448,44 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( preference_xpm ) ); KiBitmap( preference_xpm ) );
#endif #endif
// Display
AddMenuItem( configmenu, ID_PCB_DISPLAY_OPTIONS_SETUP, AddMenuItem( configmenu, ID_PCB_DISPLAY_OPTIONS_SETUP,
_( "&Display" ), _( "&Display" ),
_( "Select how items (pads, tracks texts ... ) are displayed" ), _( "Select how items (pads, tracks texts ... ) are displayed" ),
KiBitmap( display_options_xpm ) ); KiBitmap( display_options_xpm ) );
// Create sizes and dimensions submenu //--- dimensions submenu ------------------------------------------------------
wxMenu* dimensionsMenu = new wxMenu; wxMenu* dimensionsMenu = new wxMenu;
// Grid
AddMenuItem( dimensionsMenu, ID_PCB_USER_GRID_SETUP, AddMenuItem( dimensionsMenu, ID_PCB_USER_GRID_SETUP,
_( "G&rid" ),_( "Adjust user grid dimensions" ), _( "G&rid" ),_( "Adjust user grid dimensions" ),
KiBitmap( grid_xpm ) ); KiBitmap( grid_xpm ) );
// Text and Drawings
AddMenuItem( dimensionsMenu, ID_PCB_DRAWINGS_WIDTHS_SETUP, AddMenuItem( dimensionsMenu, ID_PCB_DRAWINGS_WIDTHS_SETUP,
_( "Te&xts and Drawings" ), _( "Te&xts and Drawings" ),
_( "Adjust dimensions for texts and drawings" ), _( "Adjust dimensions for texts and drawings" ),
KiBitmap( options_text_xpm ) ); KiBitmap( options_text_xpm ) );
// Pads
AddMenuItem( dimensionsMenu, ID_PCB_PAD_SETUP, AddMenuItem( dimensionsMenu, ID_PCB_PAD_SETUP,
_( "&Pads" ), _( "Adjust default pad characteristics" ), _( "&Pads" ), _( "Adjust default pad characteristics" ),
KiBitmap( pad_dimensions_xpm ) ); KiBitmap( pad_dimensions_xpm ) );
// Pads Mask Clearance
AddMenuItem( dimensionsMenu, ID_PCB_MASK_CLEARANCE, AddMenuItem( dimensionsMenu, ID_PCB_MASK_CLEARANCE,
_( "Pads &Mask Clearance" ), _( "Pads &Mask Clearance" ),
_( "Adjust the global clearance between pads and the solder resist mask" ), _( "Adjust the global clearance between pads and the solder resist mask" ),
KiBitmap( pads_mask_layers_xpm ) ); KiBitmap( pads_mask_layers_xpm ) );
// Save dimension preferences
dimensionsMenu->AppendSeparator(); dimensionsMenu->AppendSeparator();
AddMenuItem( dimensionsMenu, ID_CONFIG_SAVE, AddMenuItem( dimensionsMenu, ID_CONFIG_SAVE,
_( "&Save" ), _( "Save dimension preferences" ), _( "&Save" ), _( "Save dimension preferences" ),
KiBitmap( save_xpm ) ); KiBitmap( save_xpm ) );
// Language submenu // Language submenu
Pgm().AddMenuLanguageList( configmenu ); Pgm().AddMenuLanguageList( configmenu );
// Hotkey submenu // Hotkey submenu
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( configmenu );
//--- Macros submenu --------------------------------------------------------
// Macros submenu
wxMenu* macrosMenu = new wxMenu; wxMenu* macrosMenu = new wxMenu;
AddMenuItem( macrosMenu, ID_PREFRENCES_MACROS_SAVE, AddMenuItem( macrosMenu, ID_PREFRENCES_MACROS_SAVE,
...@@ -555,7 +498,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -555,7 +498,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Read macros from file" ), _( "Read macros from file" ),
KiBitmap( read_setup_xpm ) ); KiBitmap( read_setup_xpm ) );
// Append macros menu to config menu
AddMenuItem( configmenu, macrosMenu, AddMenuItem( configmenu, macrosMenu,
-1, _( "Ma&cros" ), -1, _( "Ma&cros" ),
_( "Macros save/read operations" ), _( "Macros save/read operations" ),
...@@ -563,75 +505,58 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -563,75 +505,58 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
configmenu->AppendSeparator(); configmenu->AppendSeparator();
// Save Preferences
AddMenuItem( configmenu, ID_CONFIG_SAVE, AddMenuItem( configmenu, ID_CONFIG_SAVE,
_( "&Save Preferences" ), _( "&Save Preferences" ),
_( "Save application preferences" ), _( "Save application preferences" ),
KiBitmap( save_setup_xpm ) ); KiBitmap( save_setup_xpm ) );
// Read Preferences
AddMenuItem( configmenu, ID_CONFIG_READ, AddMenuItem( configmenu, ID_CONFIG_READ,
_( "&Read Preferences" ), _( "&Read Preferences" ),
_( "Read application preferences" ), _( "Read application preferences" ),
KiBitmap( read_setup_xpm ) ); KiBitmap( read_setup_xpm ) );
/** //----- Tools menu ----------------------------------------------------------
* Tools menu
*/
wxMenu* toolsMenu = new wxMenu; wxMenu* toolsMenu = new wxMenu;
/* Netlist */
AddMenuItem( toolsMenu, ID_GET_NETLIST, AddMenuItem( toolsMenu, ID_GET_NETLIST,
_( "&Netlist" ), _( "&Netlist" ),
_( "Read the netlist and update board connectivity" ), _( "Read the netlist and update board connectivity" ),
KiBitmap( netlist_xpm ) ); KiBitmap( netlist_xpm ) );
/* Layer pair */
AddMenuItem( toolsMenu, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, AddMenuItem( toolsMenu, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
_( "&Layer Pair" ), _( "Change the active layer pair" ), _( "&Layer Pair" ), _( "Change the active layer pair" ),
KiBitmap( select_layer_pair_xpm ) ); KiBitmap( select_layer_pair_xpm ) );
/* DRC */
AddMenuItem( toolsMenu, ID_DRC_CONTROL, AddMenuItem( toolsMenu, ID_DRC_CONTROL,
_( "&DRC" ), _( "&DRC" ),
_( "Perform design rules check" ), KiBitmap( erc_xpm ) ); _( "Perform design rules check" ), KiBitmap( erc_xpm ) );
/* FreeRoute */
AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_FREEROUTE_ACCESS, AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
_( "&FreeRoute" ), _( "&FreeRoute" ),
_( "Fast access to the Web Based FreeROUTE advanced router" ), _( "Fast access to the Web Based FreeROUTE advanced router" ),
KiBitmap( web_support_xpm ) ); KiBitmap( web_support_xpm ) );
#ifdef KICAD_SCRIPTING_WXPYTHON #if defined(KICAD_SCRIPTING_WXPYTHON)
/* Scripting */
AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, AddMenuItem( toolsMenu, ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
_( "&Scripting Console" ), _( "&Scripting Console" ),
_( "Show/Hide the Scripting console" ), _( "Show/Hide the Scripting console" ),
KiBitmap( book_xpm ) ); KiBitmap( book_xpm ) );
#endif #endif
/* Design Rules menu
*/
wxMenu* designRulesMenu = new wxMenu; wxMenu* designRulesMenu = new wxMenu;
// Design Rules
AddMenuItem( designRulesMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, AddMenuItem( designRulesMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
_( "Design Rules" ), _( "Design Rules" ),
_( "Open the design rules editor" ), KiBitmap( hammer_xpm ) ); _( "Open the design rules editor" ), KiBitmap( hammer_xpm ) );
// Layers Setup
AddMenuItem( designRulesMenu, ID_PCB_LAYERS_SETUP, AddMenuItem( designRulesMenu, ID_PCB_LAYERS_SETUP,
_( "&Layers Setup" ), _( "Enable and set layer properties" ), _( "&Layers Setup" ), _( "Enable and set layer properties" ),
KiBitmap( copper_layers_setup_xpm ) ); KiBitmap( copper_layers_setup_xpm ) );
/**
* Help menu
*/
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
AddMenuItem( helpMenu, wxID_HELP, AddMenuItem( helpMenu, wxID_HELP,
_( "&Contents" ), _( "&Contents" ),
_( "Open the Pcbnew handbook" ), _( "Open the Pcbnew handbook" ),
...@@ -642,16 +567,13 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -642,16 +567,13 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Open the \"Getting Started in KiCad\" guide for beginners" ), _( "Open the \"Getting Started in KiCad\" guide for beginners" ),
KiBitmap( help_xpm ) ); KiBitmap( help_xpm ) );
// About
helpMenu->AppendSeparator(); helpMenu->AppendSeparator();
AddMenuItem( helpMenu, wxID_ABOUT, AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About Pcbnew" ), _( "&About Pcbnew" ),
_( "About Pcbnew printed circuit board designer" ), _( "About Pcbnew printed circuit board designer" ),
KiBitmap( info_xpm ) ); KiBitmap( info_xpm ) );
/** // Append all menus to the menuBar
* Append all menus to the menuBar
*/
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( viewMenu, _( "&View" ) );
......
...@@ -271,7 +271,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -271,7 +271,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
FOOTPRINT_VIEWER_FRAME* viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer( top_project ); FOOTPRINT_VIEWER_FRAME* viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer( top_project );
if( !viewer ) if( !viewer )
{ {
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiface().CreateWindow( this, MODULE_VIEWER_FRAME_TYPE, &Kiway() ); KIFACE_I& kf = Kiface();
viewer = (FOOTPRINT_VIEWER_FRAME*) kf.CreateWindow( this, MODULE_VIEWER_FRAME_TYPE, &Kiway(), kf.StartFlags() );
viewer->Show( true ); viewer->Show( true );
viewer->Zoom_Automatique( false ); viewer->Zoom_Automatique( false );
} }
......
...@@ -85,9 +85,6 @@ ...@@ -85,9 +85,6 @@
BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, PCB_EDIT_FRAME::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, PCB_EDIT_FRAME::OnSockRequest )
EVT_COMBOBOX( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom ) EVT_COMBOBOX( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
EVT_COMBOBOX( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid ) EVT_COMBOBOX( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
...@@ -450,7 +447,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ...@@ -450,7 +447,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
#ifdef KICAD_SCRIPTING_WXPYTHON #if defined(KICAD_SCRIPTING_WXPYTHON)
// Add the scripting panel // Add the scripting panel
EDA_PANEINFO pythonAuiInfo; EDA_PANEINFO pythonAuiInfo;
pythonAuiInfo.ScriptingToolbarPane(); pythonAuiInfo.ScriptingToolbarPane();
...@@ -831,7 +828,7 @@ void PCB_EDIT_FRAME::SetGridColor(EDA_COLOR_T aColor) ...@@ -831,7 +828,7 @@ void PCB_EDIT_FRAME::SetGridColor(EDA_COLOR_T aColor)
} }
bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void ) bool PCB_EDIT_FRAME::IsMicroViaAcceptable()
{ {
int copperlayercnt = GetBoard()->GetCopperLayerCount( ); int copperlayercnt = GetBoard()->GetCopperLayerCount( );
LAYER_NUM currLayer = getActiveLayer(); LAYER_NUM currLayer = getActiveLayer();
...@@ -1106,7 +1103,7 @@ void PCB_EDIT_FRAME::UpdateTitle() ...@@ -1106,7 +1103,7 @@ void PCB_EDIT_FRAME::UpdateTitle()
SetTitle( title ); SetTitle( title );
} }
#ifdef KICAD_SCRIPTING_WXPYTHON #if defined(KICAD_SCRIPTING_WXPYTHON)
void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent ) void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent )
{ {
if ( m_pythonPanelHidden ) if ( m_pythonPanelHidden )
...@@ -1171,4 +1168,3 @@ void PCB_EDIT_FRAME::SetRotationAngle( int aRotationAngle ) ...@@ -1171,4 +1168,3 @@ void PCB_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
m_rotationAngle = aRotationAngle; m_rotationAngle = aRotationAngle;
} }
...@@ -101,7 +101,7 @@ static struct IFACE : public KIFACE_I ...@@ -101,7 +101,7 @@ static struct IFACE : public KIFACE_I
KIFACE_I( aName, aType ) KIFACE_I( aName, aType )
{} {}
bool OnKifaceStart( PGM_BASE* aProgram ); bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits );
void OnKifaceEnd(); void OnKifaceEnd();
...@@ -116,14 +116,16 @@ static struct IFACE : public KIFACE_I ...@@ -116,14 +116,16 @@ static struct IFACE : public KIFACE_I
frame->Zoom_Automatique( true ); frame->Zoom_Automatique( true );
#ifdef KICAD_SCRIPTING #if defined(KICAD_SCRIPTING)
// give the scripting helpers access to our frame // give the scripting helpers access to our frame
ScriptingSetPcbEditFrame( frame ); ScriptingSetPcbEditFrame( frame );
#endif #endif
// @todo temporarily here if( Kiface().IsSingle() )
{
// only run this under single_top, not under a project manager.
CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER ); CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER );
}
return frame; return frame;
} }
break; break;
...@@ -141,7 +143,6 @@ static struct IFACE : public KIFACE_I ...@@ -141,7 +143,6 @@ static struct IFACE : public KIFACE_I
/* Read a default config file in case no project given on command line. /* Read a default config file in case no project given on command line.
frame->LoadProjectFile( wxEmptyString, true ); frame->LoadProjectFile( wxEmptyString, true );
*/ */
return frame; return frame;
} }
break; break;
...@@ -159,7 +160,6 @@ static struct IFACE : public KIFACE_I ...@@ -159,7 +160,6 @@ static struct IFACE : public KIFACE_I
/* Read a default config file in case no project given on command line. /* Read a default config file in case no project given on command line.
frame->LoadProjectFile( wxEmptyString, true ); frame->LoadProjectFile( wxEmptyString, true );
*/ */
return frame; return frame;
} }
break; break;
...@@ -411,13 +411,13 @@ static bool scriptingSetup() ...@@ -411,13 +411,13 @@ static bool scriptingSetup()
FP_LIB_TABLE GFootprintTable; FP_LIB_TABLE GFootprintTable;
bool IFACE::OnKifaceStart( PGM_BASE* aProgram ) bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{ {
// This is process level, not project level, initialization of the DSO. // This is process level, not project level, initialization of the DSO.
// Do nothing in here pertinent to a project! // Do nothing in here pertinent to a project!
start_common(); start_common( aCtlBits );
// Must be called before creating the main frame in order to // Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips // display the real hotkeys in menus or tool tips
......
...@@ -234,9 +234,10 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest() ...@@ -234,9 +234,10 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest()
{ {
NETINFO_ITEM* net = m_Pcb->FindNet( current_net_code ); NETINFO_ITEM* net = m_Pcb->FindNet( current_net_code );
if( net == NULL ) //Should not occur if( !net ) // Should not occur
{ {
wxMessageBox( wxT( "Build_Board_Ratsnest() error: net not found" ) ); UTF8 msg = StrPrintf( "%s: error, net %d not found", __func__, current_net_code );
wxMessageBox( msg ); // BTW, it does happen.
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment