diff --git a/3d-viewer/vrml_aux.cpp b/3d-viewer/vrml_aux.cpp index ace9a5cffe..5eb680c0bc 100644 --- a/3d-viewer/vrml_aux.cpp +++ b/3d-viewer/vrml_aux.cpp @@ -233,7 +233,7 @@ int ParseVertexList( FILE* File, std::vector& dst_vector ) } -int ParseVertex( FILE* File, glm::vec3& dst_vertex ) +bool ParseVertex( FILE* File, glm::vec3& dst_vertex ) { float a, b, c; int ret = fscanf( File, "%e %e %e", &a, &b, &c ); @@ -252,7 +252,7 @@ int ParseVertex( FILE* File, glm::vec3& dst_vertex ) // DBG( printf( "ret%d(%.9f,%.9f,%.9f)", ret, a,b,c) ); - return ret; + return ret == 3; } diff --git a/3d-viewer/vrml_aux.h b/3d-viewer/vrml_aux.h index 3ab388063d..2350a44e17 100644 --- a/3d-viewer/vrml_aux.h +++ b/3d-viewer/vrml_aux.h @@ -75,9 +75,9 @@ int ParseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector); * parse a vertex * @param File file to read from * @param dst_vertex destination vector - * @return int - return the number of elements readed + * @return bool - return true if the 3 elements are read */ -int ParseVertex( FILE* File, glm::vec3 &dst_vertex ); +bool ParseVertex( FILE* File, glm::vec3 &dst_vertex ); /** diff --git a/common/dialog_about/AboutDialog_main.cpp b/common/dialog_about/AboutDialog_main.cpp index bb30a8db64..f22ad748da 100644 --- a/common/dialog_about/AboutDialog_main.cpp +++ b/common/dialog_about/AboutDialog_main.cpp @@ -275,7 +275,7 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) info.AddDeveloper( new Contributor( wxT( "Andrew Zonenberg" ), wxT( "azonenberg@drawersteak.com" ) ) ); info.AddDeveloper( - new Contributor( wxT( "Nick Østergaard" ), wxT( "toe.nick@gmail.com" ) ) ); + new Contributor( wxT( "Nick Østergaard" ), wxT( "oe.nick@gmail.com" ) ) ); // The document writers info.AddDocWriter( @@ -299,6 +299,8 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) new Contributor( wxT( "Jean-Pierre Charras" ), wxT( "jp.charras@wanadoo.fr" ), wxT( "French (FR)" ), KiBitmapNew( lang_fr_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Mateusz Skowroński" ), wxT( "skowri@gmail.com" ), wxT( "Polish (PL)" ), KiBitmapNew( lang_pl_xpm ) ) ); + info.AddTranslator( + new Contributor( wxT( "Kerusey Karyu" ), wxT( "keruseykaryu@o2.pl" ), wxT( "Polish (PL)" ), KiBitmapNew( lang_pl_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Renie Marquet" ), wxT( "reniemarquet@uol.com.br" ), wxT( "Portuguese (PT)" ), KiBitmapNew( lang_pt_xpm ) ) ); info.AddTranslator( @@ -318,6 +320,8 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) wxT( "milonas.ko@gmail.com" ), wxT( "Greek (el_GR)" ), KiBitmapNew( lang_gr_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Massimo Cioce" ), wxT( "ciocemax@alice.it" ), wxT( "Italian (IT)" ), KiBitmapNew( lang_it_xpm ) ) ); + info.AddTranslator( + new Contributor( wxT( "Marco Ciampa" ), wxT( "ciampix@libero.it" ), wxT( "Italian (IT)" ), KiBitmapNew( lang_it_xpm ) ) ); info.AddTranslator( new Contributor( wxT( "Evgeniy Ivanov" ), wxT( "evgeniy_p_ivanov@yahoo.ca" ), wxT( "Bulgarian (BG)" ),KiBitmapNew( lang_bg_xpm ) ) ); diff --git a/common/ptree.cpp b/common/ptree.cpp index 1d2e958e02..bac47eeac1 100644 --- a/common/ptree.cpp +++ b/common/ptree.cpp @@ -152,14 +152,6 @@ static void formatList( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& int ctl = 0; -#if defined(DEBUG) - if( it->first == "field" ) - { - int breakhere = 1; - (void) breakhere; - } -#endif - if( isLast( aTree, it ) ) // is "it" the last one? { //if( !( aCtl & CTL_IN_ATTRS ) ) @@ -205,8 +197,7 @@ static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, else // is an atom, not a list { - const char* atom = out->Quotes( aKey ).c_str(); - out->Print( 0, " %s", atom ); + out->Print( 0, " %s", out->Quotes( aKey ).c_str() ); } } diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 9ffe3f3e83..3c4d5da3e5 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -279,7 +279,22 @@ wxString LIB_PART::SubReference( int aUnit, bool aAddSeparator ) if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' ) subRef << aUnit; else - subRef << wxChar( m_subpartFirstId + aUnit - 1); + { + // use letters as notation. To allow more than 26 units, the sub ref + // use one letter if letter = A .. Z or a ... z, and 2 letters otherwise + // first letter is expected to be 'A' or 'a' (i.e. 26 letters are available) + int u; + + while( aUnit > 26 ) // more than one letter are needed + { + u = aUnit / 26; + subRef << wxChar( m_subpartFirstId + u -1 ); + aUnit %= 26; + } + + u = m_subpartFirstId + aUnit - 1; + subRef << wxChar( u ); + } return subRef; } diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index 2b85ddf8be..63ced982f4 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -35,6 +35,7 @@ #include #include #include +#include // for ID_POPUP_SCH_SELECT_UNIT_CMP_MAX and ID_POPUP_SCH_SELECT_UNIT1 #include @@ -157,6 +158,13 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel() if( m_Parent->GetShowDeMorgan() ) m_AsConvertButt->SetValue( true ); + int maxUnits = ID_POPUP_SCH_SELECT_UNIT_CMP_MAX - ID_POPUP_SCH_SELECT_UNIT1; + m_SelNumberOfUnits->SetRange (1, maxUnits ); + + m_staticTextNbUnits->SetLabel( wxString::Format( + _( "Number of Units (max allowed %d)" ), maxUnits ) ); + + /* Default values for a new component. */ if( component == NULL ) { diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 3fd44f6028..b22c426880 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -56,7 +56,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM { public: /** Constructor */ - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent ); + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* aParent ); /** * Function InitBuffers @@ -69,7 +69,7 @@ private: friend class SCH_EDIT_FRAME; - SCH_EDIT_FRAME* m_Parent; + SCH_EDIT_FRAME* m_parent; SCH_COMPONENT* m_cmp; LIB_PART* m_part; bool m_skipCopyFromPanel; @@ -165,10 +165,10 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent ) } -DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent ) : - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( parent ) +DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* aParent ) : + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( aParent ) { - m_Parent = (SCH_EDIT_FRAME*) parent; + m_parent = (SCH_EDIT_FRAME*) aParent; m_cmp = NULL; m_part = NULL; @@ -258,7 +258,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSelectChipName( wxCommandEvent& event { wxArrayString dummy; int dummyunit = 1; - wxString chipname = m_Parent->SelectComponentFromLibrary( wxEmptyString, dummy, dummyunit, + wxString chipname = m_parent->SelectComponentFromLibrary( wxEmptyString, dummy, dummyunit, true, NULL, NULL ); if( chipname.IsEmpty() ) return; @@ -336,7 +336,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() { int unit_selection = unitChoice->GetCurrentSelection() + 1; - m_cmp->SetUnitSelection( &m_Parent->GetCurrentSheet(), unit_selection ); + m_cmp->SetUnitSelection( &m_parent->GetCurrentSheet(), unit_selection ); m_cmp->SetUnit( unit_selection ); } @@ -397,8 +397,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event // save old cmp in undo list if not already in edit, or moving ... // or the component to be edited is part of a block if( m_cmp->m_Flags == 0 - || m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK ) - m_Parent->SaveCopyInUndoList( m_cmp, UR_CHANGED ); + || m_parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK ) + m_parent->SaveCopyInUndoList( m_cmp, UR_CHANGED ); copyPanelToOptions(); @@ -412,7 +412,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event // correct the problem before removing the undefined fields. It should also // resolve most of the bug reports and questions regarding missing fields. if( !m_FieldsBuf[i].GetName( false ).IsEmpty() && m_FieldsBuf[i].GetText().IsEmpty() - && !m_Parent->GetTemplates().HasFieldName( m_FieldsBuf[i].GetName( false ) ) + && !m_parent->GetTemplates().HasFieldName( m_FieldsBuf[i].GetName( false ) ) && !removeRemainingFields ) { wxString msg = wxString::Format( @@ -455,11 +455,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event // Reference has a specific initialization, depending on the current active sheet // because for a given component, in a complex hierarchy, there are more than one // reference. - m_cmp->SetRef( &m_Parent->GetCurrentSheet(), m_FieldsBuf[REFERENCE].GetText() ); + m_cmp->SetRef( &m_parent->GetCurrentSheet(), m_FieldsBuf[REFERENCE].GetText() ); - m_Parent->OnModify(); - m_Parent->GetScreen()->TestDanglingEnds(); - m_Parent->GetCanvas()->Refresh( true ); + m_parent->OnModify(); + m_parent->GetScreen()->TestDanglingEnds(); + m_parent->GetCanvas()->Refresh( true ); EndQuasiModal( wxID_OK ); } @@ -664,7 +664,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent // Add template fieldnames: // Now copy in the template fields, in the order that they are present in the // template field editor UI. - const TEMPLATE_FIELDNAMES& tfnames = m_Parent->GetTemplateFieldNames(); + const TEMPLATE_FIELDNAMES& tfnames = m_parent->GetTemplateFieldNames(); for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it ) { @@ -724,7 +724,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent } #endif - m_FieldsBuf[REFERENCE].SetText( m_cmp->GetRef( &m_Parent->GetCurrentSheet() ) ); + m_FieldsBuf[REFERENCE].SetText( m_cmp->GetRef( &m_parent->GetCurrentSheet() ) ); for( unsigned i = 0; iSetSelection( m_cmp->GetUnit() - 1 ); // Disable unit selection if only one unit exists: - if( m_cmp->GetUnit() <= 1 ) + if( m_cmp->GetUnitCount() <= 1 ) { unitChoice->Enable( false ); unitsInterchageableLabel->Show( false ); @@ -1043,10 +1043,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) { // save old cmp in undo list if not already in edit, or moving ... if( m_cmp->m_Flags == 0 ) - m_Parent->SaveCopyInUndoList( m_cmp, UR_CHANGED ); + m_parent->SaveCopyInUndoList( m_cmp, UR_CHANGED ); - INSTALL_UNBUFFERED_DC( dc, m_Parent->GetCanvas() ); - m_cmp->Draw( m_Parent->GetCanvas(), &dc, wxPoint( 0, 0 ), g_XorMode ); + INSTALL_UNBUFFERED_DC( dc, m_parent->GetCanvas() ); + m_cmp->Draw( m_parent->GetCanvas(), &dc, wxPoint( 0, 0 ), g_XorMode ); // Initialize fixed field values to default values found in library // Note: the field texts are not modified because they are set in schematic, @@ -1080,9 +1080,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) m_cmp->SetOrientation( CMP_NORMAL ); - m_Parent->OnModify(); + m_parent->OnModify(); - m_cmp->Draw( m_Parent->GetCanvas(), &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); + m_cmp->Draw( m_parent->GetCanvas(), &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); EndQuasiModal( wxID_OK ); } diff --git a/eeschema/eeschema_id.h b/eeschema/eeschema_id.h index 021e8982eb..e3ab44b628 100644 --- a/eeschema/eeschema_id.h +++ b/eeschema/eeschema_id.h @@ -129,31 +129,8 @@ enum id_eeschema_frm // Unit select context menus command IDs. ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT1, - ID_POPUP_SCH_SELECT_UNIT2, - ID_POPUP_SCH_SELECT_UNIT3, - ID_POPUP_SCH_SELECT_UNIT4, - ID_POPUP_SCH_SELECT_UNIT5, - ID_POPUP_SCH_SELECT_UNIT6, - ID_POPUP_SCH_SELECT_UNIT7, - ID_POPUP_SCH_SELECT_UNIT8, - ID_POPUP_SCH_SELECT_UNIT9, - ID_POPUP_SCH_SELECT_UNIT10, - ID_POPUP_SCH_SELECT_UNIT11, - ID_POPUP_SCH_SELECT_UNIT12, - ID_POPUP_SCH_SELECT_UNIT13, - ID_POPUP_SCH_SELECT_UNIT14, - ID_POPUP_SCH_SELECT_UNIT15, - ID_POPUP_SCH_SELECT_UNIT16, - ID_POPUP_SCH_SELECT_UNIT17, - ID_POPUP_SCH_SELECT_UNIT18, - ID_POPUP_SCH_SELECT_UNIT19, - ID_POPUP_SCH_SELECT_UNIT20, - ID_POPUP_SCH_SELECT_UNIT21, - ID_POPUP_SCH_SELECT_UNIT22, - ID_POPUP_SCH_SELECT_UNIT23, - ID_POPUP_SCH_SELECT_UNIT24, - ID_POPUP_SCH_SELECT_UNIT25, - ID_POPUP_SCH_SELECT_UNIT26, + // ... leave room for 52 IDs , to select one unit among 52 in popup menu + ID_POPUP_SCH_SELECT_UNIT_CMP_MAX = ID_POPUP_SCH_SELECT_UNIT1 + 52, // Change text type context menu command IDs. ID_POPUP_SCH_CHANGE_TYPE_TEXT, diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index b3e53ee625..cf3358c859 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -447,12 +447,17 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_L { wxString num_unit; int unit = Component->GetUnit(); - num_unit.Printf( _( "Unit %c" ), "?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] ); + num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) ); wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii, num_unit, wxEmptyString, wxITEM_CHECK ); if( unit == ii + 1 ) item->Check(true); + + // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX + // See eeschema_id to modify this value. + if( ii >= (ID_POPUP_SCH_SELECT_UNIT_CMP_MAX - ID_POPUP_SCH_SELECT_UNIT1) ) + break; // We have used all IDs for these submenus } AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP, diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index de7c4d1373..0580144d56 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -274,7 +274,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, SCH_EDIT_FRAME::Process_Special_Functions ) - EVT_MENU_RANGE( ID_POPUP_SCH_SELECT_UNIT1, ID_POPUP_SCH_SELECT_UNIT26, + EVT_MENU_RANGE( ID_POPUP_SCH_SELECT_UNIT1, ID_POPUP_SCH_SELECT_UNIT_CMP_MAX, SCH_EDIT_FRAME::OnSelectUnit ) EVT_MENU_RANGE( ID_POPUP_SCH_CHANGE_TYPE_TEXT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, SCH_EDIT_FRAME::OnConvertTextType ) diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 1f17a531b6..37b991490c 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -91,7 +91,8 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); EDA_DRAW_MODE_T fillmode = FILLED; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + DISPLAY_OPTIONS* displ_opts = + panel ? (DISPLAY_OPTIONS*)panel->GetDisplayOptions() : NULL; if( displ_opts && displ_opts->m_DisplayDrawItemsFill == SKETCH ) fillmode = SKETCH; diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index b1bb1b8c13..88d11e4cda 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -126,7 +126,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) if( !item || cursorPos != selectPos ) { m_canvas->SetAbortRequest( false ); - item = PcbGeneralLocateAndDisplay(); + PcbGeneralLocateAndDisplay(); if( m_canvas->GetAbortRequest() ) { diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp index 6ec334b899..cd4ba511a3 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp @@ -430,7 +430,8 @@ void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar, } } - lNode = lNode->GetParent(); + if( lNode ) + lNode = lNode->GetParent(); if( lNode ) lNode = FindNode( lNode, wxT( "layerContents" ) );