kicad: cleaned code
This commit is contained in:
+53
-28
@@ -9,29 +9,55 @@
|
||||
|
||||
#include "kicad.h"
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
WinEDA_CommandFrame::WinEDA_CommandFrame( wxWindow* parent, int id,
|
||||
wxPoint pos, wxSize size, long style ) :
|
||||
wxSashLayoutWindow( parent, id, pos, size, style )
|
||||
/************************************************************************************/
|
||||
|
||||
/** WinEDA_CommandFrame constructor
|
||||
* create the window which the buttons to call eeschema and others...
|
||||
*/
|
||||
RIGHT_KM_FRAME::RIGHT_KM_FRAME( WinEDA_MainFrame* parent ) :
|
||||
wxSashLayoutWindow( parent, wxID_ANY )
|
||||
{
|
||||
SetDefaultSize( wxSize( size.x, 100 ) );
|
||||
SetOrientation( wxLAYOUT_HORIZONTAL );
|
||||
SetAlignment( wxLAYOUT_TOP );
|
||||
SetSashVisible( wxSASH_BOTTOM, TRUE );
|
||||
SetSashVisible( wxSASH_LEFT, TRUE );
|
||||
SetExtraBorderSize( 2 );
|
||||
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 );
|
||||
|
||||
};
|
||||
|
||||
void RIGHT_KM_FRAME::OnSize( wxSizeEvent& event )
|
||||
{
|
||||
#define EXTRA_MARGE 4
|
||||
wxSize wsize = GetClientSize();
|
||||
wsize.x -= EXTRA_MARGE;
|
||||
wsize.y -= m_ButtonsPanelHeight + EXTRA_MARGE;
|
||||
wxPoint wpos;
|
||||
wpos.x = EXTRA_MARGE/2;
|
||||
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
|
||||
@@ -40,30 +66,28 @@ void WinEDA_CommandFrame::CreateCommandToolbar( void )
|
||||
{
|
||||
wxBitmapButton* btn;
|
||||
|
||||
m_ButtonSeparation = 10;
|
||||
m_ButtonLastPosition.x = 20;
|
||||
m_ButtonLastPosition.y = 20;
|
||||
wxWindow* parent = m_ButtPanel;
|
||||
|
||||
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)" ) );
|
||||
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)" ) );
|
||||
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)" ) );
|
||||
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)" ) );
|
||||
AddFastLaunch( btn );
|
||||
|
||||
|
||||
// Set up toolbar
|
||||
#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" ) );
|
||||
AddFastLaunch( btn );
|
||||
#endif
|
||||
@@ -71,11 +95,12 @@ void WinEDA_CommandFrame::CreateCommandToolbar( void )
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_CommandFrame::AddFastLaunch( wxBitmapButton * button )
|
||||
void RIGHT_KM_FRAME::AddFastLaunch( wxBitmapButton* button )
|
||||
/****************************************************************/
|
||||
|
||||
/** Function AddFastLaunch
|
||||
* add a Bitmap Button (fast launch button) to the window
|
||||
* @param button = wxBitmapButton to add to the window
|
||||
* add a Bitmap Button (fast launch button) to the window
|
||||
* @param button = wxBitmapButton to add to the window
|
||||
*/
|
||||
{
|
||||
button->Move( m_ButtonLastPosition );
|
||||
|
||||
Reference in New Issue
Block a user