Commit e7cd29ec authored by jerryjacobs's avatar jerryjacobs

Beautify code for kicad.cpp, kicad/mainframe.cpp, treeprj_frame.cpp

parent 365dbe15
This diff is collapsed.
...@@ -21,16 +21,19 @@ ...@@ -21,16 +21,19 @@
#include "kicad.h" #include "kicad.h"
/****************/
/* Constructor */
/****************/
// Constructor
/*****************************************************************************/
WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app, WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app,
wxWindow* parent, const wxString& title, wxWindow* parent,
const wxPoint& pos, const wxSize& size ) : const wxString& title,
WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size ) const wxPoint& pos,
const wxSize& size ) :
WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size )
/*****************************************************************************/
{ {
wxString msg; wxString msg;
wxString line;
wxSize clientsize; wxSize clientsize;
m_FrameName = wxT( "KicadFrame" ); m_FrameName = wxT( "KicadFrame" );
...@@ -44,8 +47,10 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app, ...@@ -44,8 +47,10 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app,
GetSettings(); GetSettings();
if( m_Parent->m_EDA_Config ) if( m_Parent->m_EDA_Config )
{ {
m_Parent->m_EDA_Config->Read( wxT( "LeftWinWidth" ), &m_LeftWin_Width ); m_Parent->m_EDA_Config->Read( wxT( "LeftWinWidth" ),
m_Parent->m_EDA_Config->Read( wxT( "CommandWinWidth" ), &m_CommandWin_Height ); &m_LeftWin_Width );
m_Parent->m_EDA_Config->Read( wxT( "CommandWinWidth" ),
&m_CommandWin_Height );
} }
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
...@@ -57,9 +62,9 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app, ...@@ -57,9 +62,9 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app,
// Give an icon // Give an icon
#ifdef __WINDOWS__ #ifdef __WINDOWS__
SetIcon( wxICON( a_kicad_icon ) ); SetIcon( wxICON( a_kicad_icon ) );
#else #else
SetIcon( wxICON( kicad_icon ) ); SetIcon( wxICON( kicad_icon ) );
#endif #endif
clientsize = GetClientSize(); clientsize = GetClientSize();
...@@ -78,7 +83,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app, ...@@ -78,7 +83,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app,
wxNO_BORDER | wxSW_3D ); wxNO_BORDER | wxSW_3D );
m_BottomWin->SetDefaultSize( wxSize( clientsize.x, 150 ) ); m_BottomWin->SetDefaultSize( wxSize( clientsize.x, 150 ) );
m_BottomWin->SetOrientation( wxLAYOUT_HORIZONTAL ); m_BottomWin->SetOrientation( wxLAYOUT_HORIZONTAL );
m_BottomWin->SetAlignment( wxLAYOUT_BOTTOM ); m_BottomWin->SetAlignment ( wxLAYOUT_BOTTOM );
m_BottomWin->SetSashVisible( wxSASH_TOP, TRUE ); m_BottomWin->SetSashVisible( wxSASH_TOP, TRUE );
m_BottomWin->SetSashVisible( wxSASH_LEFT, TRUE ); m_BottomWin->SetSashVisible( wxSASH_LEFT, TRUE );
m_BottomWin->SetExtraBorderSize( 2 ); m_BottomWin->SetExtraBorderSize( 2 );
...@@ -91,43 +96,41 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app, ...@@ -91,43 +96,41 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app,
m_DialogWin->SetFont( *g_StdFont ); m_DialogWin->SetFont( *g_StdFont );
// m_CommandWin is the box with buttons which launch eechema, pcbnew ... // m_CommandWin is the box with buttons which launch eechema, pcbnew ...
m_CommandWin = new WinEDA_CommandFrame( this, ID_MAIN_COMMAND, m_CommandWin = new WinEDA_CommandFrame( this,
ID_MAIN_COMMAND,
wxPoint( m_LeftWin_Width, wxPoint( m_LeftWin_Width,
0 ), 0 ),
wxSize( clientsize.x, m_CommandWin_Height ), wxSize( clientsize.x,
m_CommandWin_Height ),
wxNO_BORDER | wxSW_3D ); wxNO_BORDER | wxSW_3D );
wxString line;
msg = wxGetCwd(); msg = wxGetCwd();
line.Printf( _( "Ready\nWorking dir: %s\n" ), msg.GetData() ); line.Printf( _( "Ready\nWorking dir: %s\n" ), msg.GetData() );
PrintMsg( line ); PrintMsg( line );
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::LoadProject" ) ); PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::LoadProject" ) );
#endif #endif
} }
/***************/ /*****************************************************************************/
/* Destructor */
/***************/
WinEDA_MainFrame::~WinEDA_MainFrame() WinEDA_MainFrame::~WinEDA_MainFrame()
/*****************************************************************************/
{ {
if( m_Parent->m_EDA_Config ) if( m_Parent->m_EDA_Config )
{ {
m_LeftWin_Width = m_LeftWin->GetSize().x; m_LeftWin_Width = m_LeftWin->GetSize().x;
m_CommandWin_Height = m_CommandWin->GetSize().y; m_CommandWin_Height = m_CommandWin->GetSize().y;
m_Parent->m_EDA_Config->Write( wxT( "LeftWinWidth" ), m_LeftWin_Width ); m_Parent->m_EDA_Config->Write( wxT( "LeftWinWidth" ), m_LeftWin_Width );
m_Parent->m_EDA_Config->Write( wxT( "CommandWinWidth" ), m_CommandWin_Height ); m_Parent->m_EDA_Config->Write( wxT( "CommandWinWidth" ), m_CommandWin_Height );
} }
} }
/*******************************************************/ /*******************************************************/
void WinEDA_MainFrame::PrintMsg( const wxString& text ) void WinEDA_MainFrame::PrintMsg( const wxString& text )
/*******************************************************/ /*******************************************************/
/* /*
* Put text in the dialog frame * Put text in the dialog frame
*/ */
...@@ -135,7 +138,7 @@ void WinEDA_MainFrame::PrintMsg( const wxString& text ) ...@@ -135,7 +138,7 @@ void WinEDA_MainFrame::PrintMsg( const wxString& text )
m_DialogWin->SetFont( *g_StdFont ); m_DialogWin->SetFont( *g_StdFont );
m_DialogWin->AppendText( text ); m_DialogWin->AppendText( text );
#ifdef DEBUG #ifdef DEBUG
printf("%s\n", (const char*)text.mb_str() ); printf("%s\n", (const char*)text.mb_str() );
#endif #endif
} }
...@@ -275,18 +278,18 @@ void WinEDA_MainFrame::ReDraw( wxDC* DC ) ...@@ -275,18 +278,18 @@ void WinEDA_MainFrame::ReDraw( wxDC* DC )
void WinEDA_MainFrame::Process_Special_Functions( wxCommandEvent& event ) void WinEDA_MainFrame::Process_Special_Functions( wxCommandEvent& event )
/**********************************************************************/ /**********************************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
switch( id ) switch( id )
{ {
case ID_EXIT: case ID_EXIT:
Close( TRUE ); Close( TRUE );
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_MainFrame::Process_Special_Functions error" ) ); DisplayError( this, wxT( "WinEDA_MainFrame::Process_Special_Functions error" ) );
break; break;
} }
} }
...@@ -394,18 +397,21 @@ void WinEDA_MainFrame::OnRefresh( wxCommandEvent& event ) ...@@ -394,18 +397,21 @@ void WinEDA_MainFrame::OnRefresh( wxCommandEvent& event )
} }
/*********************************/ /*********************************/
void WinEDA_MainFrame::ClearMsg() void WinEDA_MainFrame::ClearMsg()
/*********************************/ /*********************************/
{ {
m_DialogWin->Clear(); m_DialogWin->Clear();
} }
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
/*****************************************************************************/
void WinEDA_MainFrame::OnRefreshPy() void WinEDA_MainFrame::OnRefreshPy()
/*****************************************************************************/
{ {
m_LeftWin->ReCreateTreePrj(); m_LeftWin->ReCreateTreePrj();
} }
#endif #endif
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment