diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp index eabe08217b..6d2048989c 100644 --- a/common/draw_panel.cpp +++ b/common/draw_panel.cpp @@ -980,12 +980,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) else if( wheelRotation > 0 ) { if( event.ShiftDown() && !event.ControlDown() ) - { - if( axis == 0 ) - cmd.SetId( ID_PAN_UP ); - else - cmd.SetId( ID_PAN_RIGHT ); - } + cmd.SetId( ID_PAN_UP ); else if( event.ControlDown() && !event.ShiftDown() ) cmd.SetId( ID_PAN_LEFT ); else if( offCenterReq ) @@ -996,12 +991,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) else if( wheelRotation < 0 ) { if( event.ShiftDown() && !event.ControlDown() ) - { - if( axis == 0 ) - cmd.SetId( ID_PAN_DOWN ); - else - cmd.SetId( ID_PAN_LEFT ); - } + cmd.SetId( ID_PAN_DOWN ); else if( event.ControlDown() && !event.ShiftDown() ) cmd.SetId( ID_PAN_RIGHT ); else if( offCenterReq ) diff --git a/common/geometry/shape_collisions.cpp b/common/geometry/shape_collisions.cpp index bb4f330a1d..773dcc9a2d 100644 --- a/common/geometry/shape_collisions.cpp +++ b/common/geometry/shape_collisions.cpp @@ -121,14 +121,26 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_CIRCLE& aB, int aC static VECTOR2I pushoutForce( const SHAPE_CIRCLE& aA, const SEG& aB, int aClearance ) { - VECTOR2I nearest = aB.NearestPoint( aA.GetCenter() ); - VECTOR2I f (0, 0); + VECTOR2I f( 0, 0 ); - int dist = ( nearest - aA.GetCenter() ).EuclideanNorm(); - int min_dist = aClearance + aA.GetRadius(); + const VECTOR2I c = aA.GetCenter(); + const VECTOR2I nearest = aB.NearestPoint( c ); + + const int r = aA.GetRadius(); + + int dist = ( nearest - c ).EuclideanNorm(); + int min_dist = aClearance + r; if( dist < min_dist ) - f = ( aA.GetCenter() - nearest ).Resize ( min_dist - dist + 10 ); + { + for( int corr = 0; corr < 5; corr++ ) + { + f = ( aA.GetCenter() - nearest ).Resize( min_dist - dist + corr ); + + if( aB.Distance( c + f ) >= min_dist ) + break; + } + } return f; } diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index fe6890ef8c..bbab313107 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -488,10 +488,13 @@ bool PGM_BASE::initPgm() ReadPdfBrowserInfos(); // needs m_common_settings - loadCommonSettings(); - + // Init user language *before* calling loadCommonSettings, because + // env vars could be incorrectly initialized on Linux + // (if the value contains some non ASCII7 chars, the env var is not initialized) SetLanguage( true ); + loadCommonSettings(); + // Set locale option for separator used in float numbers SetLocaleTo_Default(); @@ -553,23 +556,8 @@ void PGM_BASE::loadCommonSettings() m_help_size.x = 500; m_help_size.y = 400; - wxString languageSel; - - m_common_settings->Read( languageCfgKey, &languageSel ); - setLanguageId( wxLANGUAGE_DEFAULT ); - m_common_settings->Read( showEnvVarWarningDialog, &m_show_env_var_dialog ); - // Search for the current selection - for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ ) - { - if( s_Languages[ii].m_Lang_Label == languageSel ) - { - setLanguageId( s_Languages[ii].m_WX_Lang_Identifier ); - break; - } - } - m_editor_name = m_common_settings->Read( wxT( "Editor" ) ); wxString entry, oldPath; @@ -629,6 +617,26 @@ bool PGM_BASE::SetLanguage( bool first_time ) { bool retv = true; + if( first_time ) + { + setLanguageId( wxLANGUAGE_DEFAULT ); + // First time SetLanguage is called, the user selected language id is set + // from commun user config settings + wxString languageSel; + + m_common_settings->Read( languageCfgKey, &languageSel ); + + // Search for the current selection + for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ ) + { + if( s_Languages[ii].m_Lang_Label == languageSel ) + { + setLanguageId( s_Languages[ii].m_WX_Lang_Identifier ); + break; + } + } + } + // dictionary file name without extend (full name is kicad.mo) wxString dictionaryName( wxT( "kicad" ) ); @@ -652,12 +660,15 @@ bool PGM_BASE::SetLanguage( bool first_time ) GetChars( dictionaryName ), GetChars( m_locale->GetName() ) ); } - // how about a meaningful comment here. if( !first_time ) { + // If we are here, the user has selected an other language. + // Therefore the new prefered language name is stored in common config. + // Do NOT store the wxWidgets language Id, it can change between wxWidgets + // versions, for a given language wxString languageSel; - // Search for the current selection + // Search for the current selection language name for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ ) { if( s_Languages[ii].m_WX_Lang_Identifier == m_language_id ) @@ -670,7 +681,7 @@ bool PGM_BASE::SetLanguage( bool first_time ) m_common_settings->Write( languageCfgKey, languageSel ); } - // Test if floating point notation is working (bug in cross compilation, using wine) + // Test if floating point notation is working (bug encountered in cross compilation) // Make a conversion double <=> string double dtst = 0.5; wxString msg; diff --git a/gerbview/class_X2_gerber_attributes.cpp b/gerbview/class_X2_gerber_attributes.cpp index 52d59b19e8..0e08195ddd 100644 --- a/gerbview/class_X2_gerber_attributes.cpp +++ b/gerbview/class_X2_gerber_attributes.cpp @@ -35,7 +35,7 @@ * %TF.FileFunction,Copper,L1,Top*% * * Currently: - * .FileFunction .FileFunction Identifies the files function in the PCB. + * .FileFunction .FileFunction Identifies the file's function in the PCB. * Other Standard Attributes, not yet used in Gerbview: * .Part Identifies the part the file represents, e.g. a single PCB * .MD5 Sets the MD5 file signature or checksum. @@ -46,8 +46,8 @@ /* * class X2_ATTRIBUTE - * The attribute value consists of a number of substrings separated by a , -*/ + * The attribute value consists of a number of substrings separated by a "," + */ X2_ATTRIBUTE::X2_ATTRIBUTE() { @@ -162,8 +162,8 @@ bool X2_ATTRIBUTE::ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, ch * Corresponding position substring: * Copper layer: L1, L2, L3...to indicate the layer position followed by Top, Inr or * Bot. L1 is always the top copper layer. E.g. L2,Inr. - * Extra layer, e.g. solder mask: Top or Bot defines the attachment of the layer. - * Drill/rout layer: E.g. 1,4 where 1 is the start and 4 is the end copper layer. The + * Extra layer, e.g. solder mask: Top or Bot - defines the attachment of the layer. + * Drill/rout layer: E.g. 1,4 - where 1 is the start and 4 is the end copper layer. The * pair 1,4 defines the span of the drill/rout file * Optional index. This can be used in instances where for example there are two solder * masks on the same side. The index counts from the PCB surface outwards. diff --git a/gerbview/class_X2_gerber_attributes.h b/gerbview/class_X2_gerber_attributes.h index cdd68b558f..fe77535b27 100644 --- a/gerbview/class_X2_gerber_attributes.h +++ b/gerbview/class_X2_gerber_attributes.h @@ -38,7 +38,7 @@ * %TF.FileFunction,Copper,L1,Top*% * * Currently: - * .FileFunction .FileFunction Identifies the files function in the PCB. + * .FileFunction .FileFunction Identifies the file's function in the PCB. * Other Standard Attributes, not yet used in Gerbview: * .Part Identifies the part the file represents, e.g. a single PCB * .MD5 Sets the MD5 file signature or checksum. @@ -48,7 +48,7 @@ /** * class X2_ATTRIBUTE - * The attribute value consists of a number of substrings separated by a , + * The attribute value consists of a number of substrings separated by a "," */ class X2_ATTRIBUTE @@ -138,8 +138,8 @@ public: * Corresponding position substring: * Copper layer: L1, L2, L3...to indicate the layer position followed by Top, Inr or * Bot. L1 is always the top copper layer. E.g. L2,Inr. - * Extra layer, e.g. solder mask: Top or Bot defines the attachment of the layer. - * Drill/rout layer: E.g. 1,4 where 1 is the start and 4 is the end copper layer. The + * Extra layer, e.g. solder mask: Top or Bot - defines the attachment of the layer. + * Drill/rout layer: E.g. 1,4 - where 1 is the start and 4 is the end copper layer. The * pair 1,4 defines the span of the drill/rout file * Optional index. This can be used in instances where for example there are two solder * masks on the same side. The index counts from the PCB surface outwards. diff --git a/include/HersheyCyrillic.h.unused b/include/HersheyCyrillic.h.unused deleted file mode 100644 index 18b17005a8..0000000000 --- a/include/HersheyCyrillic.h.unused +++ /dev/null @@ -1,70 +0,0 @@ -/* Hershey Cyrillic definition - * First shape has unicode value 0x410 -*/ -const static char* hershey_cyrillic[] = -{ - "H\\RFK[ RRFY[ RRIX[ RMUVU RI[O[ RU[[[", - "G]LFL[ RMFM[ RIFYFYLXF RMPUPXQYRZTZWYYXZU[I[ RUPWQXRYTYWXYWZU[", - "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MM[ RWMW[ RXMX[ RIMPM RTM[M RMTWT RI[P[ RT[[[", - "H\\QMNNLPKSKULXNZQ[S[VZXXYUYSXPVNSMQM RQMONMPLSLUMXOZQ[ RS[UZWXXUXSWPUNSM", - "G]LML[ RMMM[ RWMW[ RXMX[ RIM[M RI[P[ RT[[[", - "G\\LMLb RMMMb RMPONQMSMVNXPYSYUXXVZS[Q[OZMX RSMUNWPXSXUWXUZS[ RIMMM RIbPb", - "H[WPVQWRXQXPVNTMQMNNLPKSKULXNZQ[S[VZXX RQMONMPLSLUMXOZQ[", - "I\\RMR[ RSMS[ RMMLRLMYMYRXM RO[V[", - "I[LMR[ RMMRY RXMR[P_NaLbKbJaK`La RJMPM RTMZM", - "H]RFRb RSFSb ROFSF RRPQNPMNMLNKQKWLZN[P[QZRX RNMMNLQLWMZN[ RWMXNYQYWXZW[ RSPTNUMWMYNZQZWYZW[U[TZSX RObVb", - "H\\LMW[ RMMX[ RXML[ RJMPM RTMZM RJ[P[ RT[Z[", - "G]LML[ RMMM[ RWMW[ RXMX[ RIMPM RTM[M RI[[[[`Z[", - "G]LMLTMVPWRWUVWT RMMMTNVPW RWMW[ RXMX[ RIMPM RTM[M RT[[[", - "CbHMH[ RIMI[ RRMR[ RSMS[ R\\M\\[ R]M][ REMLM ROMVM RYM`M RE[`[", - "CbHMH[ RIMI[ RRMR[ RSMS[ R\\M\\[ R]M][ REMLM ROMVM RYM`M RE[`[``_[", - "H]QMQ[ RRMR[ RLMKRKMUM RRTVTYUZWZXYZV[N[ RVTXUYWYXXZV[", /* ъ */ - "E_JMJ[ RKMK[ RGMNM RKTOTRUSWSXRZO[G[ ROTQURWRXQZO[ RYMY[ RZMZ[ RVM]M RV[][", /* ы */ - "J[OMO[ RPMP[ RLMSM RPTTTWUXWXXWZT[L[ RTTVUWWWXVZT[", /* ь */ - "H]LIKFKLLINGQFSFVGXIYKZNZSYVXXVZS[P[MZLYKWKVLUMVLW RSFUGWIXKYNYSXVWXUZS[ RPPYP", /* э */ - "DaIMI[ RJMJ[ RFMMM RF[M[ RVMSNQPPSPUQXSZV[X[[Z]X^U^S]P[NXMVM RVMTNRPQSQURXTZV[ RX[ZZ\\X]U]S\\PZNXM RJTPT", /* ю */ - "G\\VMV[ RWMW[ RZMOMLNKPKQLSOTVT ROMMNLPLQMSOT RTTQUPVNZM[ RTTRUQVOZN[L[KZJX RS[Z[" /* я */ -}; diff --git a/include/geometry/shape_circle.h b/include/geometry/shape_circle.h index 700f61d860..a915ef97ce 100644 --- a/include/geometry/shape_circle.h +++ b/include/geometry/shape_circle.h @@ -63,7 +63,7 @@ public: { int rc = aClearance + m_radius; - return aSeg.Distance( m_center ) <= rc; + return aSeg.Distance( m_center ) < rc; } void SetRadius( int aRadius ) diff --git a/include/geometry/shape_segment.h b/include/geometry/shape_segment.h index 217368e72f..71ed5b17c4 100644 --- a/include/geometry/shape_segment.h +++ b/include/geometry/shape_segment.h @@ -59,7 +59,7 @@ public: bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const { - return m_seg.Distance( aP ) <= ( m_width + 1 ) / 2 + aClearance; + return m_seg.Distance( aP ) < ( m_width + 1 ) / 2 + aClearance; } void SetSeg( const SEG& aSeg ) diff --git a/include/import_export.h b/include/import_export.h index c31729eb30..672709f470 100644 --- a/include/import_export.h +++ b/include/import_export.h @@ -28,7 +28,7 @@ /// Macros which export functions from a DLL/DSO. /// See: http://gcc.gnu.org/wiki/Visibility -#if defined(__MINGW32__) +#if defined(_WIN32) #define APIEXPORT __declspec(dllexport) #define APIIMPORT __declspec(dllimport) #define APILOCAL diff --git a/include/kiway.h b/include/kiway.h index 406ab91f79..347c0bb92e 100644 --- a/include/kiway.h +++ b/include/kiway.h @@ -118,8 +118,10 @@ as such! As such, it is OK to use UTF8 characters: #define LIB_ENV_VAR wxT( "LD_LIBRARY_PATH" ) #elif defined(__WXMAC__) #define LIB_ENV_VAR wxT( "DYLD_LIBRARY_PATH" ) -#elif defined(__MINGW32__) +#elif defined(_WIN32) #define LIB_ENV_VAR wxT( "PATH" ) +#else + #error Platform support missing #endif