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

All: better code to handle opened frames libview, libedit, modview, modedit.

Other minor fixes.
parent b810135e
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -55,16 +55,16 @@ const wxChar* traceAutoSave = wxT( "KicadAutoSave" );
static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" );


EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,
                                ID_DRAWFRAME_TYPE idtype,
                                const wxString& title,
                                const wxPoint& pos, const wxSize& size,
                                long style ) :
    wxFrame( father, wxID_ANY, title, pos, size, style )
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent,
                                ID_DRAWFRAME_TYPE aFrameType,
                                const wxString& aTitle,
                                const wxPoint& aPos, const wxSize& aSize,
                                long aStyle, const wxString & aFrameName ) :
    wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName )
{
    wxSize minsize;

    m_Ident = idtype;
    m_Ident = aFrameType;
    m_mainToolBar = NULL;
    m_FrameIsActive = true;
    m_hasAutoSave = false;
@@ -79,7 +79,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,

    SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );

    if( ( size.x < minsize.x ) || ( size.y < minsize.y ) )
    if( ( aSize.x < minsize.x ) || ( aSize.y < minsize.y ) )
        SetSize( 0, 0, minsize.x, minsize.y );

    // Create child subwindows.
+6 −4
Original line number Diff line number Diff line
@@ -84,10 +84,12 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
END_EVENT_TABLE()


EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, ID_DRAWFRAME_TYPE idtype,
                                const wxString& title,
                                const wxPoint& pos, const wxSize& size, long style ) :
    EDA_BASE_FRAME( father, idtype, title, pos, size, style )
EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
                                ID_DRAWFRAME_TYPE aFrameType,
                                const wxString& aTitle,
                                const wxPoint& aPos, const wxSize& aSize,
                                long aStyle, const wxString & aFrameName ) :
    EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
{
    m_drawToolBar         = NULL;
    m_optionsToolBar      = NULL;
+4 −2
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
                   DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode )
END_EVENT_TABLE()

#define DISPLAY_FOOTPRINTS_FRAME_NAME wxT( "CmpFrame" )

/***************************************************************************/
/* DISPLAY_FOOTPRINTS_FRAME: the frame to display the current focused footprint */
@@ -76,9 +77,10 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent,
                                                    const wxString& title,
                                                    const wxPoint& pos,
                                                    const wxSize& size, long style ) :
    PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME_TYPE, title, pos, size, style )
    PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME_TYPE, title, pos, size,
                    style, DISPLAY_FOOTPRINTS_FRAME_NAME )
{
    m_FrameName = wxT( "CmpFrame" );
    m_FrameName = DISPLAY_FOOTPRINTS_FRAME_NAME;
    m_showAxis = true;         // true to draw axis.

    // Give an icon
+5 −2
Original line number Diff line number Diff line
@@ -103,10 +103,13 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
END_EVENT_TABLE()


#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )

CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
    EDA_BASE_FRAME( NULL, CVPCB_FRAME_TYPE, title, wxDefaultPosition, wxDefaultSize, style )
    EDA_BASE_FRAME( NULL, CVPCB_FRAME_TYPE, title, wxDefaultPosition,
                    wxDefaultSize, style, CVPCB_MAINFRAME_NAME )
{
    m_FrameName = wxT( "CvpcbFrame" );
    m_FrameName = CVPCB_MAINFRAME_NAME;

    m_ListCmp = NULL;
    m_FootprintList = NULL;
+9 −11
Original line number Diff line number Diff line
@@ -54,14 +54,12 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void )
    wxSemaphore semaphore( 0, 1 );
    wxString cmpname;

    /* Close the current Lib browser, if open, and open a new one, in "modal" mode */
    if( m_ViewlibFrame )
    {
        delete m_ViewlibFrame;
        m_ViewlibFrame = NULL;
    }
    // Close the current Lib browser, if open, and open a new one, in "modal" mode:
    LIB_VIEW_FRAME * viewlibFrame = LIB_VIEW_FRAME::GetActiveLibraryViewer();;
    if( viewlibFrame )
        viewlibFrame->Destroy();

    m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore,
    viewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore,
                        KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
    // Show the library viewer frame until it is closed
    // Wait for viewer closing event:
@@ -71,8 +69,8 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void )
        wxMilliSleep( 50 );
    }

    cmpname = m_ViewlibFrame->GetSelectedComponent();
    delete m_ViewlibFrame;
    cmpname = viewlibFrame->GetSelectedComponent();
    viewlibFrame->Destroy();

    return cmpname;
}
@@ -133,9 +131,9 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
    {
        cmpName = SelectComponentFromLibBrowser();
        if( aUnit )
            *aUnit = m_ViewlibFrame->GetUnit();
            *aUnit = LIB_VIEW_FRAME::GetUnit();
        if( aConvert )
            *aConvert = m_ViewlibFrame->GetConvert();
            *aConvert = LIB_VIEW_FRAME::GetConvert();
        if( !cmpName.IsEmpty() )
            AddHistoryComponentName( aHistoryList, cmpName );
        return cmpName;
Loading