Add CMake code to enable or disable using images in menu items.
* Add USE_IMAGES_IN_MENUS definition to override the default platform behavior for adding images to menu items. * Update COMPILING.txt to document how to use USE_IMAGES_IN_MENUS. * Fix Windows segfault when creating language selection submenu introduced by new bitmap code in r3087. * Changed per email from JP from CVPcb to CvPcb because I'm getting old and blind and misread the email. * Lot's of Doxygen comment and coding style policy fixes.
This commit is contained in:
parent
45c5e594b6
commit
c5c98f9518
|
@ -107,6 +107,19 @@ if(USE_BOOST_POLYGON_LIBRARY)
|
|||
add_definitions(-DUSE_BOOST_POLYGON_LIBRARY)
|
||||
endif(USE_BOOST_POLYGON_LIBRARY)
|
||||
|
||||
# Allow user to override the default settings for adding images to menu items. By default
|
||||
# images in menu items are enabled on all plaforms except OSX. This can be over ridden by
|
||||
# defining -DUSE_IMAGES_IN_MENUS=ON/OFF to force the preferred behavior.
|
||||
if(NOT DEFINED USE_IMAGES_IN_MENUS)
|
||||
if(NOT APPLE)
|
||||
set(USE_IMAGES_IN_MENUS ON)
|
||||
endif(NOT APPLE)
|
||||
else(NOT DEFINED USE_IMAGES_IN_MENUS)
|
||||
if(USE_IMAGES_IN_MENUS)
|
||||
set(USE_IMAGES_IN_MENUS ON)
|
||||
endif(USE_IMAGES_IN_MENUS)
|
||||
endif(NOT DEFINED USE_IMAGES_IN_MENUS)
|
||||
|
||||
# Locations for install targets.
|
||||
set(KICAD_BIN bin
|
||||
CACHE PATH "Location of KiCad binaries.")
|
||||
|
|
|
@ -50,4 +50,6 @@
|
|||
/* Warning!!! Using wxGraphicContext for rendering is experimental. */
|
||||
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
|
||||
|
||||
#cmakedefine USE_IMAGES_IN_MENUS 1
|
||||
|
||||
#endif /* __CONFIG_H__ */
|
||||
|
|
|
@ -223,5 +223,10 @@ One of these 2 option *must* be set to ON:
|
|||
It requires wxWidgets to be built with the --enable-graphics_ctx switch.
|
||||
See building wxWidgets above.
|
||||
|
||||
USE_IMAGES_IN_MENUS ON/OFF (OPTIONAL)
|
||||
Force building Kicad with or without images in menu items. If this is not defined on
|
||||
when CMake is used to create the build files, images will be included in menu items
|
||||
on all platforms except OSX.
|
||||
|
||||
Note: that it is easy to build only a specific binary such as pcbnew alone:
|
||||
make pcbnew
|
||||
|
|
|
@ -42,14 +42,14 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" );
|
|||
|
||||
/* Just add new languages to the list. This macro will properly recalculate
|
||||
* the size of the array. */
|
||||
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / \
|
||||
sizeof( struct LANGUAGE_DESCR ) )
|
||||
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / sizeof( struct LANGUAGE_DESCR ) )
|
||||
|
||||
/* Default font size */
|
||||
#define FONT_DEFAULT_SIZE 10 /* Default font size. */
|
||||
|
||||
static wxString languageCfgKey( wxT( "LanguageID" ) );
|
||||
|
||||
|
||||
/**
|
||||
* The real font size will be computed at run time
|
||||
* A small class to handle the list on existing translations.
|
||||
|
@ -69,7 +69,7 @@ struct LANGUAGE_DESCR
|
|||
int m_KI_Lang_Identifier;
|
||||
|
||||
/* The menu language icons */
|
||||
const BITMAP_DEF& m_Lang_Icon;
|
||||
const wxBitmap m_Lang_Icon;
|
||||
|
||||
/* Labels used in menus */
|
||||
const wxChar* m_Lang_Label;
|
||||
|
@ -91,7 +91,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_DEFAULT,
|
||||
ID_LANGUAGE_DEFAULT,
|
||||
lang_def_xpm,
|
||||
KiBitmap( lang_def_xpm ),
|
||||
_( "Default" )
|
||||
},
|
||||
|
||||
|
@ -99,7 +99,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_ENGLISH,
|
||||
ID_LANGUAGE_ENGLISH,
|
||||
lang_en_xpm,
|
||||
KiBitmap( lang_en_xpm ),
|
||||
wxT( "English" ),
|
||||
true
|
||||
},
|
||||
|
@ -108,7 +108,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_FRENCH,
|
||||
ID_LANGUAGE_FRENCH,
|
||||
lang_fr_xpm,
|
||||
KiBitmap( lang_fr_xpm ),
|
||||
_( "French" )
|
||||
},
|
||||
|
||||
|
@ -116,7 +116,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_FINNISH,
|
||||
ID_LANGUAGE_FINNISH,
|
||||
lang_fi_xpm,
|
||||
KiBitmap( lang_fi_xpm ),
|
||||
_( "Finnish" )
|
||||
},
|
||||
|
||||
|
@ -124,7 +124,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_SPANISH,
|
||||
ID_LANGUAGE_SPANISH,
|
||||
lang_es_xpm,
|
||||
KiBitmap( lang_es_xpm ),
|
||||
_( "Spanish" )
|
||||
},
|
||||
|
||||
|
@ -132,7 +132,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_PORTUGUESE,
|
||||
ID_LANGUAGE_PORTUGUESE,
|
||||
lang_pt_xpm,
|
||||
KiBitmap( lang_pt_xpm ),
|
||||
_( "Portuguese" )
|
||||
},
|
||||
|
||||
|
@ -140,7 +140,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_ITALIAN,
|
||||
ID_LANGUAGE_ITALIAN,
|
||||
lang_it_xpm,
|
||||
KiBitmap( lang_it_xpm ),
|
||||
_( "Italian" )
|
||||
},
|
||||
|
||||
|
@ -148,7 +148,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_GERMAN,
|
||||
ID_LANGUAGE_GERMAN,
|
||||
lang_de_xpm,
|
||||
KiBitmap( lang_de_xpm ),
|
||||
_( "German" )
|
||||
},
|
||||
|
||||
|
@ -156,7 +156,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_GREEK,
|
||||
ID_LANGUAGE_GREEK,
|
||||
lang_gr_xpm,
|
||||
KiBitmap( lang_gr_xpm ),
|
||||
_( "Greek" )
|
||||
},
|
||||
|
||||
|
@ -164,7 +164,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_SLOVENIAN,
|
||||
ID_LANGUAGE_SLOVENIAN,
|
||||
lang_sl_xpm,
|
||||
KiBitmap( lang_sl_xpm ),
|
||||
_( "Slovenian" )
|
||||
},
|
||||
|
||||
|
@ -172,7 +172,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_HUNGARIAN,
|
||||
ID_LANGUAGE_HUNGARIAN,
|
||||
lang_hu_xpm,
|
||||
KiBitmap( lang_hu_xpm ),
|
||||
_( "Hungarian" )
|
||||
},
|
||||
|
||||
|
@ -180,7 +180,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_POLISH,
|
||||
ID_LANGUAGE_POLISH,
|
||||
lang_pl_xpm,
|
||||
KiBitmap( lang_pl_xpm ),
|
||||
_( "Polish" )
|
||||
},
|
||||
|
||||
|
@ -188,7 +188,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_CZECH,
|
||||
ID_LANGUAGE_CZECH,
|
||||
lang_cs_xpm,
|
||||
KiBitmap( lang_cs_xpm ),
|
||||
_( "Czech" )
|
||||
},
|
||||
|
||||
|
@ -196,7 +196,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_RUSSIAN,
|
||||
ID_LANGUAGE_RUSSIAN,
|
||||
lang_ru_xpm,
|
||||
KiBitmap( lang_ru_xpm ),
|
||||
_( "Russian" )
|
||||
},
|
||||
|
||||
|
@ -204,7 +204,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_KOREAN,
|
||||
ID_LANGUAGE_KOREAN,
|
||||
lang_ko_xpm,
|
||||
KiBitmap( lang_ko_xpm ),
|
||||
_( "Korean" )
|
||||
},
|
||||
|
||||
|
@ -212,7 +212,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_CHINESE_SIMPLIFIED,
|
||||
ID_LANGUAGE_CHINESE_SIMPLIFIED,
|
||||
lang_chinese_xpm,
|
||||
KiBitmap( lang_chinese_xpm ),
|
||||
_( "Chinese simplified" )
|
||||
},
|
||||
|
||||
|
@ -220,7 +220,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_CATALAN,
|
||||
ID_LANGUAGE_CATALAN,
|
||||
lang_catalan_xpm,
|
||||
KiBitmap( lang_catalan_xpm ),
|
||||
_( "Catalan" )
|
||||
},
|
||||
|
||||
|
@ -228,7 +228,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_DUTCH,
|
||||
ID_LANGUAGE_DUTCH,
|
||||
lang_nl_xpm,
|
||||
KiBitmap( lang_nl_xpm ),
|
||||
_( "Dutch" )
|
||||
},
|
||||
|
||||
|
@ -236,7 +236,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
|||
{
|
||||
wxLANGUAGE_JAPANESE,
|
||||
ID_LANGUAGE_JAPANESE,
|
||||
lang_jp_xpm,
|
||||
KiBitmap( lang_jp_xpm ),
|
||||
_( "Japanese" )
|
||||
}
|
||||
};
|
||||
|
@ -278,32 +278,23 @@ WinEDA_App::~WinEDA_App()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function InitEDA_Appl
|
||||
* initialise some general parameters
|
||||
* - Default paths (help, libs, bin)and configuration flies names
|
||||
* - Language and locale
|
||||
* - fonts
|
||||
* @param aName : used as paths in configuration files
|
||||
* @param aId = flag : APP_TYPE_EESCHEMA, APP_TYPE_PCBNEW..
|
||||
* used to choose what default library path must be used
|
||||
*/
|
||||
void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId )
|
||||
{
|
||||
wxString EnvLang;
|
||||
|
||||
m_Id = aId;
|
||||
m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) +
|
||||
wxGetUserId() );
|
||||
m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() );
|
||||
|
||||
/* Init kicad environment
|
||||
* the environment variable KICAD (if exists) gives the kicad path:
|
||||
* something like set KICAD=d:\kicad
|
||||
*/
|
||||
m_Env_Defined = wxGetEnv( wxT( "KICAD" ), &m_KicadEnv );
|
||||
|
||||
if( m_Env_Defined ) // ensure m_KicadEnv ends by "/"
|
||||
{
|
||||
m_KicadEnv.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
|
||||
if( m_KicadEnv.Last() != '/' )
|
||||
m_KicadEnv += UNIX_STRING_DIR_SEP;
|
||||
}
|
||||
|
@ -343,6 +334,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId )
|
|||
wxString languageSel;
|
||||
m_EDA_CommonConfig->Read( languageCfgKey, &languageSel);
|
||||
m_LanguageId = wxLANGUAGE_DEFAULT;
|
||||
|
||||
// Search for the current selection
|
||||
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
||||
{
|
||||
|
@ -354,21 +346,16 @@ void WinEDA_App::InitEDA_Appl( const wxString& aName, id_app_type aId )
|
|||
}
|
||||
|
||||
bool succes = SetLanguage( true );
|
||||
|
||||
if( !succes )
|
||||
{
|
||||
}
|
||||
|
||||
/* Set locale option for separator used in float numbers */
|
||||
SetLocaleTo_Default();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Init online help
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void WinEDA_App::InitOnLineHelp()
|
||||
{
|
||||
wxString fullfilename = FindKicadHelpPath();
|
||||
|
@ -396,11 +383,6 @@ void WinEDA_App::InitOnLineHelp()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find the path to the executable and store it in WinEDA_App::m_BinDir
|
||||
*
|
||||
* @return TODO
|
||||
*/
|
||||
bool WinEDA_App::SetBinDir()
|
||||
{
|
||||
/* Apple MacOSx */
|
||||
|
@ -408,14 +390,17 @@ bool WinEDA_App::SetBinDir()
|
|||
|
||||
/* Derive path from location of the app bundle */
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
|
||||
if( mainBundle == NULL )
|
||||
return false;
|
||||
|
||||
CFURLRef urlref = CFBundleCopyBundleURL( mainBundle );
|
||||
|
||||
if( urlref == NULL )
|
||||
return false;
|
||||
|
||||
CFStringRef str = CFURLCopyFileSystemPath( urlref, kCFURLPOSIXPathStyle );
|
||||
|
||||
if( str == NULL )
|
||||
return false;
|
||||
|
||||
|
@ -441,6 +426,7 @@ bool WinEDA_App::SetBinDir()
|
|||
|
||||
FileName[0] = 0;
|
||||
str_arg0 = argv[0];
|
||||
|
||||
if( strchr( (const char*) argv[0], '/' ) == NULL ) // no path
|
||||
{
|
||||
sprintf( FileName, "which %s > %s", TO_UTF8( str_arg0 ), TMP_FILE );
|
||||
|
@ -452,10 +438,13 @@ bool WinEDA_App::SetBinDir()
|
|||
fclose( ftmp );
|
||||
remove( TMP_FILE );
|
||||
}
|
||||
|
||||
m_BinDir = FROM_UTF8( Line );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_BinDir = argv[0];
|
||||
}
|
||||
|
||||
#else
|
||||
m_BinDir = argv[0];
|
||||
|
@ -475,9 +464,6 @@ bool WinEDA_App::SetBinDir()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set search paths for libraries, modules, internationalization files, etc.
|
||||
*/
|
||||
void WinEDA_App::SetDefaultSearchPaths( void )
|
||||
{
|
||||
size_t i;
|
||||
|
@ -507,8 +493,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
|||
/* Add the user's home path. */
|
||||
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetUserDataDir() );
|
||||
|
||||
/* Standard application data path if it is different from the binary
|
||||
* path. */
|
||||
/* Standard application data path if it is different from the binary path. */
|
||||
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
|
||||
{
|
||||
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
|
||||
|
@ -530,9 +515,9 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
|||
#ifdef __WXMSW__
|
||||
tmp.AddEnvList( wxT( "PROGRAMFILES" ) );
|
||||
#elif __WXMAC__
|
||||
m_searchPaths.Add( wxT("/Library/Application Support/kicad") );
|
||||
m_searchPaths.Add( wxString(wxGetenv(wxT("HOME"))) +
|
||||
wxT("/Library/Application Support/kicad") );
|
||||
m_searchPaths.Add( wxT( "/Library/Application Support/kicad" );
|
||||
m_searchPaths.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) +
|
||||
wxT("/Library/Application Support/kicad") );
|
||||
#else
|
||||
tmp.AddEnvList( wxT( "PATH" ) );
|
||||
#endif
|
||||
|
@ -576,6 +561,7 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
|||
if( m_Id == APP_TYPE_EESCHEMA )
|
||||
{
|
||||
fn.AppendDir( wxT( "library" ) );
|
||||
|
||||
if( fn.IsDirReadable() )
|
||||
{
|
||||
m_libSearchPaths.Add( fn.GetPath() );
|
||||
|
@ -583,10 +569,12 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
|||
|
||||
/* Add schematic doc file path (library/doc)to search path list. */
|
||||
fn.AppendDir( wxT( "doc" ) );
|
||||
|
||||
if( fn.IsDirReadable() )
|
||||
{
|
||||
m_libSearchPaths.Add( fn.GetPath() );
|
||||
}
|
||||
|
||||
fn.RemoveLastDir();
|
||||
fn.RemoveLastDir(); // point to <kicad path>
|
||||
}
|
||||
|
@ -608,9 +596,11 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
|||
{
|
||||
m_libSearchPaths.Add( fn.GetPath() );
|
||||
}
|
||||
|
||||
fn.RemoveLastDir();
|
||||
fn.RemoveLastDir(); // point to <kicad path>
|
||||
}
|
||||
|
||||
/* Add kicad template file path to search path list. */
|
||||
fn.AppendDir( wxT( "template" ) );
|
||||
|
||||
|
@ -618,19 +608,14 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
|||
{
|
||||
m_libSearchPaths.Add( fn.GetPath() );
|
||||
}
|
||||
|
||||
fn.RemoveLastDir();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function GetSettings
|
||||
* Get application settings
|
||||
* @param aReopenLastUsedDirectory = true to switch to last opened directory, false to use current CWD
|
||||
* @return none
|
||||
*/
|
||||
void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory)
|
||||
void WinEDA_App::GetSettings( bool aReopenLastUsedDirectory )
|
||||
{
|
||||
wxASSERT( m_EDA_Config != NULL && m_EDA_CommonConfig != NULL );
|
||||
|
||||
|
@ -640,8 +625,9 @@ void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory)
|
|||
m_HelpSize.y = 400;
|
||||
|
||||
wxString languageSel;
|
||||
m_EDA_CommonConfig->Read( languageCfgKey, &languageSel);
|
||||
m_EDA_CommonConfig->Read( languageCfgKey, &languageSel );
|
||||
m_LanguageId = wxLANGUAGE_DEFAULT;
|
||||
|
||||
// Search for the current selection
|
||||
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
||||
{
|
||||
|
@ -672,21 +658,21 @@ void WinEDA_App::GetSettings(bool aReopenLastUsedDirectory)
|
|||
|
||||
wxString upath;
|
||||
int i = 1;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
upath = m_EDA_CommonConfig->Read( wxString::Format( wxT( "LibraryPath%d" ), i ), wxT( "" ) );
|
||||
if( upath.IsSameAs( wxT( "" ) ) ) break;
|
||||
upath = m_EDA_CommonConfig->Read( wxString::Format( wxT( "LibraryPath%d" ), i ),
|
||||
wxT( "" ) );
|
||||
|
||||
if( upath.IsSameAs( wxT( "" ) ) )
|
||||
break;
|
||||
|
||||
m_libSearchPaths.Add( upath );
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save application settings
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void WinEDA_App::SaveSettings()
|
||||
{
|
||||
wxASSERT( m_EDA_Config != NULL );
|
||||
|
@ -699,15 +685,6 @@ void WinEDA_App::SaveSettings()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the dictionary file name for internationalization
|
||||
* the files are in kicad/internat/xx or kicad/internat/xx_XX
|
||||
* and are named kicad.mo
|
||||
*
|
||||
* @param first_time must be set to true the first time this funct is
|
||||
* called, false otherwise
|
||||
* @return true if the language can be set (i.e. if the locale is available)
|
||||
*/
|
||||
bool WinEDA_App::SetLanguage( bool first_time )
|
||||
{
|
||||
bool retv = true;
|
||||
|
@ -717,6 +694,7 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
|||
|
||||
if( m_Locale )
|
||||
delete m_Locale;
|
||||
|
||||
m_Locale = new wxLocale;
|
||||
|
||||
#if wxCHECK_VERSION( 2, 9, 0 )
|
||||
|
@ -725,7 +703,7 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
|||
if( !m_Locale->Init( m_LanguageId, wxLOCALE_CONV_ENCODING ) )
|
||||
#endif
|
||||
{
|
||||
wxLogDebug( wxT("This language is not supported by the system.") );
|
||||
wxLogDebug( wxT( "This language is not supported by the system." ) );
|
||||
|
||||
m_LanguageId = wxLANGUAGE_DEFAULT;
|
||||
delete m_Locale;
|
||||
|
@ -736,12 +714,13 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
|||
else if( !first_time )
|
||||
{
|
||||
wxLogDebug( wxT( "Search for dictionary %s.mo in %s" ),
|
||||
GetChars( DictionaryName ), GetChars( m_Locale->GetName() ) );
|
||||
GetChars( DictionaryName ), GetChars( m_Locale->GetName() ) );
|
||||
}
|
||||
|
||||
if( !first_time )
|
||||
{
|
||||
wxString languageSel;
|
||||
|
||||
// Search for the current selection
|
||||
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
||||
{
|
||||
|
@ -751,6 +730,7 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_EDA_CommonConfig->Write( languageCfgKey, languageSel );
|
||||
}
|
||||
|
||||
|
@ -763,9 +743,10 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
|||
msg << dtst;
|
||||
double result;
|
||||
msg.ToDouble(&result);
|
||||
|
||||
if( result != dtst ) // string to double encode/decode does not work! Bug detected
|
||||
{
|
||||
// Disable floating point localisation:
|
||||
// Disable floating point localization:
|
||||
g_DisableFloatingPointLocalNotation = true;
|
||||
SetLocaleTo_C_standard( );
|
||||
}
|
||||
|
@ -780,16 +761,6 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetLanguageIdentifier
|
||||
*
|
||||
* Set in .m_LanguageId member the wxWidgets language identifier Id from
|
||||
* the kicad menu id (internal menu identifier)
|
||||
*
|
||||
* @param menu_id = the kicad menuitem id (returned by Menu Event, when
|
||||
* clicking on a menu item)
|
||||
* @return none
|
||||
*/
|
||||
void WinEDA_App::SetLanguageIdentifier( int menu_id )
|
||||
{
|
||||
wxLogDebug( wxT( "Select language ID %d from %d possible languages." ),
|
||||
|
@ -820,10 +791,10 @@ void WinEDA_App::SetLanguagePath( void )
|
|||
// Append path for Windows and unix kicad pack install
|
||||
fn.AppendDir( wxT( "share" ) );
|
||||
fn.AppendDir( wxT( "internat" ) );
|
||||
|
||||
if( fn.DirExists() )
|
||||
{
|
||||
wxLogDebug( wxT( "Adding locale lookup path: " ) +
|
||||
fn.GetPath() );
|
||||
wxLogDebug( wxT( "Adding locale lookup path: " ) + fn.GetPath() );
|
||||
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
||||
}
|
||||
|
||||
|
@ -836,8 +807,7 @@ void WinEDA_App::SetLanguagePath( void )
|
|||
|
||||
if( fn.DirExists() )
|
||||
{
|
||||
wxLogDebug( wxT( "Adding locale lookup path: " ) +
|
||||
fn.GetPath() );
|
||||
wxLogDebug( wxT( "Adding locale lookup path: " ) + fn.GetPath() );
|
||||
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
||||
}
|
||||
}
|
||||
|
@ -845,13 +815,6 @@ void WinEDA_App::SetLanguagePath( void )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function AddMenuLanguageList
|
||||
* Create menu list for language choice, and add it as submenu to a main menu
|
||||
* @param MasterMenu : The main menu. The sub menu list will be accessible
|
||||
* from the menu item with id ID_LANGUAGE_CHOICE
|
||||
* @return none
|
||||
*/
|
||||
void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
|
||||
{
|
||||
wxMenu* menu = NULL;
|
||||
|
@ -864,9 +827,11 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
|
|||
return;
|
||||
|
||||
menu = new wxMenu;
|
||||
|
||||
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
||||
{
|
||||
wxString label;
|
||||
|
||||
if( s_Language_List[ii].m_DoNotTranslate )
|
||||
label = s_Language_List[ii].m_Lang_Label;
|
||||
else
|
||||
|
@ -897,10 +862,6 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Look in search paths for requested file.
|
||||
*
|
||||
*/
|
||||
wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
|
||||
const wxArrayString* subdirs )
|
||||
{
|
||||
|
@ -928,21 +889,6 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
|
|||
}
|
||||
|
||||
|
||||
/* GetHelpFile
|
||||
* Get the help file path.
|
||||
*
|
||||
* Return the Kicad help file with path. The base paths defined in
|
||||
* m_searchPaths are tested for a valid file. The path returned can
|
||||
* be relative depending on the paths added to m_searchPaths. See the
|
||||
* documentation for wxPathList for more information. If the help file
|
||||
* for the current locale is not found, an attempt to find the English
|
||||
* version of the help file is made.
|
||||
* wxEmptyString is returned if help file not found.
|
||||
* Help file is searched in directories in this order:
|
||||
* help/<canonical name> like help/en_GB
|
||||
* help/<short name> like help/en
|
||||
* help/en
|
||||
*/
|
||||
wxString WinEDA_App::GetHelpFile( void )
|
||||
{
|
||||
wxString fn;
|
||||
|
@ -973,7 +919,6 @@ wxString WinEDA_App::GetHelpFile( void )
|
|||
altsubdirs.Add( _T( "doc" ) );
|
||||
altsubdirs.Add( _T( "help" ) );
|
||||
|
||||
|
||||
/* Search for a help file.
|
||||
* we *must* find a help file.
|
||||
* so help is searched in directories in this order:
|
||||
|
@ -986,6 +931,7 @@ wxString WinEDA_App::GetHelpFile( void )
|
|||
subdirs.Add( m_Locale->GetCanonicalName() );
|
||||
altsubdirs.Add( m_Locale->GetCanonicalName() );
|
||||
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
||||
|
||||
if( !fn )
|
||||
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
|
||||
|
||||
|
@ -999,6 +945,7 @@ wxString WinEDA_App::GetHelpFile( void )
|
|||
subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) );
|
||||
altsubdirs.Add( m_Locale->GetName().BeforeLast( '_' ) );
|
||||
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
||||
|
||||
if( !fn )
|
||||
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
|
||||
}
|
||||
|
@ -1011,6 +958,7 @@ wxString WinEDA_App::GetHelpFile( void )
|
|||
subdirs.Add( _T( "en" ) );
|
||||
altsubdirs.Add( _T( "en" ) );
|
||||
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
||||
|
||||
if( !fn )
|
||||
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
|
||||
}
|
||||
|
@ -1034,11 +982,6 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename )
|
|||
}
|
||||
|
||||
|
||||
/** ReturnLastVisitedLibraryPath
|
||||
* Returns the last visited library directory, or (if void) the first
|
||||
* path in lib path list ( but not the CWD )
|
||||
* @param aSubPathToSearch = Prefered sub path to search in path list (defualt = empty string)
|
||||
*/
|
||||
wxString WinEDA_App::ReturnLastVisitedLibraryPath( const wxString& aSubPathToSearch )
|
||||
{
|
||||
if( !m_LastVisitedLibPath.IsEmpty() )
|
||||
|
@ -1050,6 +993,7 @@ wxString WinEDA_App::ReturnLastVisitedLibraryPath( const wxString& aSubPathToSea
|
|||
* this is the second path in list (the first is the project path)
|
||||
*/
|
||||
unsigned pcount = m_libSearchPaths.GetCount();
|
||||
|
||||
if( pcount )
|
||||
{
|
||||
unsigned ipath = 0;
|
||||
|
@ -1076,6 +1020,7 @@ wxString WinEDA_App::ReturnLastVisitedLibraryPath( const wxString& aSubPathToSea
|
|||
|
||||
if( path.IsEmpty() )
|
||||
path = wxGetCwd();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
@ -1086,34 +1031,32 @@ void WinEDA_App::SaveLastVisitedLibraryPath( const wxString& aPath )
|
|||
}
|
||||
|
||||
|
||||
/** ReturnFilenameWithRelativePathInLibPath
|
||||
* @return a short filename (with extension) with only a relative path if this filename
|
||||
* can be found in library paths (i.e. if the path is a sub path of a libraries path)
|
||||
* @param aFullFilename = filename with path and extension.
|
||||
*/
|
||||
wxString WinEDA_App::ReturnFilenameWithRelativePathInLibPath( const wxString& aFullFilename )
|
||||
{
|
||||
/* If the library path is already in the library search paths
|
||||
* list, just add the library name to the list. Otherwise, add
|
||||
* the library name with the full or relative path.
|
||||
* the relative path, when possible is preferable,
|
||||
* because it preserve use of default libraries paths, when the path is a sub path of these default paths
|
||||
* because it preserve use of default libraries paths, when the path is a sub path of
|
||||
* these default paths
|
||||
* Note we accept only sub paths,
|
||||
* not relative paths starting by ../ that are not subpaths and are outside kicad libs paths
|
||||
*/
|
||||
wxFileName fn = aFullFilename;
|
||||
wxString filename = aFullFilename;
|
||||
unsigned pathlen = fn.GetPath().Len(); /* path len, used to find the better (shortest) subpath
|
||||
* within defaults paths */
|
||||
unsigned pathlen = fn.GetPath().Len(); /* path len, used to find the better (shortest)
|
||||
* subpath within defaults paths */
|
||||
|
||||
for( unsigned kk = 0; kk < m_libSearchPaths.GetCount(); kk++ )
|
||||
{
|
||||
fn = aFullFilename;
|
||||
|
||||
// Search for the shortest subpath within m_libSearchPaths:
|
||||
if( fn.MakeRelativeTo( m_libSearchPaths[kk] ) )
|
||||
{
|
||||
if( fn.GetPathWithSep().StartsWith( wxT("..") ) ) // Path outside kicad libs paths
|
||||
continue;
|
||||
|
||||
if( pathlen > fn.GetPath().Len() ) // A better (shortest) subpath is found
|
||||
{
|
||||
filename = fn.GetPathWithSep() + fn.GetFullName();
|
||||
|
@ -1126,13 +1069,6 @@ wxString WinEDA_App::ReturnFilenameWithRelativePathInLibPath( const wxString& aF
|
|||
}
|
||||
|
||||
|
||||
/* FindLibraryPath
|
||||
* Kicad saves user defined library files that are not in the standard
|
||||
* library search path list with the full file path. Calling the library
|
||||
* search path list with a user library file will fail. This helper method
|
||||
* solves that problem.
|
||||
* return a wxEmptyString if library file is not found.
|
||||
*/
|
||||
wxString WinEDA_App::FindLibraryPath( const wxString& aFileName )
|
||||
{
|
||||
if( wxFileName::FileExists( aFileName ) )
|
||||
|
@ -1142,10 +1078,6 @@ wxString WinEDA_App::FindLibraryPath( const wxString& aFileName )
|
|||
}
|
||||
|
||||
|
||||
/* Function RemoveLibraryPath
|
||||
* Removes the given path(s) from the library path list
|
||||
* aPaths = path or path list to remove. paths must be separated by ";"
|
||||
*/
|
||||
void WinEDA_App::RemoveLibraryPath( const wxString& aPaths )
|
||||
{
|
||||
wxStringTokenizer Token( aPaths, wxT( ";\n\r" ) );
|
||||
|
@ -1153,6 +1085,7 @@ void WinEDA_App::RemoveLibraryPath( const wxString& aPaths )
|
|||
while( Token.HasMoreTokens() )
|
||||
{
|
||||
wxString path = Token.GetNextToken();
|
||||
|
||||
if( m_libSearchPaths.Index( path, wxFileName::IsCaseSensitive() ) != wxNOT_FOUND )
|
||||
{
|
||||
m_libSearchPaths.Remove( path );
|
||||
|
@ -1161,12 +1094,6 @@ void WinEDA_App::RemoveLibraryPath( const wxString& aPaths )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function InsertLibraryPath
|
||||
* insert path(s) int lib paths list.
|
||||
* @param aPaths = path or path list to add. paths must be separated by ";"
|
||||
* @param aIndex = insertion point
|
||||
*/
|
||||
void WinEDA_App::InsertLibraryPath( const wxString& aPaths, size_t aIndex )
|
||||
{
|
||||
wxStringTokenizer Token( aPaths, wxT( ";\n\r" ) );
|
||||
|
@ -1174,6 +1101,7 @@ void WinEDA_App::InsertLibraryPath( const wxString& aPaths, size_t aIndex )
|
|||
while( Token.HasMoreTokens() )
|
||||
{
|
||||
wxString path = Token.GetNextToken();
|
||||
|
||||
if( wxFileName::DirExists( path )
|
||||
&& m_libSearchPaths.Index( path, wxFileName::IsCaseSensitive() ) == wxNOT_FOUND )
|
||||
{
|
||||
|
@ -1185,8 +1113,8 @@ void WinEDA_App::InsertLibraryPath( const wxString& aPaths, size_t aIndex )
|
|||
{
|
||||
m_libSearchPaths.Insert( path, aIndex );
|
||||
}
|
||||
|
||||
aIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,14 +47,6 @@ wxString GetQuotedText( wxString & text )
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called by the automatic association button
|
||||
* Read *.equ files to try to find corresponding footprint
|
||||
* for each component that is not already linked to a footprint ( a "free"
|
||||
* component )
|
||||
* format of a line:
|
||||
* 'cmp_ref' 'footprint_name'
|
||||
*/
|
||||
void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
|
||||
{
|
||||
FOOTPRINT_ALIAS_LIST aliases;
|
||||
|
@ -72,6 +64,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
|
|||
for( ii = 0; ii < m_AliasLibNames.GetCount(); ii++ )
|
||||
{
|
||||
fn = m_AliasLibNames[ii];
|
||||
|
||||
if( !fn.HasExt() ) {
|
||||
fn.SetExt( FootprintAliasFileExtension );
|
||||
// above fails if filename have more than one point
|
||||
|
@ -142,10 +135,12 @@ found in the default search paths." ),
|
|||
BOOST_FOREACH( FOOTPRINT_ALIAS& alias, aliases )
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
if( alias.m_Name.CmpNoCase( component.m_Value ) != 0 )
|
||||
continue;
|
||||
|
||||
/* filter alias so one can use multiple aliases (for polar and nonpolar caps for example) */
|
||||
/* filter alias so one can use multiple aliases (for polar and nonpolar caps for
|
||||
* example) */
|
||||
FOOTPRINT_INFO *module = m_footprints.GetModuleInfo( alias.m_FootprintName );
|
||||
|
||||
if( module )
|
||||
|
@ -164,7 +159,7 @@ found in the default search paths." ),
|
|||
any of the project footprint libraries." ),
|
||||
GetChars( component.m_Reference ),
|
||||
GetChars( alias.m_FootprintName ) );
|
||||
wxMessageBox( msg, _( "CVPcb Error" ), wxOK | wxICON_ERROR,
|
||||
wxMessageBox( msg, _( "CvPcb Error" ), wxOK | wxICON_ERROR,
|
||||
this );
|
||||
}
|
||||
if( found )
|
||||
|
|
|
@ -75,11 +75,11 @@ bool WinEDA_App::OnInit()
|
|||
wxString message;
|
||||
CVPCB_MAINFRAME* frame = NULL;
|
||||
|
||||
InitEDA_Appl( wxT( "CVPcb" ), APP_TYPE_CVPCB );
|
||||
InitEDA_Appl( wxT( "CvPcb" ), APP_TYPE_CVPCB );
|
||||
|
||||
if( m_Checker && m_Checker->IsAnotherRunning() )
|
||||
{
|
||||
if( !IsOK( NULL, _( "CVPcb is already running, Continue?" ) ) )
|
||||
if( !IsOK( NULL, _( "CvPcb is already running, Continue?" ) ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class DISPLAY_FOOTPRINTS_FRAME;
|
|||
|
||||
|
||||
/**
|
||||
* The CVPcb application main window.
|
||||
* The CvPcb application main window.
|
||||
*/
|
||||
class CVPCB_MAINFRAME : public EDA_BASE_FRAME
|
||||
{
|
||||
|
@ -87,7 +87,17 @@ public:
|
|||
void ConfigCvpcb( wxCommandEvent& event );
|
||||
void OnKeepOpenOnSave( wxCommandEvent& event );
|
||||
void DisplayModule( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Called by the automatic association button
|
||||
* Read *.equ files to try to find corresponding footprint
|
||||
* for each component that is not already linked to a footprint ( a "free"
|
||||
* component )
|
||||
* format of a line:
|
||||
* 'cmp_ref' 'footprint_name'
|
||||
*/
|
||||
void AssocieModule( wxCommandEvent& event );
|
||||
|
||||
void WriteStuffList( wxCommandEvent& event );
|
||||
void DisplayDocFile( wxCommandEvent& event );
|
||||
|
||||
|
@ -143,7 +153,7 @@ public:
|
|||
|
||||
/**
|
||||
* Function LoadSettings
|
||||
* loads the CVPcb main frame specific configuration settings.
|
||||
* loads the CvPcb main frame specific configuration settings.
|
||||
*
|
||||
* Don't forget to call this base method from any derived classes or the
|
||||
* settings will not get loaded.
|
||||
|
@ -152,7 +162,7 @@ public:
|
|||
|
||||
/**
|
||||
* Function SaveSettings
|
||||
* save the CVPcb frame specific configuration settings.
|
||||
* save the CvPcb frame specific configuration settings.
|
||||
*
|
||||
* Don't forget to call this base method from any derived classes or the
|
||||
* settings will not get saved.
|
||||
|
@ -195,16 +205,16 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetProjectFileParameters
|
||||
* return project file parameter list for CVPcb.
|
||||
* return project file parameter list for CvPcb.
|
||||
* <p>
|
||||
* Populate the project file parameter array specific to CVPcb if it hasn't
|
||||
* Populate the project file parameter array specific to CvPcb if it hasn't
|
||||
* already been populated and return a reference to the array to the caller.
|
||||
* Creating the parameter list at run time has the advantage of being able
|
||||
* to define local variables. The old method of statically building the array
|
||||
* at compile time requiring global variable definitions.
|
||||
* </p>
|
||||
*
|
||||
* @return A reference to a PARAM_CFG_ARRAY contain the project settings for CVPcb.
|
||||
* @return A reference to a PARAM_CFG_ARRAY contain the project settings for CvPcb.
|
||||
*/
|
||||
PARAM_CFG_ARRAY& GetProjectFileParameters( void );
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
ADD_MENUITEM_WITH_HELP( filesMenu,
|
||||
wxID_EXIT,
|
||||
_( "&Quit" ),
|
||||
_( "Quit CVPcb" ),
|
||||
_( "Quit CvPcb" ),
|
||||
exit_xpm );
|
||||
|
||||
// Menu Preferences:
|
||||
|
@ -108,7 +108,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
// Keep open on save
|
||||
item = new wxMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
||||
_( "Keep Open On Save" ),
|
||||
_( "Prevent CVPcb from exiting after saving netlist file" ),
|
||||
_( "Prevent CvPcb from exiting after saving netlist file" ),
|
||||
wxITEM_CHECK );
|
||||
preferencesMenu->Append( item );
|
||||
SETBITMAPS( window_close_xpm );
|
||||
|
@ -132,13 +132,13 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
|
||||
// Contents
|
||||
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_HELP, _( "&Contents" ),
|
||||
_( "Open the CVPcb handbook" ),
|
||||
_( "Open the CvPcb handbook" ),
|
||||
online_help_xpm );
|
||||
|
||||
// About
|
||||
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT,
|
||||
_( "&About CVPcb" ),
|
||||
_( "About CVPcb schematic to pcb converter" ),
|
||||
_( "&About CvPcb" ),
|
||||
_( "About CvPcb schematic to pcb converter" ),
|
||||
info_xpm );
|
||||
|
||||
// Create the menubar and append all submenus
|
||||
|
|
|
@ -70,7 +70,7 @@ bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& aFileName )
|
|||
source = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
|
||||
if( source == NULL )
|
||||
{
|
||||
msg.Printf( _( "Cannot open CVPcb component file <%s>." ),
|
||||
msg.Printf( _( "Cannot open CvPcb component file <%s>." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
msg << wxT( "\n" ) << _( "This is normal if you are opening a new netlist file" );
|
||||
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||
|
|
|
@ -80,11 +80,22 @@ public: WinEDA_App();
|
|||
/**
|
||||
* Function OnInit
|
||||
* this is the first executed function (like main() )
|
||||
* @return true if the appliction can be started.
|
||||
* @return true if the application can be started.
|
||||
*/
|
||||
bool OnInit();
|
||||
|
||||
/**
|
||||
* Function SetBinDir
|
||||
* finds the path to the executable and store it in WinEDA_App::m_BinDir
|
||||
*
|
||||
* @return TODO
|
||||
*/
|
||||
bool SetBinDir();
|
||||
|
||||
/**
|
||||
* Function SetDefaultSearchPaths
|
||||
* sets search paths for libraries, modules, internationalization files, etc.
|
||||
*/
|
||||
void SetDefaultSearchPaths( void );
|
||||
|
||||
/**
|
||||
|
@ -108,34 +119,57 @@ public: WinEDA_App();
|
|||
void InitEDA_Appl( const wxString& aName,
|
||||
id_app_type aId = APP_TYPE_UNKOWN );
|
||||
|
||||
bool SetLanguage( bool first_time = FALSE );
|
||||
/**
|
||||
* Function SetLanguage
|
||||
* sets the dictionary file name for internationalization.
|
||||
* <p>
|
||||
* The files are in kicad/internat/xx or kicad/internat/xx_XX and are named kicad.mo
|
||||
* </p>
|
||||
* @param first_time must be set to true the first time this funct is
|
||||
* called, false otherwise
|
||||
* @return true if the language can be set (i.e. if the locale is available)
|
||||
*/
|
||||
bool SetLanguage( bool first_time = false );
|
||||
|
||||
/**
|
||||
* Function AddMenuLanguageList
|
||||
* creates a menu list for language choice, and add it as submenu to \a MasterMenu.
|
||||
*
|
||||
* Create menu list for language choice, and add it as submenu to a main
|
||||
* menu
|
||||
*
|
||||
* @param MasterMenu : The main menu. The sub menu list will be
|
||||
* accessible from the menu item with id
|
||||
* ID_LANGUAGE_CHOICE
|
||||
*
|
||||
* @return the sub menu Language list
|
||||
* @param MasterMenu The main menu. The sub menu list will be accessible from the menu
|
||||
* item with id ID_LANGUAGE_CHOICE
|
||||
*/
|
||||
void AddMenuLanguageList( wxMenu* MasterMenu );
|
||||
|
||||
/**
|
||||
* Function SetLanguageIdentifier
|
||||
* sets in .m_LanguageId member the wxWidgets language identifier Id from
|
||||
* the kicad menu id (internal menu identifier).
|
||||
*
|
||||
* @param menu_id The kicad menuitem id (returned by Menu Event, when
|
||||
* clicking on a menu item)
|
||||
*/
|
||||
void SetLanguageIdentifier( int menu_id );
|
||||
|
||||
void SetLanguagePath( void );
|
||||
|
||||
/**
|
||||
* Function InitOnLineHelp
|
||||
* initializes Kicad's online help.
|
||||
*/
|
||||
void InitOnLineHelp();
|
||||
|
||||
/**
|
||||
* Function GetSettings
|
||||
* Get application settings
|
||||
* @param aReopenLastUsedDirectory = true to switch to last opened
|
||||
* directory, false to use current CWD
|
||||
* @return none
|
||||
* gets the application settings.
|
||||
* @param aReopenLastUsedDirectory True to switch to last opened directory, false
|
||||
* to use current CWD
|
||||
*/
|
||||
void GetSettings( bool aReopenLastUsedDirectory );
|
||||
|
||||
/**
|
||||
* Function SaveSettings
|
||||
* saves the application settings.
|
||||
*/
|
||||
void SaveSettings();
|
||||
|
||||
void WriteProjectConfig( const wxString& local_config_filename,
|
||||
|
@ -157,7 +191,7 @@ public: WinEDA_App();
|
|||
|
||||
/**
|
||||
* Function ReadCurrentSetupValues
|
||||
* Raed the current setup values previously saved, from m_EDA_Config
|
||||
* Read the current setup values previously saved, from m_EDA_Config
|
||||
* saved parameters are parameters that have the .m_Setup member set to
|
||||
* true
|
||||
* @param aList = array of PARAM_CFG_BASE pointers
|
||||
|
@ -180,10 +214,32 @@ public: WinEDA_App();
|
|||
void ReadPdfBrowserInfos();
|
||||
void WritePdfBrowserInfos();
|
||||
|
||||
/**
|
||||
* Function FindFileInSearchPaths
|
||||
* looks in search paths for \a filename.
|
||||
*/
|
||||
wxString FindFileInSearchPaths( const wxString& filename,
|
||||
const wxArrayString* subdirs = NULL );
|
||||
|
||||
/**
|
||||
* Function GetHelpFile
|
||||
* get the help file path.
|
||||
* <p?
|
||||
* Return the Kicad help file with path. The base paths defined in
|
||||
* m_searchPaths are tested for a valid file. The path returned can
|
||||
* be relative depending on the paths added to m_searchPaths. See the
|
||||
* documentation for wxPathList for more information. If the help file
|
||||
* for the current locale is not found, an attempt to find the English
|
||||
* version of the help file is made.
|
||||
* wxEmptyString is returned if help file not found.
|
||||
* Help file is searched in directories in this order:
|
||||
* help/<canonical name> like help/en_GB
|
||||
* help/<short name> like help/en
|
||||
* help/en
|
||||
* </p>
|
||||
*/
|
||||
wxString GetHelpFile( void );
|
||||
|
||||
wxString GetLibraryFile( const wxString& filename );
|
||||
wxString& GetEditorName();
|
||||
|
||||
|
@ -193,7 +249,8 @@ public: WinEDA_App();
|
|||
wxPathList& GetLibraryPathList() { return m_libSearchPaths; }
|
||||
wxString FindLibraryPath( const wxString& fileName );
|
||||
|
||||
/** FindLibraryPath
|
||||
/**
|
||||
* Function FindLibraryPath
|
||||
* Kicad saves user defined library files that are not in the standard
|
||||
* library search path list with the full file path. Calling the library
|
||||
* search path list with a user library file will fail. This helper method
|
||||
|
@ -207,22 +264,24 @@ public: WinEDA_App();
|
|||
}
|
||||
|
||||
|
||||
/** ReturnLastVisitedLibraryPath
|
||||
* Returns the last visited library directory, or (if void) the first
|
||||
/**
|
||||
* Function ReturnLastVisitedLibraryPath
|
||||
* returns the last visited library directory, or (if void) the first
|
||||
* path in lib path list ( but not the CWD )
|
||||
*
|
||||
* @param aSubPathToSearch = Preferred sub path to search in path list
|
||||
*/
|
||||
wxString ReturnLastVisitedLibraryPath(
|
||||
const wxString& aSubPathToSearch = wxEmptyString );
|
||||
wxString ReturnLastVisitedLibraryPath( const wxString& aSubPathToSearch = wxEmptyString );
|
||||
|
||||
void SaveLastVisitedLibraryPath( const wxString& aPath );
|
||||
|
||||
/** ReturnFilenameWithRelativePathInLibPath
|
||||
/**
|
||||
* Function ReturnFilenameWithRelativePathInLibPath
|
||||
* @return a short filename (with extension) with only a relative path if
|
||||
* this filename can be found in library paths
|
||||
* @param aFullFilename = filename with path and extension.
|
||||
* this filename can be found in library paths
|
||||
* @param aFullFilename The filename with path and extension.
|
||||
*/
|
||||
wxString ReturnFilenameWithRelativePathInLibPath(
|
||||
const wxString& aFullFilename );
|
||||
wxString ReturnFilenameWithRelativePathInLibPath( const wxString& aFullFilename );
|
||||
|
||||
/**
|
||||
* Function RemoveLibraryPath
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "bitmaps.h"
|
||||
|
||||
|
||||
/**
|
||||
* Macro TO_UTF8
|
||||
* converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
|
||||
|
@ -67,7 +70,7 @@ static inline const wxChar* GetChars( const wxString& s )
|
|||
|
||||
#define NEGATE( x ) (x = -x)
|
||||
|
||||
/// # of elements in an arrray
|
||||
/// # of elements in an array
|
||||
#define DIM( x ) unsigned( sizeof(x) / sizeof( (x)[0] ) ) // not size_t
|
||||
|
||||
|
||||
|
@ -85,6 +88,7 @@ static inline const wxChar* GetChars( const wxString& s )
|
|||
Angle += 3600;\
|
||||
while( Angle >= 3600 ) \
|
||||
Angle -= 3600;}
|
||||
|
||||
#define NEGATE_AND_NORMALIZE_ANGLE_POS( Angle ) \
|
||||
{ Angle = -Angle; while( Angle < 0 ) \
|
||||
Angle += 3600;while( Angle >= 3600 ) \
|
||||
|
@ -132,14 +136,15 @@ class BOARD_ITEM;
|
|||
BOOST_TYPEOF_REGISTER_TYPE( BOARD_ITEM* )
|
||||
|
||||
#define EXCHG( a, b ) { BOOST_TYPEOF( a ) __temp__ = (a); \
|
||||
(a) = (b); \
|
||||
(a) = (b); \
|
||||
(b) = __temp__; }
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
/* inline functions to insert menuitems with a icon: */
|
||||
/*****************************************************/
|
||||
static inline void ADD_MENUITEM( wxMenu* menu, int id,
|
||||
static inline void ADD_MENUITEM( wxMenu* menu,
|
||||
int id,
|
||||
const wxString& text,
|
||||
const wxBitmap& icon )
|
||||
{
|
||||
|
@ -147,14 +152,15 @@ static inline void ADD_MENUITEM( wxMenu* menu, int id,
|
|||
|
||||
l_item = new wxMenuItem( menu, id, text );
|
||||
|
||||
#if !defined( __WXMAC__ )
|
||||
#if defined( USE_IMAGES_IN_MENUS )
|
||||
l_item->SetBitmap( icon );
|
||||
#endif /* !defined( __WXMAC__ ) */
|
||||
#endif
|
||||
|
||||
menu->Append( l_item );
|
||||
}
|
||||
|
||||
static inline void ADD_MENUITEM_WITH_HELP( wxMenu* menu, int id,
|
||||
static inline void ADD_MENUITEM_WITH_HELP( wxMenu* menu,
|
||||
int id,
|
||||
const wxString& text,
|
||||
const wxString& help,
|
||||
const wxBitmap& icon )
|
||||
|
@ -163,44 +169,16 @@ static inline void ADD_MENUITEM_WITH_HELP( wxMenu* menu, int id,
|
|||
|
||||
l_item = new wxMenuItem( menu, id, text, help );
|
||||
|
||||
#if !defined( __WXMAC__ )
|
||||
#if defined( USE_IMAGES_IN_MENUS )
|
||||
l_item->SetBitmap( icon );
|
||||
#endif /* !defined( __WXMAC__ ) */
|
||||
#endif
|
||||
|
||||
menu->Append( l_item );
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu,
|
||||
int id, const wxString& text,
|
||||
const wxBitmap& icon )
|
||||
{
|
||||
wxMenuItem* l_item;
|
||||
|
||||
l_item = new wxMenuItem( menu, id, text );
|
||||
l_item->SetSubMenu( submenu );
|
||||
l_item->SetBitmap( icon );
|
||||
menu->Append( l_item );
|
||||
};
|
||||
|
||||
static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
|
||||
wxMenu* submenu,
|
||||
int id,
|
||||
const wxString& text,
|
||||
const wxString& help,
|
||||
const wxBitmap& icon )
|
||||
{
|
||||
wxMenuItem* l_item;
|
||||
|
||||
l_item = new wxMenuItem( menu, id, text, help );
|
||||
l_item->SetSubMenu( submenu );
|
||||
l_item->SetBitmap( icon );
|
||||
menu->Append( l_item );
|
||||
};
|
||||
|
||||
#else
|
||||
static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu,
|
||||
int id,
|
||||
static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu,
|
||||
wxMenu* submenu,
|
||||
int id,
|
||||
const wxString& text,
|
||||
const wxBitmap& icon )
|
||||
{
|
||||
|
@ -209,12 +187,12 @@ static inline void ADD_MENUITEM_WITH_SUBMENU( wxMenu* menu, wxMenu* submenu,
|
|||
l_item = new wxMenuItem( menu, id, text );
|
||||
l_item->SetSubMenu( submenu );
|
||||
|
||||
#if !defined( __WXMAC__ )
|
||||
#if defined( USE_IMAGES_IN_MENUS )
|
||||
l_item->SetBitmap( icon );
|
||||
#endif /* !defined( __WXMAC__ ) */
|
||||
#endif
|
||||
|
||||
menu->Append( l_item );
|
||||
}
|
||||
};
|
||||
|
||||
static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
|
||||
wxMenu* submenu,
|
||||
|
@ -228,24 +206,23 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
|
|||
l_item = new wxMenuItem( menu, id, text, help );
|
||||
l_item->SetSubMenu( submenu );
|
||||
|
||||
#if !defined( __WXMAC__ )
|
||||
#if defined( USE_IMAGES_IN_MENUS )
|
||||
l_item->SetBitmap( icon );
|
||||
#endif /* !defined( __WXMAC__ ) */
|
||||
|
||||
menu->Append( l_item );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
menu->Append( l_item );
|
||||
};
|
||||
|
||||
|
||||
// macro to add a bitmap list to check menus (do not use with normal menus)
|
||||
#ifdef __WINDOWS__
|
||||
# define SETBITMAPS( icon ) item->SetBitmaps( apply_xpm, (icon) )
|
||||
#if defined( USE_IMAGES_IN_MENUS ) && defined( __WINDOWS__ )
|
||||
# define SETBITMAPS( icon ) item->SetBitmaps( KiBitmap( apply_xpm ), (icon) )
|
||||
#else
|
||||
# define SETBITMAPS( icon )
|
||||
#endif
|
||||
|
||||
// macro to add a bitmap menus (do not use with check menus)
|
||||
#ifdef __WXMAC__
|
||||
#if !defined( USE_IMAGES_IN_MENUS ) || defined( __WXMAC__ )
|
||||
# define SET_BITMAP( icon )
|
||||
#else
|
||||
# define SET_BITMAP( icon ) item->SetBitmap( (icon) )
|
||||
|
|
Loading…
Reference in New Issue