Commit c5c98f95 authored by Wayne Stambaugh's avatar Wayne Stambaugh

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