Commit 0a055c04 authored by charras's avatar charras
Browse files

kicad: cleaned code

parent 1a139a7f
Loading
Loading
Loading
Loading
+818 B (198 KiB)

File changed.

No diff preview for this file type.

+3180 −3183

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@ set(KICAD_SRCS
    commandframe.cpp
    commandframe.cpp
    files-io.cpp
    files-io.cpp
    kicad.cpp
    kicad.cpp
    kicad-python.cpp
    mainframe.cpp
    mainframe.cpp
    preferences.cpp
    preferences.cpp
    prjconfig.cpp
    prjconfig.cpp
+0 −4
Original line number Original line Diff line number Diff line
@@ -19,12 +19,8 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame )
/* Window events */
/* Window events */
    EVT_SIZE( WinEDA_MainFrame::OnSize )
    EVT_SIZE( WinEDA_MainFrame::OnSize )
    EVT_CLOSE( WinEDA_MainFrame::OnCloseWindow )
    EVT_CLOSE( WinEDA_MainFrame::OnCloseWindow )
#if !defined(KICAD_AUIMANAGER)
/* Sash drag events */
/* Sash drag events */
    EVT_SASH_DRAGGED( ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag )
    EVT_SASH_DRAGGED( ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag )
    EVT_SASH_DRAGGED( ID_BOTTOM_FRAME, WinEDA_MainFrame::OnSashDrag )
    EVT_SASH_DRAGGED( ID_MAIN_COMMAND, WinEDA_MainFrame::OnSashDrag )
#endif
/* Toolbar events */
/* Toolbar events */
    EVT_TOOL( ID_NEW_PROJECT, WinEDA_MainFrame::OnLoadProject )
    EVT_TOOL( ID_NEW_PROJECT, WinEDA_MainFrame::OnLoadProject )
    EVT_TOOL( ID_LOAD_PROJECT, WinEDA_MainFrame::OnLoadProject )
    EVT_TOOL( ID_LOAD_PROJECT, WinEDA_MainFrame::OnLoadProject )
+52 −27
Original line number Original line Diff line number Diff line
@@ -9,29 +9,55 @@


#include "kicad.h"
#include "kicad.h"


RIGHT_KM_FRAME::RIGHT_KM_FRAME( WinEDA_MainFrame* parent ) :
    wxSashLayoutWindow( parent, wxID_ANY )
{
    m_Parent    = parent;
    m_DialogWin = NULL;
    m_ButtPanel = new wxPanel( this, wxID_ANY );
    m_ButtonSeparation     = 10;    // control of command buttons position
    m_ButtonLastPosition.x = 20;    // control of command buttons position
    m_ButtonLastPosition.y = 20;    // control of command buttons position
    m_ButtonsPanelHeight        = (m_ButtonLastPosition.y * 2) + 32;
    CreateCommandToolbar();
    m_DialogWin = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
                                  wxDefaultPosition, wxDefaultSize,
                                  wxTE_MULTILINE | wxSUNKEN_BORDER | wxTE_READONLY );


/************************************************************************************/
};
WinEDA_CommandFrame::WinEDA_CommandFrame( wxWindow* parent, int id,
                                          wxPoint pos, wxSize size, long style ) :
    wxSashLayoutWindow( parent, id, pos, size, style )
/************************************************************************************/


/** WinEDA_CommandFrame constructor
void RIGHT_KM_FRAME::OnSize( wxSizeEvent& event )
 * create the window which the buttons to call eeschema and others...
 */
{
{
    SetDefaultSize( wxSize( size.x, 100 ) );
    #define EXTRA_MARGE 4
    SetOrientation( wxLAYOUT_HORIZONTAL );
    wxSize wsize = GetClientSize();
    SetAlignment( wxLAYOUT_TOP );
    wsize.x -= EXTRA_MARGE;
    SetSashVisible( wxSASH_BOTTOM, TRUE );
    wsize.y -= m_ButtonsPanelHeight + EXTRA_MARGE;
    SetSashVisible( wxSASH_LEFT, TRUE );
    wxPoint wpos;
    SetExtraBorderSize( 2 );
    wpos.x = EXTRA_MARGE/2;
    CreateCommandToolbar();
    wpos.y = m_ButtonsPanelHeight + (EXTRA_MARGE/2);
    if( m_DialogWin )
    {
        m_DialogWin->SetSize( wsize );
        m_DialogWin->SetPosition(wpos );
    }
    }


    wpos.y = EXTRA_MARGE/2;
    m_ButtPanel->SetPosition(wpos );
    wsize.y -= m_ButtonsPanelHeight - EXTRA_MARGE;
    m_ButtPanel->SetSize( wsize );
    m_ButtPanel->Refresh();

    event.Skip();
}


BEGIN_EVENT_TABLE( RIGHT_KM_FRAME, wxSashLayoutWindow )
EVT_SIZE( RIGHT_KM_FRAME::OnSize )
END_EVENT_TABLE()



/*************************************************/
/*************************************************/
void WinEDA_CommandFrame::CreateCommandToolbar( void )
void RIGHT_KM_FRAME::CreateCommandToolbar( void )
/*************************************************/
/*************************************************/


/** Function CreateCommandToolbar
/** Function CreateCommandToolbar
@@ -40,30 +66,28 @@ void WinEDA_CommandFrame::CreateCommandToolbar( void )
{
{
    wxBitmapButton* btn;
    wxBitmapButton* btn;


    m_ButtonSeparation     = 10;
    wxWindow*       parent = m_ButtPanel;
    m_ButtonLastPosition.x = 20;
    m_ButtonLastPosition.y = 20;


    btn = new wxBitmapButton( this, ID_TO_EESCHEMA, wxBitmap( icon_eeschema_xpm ) );
    btn = new wxBitmapButton( parent, ID_TO_EESCHEMA, wxBitmap( icon_eeschema_xpm ) );
    btn->SetToolTip( _( "EESchema (Schematic editor)" ) );
    btn->SetToolTip( _( "EESchema (Schematic editor)" ) );
    AddFastLaunch( btn );
    AddFastLaunch( btn );


    btn = new wxBitmapButton( this, ID_TO_CVPCB, wxBitmap( icon_cvpcb_xpm ) );
    btn = new wxBitmapButton( parent, ID_TO_CVPCB, wxBitmap( icon_cvpcb_xpm ) );
    btn->SetToolTip( _( "CVpcb (Components to modules)" ) );
    btn->SetToolTip( _( "CVpcb (Components to modules)" ) );
    AddFastLaunch( btn );
    AddFastLaunch( btn );


    btn = new wxBitmapButton( this, ID_TO_PCB, wxBitmap( a_icon_pcbnew_xpm ) );
    btn = new wxBitmapButton( parent, ID_TO_PCB, wxBitmap( a_icon_pcbnew_xpm ) );
    btn->SetToolTip( _( "PCBnew (PCB editor)" ) );
    btn->SetToolTip( _( "PCBnew (PCB editor)" ) );
    AddFastLaunch( btn );
    AddFastLaunch( btn );


    btn = new wxBitmapButton( this, ID_TO_GERBVIEW, wxBitmap( icon_gerbview_xpm ) );
    btn = new wxBitmapButton( parent, ID_TO_GERBVIEW, wxBitmap( icon_gerbview_xpm ) );
    btn->SetToolTip( _( "GerbView (Gerber viewer)" ) );
    btn->SetToolTip( _( "GerbView (Gerber viewer)" ) );
    AddFastLaunch( btn );
    AddFastLaunch( btn );




    // Set up toolbar
    // Set up toolbar
#ifdef KICAD_PYTHON
#ifdef KICAD_PYTHON
    btn = new wxBitmapButton( this, ID_RUN_PYTHON, wxBitmap( icon_python_xpm ) );
    btn = new wxBitmapButton( parent, ID_RUN_PYTHON, wxBitmap( icon_python_xpm ) );
    btn->SetToolTip( _( "Run Python Script" ) );
    btn->SetToolTip( _( "Run Python Script" ) );
    AddFastLaunch( btn );
    AddFastLaunch( btn );
#endif
#endif
@@ -71,8 +95,9 @@ void WinEDA_CommandFrame::CreateCommandToolbar( void )




/****************************************************************/
/****************************************************************/
void WinEDA_CommandFrame::AddFastLaunch( wxBitmapButton * button )
void RIGHT_KM_FRAME::AddFastLaunch( wxBitmapButton* button )
/****************************************************************/
/****************************************************************/

/** Function AddFastLaunch
/** Function AddFastLaunch
 * add a  Bitmap Button (fast launch button) to the window
 * add a  Bitmap Button (fast launch button) to the window
 * @param button = wxBitmapButton to add to the window
 * @param button = wxBitmapButton to add to the window
Loading