Commit 8dc71896 authored by Dick Hollenbeck's avatar Dick Hollenbeck

Add EDA_APP::setLanguageId() accessor and fix FindwxWidgets.cmake for windows cross on linux.

parent 29446320
...@@ -144,12 +144,10 @@ ...@@ -144,12 +144,10 @@
# Helper macro to control the debugging output globally. There are # Helper macro to control the debugging output globally. There are
# two versions for controlling how verbose your output should be. # two versions for controlling how verbose your output should be.
MACRO(DBG_MSG _MSG) MACRO(DBG_MSG _MSG)
# MESSAGE(STATUS # MESSAGE(WARNING "${_MSG}")
# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
ENDMACRO(DBG_MSG) ENDMACRO(DBG_MSG)
MACRO(DBG_MSG_V _MSG) MACRO(DBG_MSG_V _MSG)
# MESSAGE(STATUS # MESSAGE(WARNING "${_MSG}")
# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
ENDMACRO(DBG_MSG_V) ENDMACRO(DBG_MSG_V)
# Clear return values in case the module is loaded more than once. # Clear return values in case the module is loaded more than once.
...@@ -201,18 +199,24 @@ ENDIF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") ...@@ -201,18 +199,24 @@ ENDIF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
#===================================================================== #=====================================================================
#===================================================================== #=====================================================================
IF(WIN32 AND NOT CYGWIN AND NOT MSYS)
IF(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_HOST_UNIX )
DBG_MSG( "setting win32 style" )
SET(wxWidgets_FIND_STYLE "win32") SET(wxWidgets_FIND_STYLE "win32")
ELSE(WIN32 AND NOT CYGWIN AND NOT MSYS) ELSE()
IF(UNIX OR MSYS) IF(CMAKE_HOST_UNIX OR MSYS)
DBG_MSG( "unix style" )
SET(wxWidgets_FIND_STYLE "unix") SET(wxWidgets_FIND_STYLE "unix")
ENDIF(UNIX OR MSYS) ENDIF()
ENDIF(WIN32 AND NOT CYGWIN AND NOT MSYS) ENDIF()
#===================================================================== #=====================================================================
# WIN32_FIND_STYLE # WIN32_FIND_STYLE
#===================================================================== #=====================================================================
IF(wxWidgets_FIND_STYLE STREQUAL "win32") IF(wxWidgets_FIND_STYLE STREQUAL "win32")
DBG_MSG("Using win32 path")
# Useful common wx libs needed by almost all components. # Useful common wx libs needed by almost all components.
SET(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat) SET(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat)
...@@ -271,9 +275,12 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -271,9 +275,12 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
MARK_AS_ADVANCED(WX_${LIB}${_DBG}) MARK_AS_ADVANCED(WX_${LIB}${_DBG})
ENDFOREACH(LIB) ENDFOREACH(LIB)
DBG_MSG( "WX_LIB_DIR:${WX_LIB_DIR}" )
# Find wxWidgets multilib base libraries. # Find wxWidgets multilib base libraries.
FIND_LIBRARY(WX_base${_DBG} FIND_LIBRARY(WX_base${_DBG}
NAMES NAMES
wxbase31${_UCD}${_DBG}
wxbase30${_UCD}${_DBG} wxbase30${_UCD}${_DBG}
wxbase29${_UCD}${_DBG} wxbase29${_UCD}${_DBG}
wxbase28${_UCD}${_DBG} wxbase28${_UCD}${_DBG}
...@@ -287,6 +294,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -287,6 +294,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
FOREACH(LIB net odbc xml) FOREACH(LIB net odbc xml)
FIND_LIBRARY(WX_${LIB}${_DBG} FIND_LIBRARY(WX_${LIB}${_DBG}
NAMES NAMES
wxbase31${_UCD}${_DBG}_${LIB}
wxbase30${_UCD}${_DBG}_${LIB} wxbase30${_UCD}${_DBG}_${LIB}
wxbase29${_UCD}${_DBG}_${LIB} wxbase29${_UCD}${_DBG}_${LIB}
wxbase28${_UCD}${_DBG}_${LIB} wxbase28${_UCD}${_DBG}_${LIB}
...@@ -302,6 +310,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -302,6 +310,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets monolithic library. # Find wxWidgets monolithic library.
FIND_LIBRARY(WX_mono${_DBG} FIND_LIBRARY(WX_mono${_DBG}
NAMES NAMES
wxmsw${_UNV}31${_UCD}${_DBG}
wxmsw${_UNV}30${_UCD}${_DBG} wxmsw${_UNV}30${_UCD}${_DBG}
wxmsw${_UNV}29${_UCD}${_DBG} wxmsw${_UNV}29${_UCD}${_DBG}
wxmsw${_UNV}28${_UCD}${_DBG} wxmsw${_UNV}28${_UCD}${_DBG}
...@@ -318,6 +327,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -318,6 +327,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
stc ribbon propgrid) stc ribbon propgrid)
FIND_LIBRARY(WX_${LIB}${_DBG} FIND_LIBRARY(WX_${LIB}${_DBG}
NAMES NAMES
wxmsw${_UNV}31${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}30${_UCD}${_DBG}_${LIB} wxmsw${_UNV}30${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}29${_UCD}${_DBG}_${LIB} wxmsw${_UNV}29${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}28${_UCD}${_DBG}_${LIB} wxmsw${_UNV}28${_UCD}${_DBG}_${LIB}
...@@ -432,6 +442,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -432,6 +442,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
D:/ D:/
$ENV{ProgramFiles} $ENV{ProgramFiles}
PATH_SUFFIXES PATH_SUFFIXES
wxWidgets-3.1.0
wxWidgets-3.0.0 wxWidgets-3.0.0
wxWidgets-2.9.5 wxWidgets-2.9.5
wxWidgets-2.9.4 wxWidgets-2.9.4
...@@ -469,6 +480,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -469,6 +480,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
# If wxWidgets_ROOT_DIR changed, clear lib dir. # If wxWidgets_ROOT_DIR changed, clear lib dir.
IF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR) IF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
DBG_MSG( "WX_ROOT_DIR != wxWidgets_ROOT_DIR" )
SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR} SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR}
CACHE INTERNAL "wxWidgets_ROOT_DIR") CACHE INTERNAL "wxWidgets_ROOT_DIR")
SET(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND" SET(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND"
...@@ -476,15 +489,19 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -476,15 +489,19 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
ENDIF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR) ENDIF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
IF(WX_ROOT_DIR) IF(WX_ROOT_DIR)
DBG_MSG( "WX_ROOT_DIR == wxWidgets_ROOT_DIR" )
# Select one default tree inside the already determined wx tree. # Select one default tree inside the already determined wx tree.
# Prefer static/shared order usually consistent with build # Prefer static/shared order usually consistent with build
# settings. # settings.
IF(MINGW) IF(MINGW)
DBG_MSG( "MINGW" )
SET(WX_LIB_DIR_PREFIX gcc) SET(WX_LIB_DIR_PREFIX gcc)
ELSE(MINGW) ELSE(MINGW)
SET(WX_LIB_DIR_PREFIX vc) SET(WX_LIB_DIR_PREFIX vc)
ENDIF(MINGW) ENDIF(MINGW)
IF(BUILD_SHARED_LIBS) IF(BUILD_SHARED_LIBS)
DBG_MSG( "BUILD_SHARED_LIBS" )
FIND_PATH(wxWidgets_LIB_DIR FIND_PATH(wxWidgets_LIB_DIR
NAMES NAMES
msw/wx/setup.h msw/wx/setup.h
...@@ -502,6 +519,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -502,6 +519,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
ELSE(BUILD_SHARED_LIBS) ELSE(BUILD_SHARED_LIBS)
DBG_MSG( "!BUILD_SHARED_LIBS WX_LIB_DIR:${WX_LIB_DIR}" )
FIND_PATH(wxWidgets_LIB_DIR FIND_PATH(wxWidgets_LIB_DIR
NAMES NAMES
msw/wx/setup.h msw/wx/setup.h
...@@ -619,7 +637,11 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ...@@ -619,7 +637,11 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
# UNIX_FIND_STYLE # UNIX_FIND_STYLE
#===================================================================== #=====================================================================
ELSE(wxWidgets_FIND_STYLE STREQUAL "win32") ELSE(wxWidgets_FIND_STYLE STREQUAL "win32")
DBG_MSG("NOT win32 path")
IF(wxWidgets_FIND_STYLE STREQUAL "unix") IF(wxWidgets_FIND_STYLE STREQUAL "unix")
DBG_MSG("unix find style")
#----------------------------------------------------------------- #-----------------------------------------------------------------
# UNIX: Helper MACROS # UNIX: Helper MACROS
#----------------------------------------------------------------- #-----------------------------------------------------------------
......
...@@ -269,7 +269,7 @@ EDA_APP::EDA_APP() ...@@ -269,7 +269,7 @@ EDA_APP::EDA_APP()
m_oneInstancePerFileChecker = NULL; m_oneInstancePerFileChecker = NULL;
m_HtmlCtrl = NULL; m_HtmlCtrl = NULL;
m_settings = NULL; m_settings = NULL;
m_LanguageId = wxLANGUAGE_DEFAULT; setLanguageId( wxLANGUAGE_DEFAULT );
m_Locale = NULL; m_Locale = NULL;
m_projectSettings = NULL; m_projectSettings = NULL;
m_commonSettings = NULL; m_commonSettings = NULL;
...@@ -345,14 +345,15 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId ) ...@@ -345,14 +345,15 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
// Internationalization: loading the kicad suitable Dictionary // Internationalization: loading the kicad suitable Dictionary
wxString languageSel; wxString languageSel;
m_commonSettings->Read( languageCfgKey, &languageSel); m_commonSettings->Read( languageCfgKey, &languageSel);
m_LanguageId = wxLANGUAGE_DEFAULT;
setLanguageId( wxLANGUAGE_DEFAULT );
// Search for the current selection // Search for the current selection
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ ) for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
{ {
if( s_Languages[ii].m_Lang_Label == languageSel ) if( s_Languages[ii].m_Lang_Label == languageSel )
{ {
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier; setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
break; break;
} }
} }
...@@ -620,14 +621,14 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory ) ...@@ -620,14 +621,14 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
wxString languageSel; wxString languageSel;
m_commonSettings->Read( languageCfgKey, &languageSel ); m_commonSettings->Read( languageCfgKey, &languageSel );
m_LanguageId = wxLANGUAGE_DEFAULT; setLanguageId( wxLANGUAGE_DEFAULT );
// Search for the current selection // Search for the current selection
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ ) for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
{ {
if( s_Languages[ii].m_Lang_Label == languageSel ) if( s_Languages[ii].m_Lang_Label == languageSel )
{ {
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier; setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
break; break;
} }
} }
...@@ -699,9 +700,7 @@ bool EDA_APP::SetLanguage( bool first_time ) ...@@ -699,9 +700,7 @@ bool EDA_APP::SetLanguage( bool first_time )
// dictionary file name without extend (full name is kicad.mo) // dictionary file name without extend (full name is kicad.mo)
wxString DictionaryName( wxT( "kicad" ) ); wxString DictionaryName( wxT( "kicad" ) );
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 )
...@@ -712,7 +711,7 @@ bool EDA_APP::SetLanguage( bool first_time ) ...@@ -712,7 +711,7 @@ bool EDA_APP::SetLanguage( bool first_time )
{ {
wxLogDebug( wxT( "This language is not supported by the system." ) ); wxLogDebug( wxT( "This language is not supported by the system." ) );
m_LanguageId = wxLANGUAGE_DEFAULT; setLanguageId( wxLANGUAGE_DEFAULT );
delete m_Locale; delete m_Locale;
m_Locale = new wxLocale; m_Locale = new wxLocale;
...@@ -781,7 +780,7 @@ void EDA_APP::SetLanguageIdentifier( int menu_id ) ...@@ -781,7 +780,7 @@ void EDA_APP::SetLanguageIdentifier( int menu_id )
{ {
if( menu_id == s_Languages[ii].m_KI_Lang_Identifier ) if( menu_id == s_Languages[ii].m_KI_Lang_Identifier )
{ {
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier; setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
break; break;
} }
} }
......
...@@ -93,6 +93,8 @@ protected: ...@@ -93,6 +93,8 @@ protected:
/// The current language setting. /// The current language setting.
int m_LanguageId; int m_LanguageId;
void setLanguageId( int aId ) { m_LanguageId = aId; }
/// The file name of the the program selected for browsing pdf files. /// The file name of the the program selected for browsing pdf files.
wxString m_PdfBrowser; wxString m_PdfBrowser;
wxPathList m_searchPaths; wxPathList m_searchPaths;
...@@ -176,7 +178,7 @@ public: ...@@ -176,7 +178,7 @@ public:
* MacOSX: Needed for file association * MacOSX: Needed for file association
* http://wiki.wxwidgets.org/WxMac-specific_topics * http://wiki.wxwidgets.org/WxMac-specific_topics
*/ */
virtual void MacOpenFile(const wxString &fileName); virtual void MacOpenFile( const wxString& aFileName );
/** /**
* Function InitEDA_Appl * Function InitEDA_Appl
...@@ -445,4 +447,4 @@ public: ...@@ -445,4 +447,4 @@ public:
*/ */
DECLARE_APP( EDA_APP ) DECLARE_APP( EDA_APP )
#endif /* APPL_WXSTRUCT_H */ #endif // APPL_WXSTRUCT_H
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