~lexaficus/kicad/python-se

« back to all changes in this revision

Viewing changes to eeschema/viewlibs.cpp

  • Committer: Wayne Stambaugh
  • Date: 2010-10-04 18:54:14 UTC
  • Revision ID: stambaughw@verizon.net-20101004185414-z4cjvg0nf29ef62e
Initial work on new component library stucture.

* Use C++ map in component library instead of boost::ptr_vector.
* Drop Boost pointer containers for standard C++ containers.
* Moved duplicate name user interface elements from library object to
  library editor.
* Added code to support direct addition and replacement of component
  alias objects into libraries.
* Removed temporary strings used to add and remove alias objects.
* Libraries only store alias objects, components now accessed thru alias.
* Simplify library API for adding, removing, and replacing components.
* Updated edit component in library dialog and library editor to reflect
  component library object changes.
* Fixed bug in library viewer when displaying alias name.
* Made a few header files compile stand alone per the new coding policy.
* Remove some dead code and the usual code formatting fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
266
266
    if( entry == NULL )
267
267
        return;
268
268
 
 
269
    wxCHECK_RET( entry->isAlias(),
 
270
                 wxT( "Entry \"" ) + entry->GetName() + wxT( "\" found in library <" ) +
 
271
                 lib->GetName() + wxT( "> is not a LIB_ALIAS object." ) );
 
272
 
 
273
    LIB_ALIAS* alias = (LIB_ALIAS*) entry;
 
274
    component = alias->GetComponent();
 
275
 
269
276
    DrawPanel->DrawBackGround( DC );
270
277
 
271
 
    if( entry->isAlias() )
 
278
    if( !alias->IsRoot() )
272
279
    {
273
 
        LIB_ALIAS* alias = (LIB_ALIAS*) entry;
274
 
        component = alias->GetComponent();
275
 
 
276
280
        if( component == NULL )     // Should not occur
277
 
        {
278
 
            wxASSERT( component != NULL );
279
 
            return;
280
 
        }
281
 
        if( ! component->isComponent() )
282
 
        {
283
 
            wxASSERT( component->isComponent() );
284
 
            return;
285
 
        }
 
281
            return;
286
282
 
 
283
        // Temporarily change the name field text to reflect the alias name.
287
284
        msg = alias->GetName();
288
 
 
289
 
        /* Temporarily change the name field text to reflect the alias name. */
290
285
        tmp = component->GetName();
291
 
        component->SetName( alias->GetName() );
 
286
        component->SetName( msg );
 
287
 
292
288
        if( m_unit < 1 )
293
289
            m_unit = 1;
294
290
        if( m_convert < 1 )
295
291
            m_convert = 1;
296
 
        component->SetName( tmp );
297
292
    }
298
293
    else
299
294
    {
300
 
        component = (LIB_COMPONENT*) entry;
301
295
        msg = _( "None" );
302
296
    }
303
297
 
304
 
    component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit, m_convert,
305
 
                     GR_DEFAULT_DRAWMODE );
 
298
    component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE );
306
299
 
307
300
    /* Redraw the cursor */
308
301
    DrawPanel->DrawCursor( DC );