Commit fa470d5c authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: Added: modview. This footprint viewer frame which has the same purpose...

Pcbnew: Added: modview. This footprint viewer frame which has the same purpose as Viewlib in Eeschema.
this viewer is built using the new  FOOTPRINT_VIEWER_FRAME class.
parent 54e221cf
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -72,11 +72,11 @@ END_EVENT_TABLE()
/* DISPLAY_FOOTPRINTS_FRAME: the frame to display the current focused footprint */
/***************************************************************************/

DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent,
                                                    const wxString& title,
                                                    const wxPoint& pos,
                                                    const wxSize& size, long style ) :
    PCB_BASE_FRAME( father, CVPCB_DISPLAY_FRAME, title, pos, size, style )
    PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME, title, pos, size, style )
{
    m_FrameName = wxT( "CmpFrame" );
    m_showAxis = true;         // true to draw axis.
@@ -146,7 +146,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
{
    delete GetScreen();
    SetScreen( NULL );
    SetScreen( NULL );      // Be sure there is no double deletion

    ( (CVPCB_MAINFRAME*) wxGetApp().GetTopWindow() )->m_DisplayFootprintFrame = NULL;
}
+9 −5
Original line number Diff line number Diff line
@@ -434,7 +434,7 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
    // ( i.e. for labels that are not prefixed by a sheetpath)
    #define NET_PRIO_MAX 4

    int priority_order[NET_PRIO_MAX+1] = {
    static int priority_order[NET_PRIO_MAX+1] = {
        NET_ITEM_UNSPECIFIED,
        NET_LABEL,
        NET_HIERLABEL,
@@ -462,15 +462,14 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
        // Calculate candidate priority
        int candidate_priority = 0;

        for( unsigned ii = 0; ii <= NET_PRIO_MAX; ii++ )
        for( unsigned prio = 0; prio <= NET_PRIO_MAX; prio++ )
        {
            if ( candidate->m_Type == priority_order[ii]  )
            if ( candidate->m_Type == priority_order[prio]  )
            {
                candidate_priority = ii;
                candidate_priority = prio;
                break;
            }
        }

        if( candidate_priority > item_priority )
        {
            item = candidate;
@@ -504,6 +503,11 @@ static NETLIST_OBJECT* FindBestNetName( NETLIST_OBJECT_LIST& aLabelItemBuffer )
                    // alphabetic label name order:
                    if( candidate->m_Label.Cmp( item->m_Label ) < 0 )
                        item = candidate;
                    else if( candidate->m_Label.Cmp( item->m_Label ) == 0 )
                    {
                        if( candidate->m_SheetList.PathHumanReadable().Cmp( item->m_SheetList.PathHumanReadable() ) < 0 )
                            item = candidate;
                    }
                }
            }
        }
+32 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@

/* Forward declarations of classes. */
class FOOTPRINT_EDIT_FRAME;
class FOOTPRINT_VIEWER_FRAME;
class BOARD;
class BOARD_CONNECTED_ITEM;
class MODULE;
@@ -81,6 +82,8 @@ public:

    EDA_3D_FRAME* m_Draw3DFrame;
    FOOTPRINT_EDIT_FRAME* m_ModuleEditFrame;
    FOOTPRINT_VIEWER_FRAME * m_ModuleViewerFrame;


protected:
    BOARD*              m_Pcb;
@@ -393,7 +396,35 @@ public:
                                        const wxString& aMask,
                                        const wxString& aKeyWord );

    MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
    /**
     * Function Load_Module_From_Library
     * Open a dialog to select a footprint, and load in in current board
     * @param aLibrary = the library name to use, or empty string to search
     * in all loaded libraries
     * @param aUseFootprintViewer = true to show the option
     * allowing the footprint selection by the footprint viewer
     * @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
     */
    MODULE* Load_Module_From_Library( const wxString& aLibrary,
                                      bool aUseFootprintViewer = true,
                                      wxDC* aDC = NULL );

    /**
     * SelectFootprintFromLibBrowser
     * Launch the footprint viewer to select the name of a footprint to load.
     * @return the selected footprint name
     */
    wxString SelectFootprintFromLibBrowser( void );

    /**
     * Function GetActiveViewerFrame
     * @return a reference to the current Module Viewer Frame if exists
     * if called from the PCB editor, this is the m_ModuleViewerFrame
     * or m_ModuleEditFrame->m_ModuleViewerFrame
     * if called from the module editor, this is the m_ModuleViewerFrame
     * or parent->m_ModuleViewerFrame
     */
    FOOTPRINT_VIEWER_FRAME * GetActiveViewerFrame();

    //  ratsnest functions
    /**
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ enum id_drawframe {
    VIEWER_FRAME,
    PCB_FRAME,
    MODULE_EDITOR_FRAME,
    MODULE_VIEWER_FRAME,
    CVPCB_FRAME,
    CVPCB_DISPLAY_FRAME,
    GERBER_FRAME,
+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ set(PCBNEW_DIALOGS
    )

set(PCBNEW_SRCS
    tool_modview.cpp
    modview.cpp
    modview_frame.cpp
    pcbframe.cpp
    attribut.cpp
    automove.cpp
Loading