Commit 56059efd authored by charras's avatar charras
Browse files

Netclasses work continued

Fixed problems in libedit and crashes when no component loaded
parent b4fe26a3
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"




#define BUILD_VERSION "(20091001-unstable)"
#define BUILD_VERSION "(20091010-unstable)"




#ifdef HAVE_SVN_VERSION
#ifdef HAVE_SVN_VERSION
+1 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ set(CVPCB_SRCS
    dialog_cvpcb_config_fbp.cpp
    dialog_cvpcb_config_fbp.cpp
    dialog_display_options.cpp
    dialog_display_options.cpp
    displayframe.cpp
    displayframe.cpp
    dummy_functions.cpp
    genequiv.cpp
    genequiv.cpp
    init.cpp
    init.cpp
    listboxes.cpp
    listboxes.cpp
+21 −0
Original line number Original line Diff line number Diff line
/* dummy_functions.cpp
 *
 *  There are functions used in some classes.
 *  they are useful in pcbnew, but have no meaning or are never used
 *  in cvpcb or gerbview.
 *  but they must exist because they appear in some classes, and here, no nothing.
 */
#include "fctsys.h"

#include "common.h"
#include "pcbnew.h"


TRACK* Marque_Une_Piste( BOARD* aPcb,
                         TRACK* aStartSegm,
                         int*   aSegmCount,
                         int*   aTrackLen,
                         bool   aReorder )
{
    return NULL;
}
+24 −12
Original line number Original line Diff line number Diff line
@@ -101,6 +101,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
    case BLOCK_DRAG:        /* Drag */
    case BLOCK_DRAG:        /* Drag */
    case BLOCK_MOVE:        /* Move */
    case BLOCK_MOVE:        /* Move */
    case BLOCK_COPY:        /* Copy */
    case BLOCK_COPY:        /* Copy */
        if ( m_component )
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
                                              m_unit, m_convert,
                                              m_unit, m_convert,
                                              g_EditPinByPinIsOn );
                                              g_EditPinByPinIsOn );
@@ -125,11 +126,13 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
        break;
        break;


    case BLOCK_DELETE:     /* Delete */
    case BLOCK_DELETE:     /* Delete */
        if ( m_component )
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
                                              m_unit, m_convert,
                                              m_unit, m_convert,
                                              g_EditPinByPinIsOn );
                                              g_EditPinByPinIsOn );
        if( ItemCount )
        if( ItemCount )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );
        if ( m_component )
            m_component->DeleteSelectedItems();
            m_component->DeleteSelectedItems();
        break;
        break;


@@ -142,6 +145,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )




    case BLOCK_MIRROR_Y:
    case BLOCK_MIRROR_Y:
        if ( m_component )
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
                                              m_unit, m_convert,
                                              m_unit, m_convert,
                                              g_EditPinByPinIsOn );
                                              g_EditPinByPinIsOn );
@@ -149,6 +153,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );
        pt = GetScreen()->m_BlockLocate.Centre();
        pt = GetScreen()->m_BlockLocate.Centre();
        pt.y *= -1;
        pt.y *= -1;
        if ( m_component )
            m_component->MirrorSelectedItemsH( pt );
            m_component->MirrorSelectedItemsH( pt );
        break;
        break;


@@ -166,6 +171,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
    if( MustDoPlace <= 0 )
    if( MustDoPlace <= 0 )
    {
    {
        if( GetScreen()->m_BlockLocate.m_Command  != BLOCK_SELECT_ITEMS_ONLY )
        if( GetScreen()->m_BlockLocate.m_Command  != BLOCK_SELECT_ITEMS_ONLY )
            if ( m_component )
                m_component->ClearSelectedItems();
                m_component->ClearSelectedItems();


        GetScreen()->m_BlockLocate.m_Flags   = 0;
        GetScreen()->m_BlockLocate.m_Flags   = 0;
@@ -213,18 +219,22 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
    case BLOCK_MOVE:                /* Move */
    case BLOCK_MOVE:                /* Move */
    case BLOCK_PRESELECT_MOVE:      /* Move with preselection list*/
    case BLOCK_PRESELECT_MOVE:      /* Move with preselection list*/
        GetScreen()->m_BlockLocate.ClearItemsList();
        GetScreen()->m_BlockLocate.ClearItemsList();
        if ( m_component )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );
        pt = GetScreen()->m_BlockLocate.m_MoveVector;
        pt = GetScreen()->m_BlockLocate.m_MoveVector;
        pt.y *= -1;
        pt.y *= -1;
        if ( m_component )
            m_component->MoveSelectedItems( pt );
            m_component->MoveSelectedItems( pt );
        DrawPanel->Refresh( TRUE );
        DrawPanel->Refresh( TRUE );
        break;
        break;


    case BLOCK_COPY:     /* Copy */
    case BLOCK_COPY:     /* Copy */
        GetScreen()->m_BlockLocate.ClearItemsList();
        GetScreen()->m_BlockLocate.ClearItemsList();
        if ( m_component )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );
        pt = GetScreen()->m_BlockLocate.m_MoveVector;
        pt = GetScreen()->m_BlockLocate.m_MoveVector;
        pt.y *= -1;
        pt.y *= -1;
        if ( m_component )
            m_component->CopySelectedItems( pt );
            m_component->CopySelectedItems( pt );
        break;
        break;


@@ -233,9 +243,11 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
        break;
        break;


    case BLOCK_MIRROR_Y:      /* Invert by popup menu, from block move */
    case BLOCK_MIRROR_Y:      /* Invert by popup menu, from block move */
        if ( m_component )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );
        pt = GetScreen()->m_BlockLocate.Centre();
        pt = GetScreen()->m_BlockLocate.Centre();
        pt.y *= -1;
        pt.y *= -1;
        if ( m_component )
            m_component->MirrorSelectedItemsH( pt );
            m_component->MirrorSelectedItemsH( pt );
        break;
        break;


+7 −6
Original line number Original line Diff line number Diff line
@@ -599,8 +599,8 @@ bool LIB_COMPONENT::Load( FILE* file, char* line, int* lineNum,
        return false;
        return false;
    }
    }


    m_DrawPinNum  = (drawnum == 'N') ? FALSE : TRUE;
    m_DrawPinNum  = (drawnum == 'N') ? FALSE : true;
    m_DrawPinName = (drawname == 'N') ? FALSE : TRUE;
    m_DrawPinName = (drawname == 'N') ? FALSE : true;


    /* Copy part name and prefix. */
    /* Copy part name and prefix. */
    strupper( name );
    strupper( name );
@@ -622,7 +622,7 @@ bool LIB_COMPONENT::Load( FILE* file, char* line, int* lineNum,


    // Copy optional infos
    // Copy optional infos
    if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'L' )
    if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'L' )
        m_UnitSelectionLocked = TRUE;
        m_UnitSelectionLocked = true;
    if( ( p = strtok( NULL, " \t\n" ) ) != NULL  && *p == 'P' )
    if( ( p = strtok( NULL, " \t\n" ) ) != NULL  && *p == 'P' )
        m_Options = ENTRY_POWER;
        m_Options = ENTRY_POWER;


@@ -862,10 +862,10 @@ void LIB_COMPONENT::SetFields( const std::vector <LIB_FIELD> aFields )
    {
    {
        bool create = FALSE;
        bool create = FALSE;
        if( !aFields[ii].m_Text.IsEmpty() )
        if( !aFields[ii].m_Text.IsEmpty() )
            create = TRUE;
            create = true;
        if( !aFields[ii].m_Name.IsEmpty()
        if( !aFields[ii].m_Name.IsEmpty()
            && ( aFields[ii].m_Name != ReturnDefaultFieldName( ii ) ) )
            && ( aFields[ii].m_Name != ReturnDefaultFieldName( ii ) ) )
            create = TRUE;
            create = true;
        if( create )
        if( create )
        {
        {
            LIB_FIELD*Field = new LIB_FIELD( this, ii );
            LIB_FIELD*Field = new LIB_FIELD( this, ii );
@@ -1302,7 +1302,7 @@ void LIB_COMPONENT::SetConversion( bool asConvert )
{
{
    if( asConvert == HasConversion() )
    if( asConvert == HasConversion() )
        return;
        return;

    // Duplicate items to create the converted shape
    if( asConvert )
    if( asConvert )
    {
    {


@@ -1321,6 +1321,7 @@ void LIB_COMPONENT::SetConversion( bool asConvert )
    }
    }
    else
    else
    {
    {
        // Delete converted shape items becuase the converted shape does not exist
        LIB_DRAW_ITEM_LIST::iterator i = m_Drawings.begin();
        LIB_DRAW_ITEM_LIST::iterator i = m_Drawings.begin();


        while( i != m_Drawings.end() )
        while( i != m_Drawings.end() )
Loading