Eeschema: extend max number of units per package to 52 and clean code to easily extend this value upto 26x26 (but 52 is a reasonable max value).
Fix a few minor coverity warnings. Add about_dialog typo fix from Nick Østergaard
This commit is contained in:
parent
886a8521a4
commit
17297babe7
|
@ -233,7 +233,7 @@ int ParseVertexList( FILE* File, std::vector<glm::vec3>& 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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 ) ) );
|
||||
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <general.h>
|
||||
#include <libeditframe.h>
|
||||
#include <class_library.h>
|
||||
#include <eeschema_id.h> // for ID_POPUP_SCH_SELECT_UNIT_CMP_MAX and ID_POPUP_SCH_SELECT_UNIT1
|
||||
|
||||
#include <dialog_edit_component_in_lib.h>
|
||||
|
||||
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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; i<m_FieldsBuf.size(); ++i )
|
||||
{
|
||||
|
@ -973,7 +973,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
|||
unitChoice->SetSelection( 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 );
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() )
|
||||
{
|
||||
|
|
|
@ -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" ) );
|
||||
|
|
Loading…
Reference in New Issue