Commit 2611a547 authored by stambaughw's avatar stambaughw

Convert global and embedded application pointers to wxGetApp()

parent 0745188d
...@@ -27,19 +27,21 @@ ...@@ -27,19 +27,21 @@
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA3D_DrawFrame::Process_Zoom ) WinEDA3D_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D, EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D,
WinEDA3D_DrawFrame::Process_Special_Functions ) WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_MENU( wxID_EXIT, WinEDA3D_DrawFrame::Exit3DFrame ) EVT_MENU( wxID_EXIT, WinEDA3D_DrawFrame::Exit3DFrame )
EVT_MENU( ID_MENU_SCREENCOPY_PNG, WinEDA3D_DrawFrame::Process_Special_Functions ) EVT_MENU( ID_MENU_SCREENCOPY_PNG,
EVT_MENU( ID_MENU_SCREENCOPY_JPEG, WinEDA3D_DrawFrame::Process_Special_Functions ) WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow ) EVT_MENU( ID_MENU_SCREENCOPY_JPEG,
WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
END_EVENT_TABLE() END_EVENT_TABLE()
/*******************************************************************/ /*******************************************************************/
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
WinEDA_App* app_parent, const wxString& title, const wxString& title,
long style ) : long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title, wxFrame( parent, DISPLAY3D_FRAME, title,
wxPoint( -1, -1 ), wxSize( -1, -1 ), style ) wxPoint( -1, -1 ), wxSize( -1, -1 ), style )
...@@ -48,7 +50,6 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, ...@@ -48,7 +50,6 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
m_FrameName = wxT( "Frame3D" ); m_FrameName = wxT( "Frame3D" );
m_Canvas = NULL; m_Canvas = NULL;
m_Parent = parent; m_Parent = parent;
m_ParentAppl = app_parent;
m_HToolBar = NULL; m_HToolBar = NULL;
m_VToolBar = NULL; m_VToolBar = NULL;
m_InternalUnits = 10000; // Unites internes = 1/10000 inch m_InternalUnits = 10000; // Unites internes = 1/10000 inch
...@@ -104,21 +105,24 @@ void WinEDA3D_DrawFrame::GetSettings() ...@@ -104,21 +105,24 @@ void WinEDA3D_DrawFrame::GetSettings()
/******************************************/ /******************************************/
{ {
wxString text; wxString text;
wxConfig* Config = m_ParentAppl->m_EDA_Config; // Current config used by application wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application
if( m_ParentAppl->m_EDA_Config ) if( config )
{ {
text = m_FrameName + wxT( "Pos_x" ); text = m_FrameName + wxT( "Pos_x" );
Config->Read( text, &m_FramePos.x ); config->Read( text, &m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" ); text = m_FrameName + wxT( "Pos_y" );
Config->Read( text, &m_FramePos.y ); config->Read( text, &m_FramePos.y );
text = m_FrameName + wxT( "Size_x" ); text = m_FrameName + wxT( "Size_x" );
Config->Read( text, &m_FrameSize.x, 600 ); config->Read( text, &m_FrameSize.x, 600 );
text = m_FrameName + wxT( "Size_y" ); text = m_FrameName + wxT( "Size_y" );
Config->Read( text, &m_FrameSize.y, 400 ); config->Read( text, &m_FrameSize.y, 400 );
Config->Read( wxT( "BgColor_Red" ), &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 ); config->Read( wxT( "BgColor_Red" ),
Config->Read( wxT( "BgColor_Green" ), &g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 ); &g_Parm_3D_Visu.m_BgColor.m_Red, 0.0 );
Config->Read( wxT( "BgColor_Blue" ), &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 ); config->Read( wxT( "BgColor_Green" ),
&g_Parm_3D_Visu.m_BgColor.m_Green, 0.0 );
config->Read( wxT( "BgColor_Blue" ),
&g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 );
} }
#ifdef __WXMAC__ #ifdef __WXMAC__
...@@ -134,7 +138,7 @@ void WinEDA3D_DrawFrame::SaveSettings() ...@@ -134,7 +138,7 @@ void WinEDA3D_DrawFrame::SaveSettings()
/*******************************************/ /*******************************************/
{ {
wxString text; wxString text;
wxConfig* Config = m_ParentAppl->m_EDA_Config; // Current config used by application wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by application
if( !Config ) if( !Config )
return; return;
......
...@@ -125,7 +125,6 @@ class WinEDA3D_DrawFrame: public wxFrame ...@@ -125,7 +125,6 @@ class WinEDA3D_DrawFrame: public wxFrame
{ {
public: public:
WinEDA_BasePcbFrame * m_Parent; WinEDA_BasePcbFrame * m_Parent;
WinEDA_App * m_ParentAppl;
Pcb3D_GLCanvas * m_Canvas; Pcb3D_GLCanvas * m_Canvas;
wxToolBar * m_HToolBar; wxToolBar * m_HToolBar;
wxToolBar * m_VToolBar; wxToolBar * m_VToolBar;
...@@ -138,8 +137,9 @@ private: ...@@ -138,8 +137,9 @@ private:
// It is "Frame3D" // It is "Frame3D"
public: public:
WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent, WinEDA_App *app_parent, WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent,
const wxString& title, long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE ); const wxString& title,
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
void Exit3DFrame(wxCommandEvent& event); void Exit3DFrame(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent & Event); void OnCloseWindow(wxCloseEvent & Event);
...@@ -169,7 +169,7 @@ public: ...@@ -169,7 +169,7 @@ public:
void Set3DEco1OnOff(); void Set3DEco1OnOff();
void Set3DEco2OnOff(); void Set3DEco2OnOff();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
void SetGLColor(int color); void SetGLColor(int color);
......
...@@ -5,6 +5,14 @@ Started 2007-June-11 ...@@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Dec-08 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all
* Remove all instances of application pointers both global and embedded
member variables. Use wxGetApp() for improved readability and type
safety.
2008-Dec-6 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Dec-6 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++pcbnew & gerbview ++pcbnew & gerbview
......
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
/*******************************************************/ /*******************************************************/
WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype, WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype,
WinEDA_App* parent, const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, long style ) : const wxPoint& pos, const wxSize& size,
long style ) :
wxFrame( father, -1, title, pos, size, style ) wxFrame( father, -1, title, pos, size, style )
{ {
wxSize minsize; wxSize minsize;
m_Ident = idtype; m_Ident = idtype;
m_Parent = parent;
SetFont( *g_StdFont ); SetFont( *g_StdFont );
m_MenuBar = NULL; // menu du haut d'ecran m_MenuBar = NULL; // menu du haut d'ecran
m_HToolBar = NULL; m_HToolBar = NULL;
...@@ -57,9 +57,9 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype, ...@@ -57,9 +57,9 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype,
WinEDA_BasicFrame::~WinEDA_BasicFrame() WinEDA_BasicFrame::~WinEDA_BasicFrame()
/******************************************/ /******************************************/
{ {
if( m_Parent->m_HtmlCtrl ) if( wxGetApp().m_HtmlCtrl )
delete m_Parent->m_HtmlCtrl; delete wxGetApp().m_HtmlCtrl;
m_Parent->m_HtmlCtrl = NULL; wxGetApp().m_HtmlCtrl = NULL;
} }
...@@ -78,17 +78,20 @@ void WinEDA_BasicFrame::GetSettings() ...@@ -78,17 +78,20 @@ void WinEDA_BasicFrame::GetSettings()
{ {
wxString text; wxString text;
int Ypos_min; int Ypos_min;
wxConfig* config;
if( m_Parent->m_EDA_Config ) config = wxGetApp().m_EDA_Config;
if( config )
{ {
text = m_FrameName + wxT( "Pos_x" ); text = m_FrameName + wxT( "Pos_x" );
m_Parent->m_EDA_Config->Read( text, &m_FramePos.x ); config->Read( text, &m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" ); text = m_FrameName + wxT( "Pos_y" );
m_Parent->m_EDA_Config->Read( text, &m_FramePos.y ); config->Read( text, &m_FramePos.y );
text = m_FrameName + wxT( "Size_x" ); text = m_FrameName + wxT( "Size_x" );
m_Parent->m_EDA_Config->Read( text, &m_FrameSize.x, 600 ); config->Read( text, &m_FrameSize.x, 600 );
text = m_FrameName + wxT( "Size_y" ); text = m_FrameName + wxT( "Size_y" );
m_Parent->m_EDA_Config->Read( text, &m_FrameSize.y, 400 ); config->Read( text, &m_FrameSize.y, 400 );
} }
// Ensure Window title bar is visible // Ensure Window title bar is visible
...@@ -109,24 +112,24 @@ void WinEDA_BasicFrame::SaveSettings() ...@@ -109,24 +112,24 @@ void WinEDA_BasicFrame::SaveSettings()
/*****************************************/ /*****************************************/
{ {
wxString text; wxString text;
wxConfig* config;
if( !m_Parent || !m_Parent->m_EDA_Config ) config = wxGetApp().m_EDA_Config;
return;
if( !m_Parent->m_EDA_Config || IsIconized() ) if( ( config == NULL ) || IsIconized() )
return; return;
m_FrameSize = GetSize(); m_FrameSize = GetSize();
m_FramePos = GetPosition(); m_FramePos = GetPosition();
text = m_FrameName + wxT( "Pos_x" ); text = m_FrameName + wxT( "Pos_x" );
m_Parent->m_EDA_Config->Write( text, (long) m_FramePos.x ); config->Write( text, (long) m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" ); text = m_FrameName + wxT( "Pos_y" );
m_Parent->m_EDA_Config->Write( text, (long) m_FramePos.y ); config->Write( text, (long) m_FramePos.y );
text = m_FrameName + wxT( "Size_x" ); text = m_FrameName + wxT( "Size_x" );
m_Parent->m_EDA_Config->Write( text, (long) m_FrameSize.x ); config->Write( text, (long) m_FrameSize.x );
text = m_FrameName + wxT( "Size_y" ); text = m_FrameName + wxT( "Size_y" );
m_Parent->m_EDA_Config->Write( text, (long) m_FrameSize.y ); config->Write( text, (long) m_FrameSize.y );
} }
...@@ -175,36 +178,28 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName ) ...@@ -175,36 +178,28 @@ void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
return; return;
//suppression d'une ancienne trace eventuelle du meme fichier //suppression d'une ancienne trace eventuelle du meme fichier
for( ii = 0; ii < m_Parent->m_LastProject.GetCount(); ) for( ii = 0; ii < wxGetApp().m_LastProject.GetCount(); )
{ {
if( m_Parent->m_LastProject[ii].IsEmpty() ) if( wxGetApp().m_LastProject[ii].IsEmpty() )
break; break;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
if( m_Parent->m_LastProject[ii].CmpNoCase( FullFileName ) == 0 ) if( wxGetApp().m_LastProject[ii].CmpNoCase( FullFileName ) == 0 )
#else #else
if( m_Parent->m_LastProject[ii] == FullFileName ) if( wxGetApp().m_LastProject[ii] == FullFileName )
#endif #endif
{ {
#if ( ( wxMAJOR_VERSION < 2) || ( ( wxMAJOR_VERSION == 2)&& (wxMINOR_VERSION <= 4 ) ) ) wxGetApp().m_LastProject.RemoveAt( ii );
m_Parent->m_LastProject.Remove( ii );
#else
m_Parent->m_LastProject.RemoveAt( ii );
#endif
} }
else else
ii++; ii++;
} }
while( m_Parent->m_LastProject.GetCount() >= m_Parent->m_LastProjectMaxCount ) while( wxGetApp().m_LastProject.GetCount() >= wxGetApp().m_LastProjectMaxCount )
{ {
#if ( ( wxMAJOR_VERSION < 2) || ( ( wxMAJOR_VERSION == 2)&& (wxMINOR_VERSION <= 4 ) ) ) wxGetApp().m_LastProject.RemoveAt( wxGetApp().m_LastProject.GetCount() - 1 );
files.Remove( files.GetCount() - 1 );
#else
m_Parent->m_LastProject.RemoveAt( m_Parent->m_LastProject.GetCount() - 1 );
#endif
} }
m_Parent->m_LastProject.Insert( FullFileName, 0 ); wxGetApp().m_LastProject.Insert( FullFileName, 0 );
ReCreateMenuBar(); ReCreateMenuBar();
} }
...@@ -216,9 +211,9 @@ wxString WinEDA_BasicFrame::GetLastProject( int rang ) ...@@ -216,9 +211,9 @@ wxString WinEDA_BasicFrame::GetLastProject( int rang )
{ {
if( rang < 0 ) if( rang < 0 )
rang = 0; rang = 0;
if( (unsigned) rang >= m_Parent->m_LastProject.GetCount() ) if( (unsigned) rang >= wxGetApp().m_LastProject.GetCount() )
return wxEmptyString; return wxEmptyString;
return m_Parent->m_LastProject[rang]; return wxGetApp().m_LastProject[rang];
} }
...@@ -227,30 +222,30 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) ...@@ -227,30 +222,30 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/**************************************************************/ /**************************************************************/
{ {
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
if( m_Parent->m_HtmlCtrl == NULL ) if( wxGetApp().m_HtmlCtrl == NULL )
{ {
m_Parent->InitOnLineHelp(); wxGetApp().InitOnLineHelp();
} }
if( m_Parent->m_HtmlCtrl ) if( wxGetApp().m_HtmlCtrl )
{ {
m_Parent->m_HtmlCtrl->DisplayContents(); wxGetApp().m_HtmlCtrl->DisplayContents();
m_Parent->m_HtmlCtrl->Display( m_Parent->m_HelpFileName ); wxGetApp().m_HtmlCtrl->Display( wxGetApp().m_HelpFileName );
} }
else else
{ {
wxString msg; wxString msg;
msg.Printf( _( "Help file %s not found" ), m_Parent->m_HelpFileName.GetData() ); msg.Printf( _( "Help file %s not found" ), wxGetApp().m_HelpFileName.GetData() );
DisplayError( this, msg ); DisplayError( this, msg );
} }
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
wxString fullfilename = FindKicadHelpPath() + m_Parent->m_HelpFileName; wxString fullfilename = FindKicadHelpPath() + wxGetApp().m_HelpFileName;
if ( wxFileExists(fullfilename) ) if ( wxFileExists(fullfilename) )
GetAssociatedDocument( this, wxEmptyString, fullfilename ); GetAssociatedDocument( this, wxEmptyString, fullfilename );
else // Try to find file in English format: else // Try to find file in English format:
{ {
fullfilename = FindKicadHelpPath() + wxT("../en/") + m_Parent->m_HelpFileName;; fullfilename = FindKicadHelpPath() + wxT("../en/") + wxGetApp().m_HelpFileName;;
GetAssociatedDocument( this, wxEmptyString, fullfilename ); GetAssociatedDocument( this, wxEmptyString, fullfilename );
} }
......
...@@ -14,14 +14,9 @@ ...@@ -14,14 +14,9 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include <wx/image.h>
#include "wx/html/htmlwin.h" #include "wx/html/htmlwin.h"
#include "wx/fs_zip.h" #include "wx/fs_zip.h"
#include "wxstruct.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "worksheet.h" #include "worksheet.h"
#include "id.h" #include "id.h"
...@@ -53,8 +48,7 @@ struct LANGUAGE_DESCR ...@@ -53,8 +48,7 @@ struct LANGUAGE_DESCR
bool m_DoNotTranslate; // set to true if the m_Lang_Label must not be translated bool m_DoNotTranslate; // set to true if the m_Lang_Label must not be translated
}; };
#define LANGUAGE_DESCR_COUNT 16 static struct LANGUAGE_DESCR s_Language_List[] =
static struct LANGUAGE_DESCR s_Language_List[LANGUAGE_DESCR_COUNT] =
{ {
{ {
wxLANGUAGE_DEFAULT, wxLANGUAGE_DEFAULT,
...@@ -155,6 +149,11 @@ static struct LANGUAGE_DESCR s_Language_List[LANGUAGE_DESCR_COUNT] = ...@@ -155,6 +149,11 @@ static struct LANGUAGE_DESCR s_Language_List[LANGUAGE_DESCR_COUNT] =
} }
}; };
/* Just add new languages to the list. This macro will properly recalculate
* the size of the array. */
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / \
sizeof( struct LANGUAGE_DESCR ) )
/**************************/ /**************************/
/* WinEDA_App Constructor */ /* WinEDA_App Constructor */
/**************************/ /**************************/
...@@ -162,15 +161,6 @@ static struct LANGUAGE_DESCR s_Language_List[LANGUAGE_DESCR_COUNT] = ...@@ -162,15 +161,6 @@ static struct LANGUAGE_DESCR s_Language_List[LANGUAGE_DESCR_COUNT] =
WinEDA_App::WinEDA_App() WinEDA_App::WinEDA_App()
{ {
m_Checker = NULL; m_Checker = NULL;
m_MainFrame = NULL;
m_PcbFrame = NULL;
m_ModuleEditFrame = NULL; // Frame for footprint edition
m_SchematicFrame = NULL; // Frame for schematic edition
m_LibeditFrame = NULL; // Frame for component edition
m_ViewlibFrame = NULL; // Frame for browsing component libraries
m_CvpcbFrame = NULL;
m_GerberFrame = NULL; // Frame for the gerber viewer GERBVIEW
m_LastProjectMaxCount = 10; m_LastProjectMaxCount = 10;
m_HtmlCtrl = NULL; m_HtmlCtrl = NULL;
m_EDA_CommonConfig = NULL; m_EDA_CommonConfig = NULL;
...@@ -250,14 +240,18 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ...@@ -250,14 +240,18 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
g_MsgFontPointSize = FONT_DEFAULT_SIZE; g_MsgFontPointSize = FONT_DEFAULT_SIZE;
g_DialogFontPointSize = FONT_DEFAULT_SIZE; g_DialogFontPointSize = FONT_DEFAULT_SIZE;
g_FixedFontPointSize = FONT_DEFAULT_SIZE; g_FixedFontPointSize = FONT_DEFAULT_SIZE;
g_StdFont = new wxFont( g_StdFontPointSize, wxFONTFAMILY_ROMAN, wxNORMAL, wxNORMAL ); g_StdFont = new wxFont( g_StdFontPointSize, wxFONTFAMILY_ROMAN,
g_MsgFont = new wxFont( g_StdFontPointSize, wxFONTFAMILY_ROMAN, wxNORMAL, wxNORMAL ); wxNORMAL, wxNORMAL );
g_DialogFont = new wxFont( g_DialogFontPointSize, wxFONTFAMILY_ROMAN, wxNORMAL, wxNORMAL ); g_MsgFont = new wxFont( g_StdFontPointSize, wxFONTFAMILY_ROMAN,
wxNORMAL, wxNORMAL );
g_DialogFont = new wxFont( g_DialogFontPointSize, wxFONTFAMILY_ROMAN,
wxNORMAL, wxNORMAL );
g_ItalicFont = new wxFont( g_DialogFontPointSize, g_ItalicFont = new wxFont( g_DialogFontPointSize,
wxFONTFAMILY_ROMAN, wxFONTFAMILY_ROMAN,
wxFONTSTYLE_ITALIC, wxFONTSTYLE_ITALIC,
wxNORMAL ); wxNORMAL );
g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL ); g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN,
wxNORMAL, wxNORMAL );
/* installation des gestionnaires de visu d'images (pour help) */ /* installation des gestionnaires de visu d'images (pour help) */
wxImage::AddHandler( new wxPNGHandler ); wxImage::AddHandler( new wxPNGHandler );
...@@ -271,14 +265,15 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ...@@ -271,14 +265,15 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
ReadPdfBrowserInfos(); ReadPdfBrowserInfos();
// Internationalisation: loading the kicad suitable Dictionnary // Internationalisation: loading the kicad suitable Dictionnary
m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId, wxLANGUAGE_DEFAULT ); m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId,
wxLANGUAGE_DEFAULT );
bool succes = SetLanguage( TRUE ); bool succes = SetLanguage( TRUE );
if( !succes ) if( !succes )
{ {
} }
SetLocaleTo_Default( ); // Set locale option for separator used in float numbers SetLocaleTo_Default(); // Set locale option for separator used in float numbers
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
PyHandler::GetInstance()->SetAppName( name ); PyHandler::GetInstance()->SetAppName( name );
...@@ -300,8 +295,8 @@ void WinEDA_App::InitOnLineHelp() ...@@ -300,8 +295,8 @@ void WinEDA_App::InitOnLineHelp()
fullfilename += wxT( "kicad.hhp" ); fullfilename += wxT( "kicad.hhp" );
if( wxFileExists( fullfilename ) ) if( wxFileExists( fullfilename ) )
{ {
m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR | m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS |
wxHF_CONTENTS | wxHF_PRINT | wxHF_OPEN_FILES wxHF_PRINT | wxHF_OPEN_FILES
/*| wxHF_SEARCH */ ); /*| wxHF_SEARCH */ );
m_HtmlCtrl->UseConfig( m_EDA_CommonConfig ); m_HtmlCtrl->UseConfig( m_EDA_CommonConfig );
m_HtmlCtrl->SetTitleFormat( wxT( "Kicad Help" ) ); m_HtmlCtrl->SetTitleFormat( wxT( "Kicad Help" ) );
...@@ -396,7 +391,8 @@ void WinEDA_App::GetSettings() ...@@ -396,7 +391,8 @@ void WinEDA_App::GetSettings()
if( m_EDA_CommonConfig ) if( m_EDA_CommonConfig )
{ {
m_LanguageId = m_EDA_CommonConfig->Read( wxT( "Language" ), wxLANGUAGE_DEFAULT ); m_LanguageId = m_EDA_CommonConfig->Read( wxT( "Language" ),
wxLANGUAGE_DEFAULT );
g_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) ); g_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) );
g_ConfigFileLocationChoice = m_EDA_CommonConfig->Read( HOTKEY_CFG_PATH_OPT, 0L ); g_ConfigFileLocationChoice = m_EDA_CommonConfig->Read( HOTKEY_CFG_PATH_OPT, 0L );
} }
...@@ -416,10 +412,14 @@ void WinEDA_App::GetSettings() ...@@ -416,10 +412,14 @@ void WinEDA_App::GetSettings()
m_LastProject.Add( Line ); m_LastProject.Add( Line );
} }
g_StdFontPointSize = m_EDA_Config->Read( wxT( "SdtFontSize" ), FONT_DEFAULT_SIZE ); g_StdFontPointSize = m_EDA_Config->Read( wxT( "SdtFontSize" ),
g_MsgFontPointSize = m_EDA_Config->Read( wxT( "MsgFontSize" ), FONT_DEFAULT_SIZE ); FONT_DEFAULT_SIZE );
g_DialogFontPointSize = m_EDA_Config->Read( wxT( "DialogFontSize" ), FONT_DEFAULT_SIZE ); g_MsgFontPointSize = m_EDA_Config->Read( wxT( "MsgFontSize" ),
g_FixedFontPointSize = m_EDA_Config->Read( wxT( "FixedFontSize" ), FONT_DEFAULT_SIZE ); FONT_DEFAULT_SIZE );
g_DialogFontPointSize = m_EDA_Config->Read( wxT( "DialogFontSize" ),
FONT_DEFAULT_SIZE );
g_FixedFontPointSize = m_EDA_Config->Read( wxT( "FixedFontSize" ),
FONT_DEFAULT_SIZE );
Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString ); Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString );
if( !Line.IsEmpty() ) if( !Line.IsEmpty() )
...@@ -593,9 +593,11 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu ) ...@@ -593,9 +593,11 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ ) for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{ {
if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier ) if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier )
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, true ); m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier,
true );
else else
m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, false ); m_Language_Menu->Check( s_Language_List[ii].m_KI_Lang_Identifier,
false );
} }
if( MasterMenu ) if( MasterMenu )
......
...@@ -4,22 +4,9 @@ ...@@ -4,22 +4,9 @@
/************************************************/ /************************************************/
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "fctsys.h"
#include "wx/mimetype.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWindows headers
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <stdio.h> #include "wx/mimetype.h"
#include <string.h>
#include <ctype.h>
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#ifndef _MSC_VER #ifndef _MSC_VER
...@@ -27,9 +14,7 @@ ...@@ -27,9 +14,7 @@
#endif #endif
#endif #endif
#include "fctsys.h"
#include "common.h" #include "common.h"
#include "wxstruct.h"
#include "macros.h" #include "macros.h"
/* List of default paths used to locate help files and kicad library files. /* List of default paths used to locate help files and kicad library files.
...@@ -114,7 +99,6 @@ static wxString s_KicadBinaryPathList[] = { ...@@ -114,7 +99,6 @@ static wxString s_KicadBinaryPathList[] = {
#endif #endif
wxT( "end_list" ) // End of list symbol, do not change wxT( "end_list" ) // End of list symbol, do not change
}; };
extern WinEDA_App* g_EDA_Appl;
/***************************************************************************/ /***************************************************************************/
...@@ -402,12 +386,12 @@ wxString FindKicadHelpPath() ...@@ -402,12 +386,12 @@ wxString FindKicadHelpPath()
bool PathFound = FALSE; bool PathFound = FALSE;
/* find kicad/help/ */ /* find kicad/help/ */
tmp = g_EDA_Appl->m_BinDir; tmp = wxGetApp().m_BinDir;
if( tmp.Last() == '/' ) if( tmp.Last() == '/' )
tmp.RemoveLast(); tmp.RemoveLast();
FullPath = tmp.BeforeLast( '/' ); // cd .. FullPath = tmp.BeforeLast( '/' ); // cd ..
FullPath += wxT( "/doc/help/" ); FullPath += wxT( "/doc/help/" );
LocaleString = g_EDA_Appl->m_Locale->GetCanonicalName(); LocaleString = wxGetApp().m_Locale->GetCanonicalName();
wxString path_tmp = FullPath; wxString path_tmp = FullPath;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
...@@ -420,9 +404,9 @@ wxString FindKicadHelpPath() ...@@ -420,9 +404,9 @@ wxString FindKicadHelpPath()
} }
/* find kicad/help/ from environment variable KICAD */ /* find kicad/help/ from environment variable KICAD */
if( !PathFound && g_EDA_Appl->m_Env_Defined ) if( !PathFound && wxGetApp().m_Env_Defined )
{ {
FullPath = g_EDA_Appl->m_KicadEnv + wxT( "/doc/help/" ); FullPath = wxGetApp().m_KicadEnv + wxT( "/doc/help/" );
if( wxDirExists( FullPath ) ) if( wxDirExists( FullPath ) )
PathFound = TRUE; PathFound = TRUE;
} }
...@@ -483,15 +467,15 @@ wxString FindKicadFile( const wxString& shortname ) ...@@ -483,15 +467,15 @@ wxString FindKicadFile( const wxString& shortname )
/* test de la presence du fichier shortname dans le repertoire de /* test de la presence du fichier shortname dans le repertoire de
* des binaires de kicad */ * des binaires de kicad */
FullFileName = g_EDA_Appl->m_BinDir + shortname; FullFileName = wxGetApp().m_BinDir + shortname;
if( wxFileExists( FullFileName ) ) if( wxFileExists( FullFileName ) )
return FullFileName; return FullFileName;
/* test de la presence du fichier shortname dans le repertoire /* test de la presence du fichier shortname dans le repertoire
* defini par la variable d'environnement KICAD */ * defini par la variable d'environnement KICAD */
if( g_EDA_Appl->m_Env_Defined ) if( wxGetApp().m_Env_Defined )
{ {
FullFileName = g_EDA_Appl->m_KicadEnv + shortname; FullFileName = wxGetApp().m_KicadEnv + shortname;
if( wxFileExists( FullFileName ) ) if( wxFileExists( FullFileName ) )
return FullFileName; return FullFileName;
} }
...@@ -566,7 +550,7 @@ void SetRealLibraryPath( const wxString& shortlibname ) ...@@ -566,7 +550,7 @@ void SetRealLibraryPath( const wxString& shortlibname )
else else
{ {
g_RealLibDirBuffer = ReturnKicadDatasPath(); g_RealLibDirBuffer = ReturnKicadDatasPath();
if( g_EDA_Appl->m_Env_Defined ) // Chemin impose par la variable d'environnement if( wxGetApp().m_Env_Defined ) // Chemin impose par la variable d'environnement
{ {
PathFound = TRUE; PathFound = TRUE;
} }
...@@ -599,35 +583,36 @@ wxString ReturnKicadDatasPath() ...@@ -599,35 +583,36 @@ wxString ReturnKicadDatasPath()
bool PathFound = FALSE; bool PathFound = FALSE;
wxString data_path; wxString data_path;
if( g_EDA_Appl->m_Env_Defined ) // Chemin impose par la variable d'environnement if( wxGetApp().m_Env_Defined ) // Chemin impose par la variable d'environnement
{ {
data_path = g_EDA_Appl->m_KicadEnv; data_path = wxGetApp().m_KicadEnv;
PathFound = TRUE; PathFound = TRUE;
} }
else // Chemin cherche par le chemin des executables else // Chemin cherche par le chemin des executables
{ {
// le chemin est bindir../ // le chemin est bindir../
wxString tmp = g_EDA_Appl->m_BinDir; wxString tmp = wxGetApp().m_BinDir;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
tmp.MakeLower(); tmp.MakeLower();
#endif #endif
if( tmp.Contains( wxT( "kicad" ) ) ) if( tmp.Contains( wxT( "kicad" ) ) )
{ {
#ifdef __WINDOWS__ #ifdef __WINDOWS__
tmp = g_EDA_Appl->m_BinDir; tmp = wxGetApp().m_BinDir;
#endif #endif
if( tmp.Last() == '/' ) if( tmp.Last() == '/' )
tmp.RemoveLast(); tmp.RemoveLast();
data_path = tmp.BeforeLast( '/' ); // id cd ../ data_path = tmp.BeforeLast( '/' ); // id cd ../
data_path += UNIX_STRING_DIR_SEP; data_path += UNIX_STRING_DIR_SEP;
// Old versions of kicad use kicad/ as default for data // Old versions of kicad use kicad/ as default for data
// and last versions kicad/share/ // and last versions kicad/share/
// So we search for kicad/share/ first // So we search for kicad/share/ first
wxString old_path = data_path; wxString old_path = data_path;
data_path += wxT("share/"); data_path += wxT( "share/" );
if( wxDirExists( data_path ) ) if( wxDirExists( data_path ) )
PathFound = TRUE; PathFound = TRUE;
else if ( wxDirExists( old_path ) ) else if( wxDirExists( old_path ) )
{ {
data_path = old_path; data_path = old_path;
PathFound = TRUE; PathFound = TRUE;
...@@ -693,17 +678,19 @@ wxString GetEditorName() ...@@ -693,17 +678,19 @@ wxString GetEditorName()
); );
} }
if( ( !editorname.IsEmpty() ) && g_EDA_Appl->m_EDA_CommonConfig ) if( ( !editorname.IsEmpty() ) && wxGetApp().m_EDA_CommonConfig )
{ {
g_EditorName = editorname; g_EditorName = editorname;
g_EDA_Appl->m_EDA_CommonConfig->Write( wxT( "Editor" ), g_EditorName ); wxGetApp().m_EDA_CommonConfig->Write( wxT( "Editor" ), g_EditorName );
} }
return g_EditorName; return g_EditorName;
} }
/***********************************/ /***********************************/
bool OpenPDF( const wxString& file ) bool OpenPDF( const wxString& file )
/***********************************/ /***********************************/
/** Function OpenPDF /** Function OpenPDF
* run the PDF viewer and display a PDF file * run the PDF viewer and display a PDF file
* @param file = PDF file to open * @param file = PDF file to open
...@@ -715,11 +702,11 @@ bool OpenPDF( const wxString& file ) ...@@ -715,11 +702,11 @@ bool OpenPDF( const wxString& file )
wxString type; wxString type;
bool success = false; bool success = false;
g_EDA_Appl->ReadPdfBrowserInfos(); wxGetApp().ReadPdfBrowserInfos();
if( !g_EDA_Appl->m_PdfBrowserIsDefault ) // Run the prefered PDF Browser if( !wxGetApp().m_PdfBrowserIsDefault ) // Run the prefered PDF Browser
{ {
AddDelimiterString( filename ); AddDelimiterString( filename );
command = g_EDA_Appl->m_PdfBrowser + wxT( " " ) + filename; command = wxGetApp().m_PdfBrowser + wxT( " " ) + filename;
} }
else else
{ {
...@@ -730,14 +717,15 @@ bool OpenPDF( const wxString& file ) ...@@ -730,14 +717,15 @@ bool OpenPDF( const wxString& file )
success = filetype->GetOpenCommand( &command, params ); success = filetype->GetOpenCommand( &command, params );
delete filetype; delete filetype;
#ifndef __WINDOWS__ #ifndef __WINDOWS__
// Bug ? under linux wxWidgets returns acroread as PDF viewer,even it not exists // Bug ? under linux wxWidgets returns acroread as PDF viewer,even it not exists
if ( command.StartsWith(wxT("acroread")) ) // Workaround if( command.StartsWith( wxT( "acroread" ) ) ) // Workaround
success = false; success = false;
#endif #endif
if( success && !command.IsEmpty() ) if( success && !command.IsEmpty() )
{ {
success = ProcessExecute( command ); success = ProcessExecute( command );
if ( success ) if( success )
return success; return success;
} }
...@@ -770,6 +758,7 @@ bool OpenPDF( const wxString& file ) ...@@ -770,6 +758,7 @@ bool OpenPDF( const wxString& file )
break; break;
} }
} }
#endif #endif
} }
} }
...@@ -777,17 +766,17 @@ bool OpenPDF( const wxString& file ) ...@@ -777,17 +766,17 @@ bool OpenPDF( const wxString& file )
if( !command.IsEmpty() ) if( !command.IsEmpty() )
{ {
success = ProcessExecute( command ); success = ProcessExecute( command );
if ( !success ) if( !success )
{ {
wxString msg = _("Problem while running the PDF viewer"); wxString msg = _( "Problem while running the PDF viewer" );
msg << _("\n command is ") << command; msg << _( "\n command is " ) << command;
DisplayError( NULL, msg ); DisplayError( NULL, msg );
} }
} }
else else
{ {
wxString msg = _("Unable to find a PDF viewer for"); wxString msg = _( "Unable to find a PDF viewer for" );
msg << wxT(" ") << filename; msg << wxT( " " ) << filename;
DisplayError( NULL, msg ); DisplayError( NULL, msg );
success = false; success = false;
} }
...@@ -795,6 +784,7 @@ bool OpenPDF( const wxString& file ) ...@@ -795,6 +784,7 @@ bool OpenPDF( const wxString& file )
return success; return success;
} }
/*************************************/ /*************************************/
void OpenFile( const wxString& file ) void OpenFile( const wxString& file )
/*************************************/ /*************************************/
......
...@@ -674,6 +674,8 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id ) ...@@ -674,6 +674,8 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
*/ */
{ {
wxMenuBar* menu = frame->GetMenuBar(); wxMenuBar* menu = frame->GetMenuBar();
wxConfig * config = wxGetApp().m_EDA_CommonConfig;
wxASSERT( config != NULL );
switch( id ) switch( id )
{ {
...@@ -683,8 +685,7 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id ) ...@@ -683,8 +685,7 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
g_ConfigFileLocationChoice = 0; g_ConfigFileLocationChoice = 0;
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, true ); menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, true );
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, false ); menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, false );
frame->m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT, config->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
g_ConfigFileLocationChoice );
} }
break; break;
...@@ -694,8 +695,7 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id ) ...@@ -694,8 +695,7 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
g_ConfigFileLocationChoice = 1; g_ConfigFileLocationChoice = 1;
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, false ); menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, false );
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, true ); menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, true );
frame->m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT, config->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
g_ConfigFileLocationChoice );
} }
break; break;
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
/*********************************************************************/ /*********************************************************************/
static bool ReCreatePrjConfig( const wxString& local_config_filename, static bool ReCreatePrjConfig( const wxString& local_config_filename,
const wxString& GroupName, bool ForceUseLocalConfig ) const wxString& GroupName,
bool ForceUseLocalConfig )
/*********************************************************************/ /*********************************************************************/
/* Cree ou recree la configuration locale de kicad (filename.pro) /* Cree ou recree la configuration locale de kicad (filename.pro)
...@@ -44,8 +45,10 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename, ...@@ -44,8 +45,10 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
if( ForceUseLocalConfig || wxFileExists( g_Prj_Config_LocalFilename ) ) if( ForceUseLocalConfig || wxFileExists( g_Prj_Config_LocalFilename ) )
{ {
g_Prj_Default_Config_FullFilename.Empty(); g_Prj_Default_Config_FullFilename.Empty();
g_Prj_Config = new wxFileConfig( wxEmptyString, wxEmptyString, g_Prj_Config = new wxFileConfig( wxEmptyString,
g_Prj_Config_LocalFilename, wxEmptyString, wxEmptyString,
g_Prj_Config_LocalFilename,
wxEmptyString,
wxCONFIG_USE_RELATIVE_PATH ); wxCONFIG_USE_RELATIVE_PATH );
g_Prj_Config->DontCreateOnDemand(); g_Prj_Config->DontCreateOnDemand();
...@@ -73,8 +76,10 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename, ...@@ -73,8 +76,10 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
g_Prj_Config_Filename_ext; g_Prj_Config_Filename_ext;
// Recreate new config // Recreate new config
g_Prj_Config = new wxFileConfig( wxEmptyString, wxEmptyString, g_Prj_Config = new wxFileConfig( wxEmptyString,
wxEmptyString, g_Prj_Default_Config_FullFilename, wxEmptyString,
wxEmptyString,
g_Prj_Default_Config_FullFilename,
wxCONFIG_USE_RELATIVE_PATH ); wxCONFIG_USE_RELATIVE_PATH );
g_Prj_Config->DontCreateOnDemand(); g_Prj_Config->DontCreateOnDemand();
...@@ -85,7 +90,8 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename, ...@@ -85,7 +90,8 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
/***************************************************************************************/ /***************************************************************************************/
void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename, void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, PARAM_CFG_BASE** List ) const wxString& GroupName,
PARAM_CFG_BASE** List )
/***************************************************************************************/ /***************************************************************************************/
/* enregistrement de la config "projet"*/ /* enregistrement de la config "projet"*/
{ {
...@@ -203,7 +209,8 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename, ...@@ -203,7 +209,8 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
// We use indexlib+1 because first lib name is LibName1 // We use indexlib+1 because first lib name is LibName1
cle_config << (indexlib + 1); cle_config << (indexlib + 1);
g_Prj_Config->Write( cle_config, libname_list->Item( indexlib ) ); g_Prj_Config->Write( cle_config,
libname_list->Item( indexlib ) );
} }
break; break;
...@@ -227,7 +234,8 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename, ...@@ -227,7 +234,8 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
/***************************************************************************************/ /***************************************************************************************/
bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename, bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, PARAM_CFG_BASE** List, const wxString& GroupName,
PARAM_CFG_BASE** List,
bool Load_Only_if_New ) bool Load_Only_if_New )
/***************************************************************************************/ /***************************************************************************************/
...@@ -238,8 +246,8 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename, ...@@ -238,8 +246,8 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
* return: * return:
* TRUE si lue. * TRUE si lue.
* Met a jour en plus: * Met a jour en plus:
* g_EDA_Appl->m_CurrentOptionFileDateAndTime * wxGetApp().m_CurrentOptionFileDateAndTime
* g_EDA_Appl->m_CurrentOptionFile * wxGetApp().m_CurrentOptionFile
*/ */
{ {
const PARAM_CFG_BASE* pt_cfg; const PARAM_CFG_BASE* pt_cfg;
...@@ -253,22 +261,22 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename, ...@@ -253,22 +261,22 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP ); g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
timestamp = g_Prj_Config->Read( wxT( "update" ) ); timestamp = g_Prj_Config->Read( wxT( "update" ) );
if( Load_Only_if_New && ( !timestamp.IsEmpty() ) if( Load_Only_if_New && ( !timestamp.IsEmpty() )
&& (timestamp == g_EDA_Appl->m_CurrentOptionFileDateAndTime) ) && (timestamp == wxGetApp().m_CurrentOptionFileDateAndTime) )
{ {
return FALSE; return FALSE;
} }
g_EDA_Appl->m_CurrentOptionFileDateAndTime = timestamp; wxGetApp().m_CurrentOptionFileDateAndTime = timestamp;
if( !g_Prj_Default_Config_FullFilename.IsEmpty() ) if( !g_Prj_Default_Config_FullFilename.IsEmpty() )
g_EDA_Appl->m_CurrentOptionFile = g_Prj_Default_Config_FullFilename; wxGetApp().m_CurrentOptionFile = g_Prj_Default_Config_FullFilename;
else else
{ {
if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() ) if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() )
g_EDA_Appl->m_CurrentOptionFile = wxGetApp().m_CurrentOptionFile =
wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename; wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename;
else else
g_EDA_Appl->m_CurrentOptionFile = g_Prj_Config_LocalFilename; wxGetApp().m_CurrentOptionFile = g_Prj_Config_LocalFilename;
} }
for( ; *List != NULL; List++ ) for( ; *List != NULL; List++ )
...@@ -437,7 +445,8 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam, ...@@ -437,7 +445,8 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam, PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
int default_val, const wxChar* group ) : int default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group ) PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
...@@ -445,8 +454,11 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam, ...@@ -445,8 +454,11 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
} }
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam, PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
int default_val, const wxChar* group ) : const wxChar* ident,
int* ptparam,
int default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group ) PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
...@@ -467,8 +479,12 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam, ...@@ -467,8 +479,12 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
} }
PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam, PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
double default_val, double min, double max, const wxChar* ident,
double* ptparam,
double default_val,
double min,
double max,
const wxChar* group ) : const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_DOUBLE, group ) PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
{ {
...@@ -489,8 +505,11 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam, ...@@ -489,8 +505,11 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
} }
PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam, PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
int default_val, const wxChar* group ) : const wxChar* ident,
bool* ptparam,
int default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_BOOL, group ) PARAM_CFG_BASE( ident, PARAM_BOOL, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
...@@ -500,7 +519,8 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam ...@@ -500,7 +519,8 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident, PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident,
wxString* ptparam, const wxChar* group ) : wxString* ptparam,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_WXSTRING, group ) PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
...@@ -508,7 +528,8 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident, ...@@ -508,7 +528,8 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident,
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident, PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
wxString* ptparam, const wxChar* group ) : wxString* ptparam,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_WXSTRING, group ) PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
...@@ -517,7 +538,8 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident, ...@@ -517,7 +538,8 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident, PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
wxArrayString* ptparam, const wxChar* group ) : wxArrayString* ptparam,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_LIBNAME_LIST, group ) PARAM_CFG_BASE( ident, PARAM_LIBNAME_LIST, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h"
#include "common.h" #include "common.h"
#include "cvpcb.h" #include "cvpcb.h"
#include "protos.h" #include "protos.h"
...@@ -36,7 +35,7 @@ void Read_Config( const wxString& FileName ) ...@@ -36,7 +35,7 @@ void Read_Config( const wxString& FileName )
g_LibName_List.Clear(); g_LibName_List.Clear();
g_ListName_Equ.Clear(); g_ListName_Equ.Clear();
g_EDA_Appl->ReadProjectConfig( FullFileName, wxGetApp().ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE ); GROUP, ParamCfgList, FALSE );
if( NetInExtBuffer.IsEmpty() ) if( NetInExtBuffer.IsEmpty() )
...@@ -86,5 +85,5 @@ void Save_Config( wxWindow* parent ) ...@@ -86,5 +85,5 @@ void Save_Config( wxWindow* parent )
return; return;
/* ecriture de la configuration */ /* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList ); wxGetApp().WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
} }
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <wx/fontdlg.h> #include <wx/fontdlg.h>
#include "cvpcb.h" #include "cvpcb.h"
#include "gr_basic.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "bitmaps.h" #include "bitmaps.h"
...@@ -21,10 +20,12 @@ ...@@ -21,10 +20,12 @@
/*******************************************************/ /*******************************************************/
/* Constructeur de WinEDA_CvpcbFrame: la fenetre generale */ /* Constructeur de WinEDA_CvpcbFrame: la fenetre generale */
/*******************************************************/ /*******************************************************/
WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( WinEDA_App* parent, const wxString& title, long style ) : WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
WinEDA_BasicFrame( NULL, CVPCB_FRAME, parent, title, wxDefaultPosition, wxDefaultSize, style ) WinEDA_BasicFrame( NULL, CVPCB_FRAME, title, wxDefaultPosition,
wxDefaultSize, style )
{ {
m_FrameName = wxT( "CvpcbFrame" ); m_FrameName = wxT( "CvpcbFrame" );
//m_AboutTitle = g_CvpcbAboutTitle; //m_AboutTitle = g_CvpcbAboutTitle;
m_ListCmp = NULL; m_ListCmp = NULL;
m_FootprintList = NULL; m_FootprintList = NULL;
...@@ -97,10 +98,13 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( WinEDA_App* parent, const wxString& title, ...@@ -97,10 +98,13 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( WinEDA_App* parent, const wxString& title,
WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame() WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame()
/******************************************/ /******************************************/
{ {
if( m_Parent->m_EDA_Config ) wxConfig* config = wxGetApp().m_EDA_Config;
if( config )
{ {
int state = m_HToolBar->GetToolState( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ); int state = m_HToolBar->GetToolState(
m_Parent->m_EDA_Config->Write( wxT( FILTERFOOTPRINTKEY ), state ); ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST );
config->Write( wxT( FILTERFOOTPRINTKEY ), state );
} }
} }
...@@ -117,77 +121,74 @@ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event ) ...@@ -117,77 +121,74 @@ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event )
/* Event table for WinEDA_CvpcbFrame */ /* Event table for WinEDA_CvpcbFrame */
/*************************************/ /*************************************/
BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
EVT_MENU_RANGE( ID_LOAD_PROJECT,
EVT_MENU_RANGE( ID_LOAD_PROJECT,
ID_LOAD_FILE_10, ID_LOAD_FILE_10,
WinEDA_CvpcbFrame::LoadNetList ) WinEDA_CvpcbFrame::LoadNetList )
// Menu events // Menu events
EVT_MENU( ID_SAVE_PROJECT, EVT_MENU( ID_SAVE_PROJECT,
WinEDA_CvpcbFrame::SaveQuitCvpcb ) WinEDA_CvpcbFrame::SaveQuitCvpcb )
EVT_MENU( ID_CVPCB_QUIT, EVT_MENU( ID_CVPCB_QUIT,
WinEDA_CvpcbFrame::OnQuit ) WinEDA_CvpcbFrame::OnQuit )
EVT_MENU( ID_CVPCB_DISPLAY_HELP, EVT_MENU( ID_CVPCB_DISPLAY_HELP,
WinEDA_CvpcbFrame::GetKicadHelp ) WinEDA_CvpcbFrame::GetKicadHelp )
EVT_MENU( ID_CVPCB_DISPLAY_LICENCE, EVT_MENU( ID_CVPCB_DISPLAY_LICENCE,
WinEDA_CvpcbFrame::GetKicadAbout ) WinEDA_CvpcbFrame::GetKicadAbout )
EVT_MENU( ID_CONFIG_REQ, EVT_MENU( ID_CONFIG_REQ,
WinEDA_CvpcbFrame::ConfigCvpcb ) WinEDA_CvpcbFrame::ConfigCvpcb )
EVT_MENU( ID_CONFIG_SAVE, EVT_MENU( ID_CONFIG_SAVE,
WinEDA_CvpcbFrame::Update_Config ) WinEDA_CvpcbFrame::Update_Config )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN,
ID_PREFERENCES_FONT_END, ID_PREFERENCES_FONT_END,
WinEDA_CvpcbFrame::ProcessFontPreferences ) WinEDA_CvpcbFrame::ProcessFontPreferences )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, EVT_MENU_RANGE( ID_LANGUAGE_CHOICE,
ID_LANGUAGE_CHOICE_END, ID_LANGUAGE_CHOICE_END,
WinEDA_CvpcbFrame::SetLanguage ) WinEDA_CvpcbFrame::SetLanguage )
// Toolbar events // Toolbar events
EVT_TOOL( ID_CVPCB_QUIT, EVT_TOOL( ID_CVPCB_QUIT,
WinEDA_CvpcbFrame::OnQuit ) WinEDA_CvpcbFrame::OnQuit )
EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST, EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST,
WinEDA_CvpcbFrame::LoadNetList ) WinEDA_CvpcbFrame::LoadNetList )
EVT_TOOL( ID_CVPCB_SAVEQUITCVPCB, EVT_TOOL( ID_CVPCB_SAVEQUITCVPCB,
WinEDA_CvpcbFrame::SaveQuitCvpcb ) WinEDA_CvpcbFrame::SaveQuitCvpcb )
EVT_TOOL( ID_CVPCB_CREATE_CONFIGWINDOW, EVT_TOOL( ID_CVPCB_CREATE_CONFIGWINDOW,
WinEDA_CvpcbFrame::ConfigCvpcb ) WinEDA_CvpcbFrame::ConfigCvpcb )
EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP,
WinEDA_CvpcbFrame::DisplayModule ) WinEDA_CvpcbFrame::DisplayModule )
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA,
WinEDA_CvpcbFrame::ToFirstNA ) WinEDA_CvpcbFrame::ToFirstNA )
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA,
WinEDA_CvpcbFrame::ToPreviousNA ) WinEDA_CvpcbFrame::ToPreviousNA )
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS,
WinEDA_CvpcbFrame::DelAssociations ) WinEDA_CvpcbFrame::DelAssociations )
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE,
WinEDA_CvpcbFrame::AssocieModule ) WinEDA_CvpcbFrame::AssocieModule )
EVT_TOOL( ID_CVPCB_CREATE_STUFF_FILE, EVT_TOOL( ID_CVPCB_CREATE_STUFF_FILE,
WinEDA_CvpcbFrame::WriteStuffList ) WinEDA_CvpcbFrame::WriteStuffList )
EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC,
WinEDA_CvpcbFrame::DisplayDocFile ) WinEDA_CvpcbFrame::DisplayDocFile )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
WinEDA_CvpcbFrame::OnSelectFilteringFootprint ) WinEDA_CvpcbFrame::OnSelectFilteringFootprint )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
WinEDA_CvpcbFrame::OnSelectFilteringFootprint ) WinEDA_CvpcbFrame::OnSelectFilteringFootprint )
// Frame events // Frame events
EVT_CHAR_HOOK( WinEDA_CvpcbFrame::OnChar ) EVT_CHAR_HOOK( WinEDA_CvpcbFrame::OnChar )
EVT_CLOSE( WinEDA_CvpcbFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_CvpcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_CvpcbFrame::OnSize ) EVT_SIZE( WinEDA_CvpcbFrame::OnSize )
// List item events // List item events
EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST,
WinEDA_CvpcbFrame::OnLeftClick ) WinEDA_CvpcbFrame::OnLeftClick )
EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST,
WinEDA_CvpcbFrame::OnLeftDClick ) WinEDA_CvpcbFrame::OnLeftDClick )
EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST, EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST,
WinEDA_CvpcbFrame::OnSelectComponent ) WinEDA_CvpcbFrame::OnSelectComponent )
END_EVENT_TABLE() END_EVENT_TABLE()
/******************************************************/ /******************************************************/
void WinEDA_CvpcbFrame::OnQuit( wxCommandEvent& event ) void WinEDA_CvpcbFrame::OnQuit( wxCommandEvent& event )
/******************************************************/ /******************************************************/
...@@ -196,7 +197,6 @@ void WinEDA_CvpcbFrame::OnQuit( wxCommandEvent& event ) ...@@ -196,7 +197,6 @@ void WinEDA_CvpcbFrame::OnQuit( wxCommandEvent& event )
} }
/**********************************************************/ /**********************************************************/
void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
/**********************************************************/ /**********************************************************/
...@@ -206,10 +206,10 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -206,10 +206,10 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
if( modified ) if( modified )
{ {
unsigned ii; unsigned ii;
wxMessageDialog dialog( this, _( "Net and component list modified.\n Save before exit ?" ), wxMessageDialog dialog( this,
_( "Net and component list modified.\n Save before exit ?" ),
_( "Confirmation" ), _( "Confirmation" ),
wxYES_NO | wxCANCEL | wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
wxICON_EXCLAMATION | wxYES_DEFAULT );
ii = dialog.ShowModal(); ii = dialog.ShowModal();
...@@ -229,7 +229,8 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -229,7 +229,8 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
modified = 0; modified = 0;
else if( diag == 0 ) else if( diag == 0 )
{ {
if( !IsOK( this, _( "Problem when saving files, exit anyway ?" ) ) ) if( !IsOK( this,
_( "Problem when saving files, exit anyway ?" ) ) )
{ {
Event.Veto(); Event.Veto();
return; return;
...@@ -240,10 +241,10 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -240,10 +241,10 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
} }
// Close the help frame // Close the help frame
if( m_Parent->m_HtmlCtrl ) if( wxGetApp().m_HtmlCtrl )
{ {
if( m_Parent->m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active
m_Parent->m_HtmlCtrl->GetFrame()->Close( TRUE ); wxGetApp().m_HtmlCtrl->GetFrame()->Close( TRUE );
} }
if( !NetInNameBuffer.IsEmpty() ) if( !NetInNameBuffer.IsEmpty() )
...@@ -372,7 +373,8 @@ void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event ) ...@@ -372,7 +373,8 @@ void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event )
composants_non_affectes = nbcomp; composants_non_affectes = nbcomp;
} }
Line.Printf( _( "Componants: %d (free: %d)" ), nbcomp, composants_non_affectes ); Line.Printf( _( "Componants: %d (free: %d)" ), nbcomp,
composants_non_affectes );
SetStatusText( Line, 1 ); SetStatusText( Line, 1 );
} }
...@@ -486,8 +488,8 @@ void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event ) ...@@ -486,8 +488,8 @@ void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
m_Parent->SetLanguageIdentifier( id ); wxGetApp().SetLanguageIdentifier( id );
m_Parent->SetLanguage(); wxGetApp().SetLanguage();
} }
...@@ -497,12 +499,13 @@ void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event ) ...@@ -497,12 +499,13 @@ void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event )
{ {
wxString DocModuleFileName, fullfilename; wxString DocModuleFileName, fullfilename;
DocModuleFileName = g_EDA_Appl->m_EDA_CommonConfig->Read( DOC_FOOTPRINTS_LIST_KEY, DocModuleFileName = wxGetApp().m_EDA_CommonConfig->Read(
DOC_FOOTPRINTS_LIST_KEY,
DEFAULT_FOOTPRINTS_LIST_FILENAME ); DEFAULT_FOOTPRINTS_LIST_FILENAME );
if( wxIsAbsolutePath(DocModuleFileName) ) if( wxIsAbsolutePath( DocModuleFileName ) )
fullfilename = DocModuleFileName; fullfilename = DocModuleFileName;
else else
fullfilename = FindKicadHelpPath() + wxT("../") + DocModuleFileName; fullfilename = FindKicadHelpPath() + wxT( "../" ) + DocModuleFileName;
GetAssociatedDocument( this, wxEmptyString, fullfilename ); GetAssociatedDocument( this, wxEmptyString, fullfilename );
} }
...@@ -537,7 +540,8 @@ void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event ) ...@@ -537,7 +540,8 @@ void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) ); DisplayError( this,
wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) );
break; break;
} }
} }
......
/*******************/ /*******************/
/* File: cvpcb.cpp */ /* File: cvpcb.cpp */
/*******************/ /*******************/
#define MAIN #define MAIN
#define eda_global #define eda_global
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "cvpcb.h" #include "cvpcb.h"
#include "trigo.h" #include "trigo.h"
#include "gr_basic.h"
#include "zones.h" #include "zones.h"
#include "bitmaps.h" #include "bitmaps.h"
...@@ -18,77 +17,76 @@ ...@@ -18,77 +17,76 @@
#include "id.h" #include "id.h"
wxString g_Main_Title = wxT("CVpcb"); wxString g_Main_Title = wxT( "CVpcb" );
// Create a new application object // Create a new application object
IMPLEMENT_APP(WinEDA_App) IMPLEMENT_APP( WinEDA_App )
/* fonctions locales */ /* fonctions locales */
/************************************/ /************************************/
/* Called to initialize the program */ /* Called to initialize the program */
/************************************/ /************************************/
bool WinEDA_App::OnInit() bool WinEDA_App::OnInit()
{ {
wxString msg; wxString msg;
wxString currCWD = wxGetCwd(); wxString currCWD = wxGetCwd();
WinEDA_CvpcbFrame* frame = NULL;
g_EDA_Appl = this; InitEDA_Appl( wxT( "cvpcb" ) );
InitEDA_Appl( wxT("cvpcb") );
if ( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
{ {
if ( ! IsOK(NULL, _("Cvpcb is already running, Continue?") ) ) if( !IsOK( NULL, _( "Cvpcb is already running, Continue?" ) ) )
return false; return false;
} }
GetSettings(); // read current setup GetSettings(); // read current setup
wxSetWorkingDirectory(currCWD); // mofifie par GetSetting wxSetWorkingDirectory( currCWD ); // mofifie par GetSetting
SetRealLibraryPath( wxT("modules") ); SetRealLibraryPath( wxT( "modules" ) );
if(argc > 1 ) if( argc > 1 )
{ {
NetInNameBuffer = argv[1]; NetInNameBuffer = argv[1];
NetNameBuffer = argv[1]; NetNameBuffer = argv[1];
} }
if ( ! NetInNameBuffer.IsEmpty() ) if( !NetInNameBuffer.IsEmpty() )
wxSetWorkingDirectory( wxPathOnly(NetInNameBuffer) ); wxSetWorkingDirectory( wxPathOnly( NetInNameBuffer ) );
g_DrawBgColor = BLACK; g_DrawBgColor = BLACK;
Read_Config(NetInNameBuffer); Read_Config( NetInNameBuffer );
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
m_CvpcbFrame = new WinEDA_CvpcbFrame(this, Title); frame = new WinEDA_CvpcbFrame( Title );
msg.Printf( wxT("Modules: %d"), nblib); msg.Printf( wxT( "Modules: %d" ), nblib );
m_CvpcbFrame->SetStatusText(msg,2); frame->SetStatusText( msg, 2 );
// Show the frame // Show the frame
SetTopWindow(m_CvpcbFrame); SetTopWindow( frame );
m_CvpcbFrame->Show(TRUE); frame->Show( TRUE );
listlib(); listlib();
m_CvpcbFrame->BuildFootprintListBox(); frame->BuildFootprintListBox();
if( ! NetInNameBuffer.IsEmpty() ) /* nom de fichier passe a la commande */ if( !NetInNameBuffer.IsEmpty() ) /* nom de fichier passe a la commande */
{ {
FFileName = MakeFileName(NetDirBuffer, FFileName = MakeFileName( NetDirBuffer,
NetInNameBuffer, NetInExtBuffer); NetInNameBuffer, NetInExtBuffer );
m_CvpcbFrame->ReadNetListe(); frame->ReadNetListe();
} }
else /* Mise a jour du titre de la fenetre principale */ else /* Mise a jour du titre de la fenetre principale */
{ {
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
msg.Printf( wxT("%s {%s%c} [no file]"), msg.Printf( wxT( "%s {%s%c} [no file]" ),
Title.GetData(), wxGetCwd().GetData(), DIR_SEP); Title.GetData(), wxGetCwd().GetData(), DIR_SEP );
m_CvpcbFrame->SetTitle(msg); frame->SetTitle( msg );
} }
return TRUE; return TRUE;
} }
...@@ -39,7 +39,7 @@ private: ...@@ -39,7 +39,7 @@ private:
// Constructor and destructor // Constructor and destructor
public: public:
WinEDA_CvpcbFrame( WinEDA_App * parent, const wxString &title, WinEDA_CvpcbFrame( const wxString &title,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_CvpcbFrame(); ~WinEDA_CvpcbFrame();
...@@ -180,7 +180,7 @@ class WinEDA_DisplayFrame : public WinEDA_BasePcbFrame ...@@ -180,7 +180,7 @@ class WinEDA_DisplayFrame : public WinEDA_BasePcbFrame
public: public:
public: public:
WinEDA_DisplayFrame( wxWindow * father, WinEDA_App * parent, WinEDA_DisplayFrame( wxWindow * father,
const wxString &title, const wxString &title,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
......
...@@ -72,7 +72,7 @@ wxString title; ...@@ -72,7 +72,7 @@ wxString title;
m_DoUpdate = TRUE; m_DoUpdate = TRUE;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile; title = _("from ") + wxGetApp().m_CurrentOptionFile;
SetTitle(title); SetTitle(title);
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "wxstruct.h"
#include "cvpcb.h" #include "cvpcb.h"
#include "id.h" #include "id.h"
#include "bitmaps.h" #include "bitmaps.h"
...@@ -32,11 +31,11 @@ END_EVENT_TABLE() ...@@ -32,11 +31,11 @@ END_EVENT_TABLE()
/* WinEDA_DisplayFrame: the frame to display the current focused footprint */ /* WinEDA_DisplayFrame: the frame to display the current focused footprint */
/***************************************************************************/ /***************************************************************************/
WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent, WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, long style ) : const wxSize& size, long style ) :
WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos, WinEDA_BasePcbFrame( father, CVPCB_DISPLAY_FRAME, title, pos,
size, style ) size, style )
{ {
m_FrameName = wxT( "CmpFrame" ); m_FrameName = wxT( "CmpFrame" );
...@@ -73,7 +72,7 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame() ...@@ -73,7 +72,7 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
delete m_Pcb; delete m_Pcb;
m_Parent->m_CvpcbFrame->DrawFrame = NULL; ( (WinEDA_CvpcbFrame*) wxGetApp().GetTopWindow() )->DrawFrame = NULL;
} }
......
/***************************************/ /***************************************/
/** menucfg : configuration de CVPCB **/ /** menucfg : configuration de CVPCB **/
/***************************************/ /***************************************/
/* cree et/ou affiche et modifie la configuration de CVPCB */ /* cree et/ou affiche et modifie la configuration de CVPCB */
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWindows headers
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -24,19 +11,19 @@ ...@@ -24,19 +11,19 @@
#include "protos.h" #include "protos.h"
/*****************************************/ /*****************************************/
/* classe pour la frame de Configuration */ /* classe pour la frame de Configuration */
/*****************************************/ /*****************************************/
#include "dialog_cvpcb_config.cpp" #include "dialog_cvpcb_config.cpp"
/***************************************************/ /***************************************************/
void WinEDA_CvpcbFrame::CreateConfigWindow() void WinEDA_CvpcbFrame::CreateConfigWindow()
/***************************************************/ /***************************************************/
/* Creation de la fenetre de configuration de CVPCB */ /* Creation de la fenetre de configuration de CVPCB */
{ {
KiConfigCvpcbFrame * ConfigFrame = new KiConfigCvpcbFrame(this); KiConfigCvpcbFrame* ConfigFrame = new KiConfigCvpcbFrame( this );
ConfigFrame->ShowModal(); ConfigFrame->Destroy(); ConfigFrame->ShowModal(); ConfigFrame->Destroy();
} }
...@@ -45,71 +32,94 @@ KiConfigCvpcbFrame * ConfigFrame = new KiConfigCvpcbFrame(this); ...@@ -45,71 +32,94 @@ KiConfigCvpcbFrame * ConfigFrame = new KiConfigCvpcbFrame(this);
void KiConfigCvpcbFrame::SetDialogDatas() void KiConfigCvpcbFrame::SetDialogDatas()
/*********************************************/ /*********************************************/
{ {
m_ListLibr->InsertItems(g_LibName_List,0); m_ListLibr->InsertItems( g_LibName_List, 0 );
m_ListEquiv->InsertItems(g_ListName_Equ,0); m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
m_LibDirCtrl = new WinEDA_EnterText(this, m_LibDirCtrl = new WinEDA_EnterText( this,
_("Lib Dir:"), g_UserLibDirBuffer, _( "Lib Dir:" ), g_UserLibDirBuffer,
m_RightBoxSizer, wxDefaultSize); m_RightBoxSizer, wxDefaultSize );
m_NetInputExtCtrl = new WinEDA_EnterText(this, m_NetInputExtCtrl = new WinEDA_EnterText( this,
_("Net Input Ext:"),NetInExtBuffer, _( "Net Input Ext:" ),
m_NetExtBoxSizer, wxDefaultSize); NetInExtBuffer,
m_NetExtBoxSizer, wxDefaultSize );
wxString DocModuleFileName = wxString DocModuleFileName =
g_EDA_Appl->m_EDA_CommonConfig->Read( DOC_FOOTPRINTS_LIST_KEY, DEFAULT_FOOTPRINTS_LIST_FILENAME); wxGetApp().m_EDA_CommonConfig->Read( DOC_FOOTPRINTS_LIST_KEY,
m_TextHelpModulesFileName = new WinEDA_EnterText(this, DEFAULT_FOOTPRINTS_LIST_FILENAME );
_("Module Doc File:"), DocModuleFileName, m_TextHelpModulesFileName = new WinEDA_EnterText( this,
m_RightBoxSizer, wxDefaultSize); _( "Module Doc File:" ),
DocModuleFileName,
m_RightBoxSizer,
wxDefaultSize );
/* Create info on Files ext */ /* Create info on Files ext */
wxStaticText * StaticText; wxStaticText* StaticText;
wxString text; wxString text;
text.Printf( wxT("%s %s"), _("Cmp ext:"), g_ExtCmpBuffer.GetData() ); text.Printf( wxT( "%s %s" ), _( "Cmp ext:" ), g_ExtCmpBuffer.GetData() );
StaticText = new wxStaticText(this, -1,text); StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add(StaticText, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE); m_FileExtList->Add(
StaticText,
text.Printf( wxT("%s %s"), _("Lib ext:"), LibExtBuffer.GetData()); wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
StaticText = new wxStaticText(this, -1,text); wxADJUST_MINSIZE );
m_FileExtList->Add(StaticText, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE);
text.Printf( wxT( "%s %s" ), _( "Lib ext:" ), LibExtBuffer.GetData() );
text.Printf( wxT("%s %s"), _("NetOut ext:"), NetExtBuffer.GetData()); StaticText = new wxStaticText( this, -1, text );
StaticText = new wxStaticText(this, -1,text); m_FileExtList->Add(
m_FileExtList->Add(StaticText, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE); StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
text.Printf( wxT("%s %s"), _("Equiv ext:"), g_EquivExtBuffer.GetData()); wxADJUST_MINSIZE );
StaticText = new wxStaticText(this, -1,text);
m_FileExtList->Add(StaticText, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE); text.Printf( wxT( "%s %s" ), _( "NetOut ext:" ), NetExtBuffer.GetData() );
StaticText = new wxStaticText( this, -1, text );
text.Printf( wxT("%s %s"), _("Retro ext:"), ExtRetroBuffer.GetData()); m_FileExtList->Add(
StaticText = new wxStaticText(this, -1,text); StaticText,
m_FileExtList->Add(StaticText, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE); wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
text.Printf( wxT( "%s %s" ), _( "Equiv ext:" ),
g_EquivExtBuffer.GetData() );
StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add(
StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
text.Printf( wxT( "%s %s" ), _( "Retro ext:" ), ExtRetroBuffer.GetData() );
StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add(
StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
} }
/********************************************************/ /********************************************************/
void KiConfigCvpcbFrame::AcceptCfg(wxCommandEvent& event) void KiConfigCvpcbFrame::AcceptCfg( wxCommandEvent& event )
/********************************************************/ /********************************************************/
{ {
Update(); Update();
Close(); Close();
} }
/**********************************/ /**********************************/
void KiConfigCvpcbFrame::Update() void KiConfigCvpcbFrame::Update()
/**********************************/ /**********************************/
{ {
wxString msg; wxString msg;
if ( ! m_DoUpdate ) return; if( !m_DoUpdate )
return;
NetInExtBuffer = m_NetInputExtCtrl->GetValue(); NetInExtBuffer = m_NetInputExtCtrl->GetValue();
g_EDA_Appl->m_EDA_CommonConfig->Write( DOC_FOOTPRINTS_LIST_KEY, wxGetApp().m_EDA_CommonConfig->Write( DOC_FOOTPRINTS_LIST_KEY,
m_TextHelpModulesFileName->GetValue()); m_TextHelpModulesFileName->GetValue() );
msg = m_LibDirCtrl->GetValue(); msg = m_LibDirCtrl->GetValue();
if ( msg != g_UserLibDirBuffer ) if( msg != g_UserLibDirBuffer )
{ {
g_UserLibDirBuffer = m_LibDirCtrl->GetValue(); g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") ); SetRealLibraryPath( wxT( "modules" ) );
listlib(); listlib();
ListModIsModified = 1; ListModIsModified = 1;
m_Parent->BuildFootprintListBox(); m_Parent->BuildFootprintListBox();
...@@ -118,26 +128,27 @@ wxString msg; ...@@ -118,26 +128,27 @@ wxString msg;
/****************************************************/ /****************************************************/
void KiConfigCvpcbFrame::SaveCfg(wxCommandEvent& event) void KiConfigCvpcbFrame::SaveCfg( wxCommandEvent& event )
/****************************************************/ /****************************************************/
{ {
Update(); Update();
Save_Config(this); Save_Config( this );
} }
/******************************************************/ /******************************************************/
void KiConfigCvpcbFrame::ReadOldCfg(wxCommandEvent& event) void KiConfigCvpcbFrame::ReadOldCfg( wxCommandEvent& event )
/******************************************************/ /******************************************************/
{ {
wxString line; wxString line;
NetInNameBuffer.Replace(WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP); NetInNameBuffer.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
wxString FullFileName = NetInNameBuffer.AfterLast('/'); wxString FullFileName = NetInNameBuffer.AfterLast( '/' );
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext ); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Read config file"), FullFileName = EDA_FileSelector( _( "Read config file" ),
wxGetCwd(), /* Chemin par defaut */ wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */ g_Prj_Config_Filename_ext, /* extension par defaut */
...@@ -146,164 +157,174 @@ wxString FullFileName = NetInNameBuffer.AfterLast('/'); ...@@ -146,164 +157,174 @@ wxString FullFileName = NetInNameBuffer.AfterLast('/');
wxFD_OPEN, wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */ TRUE /* ne change pas de repertoire courant */
); );
if ( FullFileName.IsEmpty() ) return; if( FullFileName.IsEmpty() )
if ( ! wxFileExists(FullFileName) ) return;
if( !wxFileExists( FullFileName ) )
{ {
line.Printf( _("File %s not found"), FullFileName.GetData()); line.Printf( _( "File %s not found" ), FullFileName.GetData() );
DisplayError(this, line); return; DisplayError( this, line ); return;
} }
Read_Config( FullFileName ); Read_Config( FullFileName );
m_DoUpdate = FALSE; m_DoUpdate = FALSE;
Close(TRUE); Close( TRUE );
} }
/*******************************************************/ /*******************************************************/
void KiConfigCvpcbFrame::LibDelFct(wxCommandEvent& event) void KiConfigCvpcbFrame::LibDelFct( wxCommandEvent& event )
/*******************************************************/ /*******************************************************/
{ {
int ii; int ii;
ii = m_ListLibr->GetSelection(); ii = m_ListLibr->GetSelection();
if ( ii < 0 ) return; if( ii < 0 )
return;
ListModIsModified = 1; ListModIsModified = 1;
g_LibName_List.RemoveAt(ii); g_LibName_List.RemoveAt( ii );
/* suppression de la reference dans la liste des librairies */ /* suppression de la reference dans la liste des librairies */
m_ListLibr->Delete(ii); m_ListLibr->Delete( ii );
g_UserLibDirBuffer = m_LibDirCtrl->GetValue(); g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") ); SetRealLibraryPath( wxT( "modules" ) );
listlib(); listlib();
m_Parent->BuildFootprintListBox(); m_Parent->BuildFootprintListBox();
} }
/********************************************************/ /********************************************************/
void KiConfigCvpcbFrame::LibAddFct(wxCommandEvent& event) void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
/********************************************************/ /********************************************************/
{ {
int ii; int ii;
wxString FullFileName, ShortLibName, mask; wxString FullFileName, ShortLibName, mask;
ii = m_ListLibr->GetSelection(); ii = m_ListLibr->GetSelection();
if ( event.GetId() == ADD_LIB ) /* Ajout apres selection */ if( event.GetId() == ADD_LIB ) /* Ajout apres selection */
{ {
ii ++; ii++;
} }
if ( ii < 0 ) ii = 0; if( ii < 0 )
ii = 0;
Update(); Update();
mask = wxT("*") + LibExtBuffer; mask = wxT( "*" ) + LibExtBuffer;
wxFileDialog FilesDialog(this, _("Library files:"), g_RealLibDirBuffer, wxFileDialog FilesDialog( this, _( "Library files:" ), g_RealLibDirBuffer,
wxEmptyString, mask, wxEmptyString, mask,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE); wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
FilesDialog.ShowModal(); FilesDialog.ShowModal();
wxArrayString Filenames; wxArrayString Filenames;
FilesDialog.GetPaths(Filenames); FilesDialog.GetPaths( Filenames );
if ( Filenames.GetCount() == 0 ) if( Filenames.GetCount() == 0 )
return; return;
for ( unsigned jj = 0; jj < Filenames.GetCount(); jj ++ ) for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{ {
FullFileName = Filenames[jj]; FullFileName = Filenames[jj];
ShortLibName = MakeReducedFileName(FullFileName,g_RealLibDirBuffer,LibExtBuffer); ShortLibName = MakeReducedFileName( FullFileName,
g_RealLibDirBuffer,
LibExtBuffer );
//Add or insert new library name //Add or insert new library name
if ( g_LibName_List.Index(ShortLibName) == wxNOT_FOUND) if( g_LibName_List.Index( ShortLibName ) == wxNOT_FOUND )
{ {
ListModIsModified = 1; ListModIsModified = 1;
g_LibName_List.Insert(ShortLibName, ii++); g_LibName_List.Insert( ShortLibName, ii++ );
} }
else else
{ {
wxString msg; wxString msg;
msg << wxT("<") << ShortLibName << wxT("> : ") << _("Library already in use"); msg << wxT( "<" ) << ShortLibName << wxT( "> : " ) << _(
DisplayError(this, msg); "Library already in use" );
DisplayError( this, msg );
} }
} }
g_UserLibDirBuffer = m_LibDirCtrl->GetValue(); g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") ); SetRealLibraryPath( wxT( "modules" ) );
listlib(); listlib();
m_Parent->BuildFootprintListBox(); m_Parent->BuildFootprintListBox();
m_ListLibr->Clear(); m_ListLibr->Clear();
m_ListLibr->InsertItems(g_LibName_List, 0); m_ListLibr->InsertItems( g_LibName_List, 0 );
} }
/********************************************************/ /********************************************************/
void KiConfigCvpcbFrame::EquDelFct(wxCommandEvent& event) void KiConfigCvpcbFrame::EquDelFct( wxCommandEvent& event )
/********************************************************/ /********************************************************/
{ {
int ii; int ii;
ii = m_ListEquiv->GetSelection(); ii = m_ListEquiv->GetSelection();
if ( ii < 0 ) return; if( ii < 0 )
return;
g_ListName_Equ.RemoveAt(ii); g_ListName_Equ.RemoveAt( ii );
m_ListEquiv->Delete(ii); m_ListEquiv->Delete( ii );
} }
/********************************************************/ /********************************************************/
void KiConfigCvpcbFrame::EquAddFct(wxCommandEvent& event) void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event )
/********************************************************/ /********************************************************/
{ {
int ii; int ii;
wxString FullFileName, ShortLibName, mask; wxString FullFileName, ShortLibName, mask;
ii = m_ListEquiv->GetSelection(); ii = m_ListEquiv->GetSelection();
if ( event.GetId() == ADD_EQU ) ii ++; /* Ajout apres selection */ if( event.GetId() == ADD_EQU )
if ( ii < 0 ) ii = 0; ii++; /* Ajout apres selection */
if( ii < 0 )
ii = 0;
Update(); Update();
mask = wxT("*") + g_EquivExtBuffer; mask = wxT( "*" ) + g_EquivExtBuffer;
wxFileDialog FilesDialog(this, _("Equiv Files:"), g_RealLibDirBuffer, wxFileDialog FilesDialog( this, _( "Equiv Files:" ), g_RealLibDirBuffer,
wxEmptyString, mask, wxEmptyString, mask,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE); wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
FilesDialog.ShowModal(); FilesDialog.ShowModal();
wxArrayString Filenames; wxArrayString Filenames;
FilesDialog.GetFilenames(Filenames); FilesDialog.GetFilenames( Filenames );
if ( Filenames.GetCount() == 0 ) if( Filenames.GetCount() == 0 )
return; return;
for ( unsigned jj = 0; jj < Filenames.GetCount(); jj ++ ) for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{ {
FullFileName = Filenames[jj]; FullFileName = Filenames[jj];
ShortLibName = MakeReducedFileName(FullFileName,g_RealLibDirBuffer,g_EquivExtBuffer); ShortLibName = MakeReducedFileName( FullFileName,
g_RealLibDirBuffer,
g_EquivExtBuffer );
//Add or insert new equiv library name //Add or insert new equiv library name
if ( g_ListName_Equ.Index(ShortLibName) == wxNOT_FOUND) if( g_ListName_Equ.Index( ShortLibName ) == wxNOT_FOUND )
{ {
g_ListName_Equ.Insert(ShortLibName, ii++); g_ListName_Equ.Insert( ShortLibName, ii++ );
} }
else else
{ {
wxString msg; wxString msg;
msg << wxT("<") << ShortLibName << wxT("> : ") << _("Library already in use"); msg << wxT( "<" ) << ShortLibName << wxT( "> : " ) << _(
DisplayError(this, msg); "Library already in use" );
DisplayError( this, msg );
} }
} }
/* Update display list */ /* Update display list */
g_UserLibDirBuffer = m_LibDirCtrl->GetValue(); g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") ); SetRealLibraryPath( wxT( "modules" ) );
listlib(); listlib();
m_ListEquiv->Clear(); m_ListEquiv->Clear();
m_ListEquiv->InsertItems(g_ListName_Equ, 0); m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
} }
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h"
#include "common.h" #include "common.h"
#include "cvpcb.h" #include "cvpcb.h"
#include "3d_viewer.h" #include "3d_viewer.h"
...@@ -28,9 +27,9 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() ...@@ -28,9 +27,9 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
if( DrawFrame == NULL ) if( DrawFrame == NULL )
{ {
DrawFrame = new WinEDA_DisplayFrame( this, m_Parent, _( "Module" ), DrawFrame = new WinEDA_DisplayFrame( this, _( "Module" ),
wxPoint( 0, 0 ), wxSize( 600, wxPoint( 0, 0 ),
400 ), wxSize( 600, 400 ),
KICAD_DEFAULT_DRAWFRAME_STYLE | KICAD_DEFAULT_DRAWFRAME_STYLE |
wxFRAME_FLOAT_ON_PARENT ); wxFRAME_FLOAT_ON_PARENT );
IsNew = TRUE; IsNew = TRUE;
......
/***************************************************/ /***************************************************/
/* tool_cvpcb.cpp: construction du menu principal */ /* tool_cvpcb.cpp: construction du menu principal */
/***************************************************/ /***************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "cvpcb.h" #include "cvpcb.h"
...@@ -12,8 +10,6 @@ ...@@ -12,8 +10,6 @@
#include "protos.h" #include "protos.h"
#define BITMAP wxBitmap
#include "bitmaps.h" #include "bitmaps.h"
#include "id.h" #include "id.h"
...@@ -23,64 +19,71 @@ ...@@ -23,64 +19,71 @@
void WinEDA_CvpcbFrame::ReCreateHToolbar() void WinEDA_CvpcbFrame::ReCreateHToolbar()
/*********************************************/ /*********************************************/
{ {
if ( m_HToolBar != NULL ) return; wxConfig* config = wxGetApp().m_EDA_Config;
m_HToolBar = new WinEDA_Toolbar(TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE); if( m_HToolBar != NULL )
SetToolBar(m_HToolBar); return;
m_HToolBar->AddTool(ID_CVPCB_READ_INPUT_NETLIST, BITMAP(open_xpm), m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
_("Open a NetList file")); SetToolBar( m_HToolBar );
m_HToolBar->AddTool(ID_CVPCB_SAVEQUITCVPCB, BITMAP(save_xpm), m_HToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxBitmap( open_xpm ),
_("Save NetList and Footprints List files")); _( "Open a NetList file" ) );
m_HToolBar->AddTool( ID_CVPCB_SAVEQUITCVPCB, wxBitmap( save_xpm ),
_( "Save NetList and Footprints List files" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_CREATE_CONFIGWINDOW, BITMAP(config_xpm), m_HToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxBitmap( config_xpm ),
_("Configuration")); _( "Configuration" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_CREATE_SCREENCMP, BITMAP(module_xpm), m_HToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxBitmap( module_xpm ),
_("View selected footprint")); _( "View selected footprint" ) );
m_HToolBar->AddTool(ID_CVPCB_AUTO_ASSOCIE, BITMAP(auto_associe_xpm), m_HToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxBitmap( auto_associe_xpm ),
_("Automatic Association")); _( "Automatic Association" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_GOTO_PREVIOUSNA, BITMAP(left_xpm), m_HToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxBitmap( left_xpm ),
_("Select previous free component")); _( "Select previous free component" ) );
m_HToolBar->AddTool(ID_CVPCB_GOTO_FIRSTNA, BITMAP(right_xpm), m_HToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxBitmap( right_xpm ),
_("Select next free component")); _( "Select next free component" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_DEL_ASSOCIATIONS, BITMAP(delete_association_xpm), m_HToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS,
_("Delete all associations")); wxBitmap( delete_association_xpm ),
_( "Delete all associations" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_CREATE_STUFF_FILE, BITMAP(save_cmpstuff_xpm), m_HToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE,
_("Create stuff file (component/footprint list)")); wxBitmap( save_cmpstuff_xpm ),
_( "Create stuff file (component/footprint list)" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_PCB_DISPLAY_FOOTPRINT_DOC, BITMAP(file_footprint_xpm), m_HToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC,
_("Display footprints list documentation")); wxBitmap( file_footprint_xpm ),
_( "Display footprints list documentation" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddRadioTool(ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, m_HToolBar->AddRadioTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
wxEmptyString, BITMAP(module_filtered_list_xpm), wxEmptyString,
wxBitmap( module_filtered_list_xpm ),
wxNullBitmap, wxNullBitmap,
_("Display the filtered footprint list for the current component")); _( "Display the filtered footprint list for the current component" ) );
m_HToolBar->AddRadioTool(ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, m_HToolBar->AddRadioTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
wxEmptyString, BITMAP(module_full_list_xpm), wxEmptyString, wxBitmap( module_full_list_xpm ),
wxNullBitmap, wxNullBitmap,
_("Display the full footprint list (without filtering)")); _( "Display the full footprint list (without filtering)" ) );
if( m_Parent->m_EDA_Config ) if( config )
{ {
wxString key = wxT(FILTERFOOTPRINTKEY); wxString key = wxT( FILTERFOOTPRINTKEY );
int opt = m_Parent->m_EDA_Config->Read(key, (long)1); int opt = config->Read( key, (long) 1 );
m_HToolBar->ToggleTool(ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt); m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt );
m_HToolBar->ToggleTool(ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, ! opt); m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, !opt );
} }
// after adding the buttons to the toolbar, must call Realize() to reflect // after adding the buttons to the toolbar, must call Realize() to reflect
...@@ -92,97 +95,104 @@ void WinEDA_CvpcbFrame::ReCreateHToolbar() ...@@ -92,97 +95,104 @@ void WinEDA_CvpcbFrame::ReCreateHToolbar()
/*******************************************/ /*******************************************/
void WinEDA_CvpcbFrame::ReCreateMenuBar() void WinEDA_CvpcbFrame::ReCreateMenuBar()
/*******************************************/ /*******************************************/
/* Creation des menus de la fenetre principale /* Creation des menus de la fenetre principale
*/ */
{ {
int ii; int ii;
wxMenuBar * menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL ) if( menuBar == NULL )
{ {
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menuBar); SetMenuBar( menuBar );
m_FilesMenu = new wxMenu; m_FilesMenu = new wxMenu;
wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_LOAD_PROJECT, wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT,
_("&Open"), _( "&Open" ),
_("Open a NetList file") ); _( "Open a NetList file" ) );
item->SetBitmap(open_xpm); item->SetBitmap( open_xpm );
m_FilesMenu->Append(item); m_FilesMenu->Append( item );
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_SAVE_PROJECT, item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT,
_("&Save As..."), _( "&Save As..." ),
_("Save New NetList and Footprints List files") ); _( "Save New NetList and Footprints List files" ) );
item->SetBitmap(save_xpm); item->SetBitmap( save_xpm );
m_FilesMenu->Append(item); m_FilesMenu->Append( item );
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_CVPCB_QUIT, _("E&xit"), _("Quit Cvpcb" )); item = new wxMenuItem( m_FilesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
item->SetBitmap(exit_xpm); _( "Quit Cvpcb" ) );
m_FilesMenu->Append(item); item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item );
// Creation des selections des anciens fichiers // Creation des selections des anciens fichiers
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
for ( ii = 0; ii < 10; ii++ ) for( ii = 0; ii < 10; ii++ )
{ {
if ( GetLastProject(ii).IsEmpty() ) break; if( GetLastProject( ii ).IsEmpty() )
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
} }
// Menu Configuration: // Menu Configuration:
wxMenu * configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
item = new wxMenuItem(configmenu, ID_CONFIG_REQ, _("&Configuration"), item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_("Setting Libraries, Directories and others...")); _( "Setting Libraries, Directories and others..." ) );
item->SetBitmap(config_xpm); item->SetBitmap( config_xpm );
configmenu->Append(item); configmenu->Append( item );
// Font selection and setup // Font selection and setup
AddFontSelectionMenu(configmenu); AddFontSelectionMenu( configmenu );
m_Parent->SetLanguageList(configmenu); wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
_("&Save config"), _( "&Save config" ),
_("Save configuration in current dir")); _( "Save configuration in current dir" ) );
item->SetBitmap(save_setup_xpm); item->SetBitmap( save_setup_xpm );
configmenu->Append(item); configmenu->Append( item );
// Menu Help: // Menu Help:
wxMenu *helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem(helpMenu , ID_CVPCB_DISPLAY_HELP, _("&Contents"), item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ),
_("Open the cvpcb manual")); _( "Open the cvpcb manual" ) );
item->SetBitmap(help_xpm); item->SetBitmap( help_xpm );
helpMenu->Append(item); helpMenu->Append( item );
item = new wxMenuItem(helpMenu , ID_CVPCB_DISPLAY_LICENCE, _("&About cvpcb"), item =
_("About cvpcb schematic to pcb converter")); new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
item->SetBitmap(info_xpm); _( "&About cvpcb" ),
helpMenu->Append(item); _( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm );
menuBar->Append(m_FilesMenu, _("&File")); helpMenu->Append( item );
menuBar->Append(configmenu, _("&Preferences"));
menuBar->Append(helpMenu, _("&Help")); menuBar->Append( m_FilesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
} }
else // simple mise a jour de la liste des fichiers anciens else // simple mise a jour de la liste des fichiers anciens
{ {
wxMenuItem * item; wxMenuItem* item;
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = wxGetApp().m_LastProjectMaxCount;
for ( ii = max_file-1; ii >=0 ; ii-- ) for( ii = max_file - 1; ii >=0; ii-- )
{ {
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{ {
item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii); item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if ( item ) delete item; if( item )
delete item;
} }
} }
for ( ii = 0; ii < max_file; ii++ )
for( ii = 0; ii < max_file; ii++ )
{ {
if ( GetLastProject(ii).IsEmpty() ) break; if( GetLastProject( ii ).IsEmpty() )
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
} }
} }
} }
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
/****************************************************/ /****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -19,17 +18,22 @@ ...@@ -19,17 +18,22 @@
/* Fonctions exportees */ /* Fonctions exportees */
/* Fonctions Locales */ /* Fonctions Locales */
static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen, static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel,
wxDC* DC,
BASE_SCREEN* screen,
SCH_ITEM* DrawStruct ); SCH_ITEM* DrawStruct );
static void CollectStructsToDrag( SCH_SCREEN* screen ); static void CollectStructsToDrag( SCH_SCREEN* screen );
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ); static void AddPickedItem( SCH_SCREEN* screen, wxPoint position );
static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem, static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
wxPoint& position ); wxPoint& position );
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
static SCH_ITEM * SaveStructListForPaste( SCH_ITEM* DrawStruct ); wxDC* DC,
bool erase );
static SCH_ITEM* SaveStructListForPaste( SCH_ITEM* DrawStruct );
static bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, static bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM * DrawStruct, wxPoint& Center ); SCH_ITEM* DrawStruct, wxPoint& Center );
static void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center ); static void MirrorOneStruct( SCH_ITEM* DrawStruct,
wxPoint& Center );
/*************************************************************************/ /*************************************************************************/
int WinEDA_SchematicFrame::ReturnBlockCommand( int key ) int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
...@@ -100,7 +104,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -100,7 +104,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
bool err = FALSE; bool err = FALSE;
DrawBlockStruct* block = &GetScreen()->BlockLocate; DrawBlockStruct* block = &GetScreen()->BlockLocate;
SCH_ITEM * NewStruct = NULL; SCH_ITEM* NewStruct = NULL;
if( DrawPanel->ManageCurseur == NULL ) if( DrawPanel->ManageCurseur == NULL )
{ {
...@@ -112,7 +116,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -112,7 +116,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
{ {
wxString msg; wxString msg;
err = TRUE; err = TRUE;
msg.Printf( wxT( "HandleBlockPLace() : m_BlockDrawStruct = NULL (cmd %d, state %d)" ), msg.Printf( wxT( "HandleBlockPLace() : m_BlockDrawStruct = " \
"NULL (cmd %d, state %d)" ),
block->m_Command, block->m_State ); block->m_Command, block->m_State );
DisplayError( this, msg ); DisplayError( this, msg );
} }
...@@ -130,9 +135,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -130,9 +135,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
SaveCopyInUndoList( (SCH_ITEM*)block->m_BlockDrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) block->m_BlockDrawStruct, IS_CHANGED );
MoveStruct( DrawPanel, DC, (SCH_ITEM*)block->m_BlockDrawStruct ); MoveStruct( DrawPanel, DC, (SCH_ITEM*) block->m_BlockDrawStruct );
block->m_BlockDrawStruct = NULL; block->m_BlockDrawStruct = NULL;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
...@@ -142,10 +147,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -142,10 +147,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
NewStruct = CopyStruct( DrawPanel, DC, GetScreen(), (SCH_ITEM*)block->m_BlockDrawStruct ); NewStruct = CopyStruct( DrawPanel, DC,
GetScreen(),
(SCH_ITEM*) block->m_BlockDrawStruct );
SaveCopyInUndoList( NewStruct, SaveCopyInUndoList(
(block->m_Command == BLOCK_PRESELECT_MOVE) ? IS_CHANGED : IS_NEW ); NewStruct,
(block->m_Command ==
BLOCK_PRESELECT_MOVE) ? IS_CHANGED : IS_NEW );
block->m_BlockDrawStruct = NULL; block->m_BlockDrawStruct = NULL;
break; break;
...@@ -173,7 +182,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -173,7 +182,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
/* clear struct.m_Flags */ /* clear struct.m_Flags */
SCH_ITEM* Struct; SCH_ITEM* Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() ) for( Struct = GetScreen()->EEDrawList;
Struct != NULL;
Struct = Struct->Next() )
Struct->m_Flags = 0; Struct->m_Flags = 0;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
...@@ -187,11 +198,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -187,11 +198,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( block->m_BlockDrawStruct ) if( block->m_BlockDrawStruct )
{ {
DisplayError( this, wxT( "HandleBlockPLace() error: DrawStruct != Null" ) ); DisplayError( this,
wxT( "HandleBlockPLace() error: DrawStruct != Null" ) );
block->m_BlockDrawStruct = NULL; block->m_BlockDrawStruct = NULL;
} }
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state,
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
} }
...@@ -267,7 +281,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -267,7 +281,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
ii = -1; ii = -1;
DeleteStruct( DrawPanel, DC, (SCH_ITEM*) block->m_BlockDrawStruct ); DeleteStruct( DrawPanel,
DC,
(SCH_ITEM*) block->m_BlockDrawStruct );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
block->m_BlockDrawStruct = NULL; block->m_BlockDrawStruct = NULL;
...@@ -283,8 +299,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -283,8 +299,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
{ {
wxPoint oldpos = GetScreen()->m_Curseur; wxPoint oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
SCH_ITEM * DrawStructCopy = SCH_ITEM* DrawStructCopy =
SaveStructListForPaste( (SCH_ITEM*)block->m_BlockDrawStruct ); SaveStructListForPaste(
(SCH_ITEM*) block->m_BlockDrawStruct );
PlaceStruct( GetScreen(), DrawStructCopy ); PlaceStruct( GetScreen(), DrawStructCopy );
GetScreen()->m_Curseur = oldpos; GetScreen()->m_Curseur = oldpos;
ii = -1; ii = -1;
...@@ -316,7 +333,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -316,7 +333,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
if( block->m_Command == BLOCK_ABORT ) if( block->m_Command == BLOCK_ABORT )
{ /* clear struct.m_Flags */ { /* clear struct.m_Flags */
EDA_BaseStruct* Struct; EDA_BaseStruct* Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() ) for( Struct = GetScreen()->EEDrawList;
Struct != NULL;
Struct = Struct->Next() )
Struct->m_Flags = 0; Struct->m_Flags = 0;
} }
...@@ -328,7 +347,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -328,7 +347,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state,
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
} }
if( zoom_command ) if( zoom_command )
...@@ -414,7 +435,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -414,7 +435,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
{ {
wxPoint oldpos = GetScreen()->m_Curseur; wxPoint oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
SCH_ITEM * DrawStructCopy = SCH_ITEM* DrawStructCopy =
SaveStructListForPaste( (SCH_ITEM*) block->m_BlockDrawStruct ); SaveStructListForPaste( (SCH_ITEM*) block->m_BlockDrawStruct );
PlaceStruct( GetScreen(), DrawStructCopy ); PlaceStruct( GetScreen(), DrawStructCopy );
GetScreen()->m_Curseur = oldpos; GetScreen()->m_Curseur = oldpos;
...@@ -424,7 +445,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -424,7 +445,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
DrawPanel->SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor ); DrawPanel->SetCursor(
DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
Window_Zoom( GetScreen()->BlockLocate ); Window_Zoom( GetScreen()->BlockLocate );
break; break;
...@@ -438,13 +460,17 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -438,13 +460,17 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
SaveCopyInUndoList( (SCH_ITEM*)block->m_BlockDrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) block->m_BlockDrawStruct,
IS_CHANGED );
ii = -1; ii = -1;
/* Compute the mirror centre and put it on grid */ /* Compute the mirror centre and put it on grid */
wxPoint Center = block->Centre(); wxPoint Center = block->Centre();
PutOnGrid( &Center ); PutOnGrid( &Center );
MirrorStruct( DrawPanel, DC, (SCH_ITEM*)block->m_BlockDrawStruct, Center ); MirrorStruct( DrawPanel,
DC,
(SCH_ITEM*) block->m_BlockDrawStruct,
Center );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
...@@ -463,7 +489,9 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -463,7 +489,9 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state,
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
} }
} }
...@@ -499,7 +527,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -499,7 +527,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
DrawStructsInGhost( panel, DrawStructsInGhost( panel,
DC, DC,
(SCH_ITEM*)PickedList->m_PickedStruct, (SCH_ITEM*) PickedList->m_PickedStruct,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y ); PtBlock->m_MoveVector.y );
PickedList = (DrawPickedStruct*) PickedList->Next(); PickedList = (DrawPickedStruct*) PickedList->Next();
...@@ -508,15 +536,17 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -508,15 +536,17 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
else else
DrawStructsInGhost( panel, DrawStructsInGhost( panel,
DC, DC,
(SCH_ITEM*)PtBlock->m_BlockDrawStruct, (SCH_ITEM*) PtBlock->m_BlockDrawStruct,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y ); PtBlock->m_MoveVector.y );
} }
/* Redessin nouvel affichage */ /* Redessin nouvel affichage */
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x; PtBlock->m_MoveVector.x = screen->m_Curseur.x -
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y; PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y -
PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
PtBlock->Offset( PtBlock->m_MoveVector ); PtBlock->Offset( PtBlock->m_MoveVector );
...@@ -532,7 +562,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -532,7 +562,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
DrawStructsInGhost( panel, DrawStructsInGhost( panel,
DC, DC,
(SCH_ITEM*)PickedList->m_PickedStruct, (SCH_ITEM*) PickedList->m_PickedStruct,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y ); PtBlock->m_MoveVector.y );
PickedList = (DrawPickedStruct*) PickedList->Next(); PickedList = (DrawPickedStruct*) PickedList->Next();
...@@ -541,7 +571,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -541,7 +571,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
else else
DrawStructsInGhost( panel, DrawStructsInGhost( panel,
DC, DC,
(SCH_ITEM*)PtBlock->m_BlockDrawStruct, (SCH_ITEM*) PtBlock->m_BlockDrawStruct,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y ); PtBlock->m_MoveVector.y );
} }
...@@ -565,7 +595,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) ...@@ -565,7 +595,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
if( DC ) if( DC )
panel->PostDirtyRect( pickedList->GetBoundingBoxUnion() ); panel->PostDirtyRect( pickedList->GetBoundingBoxUnion() );
PlaceStruct( panel->GetScreen(), pickedList); // Place it in its new position. PlaceStruct( panel->GetScreen(), pickedList ); // Place it in its new position.
if( DC ) if( DC )
RedrawStructList( panel, DC, pickedList, GR_DEFAULT_DRAWMODE ); RedrawStructList( panel, DC, pickedList, GR_DEFAULT_DRAWMODE );
...@@ -576,7 +606,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) ...@@ -576,7 +606,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
else else
{ {
if( DC ) if( DC )
panel->PostDirtyRect( DrawStruct->GetBoundingBox()); panel->PostDirtyRect( DrawStruct->GetBoundingBox() );
PlaceStruct( panel->GetScreen(), DrawStruct ); /* Place it in its new position. */ PlaceStruct( panel->GetScreen(), DrawStruct ); /* Place it in its new position. */
if( DC ) if( DC )
RedrawOneStruct( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
...@@ -594,7 +624,7 @@ static void MirrorYPoint( wxPoint& point, wxPoint& Center ) ...@@ -594,7 +624,7 @@ static void MirrorYPoint( wxPoint& point, wxPoint& Center )
/**************************************************************/ /**************************************************************/
void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center ) void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
/**************************************************************/ /**************************************************************/
/* Given a structure rotate it to 90 degrees refer to the Center point. /* Given a structure rotate it to 90 degrees refer to the Center point.
...@@ -612,10 +642,13 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center ) ...@@ -612,10 +642,13 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
DrawNoConnectStruct* DrawNoConnect; DrawNoConnectStruct* DrawNoConnect;
SCH_TEXT* DrawText; SCH_TEXT* DrawText;
wxPoint px; wxPoint px;
WinEDA_SchematicFrame* frame;
if( !DrawStruct ) if( !DrawStruct )
return; return;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
...@@ -684,7 +717,7 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center ) ...@@ -684,7 +717,7 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
MirrorYPoint( px, Center ); MirrorYPoint( px, Center );
px.x -= dx; px.x -= dx;
g_EDA_Appl->m_SchematicFrame->PutOnGrid( &px ); frame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
...@@ -700,23 +733,23 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center ) ...@@ -700,23 +733,23 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
px = DrawText->m_Pos; px = DrawText->m_Pos;
MirrorYPoint( px, Center ); MirrorYPoint( px, Center );
g_EDA_Appl->m_SchematicFrame->PutOnGrid( &px ); frame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
DrawLibItem = (SCH_COMPONENT*) DrawStruct; DrawLibItem = (SCH_COMPONENT*) DrawStruct;
dx = DrawLibItem->m_Pos.x; dx = DrawLibItem->m_Pos.x;
g_EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem, frame->CmpRotationMiroir( DrawLibItem, NULL, CMP_MIROIR_Y );
NULL, CMP_MIROIR_Y );
MirrorYPoint( DrawLibItem->m_Pos, Center ); MirrorYPoint( DrawLibItem->m_Pos, Center );
dx -= DrawLibItem->m_Pos.x; dx -= DrawLibItem->m_Pos.x;
for( ii = 0; ii < DrawLibItem->GetFieldCount(); ii++ ) for( ii = 0; ii < DrawLibItem->GetFieldCount(); ii++ )
{ {
/* move the fields to the new position because the component itself has moved */ /* move the fields to the new position because the component itself has moved */
DrawLibItem->GetField(ii)->m_Pos.x -= dx; DrawLibItem->GetField( ii )->m_Pos.x -= dx;
} }
break; break;
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
...@@ -729,7 +762,8 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center ) ...@@ -729,7 +762,8 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
{ {
MirrorYPoint( DrawSheetLabel->m_Pos, Center ); MirrorYPoint( DrawSheetLabel->m_Pos, Center );
DrawSheetLabel->m_Edge = DrawSheetLabel->m_Edge ? 0 : 1; DrawSheetLabel->m_Edge = DrawSheetLabel->m_Edge ? 0 : 1;
DrawSheetLabel = (Hierarchical_PIN_Sheet_Struct*) DrawSheetLabel->Next(); DrawSheetLabel =
(Hierarchical_PIN_Sheet_Struct*) DrawSheetLabel->Next();
} }
break; break;
...@@ -753,7 +787,10 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center ) ...@@ -753,7 +787,10 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is * * If DrawStruct is of type DrawPickedStruct, a list of objects picked is *
* assumed, otherwise exactly one structure is assumed been picked. * * assumed, otherwise exactly one structure is assumed been picked. *
*****************************************************************************/ *****************************************************************************/
bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct, wxPoint& Center ) bool MirrorStruct( WinEDA_DrawPanel* panel,
wxDC* DC,
SCH_ITEM* DrawStruct,
wxPoint& Center )
{ {
if( !DrawStruct ) if( !DrawStruct )
return FALSE; return FALSE;
...@@ -765,7 +802,7 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct, wxP ...@@ -765,7 +802,7 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct, wxP
if( DC ) if( DC )
panel->PostDirtyRect( pickedList->GetBoundingBoxUnion() ); panel->PostDirtyRect( pickedList->GetBoundingBoxUnion() );
for( DrawPickedStruct* cur = pickedList; cur; cur=cur->Next() ) for( DrawPickedStruct* cur = pickedList; cur; cur = cur->Next() )
{ {
MirrorOneStruct( (SCH_ITEM*) cur->m_PickedStruct, Center ); MirrorOneStruct( (SCH_ITEM*) cur->m_PickedStruct, Center );
cur->m_PickedStruct->m_Flags = 0; cur->m_PickedStruct->m_Flags = 0;
...@@ -795,8 +832,10 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct, wxP ...@@ -795,8 +832,10 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct, wxP
/*****************************************************************************/ /*****************************************************************************/
static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen, static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel,
SCH_ITEM * DrawStruct ) wxDC* DC,
BASE_SCREEN* screen,
SCH_ITEM* DrawStruct )
/*****************************************************************************/ /*****************************************************************************/
/* Routine to copy a new entity of an object and reposition it. /* Routine to copy a new entity of an object and reposition it.
...@@ -805,7 +844,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc ...@@ -805,7 +844,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
* Return the new created struct * Return the new created struct
*/ */
{ {
SCH_ITEM * NewDrawStruct; SCH_ITEM* NewDrawStruct;
DrawPickedStruct* PickedList = NULL; DrawPickedStruct* PickedList = NULL;
if( !DrawStruct ) if( !DrawStruct )
...@@ -829,7 +868,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc ...@@ -829,7 +868,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
{ {
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL); ( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
} }
break; break;
...@@ -894,7 +933,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc ...@@ -894,7 +933,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
( (SCH_COMPONENT*) NewDrawStruct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) NewDrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation(NULL); ( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation( NULL );
break; break;
} }
...@@ -917,7 +956,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc ...@@ -917,7 +956,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
/*********************************************************************************/ /*********************************************************************************/
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct ) void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
/*********************************************************************************/ /*********************************************************************************/
/* Routine to delete an object from global drawing object list. /* Routine to delete an object from global drawing object list.
...@@ -934,8 +973,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct ) ...@@ -934,8 +973,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct )
{ {
/* Cette stucture est rattachee a une feuille, et n'est pas /* Cette stucture est rattachee a une feuille, et n'est pas
* accessible par la liste globale directement */ * accessible par la liste globale directement */
frame->SaveCopyInUndoList( (SCH_ITEM*) ( (Hierarchical_PIN_Sheet_Struct*) DrawStruct )->GetParent(), IS_CHANGED ); frame->SaveCopyInUndoList( (SCH_ITEM*)( (Hierarchical_PIN_Sheet_Struct
frame->DeleteSheetLabel( DC ? true : false , (Hierarchical_PIN_Sheet_Struct*) DrawStruct ); *) DrawStruct )->GetParent(),
IS_CHANGED );
frame->DeleteSheetLabel( DC ? true : false,
(Hierarchical_PIN_Sheet_Struct*) DrawStruct );
return; return;
} }
...@@ -943,9 +985,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct ) ...@@ -943,9 +985,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct )
{ {
// Unlink all picked structs from current EEDrawList // Unlink all picked structs from current EEDrawList
for( DrawPickedStruct* cur = (DrawPickedStruct*) DrawStruct; cur; cur=cur->Next() ) for( DrawPickedStruct* cur = (DrawPickedStruct*) DrawStruct;
cur;
cur = cur->Next() )
{ {
SCH_ITEM * item = cur->m_PickedStruct; SCH_ITEM* item = cur->m_PickedStruct;
screen->RemoveFromDrawList( item ); screen->RemoveFromDrawList( item );
panel->PostDirtyRect( item->GetBoundingBox() ); panel->PostDirtyRect( item->GetBoundingBox() );
item->SetNext( 0 ); item->SetNext( 0 );
...@@ -977,7 +1021,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct ) ...@@ -977,7 +1021,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct )
/*****************************************************************/ /*****************************************************************/
SCH_ITEM * SaveStructListForPaste( SCH_ITEM * DrawStruct ) SCH_ITEM* SaveStructListForPaste( SCH_ITEM* DrawStruct )
/*****************************************************************/ /*****************************************************************/
/* Routine to Save an object from global drawing object list. /* Routine to Save an object from global drawing object list.
...@@ -987,7 +1031,7 @@ SCH_ITEM * SaveStructListForPaste( SCH_ITEM * DrawStruct ) ...@@ -987,7 +1031,7 @@ SCH_ITEM * SaveStructListForPaste( SCH_ITEM * DrawStruct )
*/ */
{ {
DrawPickedStruct* PickedList; DrawPickedStruct* PickedList;
SCH_ITEM * DrawStructCopy; SCH_ITEM* DrawStructCopy;
if( !DrawStruct ) if( !DrawStruct )
return NULL; return NULL;
...@@ -1027,7 +1071,7 @@ SCH_ITEM * SaveStructListForPaste( SCH_ITEM * DrawStruct ) ...@@ -1027,7 +1071,7 @@ SCH_ITEM * SaveStructListForPaste( SCH_ITEM * DrawStruct )
*****************************************************************************/ *****************************************************************************/
void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
{ {
SCH_ITEM * DrawStruct; SCH_ITEM* DrawStruct;
DrawPickedStruct* PickedList = NULL; DrawPickedStruct* PickedList = NULL;
if( g_BlockSaveDataList == NULL ) if( g_BlockSaveDataList == NULL )
...@@ -1051,7 +1095,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1051,7 +1095,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == TYPE_SCH_COMPONENT )
{ {
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL); ( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
SetaParent( Struct, GetScreen() ); SetaParent( Struct, GetScreen() );
} }
PickedList = (DrawPickedStruct*) PickedList->Next(); PickedList = (DrawPickedStruct*) PickedList->Next();
...@@ -1060,7 +1104,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1060,7 +1104,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; ) for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; )
{ {
SCH_ITEM * Struct = PickedList->m_PickedStruct; SCH_ITEM* Struct = PickedList->m_PickedStruct;
Struct->SetNext( GetScreen()->EEDrawList ); Struct->SetNext( GetScreen()->EEDrawList );
SetaParent( Struct, GetScreen() ); SetaParent( Struct, GetScreen() );
GetScreen()->EEDrawList = Struct; GetScreen()->EEDrawList = Struct;
...@@ -1075,7 +1119,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1075,7 +1119,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
if( DrawStruct->Type() == TYPE_SCH_COMPONENT ) if( DrawStruct->Type() == TYPE_SCH_COMPONENT )
{ {
( (SCH_COMPONENT*) DrawStruct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) DrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation(NULL); ( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation( NULL );
} }
SetaParent( DrawStruct, GetScreen() ); SetaParent( DrawStruct, GetScreen() );
RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
...@@ -1085,8 +1129,10 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1085,8 +1129,10 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
} }
/* clear .m_Flags member for all items */ /* clear .m_Flags member for all items */
SCH_ITEM * Struct; SCH_ITEM* Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() ) for( Struct = GetScreen()->EEDrawList;
Struct != NULL;
Struct = Struct->Next() )
Struct->m_Flags = 0; Struct->m_Flags = 0;
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -1098,7 +1144,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1098,7 +1144,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
/***************************************************************************** /*****************************************************************************
* Routine to place a given object. * * Routine to place a given object. *
*****************************************************************************/ *****************************************************************************/
bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM * DrawStruct ) bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM* DrawStruct )
{ {
DrawPickedStruct* DrawStructs; DrawPickedStruct* DrawStructs;
wxPoint move_vector; wxPoint move_vector;
...@@ -1149,7 +1195,7 @@ bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM * DrawStruct ) ...@@ -1149,7 +1195,7 @@ bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM * DrawStruct )
/**************************************************************************/ /**************************************************************************/
void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector ) void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
/*************************************************************************/ /*************************************************************************/
/* Given a structure move it by Dx, Dy. /* Given a structure move it by Dx, Dy.
...@@ -1238,7 +1284,7 @@ void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector ) ...@@ -1238,7 +1284,7 @@ void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector )
DrawLibItem->m_Pos += move_vector; DrawLibItem->m_Pos += move_vector;
for( ii = 0; ii < DrawLibItem->GetFieldCount(); ii++ ) for( ii = 0; ii < DrawLibItem->GetFieldCount(); ii++ )
{ {
DrawLibItem->GetField(ii)->m_Pos += move_vector; DrawLibItem->GetField( ii )->m_Pos += move_vector;
} }
break; break;
...@@ -1270,14 +1316,14 @@ void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector ) ...@@ -1270,14 +1316,14 @@ void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector )
/************************************************************/ /************************************************************/
SCH_ITEM * DuplicateStruct( SCH_ITEM * DrawStruct ) SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
/************************************************************/ /************************************************************/
/* Routine to create a new copy of given struct. /* Routine to create a new copy of given struct.
* The new object is not put in draw list (not linked) * The new object is not put in draw list (not linked)
*/ */
{ {
SCH_ITEM * NewDrawStruct = NULL; SCH_ITEM* NewDrawStruct = NULL;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
{ {
...@@ -1379,7 +1425,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1379,7 +1425,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/****************************************************/ /****************************************************/
{ {
DrawPickedStruct* DrawStructs, * FirstPicked; DrawPickedStruct* DrawStructs, * FirstPicked;
SCH_ITEM * Struct; SCH_ITEM* Struct;
EDA_DrawLineStruct* SegmStruct; EDA_DrawLineStruct* SegmStruct;
int ox, oy, fx, fy; int ox, oy, fx, fy;
...@@ -1387,12 +1433,15 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1387,12 +1433,15 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() ) for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() )
Struct->m_Flags = 0; Struct->m_Flags = 0;
if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() ==
DRAW_SEGMENT_STRUCT_TYPE )
screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED; screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED;
else if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) else if( screen->BlockLocate.m_BlockDrawStruct->Type() ==
DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct; DrawStructs =
(DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
while( DrawStructs ) while( DrawStructs )
{ {
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
...@@ -1416,9 +1465,11 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1416,9 +1465,11 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/* Pour Drag Block: remise sous forme de liste de structure, s'il n'y /* Pour Drag Block: remise sous forme de liste de structure, s'il n'y
* a qu'un seul element ( pour homogeneiser les traitements ulterieurs */ * a qu'un seul element ( pour homogeneiser les traitements ulterieurs */
if( screen->BlockLocate.m_BlockDrawStruct->Type() != DRAW_PICK_ITEM_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() !=
DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawStructs = new DrawPickedStruct( (SCH_ITEM*) screen->BlockLocate.m_BlockDrawStruct ); DrawStructs = new DrawPickedStruct(
(SCH_ITEM*) screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = DrawStructs; screen->BlockLocate.m_BlockDrawStruct = DrawStructs;
} }
...@@ -1446,7 +1497,9 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1446,7 +1497,9 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
* fils et connexions hors bloc relies a des pins ou entries elles meme * fils et connexions hors bloc relies a des pins ou entries elles meme
* draggees */ * draggees */
FirstPicked = DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct; FirstPicked = DrawStructs =
(DrawPickedStruct*) screen->BlockLocate.
m_BlockDrawStruct;
while( DrawStructs ) while( DrawStructs )
{ {
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
...@@ -1458,7 +1511,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1458,7 +1511,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos ); DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos );
while( DrawItem ) while( DrawItem )
{ {
if( (pos.x < ox) || (pos.x > fx) || (pos.y < oy) || (pos.y > fy) ) if( (pos.x < ox) || (pos.x > fx) || (pos.y < oy)
|| (pos.y > fy) )
AddPickedItem( screen, pos ); AddPickedItem( screen, pos );
DrawItem = GetNextPinPosition( NULL, pos ); DrawItem = GetNextPinPosition( NULL, pos );
...@@ -1467,7 +1521,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1467,7 +1521,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
Hierarchical_PIN_Sheet_Struct* SLabel = ( (DrawSheetStruct*) Struct )->m_Label; Hierarchical_PIN_Sheet_Struct* SLabel =
( (DrawSheetStruct*) Struct )->m_Label;
while( SLabel ) while( SLabel )
{ {
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
...@@ -1491,7 +1546,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1491,7 +1546,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/******************************************************************/ /******************************************************************/
{ {
DrawPickedStruct* DrawStructs; DrawPickedStruct* DrawStructs;
SCH_ITEM * Struct; SCH_ITEM* Struct;
/* Examen de la liste des elements deja selectionnes */ /* Examen de la liste des elements deja selectionnes */
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct; DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
...@@ -1541,7 +1596,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1541,7 +1596,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break; break;
DrawStructs = new DrawPickedStruct( Struct ); DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs; screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
...@@ -1553,7 +1609,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1553,7 +1609,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{ {
DrawStructs = new DrawPickedStruct( Struct ); DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs; screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags = SELECTED | ENDPOINT | STARTPOINT; Struct->m_Flags = SELECTED | ENDPOINT | STARTPOINT;
Struct->m_Flags &= ~STARTPOINT; Struct->m_Flags &= ~STARTPOINT;
} }
...@@ -1561,7 +1618,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1561,7 +1618,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{ {
DrawStructs = new DrawPickedStruct( Struct ); DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs; screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags = SELECTED | ENDPOINT | STARTPOINT; Struct->m_Flags = SELECTED | ENDPOINT | STARTPOINT;
Struct->m_Flags &= ~ENDPOINT; Struct->m_Flags &= ~ENDPOINT;
} }
...@@ -1582,7 +1640,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1582,7 +1640,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break; break;
DrawStructs = new DrawPickedStruct( Struct ); DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs; screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags |= SELECTED; Struct->m_Flags |= SELECTED;
break; break;
...@@ -1596,7 +1655,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1596,7 +1655,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break; break;
DrawStructs = new DrawPickedStruct( Struct ); DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs; screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags |= SELECTED; Struct->m_Flags |= SELECTED;
break; break;
...@@ -1621,7 +1681,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1621,7 +1681,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break; break;
DrawStructs = new DrawPickedStruct( Struct ); DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs; screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags |= SELECTED; Struct->m_Flags |= SELECTED;
break; break;
...@@ -1634,7 +1695,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1634,7 +1695,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break; break;
DrawStructs = new DrawPickedStruct( Struct ); DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs; screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags |= SELECTED; Struct->m_Flags |= SELECTED;
break; break;
...@@ -1661,7 +1723,8 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem, ...@@ -1661,7 +1723,8 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
if( DrawLibItem ) if( DrawLibItem )
{ {
NextItem = NULL; NextItem = NULL;
if( ( Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, if( ( Entry =
FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString,
FIND_ROOT ) ) == NULL ) FIND_ROOT ) ) == NULL )
return NULL; return NULL;
DEntry = Entry->m_Drawings; DEntry = Entry->m_Drawings;
...@@ -1690,10 +1753,10 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem, ...@@ -1690,10 +1753,10 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
orient = Pin->ReturnPinDrawOrient( TransMat ); orient = Pin->ReturnPinDrawOrient( TransMat );
/* Calcul de la position du point de reference */ /* Calcul de la position du point de reference */
position.x = PartX + (TransMat[0][0] * Pin->m_Pos.x) position.x = PartX + (TransMat[0][0] *Pin->m_Pos.x)
+ (TransMat[0][1] * Pin->m_Pos.y); + (TransMat[0][1] *Pin->m_Pos.y);
position.y = PartY + (TransMat[1][0] * Pin->m_Pos.x) position.y = PartY + (TransMat[1][0] *Pin->m_Pos.x)
+ (TransMat[1][1] * Pin->m_Pos.y); + (TransMat[1][1] *Pin->m_Pos.y);
NextItem = DEntry->Next(); NextItem = DEntry->Next();
return DEntry; return DEntry;
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/*****************/ /*****************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -14,16 +13,23 @@ ...@@ -14,16 +13,23 @@
/**********************************************************************************************/ /**********************************************************************************************/
void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) wxDC* aDC,
const wxPoint& aOffset,
int aColor,
int aDrawMode,
void* aData,
int aTransformMatrix[2][2] )
/**********************************************************************************************/ /**********************************************************************************************/
{ {
// Invisibles pins are only drawn on request. // Invisibles pins are only drawn on request.
// But in libedit they are drawn in g_InvisibleItemColor because we must see them // But in libedit they are drawn in g_InvisibleItemColor because we must see them
WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
if( ( m_Attributs & PINNOTDRAW ) ) if( ( m_Attributs & PINNOTDRAW ) )
{ {
if ( g_EDA_Appl->m_LibeditFrame && g_EDA_Appl->m_LibeditFrame->IsActive() ) if( frame->m_LibeditFrame && frame->m_LibeditFrame->IsActive() )
aColor = g_InvisibleItemColor; aColor = g_InvisibleItemColor;
else if( !g_ShowAllPins ) else if( !g_ShowAllPins )
return; return;
...@@ -53,8 +59,12 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs ...@@ -53,8 +59,12 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs
/********************************************************************************/ /********************************************************************************/
void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
const wxPoint& aPinPos, int aOrient, int aDrawMode, int aColor ) wxDC* aDC,
const wxPoint& aPinPos,
int aOrient,
int aDrawMode,
int aColor )
/*******************************************************************************/ /*******************************************************************************/
/* Draw the pin symbol (without texts) /* Draw the pin symbol (without texts)
...@@ -120,14 +130,34 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -120,14 +130,34 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
GRMoveTo( x1, y1 + CLOCK_PIN_DIM ); GRMoveTo( x1, y1 + CLOCK_PIN_DIM );
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - MapX1 * CLOCK_PIN_DIM, y1, width, color ); GRLineTo( &aPanel->m_ClipBox,
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1 - CLOCK_PIN_DIM, width, color ); aDC,
x1 - MapX1 * CLOCK_PIN_DIM,
y1,
width,
color );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1,
y1 - CLOCK_PIN_DIM,
width,
color );
} }
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
GRMoveTo( x1 + CLOCK_PIN_DIM, y1 ); GRMoveTo( x1 + CLOCK_PIN_DIM, y1 );
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1 - MapY1 * CLOCK_PIN_DIM, width, color ); GRLineTo( &aPanel->m_ClipBox,
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - CLOCK_PIN_DIM, y1, width, color ); aDC,
x1,
y1 - MapY1 * CLOCK_PIN_DIM,
width,
color );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1 - CLOCK_PIN_DIM,
y1,
width,
color );
} }
} }
...@@ -136,8 +166,12 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -136,8 +166,12 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
GRMoveTo( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ); GRMoveTo( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 );
GRLineTo( &aPanel->m_ClipBox, aDC, x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, GRLineTo( &aPanel->m_ClipBox,
y1 - IEEE_SYMBOL_PIN_DIM, width, color ); aDC,
x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 - IEEE_SYMBOL_PIN_DIM,
width,
color );
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1, width, color ); GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1, width, color );
} }
else /* MapX1 = 0 */ else /* MapX1 = 0 */
...@@ -176,7 +210,13 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -176,7 +210,13 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
/* Draw the pin end target (active end of the pin) */ /* Draw the pin end target (active end of the pin) */
if( !g_IsPrinting ) // Draw but do not print the pin end target 1 pixel width */ if( !g_IsPrinting ) // Draw but do not print the pin end target 1 pixel width */
GRCircle( &aPanel->m_ClipBox, aDC, posX, posY, TARGET_PIN_DIAM, 0, color ); GRCircle( &aPanel->m_ClipBox,
aDC,
posX,
posY,
TARGET_PIN_DIAM,
0,
color );
} }
...@@ -188,10 +228,15 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -188,10 +228,15 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* If TextInside then the text is been put inside,otherwise all is drawn outside. * If TextInside then the text is been put inside,otherwise all is drawn outside.
* Pin Name: substring beteween '~' is negated * Pin Name: substring beteween '~' is negated
*****************************************************************************/ *****************************************************************************/
void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
wxPoint& pin_pos, int orient, wxDC* DC,
int TextInside, bool DrawPinNum, bool DrawPinName, wxPoint& pin_pos,
int Color, int DrawMode ) int orient,
int TextInside,
bool DrawPinNum,
bool DrawPinName,
int Color,
int DrawMode )
/* DrawMode = GR_OR, XOR ... */ /* DrawMode = GR_OR, XOR ... */
{ {
int ii, x, y, x1, y1, dx, dy, len; int ii, x, y, x1, y1, dx, dy, len;
...@@ -244,7 +289,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -244,7 +289,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
if( *textsrc == '~' ) if( *textsrc == '~' )
{ {
PinTextBarPos[PinTextBarCount++] = (int) (PinTxtLen * fPinTextPitch); PinTextBarPos[PinTextBarCount++] =
(int) ( PinTxtLen * fPinTextPitch );
} }
else else
{ {
...@@ -255,7 +301,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -255,7 +301,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
textsrc++; textsrc++;
} }
PinTxtLen = (int) (fPinTextPitch * PinTxtLen); PinTxtLen = (int) ( fPinTextPitch * PinTxtLen );
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~' PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
if( PinText[0] == 0 ) if( PinText[0] == 0 )
...@@ -272,10 +318,13 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -272,10 +318,13 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
if( orient == PIN_RIGHT ) if( orient == PIN_RIGHT )
{ {
x = x1 + TextInside; x = x1 + TextInside;
DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, PinText, DrawGraphicText( panel, DC, wxPoint( x,
y1 ), NameColor,
PinText,
TEXT_ORIENT_HORIZ, TEXT_ORIENT_HORIZ,
PinNameSize, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -285,16 +334,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -285,16 +334,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( dx, 0 ); GRMoveRel( dx, 0 );
len = PinTextBarPos[ii++] - dx; // Get the line length len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor ); GRLineRel( &panel->m_ClipBox,
DC,
len,
0,
LineWidth,
NameColor );
} }
} }
else // Orient == PIN_LEFT else // Orient == PIN_LEFT
{ {
x = x1 - TextInside; x = x1 - TextInside;
DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, PinText, DrawGraphicText( panel, DC, wxPoint( x,
y1 ), NameColor,
PinText,
TEXT_ORIENT_HORIZ, TEXT_ORIENT_HORIZ,
PinNameSize, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -304,7 +361,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -304,7 +361,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( dx - PinTxtLen, 0 ); GRMoveRel( dx - PinTxtLen, 0 );
len = PinTextBarPos[ii++] - dx; // Get the line length len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor ); GRLineRel( &panel->m_ClipBox,
DC,
len,
0,
LineWidth,
NameColor );
} }
} }
} }
...@@ -312,9 +374,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -312,9 +374,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
if( DrawPinNum ) if( DrawPinNum )
{ {
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ), NumColor, StringPinNum, wxPoint( (x1 + pin_pos.x) / 2,
y1 - TXTMARGE ), NumColor,
StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth ); GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
...@@ -326,9 +391,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -326,9 +391,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
y = y1 + TextInside; y = y1 + TextInside;
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, PinText, DrawGraphicText( panel, DC, wxPoint( x1,
y ), NameColor,
PinText,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth ); GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP, LineWidth );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -338,16 +406,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -338,16 +406,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, PinTxtLen - dx ); GRMoveRel( 0, PinTxtLen - dx );
len = PinTextBarPos[ii++] - dx; // Get the line length len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor ); GRLineRel( &panel->m_ClipBox,
DC,
0,
-len,
LineWidth,
NameColor );
} }
} }
else /* PIN_UP */ else /* PIN_UP */
{ {
y = y1 - TextInside; y = y1 - TextInside;
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, PinText, DrawGraphicText( panel, DC, wxPoint( x1,
y ), NameColor,
PinText,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth ); GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -357,7 +433,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -357,7 +433,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, -dx ); GRMoveRel( 0, -dx );
len = PinTextBarPos[ii++] - dx; // Get the line length len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor ); GRLineRel( &panel->m_ClipBox,
DC,
0,
-len,
LineWidth,
NameColor );
} }
} }
} }
...@@ -365,9 +446,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -365,9 +446,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
if( DrawPinNum ) if( DrawPinNum )
{ {
DrawGraphicText( panel, DC, DrawGraphicText( panel, DC,
wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ), NumColor,
StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
} }
} }
} }
...@@ -379,10 +463,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -379,10 +463,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
if( PinText && DrawPinName ) if( PinText && DrawPinName )
{ {
x = (x1 + pin_pos.x) / 2; x = (x1 + pin_pos.x) / 2;
DrawGraphicText( panel, DC, wxPoint( x, y1 - TXTMARGE ), DrawGraphicText( panel, DC, wxPoint( x,
y1 - TXTMARGE ),
NameColor, PinText, NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize, TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth ); GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -391,16 +477,23 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -391,16 +477,23 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( dx, 0 ); GRMoveRel( dx, 0 );
len = PinTextBarPos[ii++] - dx; // Get the line length len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor ); GRLineRel( &panel->m_ClipBox,
DC,
len,
0,
LineWidth,
NameColor );
} }
} }
if( DrawPinNum ) if( DrawPinNum )
{ {
x = (x1 + pin_pos.x) / 2; x = (x1 + pin_pos.x) / 2;
DrawGraphicText( panel, DC, wxPoint( x, y1 + TXTMARGE ), DrawGraphicText( panel, DC, wxPoint( x,
y1 + TXTMARGE ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth ); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
LineWidth );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
...@@ -408,10 +501,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -408,10 +501,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
if( PinText && DrawPinName ) if( PinText && DrawPinName )
{ {
y = (y1 + pin_pos.y) / 2; y = (y1 + pin_pos.y) / 2;
DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE, y ), DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE,
y ),
NameColor, PinText, NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -420,16 +515,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -420,16 +515,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, PinTxtLen - dx ); GRMoveRel( 0, PinTxtLen - dx );
len = PinTextBarPos[ii++] - dx; // Get the line length len = PinTextBarPos[ii++] - dx; // Get the line length
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor ); GRLineRel( &panel->m_ClipBox,
DC,
0,
-len,
LineWidth,
NameColor );
} }
} }
if( DrawPinNum ) if( DrawPinNum )
{ {
DrawGraphicText( panel, DC, wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ), DrawGraphicText( panel, DC,
wxPoint( x1 + TXTMARGE,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
} }
} }
} }
...@@ -448,8 +551,11 @@ extern void Move_Plume( wxPoint pos, int plume ); // see plot.cpp ...@@ -448,8 +551,11 @@ extern void Move_Plume( wxPoint pos, int plume ); // see plot.cpp
* If TextInside then the text is been put inside (moving from x1, y1 in * * If TextInside then the text is been put inside (moving from x1, y1 in *
* the opposite direction to x2,y2), otherwise all is drawn outside. * * the opposite direction to x2,y2), otherwise all is drawn outside. *
*****************************************************************************/ *****************************************************************************/
void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
int TextInside, bool DrawPinNum, bool DrawPinName ) int orient,
int TextInside,
bool DrawPinNum,
bool DrawPinName )
{ {
int dx, len, start; int dx, len, start;
int ii, x, y, x1, y1, cte; int ii, x, y, x1, y1, cte;
...@@ -461,7 +567,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -461,7 +567,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
int PinTxtLen = 0; int PinTxtLen = 0;
wxSize PinNameSize = wxSize( m_PinNameSize, m_PinNameSize ); wxSize PinNameSize = wxSize( m_PinNameSize, m_PinNameSize );
wxSize PinNumSize = wxSize( m_PinNumSize, m_PinNumSize ); wxSize PinNumSize = wxSize( m_PinNumSize, m_PinNumSize );
bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt; bool plot_color = (g_PlotFormat == PLOT_FORMAT_POST)
&& g_PlotPSColorOpt;
/* Get the num and name colors */ /* Get the num and name colors */
NameColor = plot_color ? ReturnLayerColor( LAYER_PINNAM ) : -1; NameColor = plot_color ? ReturnLayerColor( LAYER_PINNAM ) : -1;
...@@ -495,7 +602,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -495,7 +602,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
{ {
if( *textsrc == '~' ) if( *textsrc == '~' )
{ {
PinTextBarPos[PinTextBarCount++] = (int) (fPinTextPitch * PinTxtLen); PinTextBarPos[PinTextBarCount++] =
(int) ( fPinTextPitch * PinTxtLen );
} }
else else
{ {
...@@ -506,7 +614,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -506,7 +614,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
textsrc++; textsrc++;
} }
PinTxtLen = (int) (fPinTextPitch * PinTxtLen); PinTxtLen = (int) ( fPinTextPitch * PinTxtLen );
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~' PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
if( PinText[0] == 0 ) if( PinText[0] == 0 )
...@@ -521,10 +629,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -521,10 +629,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( orient == PIN_RIGHT ) if( orient == PIN_RIGHT )
{ {
x = x1 + TextInside; x = x1 + TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 ), NameColor, PinText, PlotGraphicText( g_PlotFormat, wxPoint( x,
y1 ), NameColor,
PinText,
TEXT_ORIENT_HORIZ, TEXT_ORIENT_HORIZ,
PinNameSize, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER ); GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -538,10 +649,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -538,10 +649,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
else // orient == PIN_LEFT else // orient == PIN_LEFT
{ {
x = x1 - TextInside; x = x1 - TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 ), PlotGraphicText( g_PlotFormat, wxPoint( x,
y1 ),
NameColor, PinText, TEXT_ORIENT_HORIZ, NameColor, PinText, TEXT_ORIENT_HORIZ,
PinNameSize, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER ); GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -556,10 +669,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -556,10 +669,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( DrawPinNum ) if( DrawPinNum )
{ {
PlotGraphicText( g_PlotFormat, wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ), PlotGraphicText( g_PlotFormat,
wxPoint( (x1 + pin_pos.x) / 2,
y1 - TXTMARGE ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize, TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM ); GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
} }
} }
else /* Its a vertical line. */ else /* Its a vertical line. */
...@@ -570,9 +686,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -570,9 +686,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
{ {
y = y1 + TextInside; y = y1 + TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor, PinText, PlotGraphicText( g_PlotFormat, wxPoint( x1,
y ), NameColor,
PinText,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP ); GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -587,9 +706,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -587,9 +706,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
{ {
y = y1 - TextInside; y = y1 - TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor, PinText, PlotGraphicText( g_PlotFormat, wxPoint( x1,
y ), NameColor,
PinText,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM ); GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -604,10 +726,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -604,10 +726,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( DrawPinNum ) if( DrawPinNum )
{ {
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), PlotGraphicText( g_PlotFormat,
wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER ); GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
} }
} }
} }
...@@ -619,10 +744,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -619,10 +744,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( PinText && DrawPinName ) if( PinText && DrawPinName )
{ {
x = (x1 + pin_pos.x) / 2; x = (x1 + pin_pos.x) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 - TXTMARGE ), PlotGraphicText( g_PlotFormat, wxPoint( x,
y1 - TXTMARGE ),
NameColor, PinText, NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize, TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM ); GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -648,10 +775,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -648,10 +775,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( PinText && DrawPinName ) if( PinText && DrawPinName )
{ {
y = (y1 + pin_pos.y) / 2; y = (y1 + pin_pos.y) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE, y ), PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE,
y ),
NameColor, PinText, NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize, TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER ); GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
for( ii = 0; ii < PinTextBarCount; ) for( ii = 0; ii < PinTextBarCount; )
{ {
...@@ -666,17 +795,19 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -666,17 +795,19 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( DrawPinNum ) if( DrawPinNum )
{ {
PlotGraphicText( g_PlotFormat, wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ), PlotGraphicText( g_PlotFormat,
wxPoint( x1 + TXTMARGE,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum, NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize, TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER ); GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER );
} }
} }
} }
} }
/***************************************************************/ /***************************************************************/
LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE ) LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE )
/***************************************************************/ /***************************************************************/
...@@ -780,7 +911,7 @@ void LibDrawPin::ReturnPinStringNum( wxString& buffer ) const ...@@ -780,7 +911,7 @@ void LibDrawPin::ReturnPinStringNum( wxString& buffer ) const
{ {
char ascii_buf[5]; char ascii_buf[5];
memcpy(ascii_buf, &m_PinNum , 4); memcpy( ascii_buf, &m_PinNum, 4 );
ascii_buf[4] = 0; ascii_buf[4] = 0;
buffer = CONV_FROM_UTF8( ascii_buf ); buffer = CONV_FROM_UTF8( ascii_buf );
...@@ -835,4 +966,3 @@ LibDrawPin* LibDrawPin::GenCopy() ...@@ -835,4 +966,3 @@ LibDrawPin* LibDrawPin::GenCopy()
return newpin; return newpin;
} }
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/*********************************/ /*********************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -15,7 +14,8 @@ ...@@ -15,7 +14,8 @@
/* Routines locales */ /* Routines locales */
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm, EDA_DrawLineStruct* TstSegm ); static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
EDA_DrawLineStruct* TstSegm );
/* Variable locales */ /* Variable locales */
...@@ -33,6 +33,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -33,6 +33,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
int flag; int flag;
bool Modify = FALSE; bool Modify = FALSE;
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
DrawList = EEDrawList; DrawList = EEDrawList;
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
...@@ -63,7 +67,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -63,7 +67,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
} }
} }
g_EDA_Appl->m_SchematicFrame->TestDanglingEnds( EEDrawList, DC ); frame->TestDanglingEnds( EEDrawList, DC );
return Modify; return Modify;
} }
...@@ -80,7 +84,8 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -80,7 +84,8 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
if( Screen == NULL ) if( Screen == NULL )
{ {
DisplayError( NULL, wxT( "BreakSegmentOnJunction() error: NULL screen" ) ); DisplayError( NULL,
wxT( "BreakSegmentOnJunction() error: NULL screen" ) );
return; return;
} }
...@@ -149,7 +154,8 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen, ...@@ -149,7 +154,8 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen,
segment = (EDA_DrawLineStruct*) DrawList; segment = (EDA_DrawLineStruct*) DrawList;
ox = segment->m_Start.x; oy = segment->m_Start.y; ox = segment->m_Start.x; oy = segment->m_Start.y;
fx = segment->m_End.x; fy = segment->m_End.y; fx = segment->m_End.x; fy = segment->m_End.y;
if( distance( fx - ox, fy - oy, breakpoint.x - ox, breakpoint.y - oy, 0 ) == 0 ) if( distance( fx - ox, fy - oy, breakpoint.x - ox, breakpoint.y -
oy, 0 ) == 0 )
break; break;
/* Segment connecte: doit etre coupe en 2 si px,py n'est /* Segment connecte: doit etre coupe en 2 si px,py n'est
...@@ -256,10 +262,10 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm, ...@@ -256,10 +262,10 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
} }
else else
{ {
if( atan2( (double)(RefSegm->m_Start.x - RefSegm->m_End.x), if( atan2( (double) ( RefSegm->m_Start.x - RefSegm->m_End.x ),
(double)(RefSegm->m_Start.y - RefSegm->m_End.y) ) == (double) ( RefSegm->m_Start.y - RefSegm->m_End.y ) ) ==
atan2( (double)(TstSegm->m_Start.x - TstSegm->m_End.x), atan2( (double) ( TstSegm->m_Start.x - TstSegm->m_End.x ),
(double)(TstSegm->m_Start.y - TstSegm->m_End.y) ) ) (double) ( TstSegm->m_Start.y - TstSegm->m_End.y ) ) )
{ {
RefSegm->m_End = TstSegm->m_End; RefSegm->m_End = TstSegm->m_End;
return 1; return 1;
......
...@@ -36,8 +36,10 @@ void RemoteCommand( const char* cmdline ) ...@@ -36,8 +36,10 @@ void RemoteCommand( const char* cmdline )
char line[1024]; char line[1024];
char* idcmd; char* idcmd;
char* text; char* text;
WinEDA_SchematicFrame* frame = g_EDA_Appl->m_SchematicFrame;
wxString part_ref, msg; wxString part_ref, msg;
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
...@@ -109,14 +111,16 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT ...@@ -109,14 +111,16 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
{ {
if( LibItem == NULL ) if( LibItem == NULL )
break; break;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField(REFERENCE)->m_Text ) ); sprintf( Line, "$PART: %s",
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
} }
break; break;
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
LibItem = (SCH_COMPONENT*) objectToSync; LibItem = (SCH_COMPONENT*) objectToSync;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); sprintf( Line, "$PART: %s",
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
break; break;
...@@ -133,7 +137,8 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT ...@@ -133,7 +137,8 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
} }
else else
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); sprintf( Line, "$PART: %s",
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
break; break;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/*******************************************************/ /*******************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -24,8 +23,10 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion ) ...@@ -24,8 +23,10 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
{ {
EDA_BaseStruct* DrawStruct; EDA_BaseStruct* DrawStruct;
EDA_BaseStruct* EEDrawList; EDA_BaseStruct* EEDrawList;
WinEDA_SchematicFrame* frame = g_EDA_Appl->m_SchematicFrame;
wxString msg; wxString msg;
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
if( FirstSheet == NULL ) if( FirstSheet == NULL )
return; return;
...@@ -59,7 +60,8 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion ) ...@@ -59,7 +60,8 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
EEDrawList = EEDrawList->Next(); EEDrawList = EEDrawList->Next();
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct, confirm_deletion ); DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct,
confirm_deletion );
} }
} }
......
...@@ -132,12 +132,15 @@ WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent, ...@@ -132,12 +132,15 @@ WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent,
const wxSize& size, const wxSize& size,
long style ) long style )
{ {
wxConfig* config = wxGetApp().m_EDA_Config;
wxASSERT( config != NULL );
m_Parent = parent; m_Parent = parent;
/* Get options */ /* Get options */
s_OutputFormOpt = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_FORMAT, (long) 0 ); s_OutputFormOpt = config->Read( OPTION_BOM_FORMAT, (long) 0 );
s_OutputSeparatorOpt = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_SEPARATOR, (long) 0 ); s_OutputSeparatorOpt = config->Read( OPTION_BOM_SEPARATOR, (long) 0 );
long addfields = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_ADD_FIELD, (long) 0 ); long addfields = config->Read( OPTION_BOM_ADD_FIELD, (long) 0 );
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ ) for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
{ {
if( (addfields & bitmask) ) if( (addfields & bitmask) )
...@@ -491,6 +494,9 @@ void WinEDA_Build_BOM_Frame::OnApplyClick( wxCommandEvent& event ) ...@@ -491,6 +494,9 @@ void WinEDA_Build_BOM_Frame::OnApplyClick( wxCommandEvent& event )
void WinEDA_Build_BOM_Frame::SavePreferences() void WinEDA_Build_BOM_Frame::SavePreferences()
/**************************************************/ /**************************************************/
{ {
wxConfig* config = wxGetApp().m_EDA_Config;
wxASSERT( config != NULL );
// Determine current settings of "List items" and "Options" checkboxes // Determine current settings of "List items" and "Options" checkboxes
// (NOTE: These 6 settings are restored when the dialog box is next // (NOTE: These 6 settings are restored when the dialog box is next
// invoked, but are *not* still saved after EESchema is next shut down.) // invoked, but are *not* still saved after EESchema is next shut down.)
...@@ -519,8 +525,8 @@ void WinEDA_Build_BOM_Frame::SavePreferences() ...@@ -519,8 +525,8 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
s_Add_F8_state = m_AddField8->GetValue(); s_Add_F8_state = m_AddField8->GetValue();
// Now save current settings of both radiobutton groups // Now save current settings of both radiobutton groups
m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt ); config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt );
m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt ); config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt );
// Now save current settings of all "Fields to add" checkboxes // Now save current settings of all "Fields to add" checkboxes
long addfields = 0; long addfields = 0;
...@@ -531,5 +537,5 @@ void WinEDA_Build_BOM_Frame::SavePreferences() ...@@ -531,5 +537,5 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
bitmask <<= 1; bitmask <<= 1;
} }
m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_ADD_FIELD, addfields ); config->Write( OPTION_BOM_ADD_FIELD, addfields );
} }
...@@ -102,7 +102,7 @@ wxString msg; ...@@ -102,7 +102,7 @@ wxString msg;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
msg = _("from ") + g_EDA_Appl->m_CurrentOptionFile; msg = _("from ") + wxGetApp().m_CurrentOptionFile;
SetTitle(msg); SetTitle(msg);
SetFormatsNetListes(); SetFormatsNetListes();
m_ListLibr->InsertItems(g_LibName_List, 0); m_ListLibr->InsertItems(g_LibName_List, 0);
...@@ -312,8 +312,8 @@ void KiConfigEeschemaFrame::OnCloseWindow(wxCloseEvent & event) ...@@ -312,8 +312,8 @@ void KiConfigEeschemaFrame::OnCloseWindow(wxCloseEvent & event)
if ( m_LibListChanged ) if ( m_LibListChanged )
{ {
LoadLibraries(m_Parent); LoadLibraries(m_Parent);
if ( m_Parent->m_Parent->m_ViewlibFrame ) if ( m_Parent->m_ViewlibFrame )
m_Parent->m_Parent->m_ViewlibFrame->ReCreateListLib(); m_Parent->m_ViewlibFrame->ReCreateListLib();
} }
EndModal(0); EndModal(0);
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "protos.h" #include "protos.h"
#include "eeconfig.h" #include "eeconfig.h"
#include "worksheet.h" #include "worksheet.h"
#include "hotkeys_basic.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "id.h" #include "id.h"
...@@ -44,7 +43,7 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event ) ...@@ -44,7 +43,7 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
case ID_OPTIONS_SETUP: case ID_OPTIONS_SETUP:
DisplayOptionFrame( this, pos ); DisplayOptionFrame( this, pos );
DrawPanel->Refresh(TRUE); // Redraw, because grid settings may have changed. DrawPanel->Refresh( TRUE ); // Redraw, because grid settings may have changed.
break; break;
case ID_CONFIG_SAVE: case ID_CONFIG_SAVE:
...@@ -93,7 +92,7 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event ) ...@@ -93,7 +92,7 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
AddDelimiterString(FullFileName); AddDelimiterString( FullFileName );
wxString editorname = GetEditorName(); wxString editorname = GetEditorName();
if( !editorname.IsEmpty() ) if( !editorname.IsEmpty() )
ExecuteFile( this, editorname, FullFileName ); ExecuteFile( this, editorname, FullFileName );
...@@ -110,7 +109,9 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event ) ...@@ -110,7 +109,9 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_SchematicFrame::Process_Config internal error" ) ); DisplayError( this,
wxT(
"WinEDA_SchematicFrame::Process_Config internal error" ) );
} }
} }
...@@ -123,11 +124,14 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose ) ...@@ -123,11 +124,14 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
* Read the hotkey files config for eeschema and libedit * Read the hotkey files config for eeschema and libedit
*/ */
{ {
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); wxString FullFileName = ReturnHotkeyConfigFilePath(
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile( FullFileName, s_Eeschema_Hokeys_Descr, verbose ); frame->ReadHotkeyConfigFile( FullFileName,
s_Eeschema_Hokeys_Descr,
verbose );
return TRUE; return TRUE;
} }
...@@ -148,6 +152,9 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig ) ...@@ -148,6 +152,9 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
wxString FullFileName; wxString FullFileName;
bool IsRead = TRUE; bool IsRead = TRUE;
wxArrayString liblist_tmp = g_LibName_List; wxArrayString liblist_tmp = g_LibName_List;
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
if( CfgFileName.IsEmpty() ) if( CfgFileName.IsEmpty() )
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName; FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
...@@ -155,8 +162,9 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig ) ...@@ -155,8 +162,9 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
FullFileName = CfgFileName; FullFileName = CfgFileName;
g_LibName_List.Clear(); g_LibName_List.Clear();
if( !g_EDA_Appl->ReadProjectConfig( FullFileName, if( !wxGetApp().ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE ) ) // Config non lue GROUP, ParamCfgList,
ForceRereadConfig ? FALSE : TRUE ) ) // Config non lue
{ {
g_LibName_List = liblist_tmp; g_LibName_List = liblist_tmp;
IsRead = FALSE; IsRead = FALSE;
...@@ -172,13 +180,13 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig ) ...@@ -172,13 +180,13 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
g_LibName_List.Add( wxT( "device" ) ); g_LibName_List.Add( wxT( "device" ) );
} }
if( g_EDA_Appl->m_SchematicFrame ) if( frame )
{ {
g_EDA_Appl->m_SchematicFrame->SetDrawBgColor( g_DrawBgColor ); frame->SetDrawBgColor( g_DrawBgColor );
g_EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid; frame->m_Draw_Grid = g_ShowGrid;
} }
LoadLibraries( g_EDA_Appl->m_SchematicFrame ); LoadLibraries( frame );
return IsRead; return IsRead;
} }
...@@ -210,5 +218,5 @@ void WinEDA_SchematicFrame::Save_Config( wxWindow* displayframe ) ...@@ -210,5 +218,5 @@ void WinEDA_SchematicFrame::Save_Config( wxWindow* displayframe )
return; return;
/* ecriture de la configuration */ /* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList ); wxGetApp().WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
} }
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#include "fctsys.h" #include "fctsys.h"
#include <wx/image.h>
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
...@@ -42,8 +40,7 @@ IMPLEMENT_APP( WinEDA_App ) ...@@ -42,8 +40,7 @@ IMPLEMENT_APP( WinEDA_App )
bool WinEDA_App::OnInit() bool WinEDA_App::OnInit()
{ {
wxString FFileName; wxString FFileName;
WinEDA_SchematicFrame* frame = NULL;
g_EDA_Appl = this;
g_DebugLevel = 0; // Debug level */ g_DebugLevel = 0; // Debug level */
...@@ -61,44 +58,43 @@ bool WinEDA_App::OnInit() ...@@ -61,44 +58,43 @@ bool WinEDA_App::OnInit()
/* init EESCHEMA */ /* init EESCHEMA */
GetSettings(); // read current setup GetSettings(); // read current setup
SeedLayers(); SeedLayers();
Read_Hotkey_Config( m_SchematicFrame, false ); /* Must be called before creating the main frame Read_Hotkey_Config( frame, false ); /* Must be called before creating
* in order to display the real hotkeys in menus * the main frame in order to
* display the real hotkeys in menus
* or tool tips */ * or tool tips */
// Create main frame (schematic frame) : // Create main frame (schematic frame) :
m_SchematicFrame = new WinEDA_SchematicFrame( NULL, this, frame = new WinEDA_SchematicFrame( NULL, wxT( "EESchema" ),
wxT( "EESchema" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) ); wxPoint( 0, 0 ), wxSize( 600, 400 ) );
SetTopWindow( m_SchematicFrame ); SetTopWindow( frame );
m_SchematicFrame->Show( TRUE ); frame->Show( TRUE );
if( CreateServer( m_SchematicFrame, KICAD_SCH_PORT_SERVICE_NUMBER ) ) if( CreateServer( frame, KICAD_SCH_PORT_SERVICE_NUMBER ) )
{ {
// RemoteCommand is in controle.cpp and is called when PCBNEW // RemoteCommand is in controle.cpp and is called when PCBNEW
// sends EESCHEMA a command // sends EESCHEMA a command
SetupServerFunction( RemoteCommand ); SetupServerFunction( RemoteCommand );
} }
ActiveScreen = m_SchematicFrame->GetScreen(); ActiveScreen = frame->GetScreen();
m_SchematicFrame->Zoom_Automatique( TRUE ); frame->Zoom_Automatique( TRUE );
/* Load file specified in the command line. */ /* Load file specified in the command line. */
if( !FFileName.IsEmpty() ) if( !FFileName.IsEmpty() )
{ {
ChangeFileNameExt( FFileName, g_SchExtBuffer ); ChangeFileNameExt( FFileName, g_SchExtBuffer );
wxSetWorkingDirectory( wxPathOnly( FFileName ) ); wxSetWorkingDirectory( wxPathOnly( FFileName ) );
if( m_SchematicFrame->DrawPanel ) if( frame->DrawPanel )
if( m_SchematicFrame->LoadOneEEProject( FFileName, FALSE ) <= 0 ) if( frame->LoadOneEEProject( FFileName, FALSE ) <= 0 )
m_SchematicFrame->DrawPanel->Refresh( TRUE ); // File not found or error frame->DrawPanel->Refresh( TRUE ); // File not found or error
} }
else else
{ {
Read_Config( wxEmptyString, TRUE ); // Read a default config file if no file to load Read_Config( wxEmptyString, TRUE ); // Read a default config file if no file to load
if( m_SchematicFrame->DrawPanel ) if( frame->DrawPanel )
m_SchematicFrame->DrawPanel->Refresh( TRUE ); frame->DrawPanel->Refresh( TRUE );
} }
return TRUE; return TRUE;
} }
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/*************************************************/ /*************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
...@@ -30,18 +29,17 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent ) ...@@ -30,18 +29,17 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
wxString name; wxString name;
WinEDA_ViewlibFrame* Viewer; WinEDA_ViewlibFrame* Viewer;
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
WinEDA_SchematicFrame* frame;
Viewer = parent->m_Parent->m_ViewlibFrame; frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
Viewer = frame->m_ViewlibFrame;
/* Close the current Lib browser, if open, and open a new one, in "modal" mode */ /* Close the current Lib browser, if open, and open a new one, in "modal" mode */
if( Viewer ) if( Viewer )
Viewer->Destroy(); Viewer->Destroy();
Viewer = parent->m_Parent->m_ViewlibFrame = new Viewer = frame->m_ViewlibFrame =
WinEDA_ViewlibFrame( new WinEDA_ViewlibFrame( frame, NULL, &semaphore );
parent->m_Parent->m_SchematicFrame,
parent->m_Parent,
NULL,
&semaphore );
Viewer->AdjustScrollBars(); Viewer->AdjustScrollBars();
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
...@@ -57,7 +55,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent ) ...@@ -57,7 +55,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
/**************************************************************************/ /**************************************************************************/
SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component(wxDC* DC,
const wxString& libname, const wxString& libname,
wxArrayString& HistoryList, wxArrayString& HistoryList,
bool UseLibBrowser ) bool UseLibBrowser )
...@@ -179,7 +177,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -179,7 +177,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
DrawLibItem = new SCH_COMPONENT( GetScreen()->m_Curseur ); DrawLibItem = new SCH_COMPONENT( GetScreen()->m_Curseur );
DrawLibItem->m_Multi = 1;/* Selection de l'unite 1 dans le boitier */ DrawLibItem->m_Multi = 1; /* Selection de l'unite 1 dans le boitier */
DrawLibItem->m_Convert = 1; DrawLibItem->m_Convert = 1;
DrawLibItem->m_ChipName = Name; DrawLibItem->m_ChipName = Name;
DrawLibItem->m_TimeStamp = GetTimeStamp(); DrawLibItem->m_TimeStamp = GetTimeStamp();
...@@ -203,7 +201,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -203,7 +201,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
msg += wxT( "?" ); msg += wxT( "?" );
//update the reference -- just the prefix for now. //update the reference -- just the prefix for now.
DrawLibItem->SetRef(GetSheet(), msg ); DrawLibItem->SetRef( GetSheet(), msg );
/* Init champ Reference */ /* Init champ Reference */
DrawLibItem->GetField( REFERENCE )->m_Pos.x = DrawLibItem->GetField( REFERENCE )->m_Pos.x =
...@@ -213,9 +211,12 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -213,9 +211,12 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawLibItem->GetField( REFERENCE )->m_Orient = Entry->m_Prefix.m_Orient; DrawLibItem->GetField( REFERENCE )->m_Orient = Entry->m_Prefix.m_Orient;
DrawLibItem->GetField( REFERENCE )->m_Size = Entry->m_Prefix.m_Size; DrawLibItem->GetField( REFERENCE )->m_Size = Entry->m_Prefix.m_Size;
DrawLibItem->m_PrefixString = Entry->m_Prefix.m_Text; DrawLibItem->m_PrefixString = Entry->m_Prefix.m_Text;
DrawLibItem->GetField( REFERENCE )->m_Attributs = Entry->m_Prefix.m_Attributs; DrawLibItem->GetField( REFERENCE )->m_Attributs =
DrawLibItem->GetField( REFERENCE )->m_HJustify = Entry->m_Prefix.m_HJustify; Entry->m_Prefix.m_Attributs;
DrawLibItem->GetField( REFERENCE )->m_VJustify = Entry->m_Prefix.m_VJustify; DrawLibItem->GetField( REFERENCE )->m_HJustify =
Entry->m_Prefix.m_HJustify;
DrawLibItem->GetField( REFERENCE )->m_VJustify =
Entry->m_Prefix.m_VJustify;
/* Init des autres champs si predefinis dans la librairie */ /* Init des autres champs si predefinis dans la librairie */
for( Field = Entry->Fields; Field != NULL; Field = Field->Next() ) for( Field = Entry->Fields; Field != NULL; Field = Field->Next() )
...@@ -298,7 +299,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( ...@@ -298,7 +299,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
else else
{ {
DrawPanel->PostDirtyRect( DrawComponent->GetBoundingBox()); DrawPanel->PostDirtyRect( DrawComponent->GetBoundingBox() );
} }
} }
...@@ -310,7 +311,9 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( ...@@ -310,7 +311,9 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0,
0 ),
GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
...@@ -369,7 +372,8 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent, ...@@ -369,7 +372,8 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL ) if( DrawComponent == NULL )
return; return;
LibEntry = FindLibPart( DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); LibEntry = FindLibPart(
DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( LibEntry == NULL ) if( LibEntry == NULL )
return; return;
...@@ -399,7 +403,8 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent, ...@@ -399,7 +403,8 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0,
0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -417,7 +422,8 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, ...@@ -417,7 +422,8 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL ) if( DrawComponent == NULL )
return; return;
LibEntry = FindLibPart( DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); LibEntry = FindLibPart(
DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( LibEntry == NULL ) if( LibEntry == NULL )
return; return;
...@@ -440,7 +446,8 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, ...@@ -440,7 +446,8 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Flags & IS_MOVED ) if( DrawComponent->m_Flags & IS_MOVED )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0,
0 ), GR_DEFAULT_DRAWMODE );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -487,7 +494,8 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component, ...@@ -487,7 +494,8 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
if( Component->m_Flags == 0 ) if( Component->m_Flags == 0 )
{ {
if( g_ItemToUndoCopy ){ if( g_ItemToUndoCopy )
{
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
} }
g_ItemToUndoCopy = Component->GenCopy(); g_ItemToUndoCopy = Component->GenCopy();
...@@ -504,6 +512,7 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component, ...@@ -504,6 +512,7 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) ); memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) );
#if 1 #if 1
// switch from normal mode to xor mode for the duration of the move, first // switch from normal mode to xor mode for the duration of the move, first
// by erasing fully any "normal drawing mode" primitives with the PostDirtyRect(), // by erasing fully any "normal drawing mode" primitives with the PostDirtyRect(),
// then by drawing the first time in xor mode so that subsequent xor // then by drawing the first time in xor mode so that subsequent xor
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -22,48 +21,46 @@ ...@@ -22,48 +21,46 @@
/* class WinEDA_LibeditFrame */ /* class WinEDA_LibeditFrame */
/*****************************/ /*****************************/
BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow ) COMMON_EVENTS_DRAWFRAME
EVT_SIZE( WinEDA_LibeditFrame::OnSize ) EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_LibeditFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_LibeditFrame::Process_Zoom ) WinEDA_LibeditFrame::Process_Zoom )
// Tools et boutons de Libedit: // Tools et boutons de Libedit:
/* Main horizontal toolbar */ /* Main horizontal toolbar */
EVT_TOOL_RANGE( ID_LIBEDIT_START_H_TOOL, ID_LIBEDIT_END_H_TOOL, EVT_TOOL_RANGE( ID_LIBEDIT_START_H_TOOL, ID_LIBEDIT_END_H_TOOL,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_PART_NUMBER, EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_PART_NUMBER,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS, EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
/* Right Vertical toolbar */ /* Right Vertical toolbar */
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_LibeditFrame::Process_Special_Functions ) EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_LibeditFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_LIBEDIT_START_V_TOOL, ID_LIBEDIT_END_V_TOOL, EVT_TOOL_RANGE( ID_LIBEDIT_START_V_TOOL, ID_LIBEDIT_END_V_TOOL,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
/* PopUp events and commands: */ /* PopUp events and commands: */
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE, EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
// Annulation de commande en cours // Annulation de commande en cours
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions ) WinEDA_LibeditFrame::Process_Special_Functions )
// PopUp Menus pour Zooms trait�s dans drawpanel.cpp // PopUp Menus pour Zooms trait�s dans drawpanel.cpp
END_EVENT_TABLE() END_EVENT_TABLE()
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
WinEDA_DrawFrame( father, LIBEDITOR_FRAME, parent, title, pos, size, style ) WinEDA_DrawFrame( father, LIBEDITOR_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT( "LibeditFrame" ); m_FrameName = wxT( "LibeditFrame" );
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
...@@ -89,7 +86,9 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, ...@@ -89,7 +86,9 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_LibeditFrame::~WinEDA_LibeditFrame() WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
/**********************************************/ /**********************************************/
{ {
m_Parent->m_LibeditFrame = NULL; WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame = NULL;
} }
......
...@@ -112,7 +112,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -112,7 +112,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
// Create the list of last edited schematic files // Create the list of last edited schematic files
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = 0; ii < max_file; ii++ ) for( ii = 0; ii < max_file; ii++ )
{ {
if( GetLastProject( ii ).IsEmpty() ) if( GetLastProject( ii ).IsEmpty() )
...@@ -376,7 +376,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -376,7 +376,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
// Font selection and setup // Font selection and setup
AddFontSelectionMenu( configmenu ); AddFontSelectionMenu( configmenu );
m_Parent->SetLanguageList( configmenu ); wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ), item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ),
...@@ -417,7 +417,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -417,7 +417,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
else // Update the list of last edited schematic files else // Update the list of last edited schematic files
{ {
wxMenuItem* item; wxMenuItem* item;
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- ) for( ii = max_file - 1; ii >=0; ii-- )
{ {
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) ) if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
......
...@@ -53,35 +53,38 @@ wxString ReturnUserNetlistTypeName( bool first_item ) ...@@ -53,35 +53,38 @@ wxString ReturnUserNetlistTypeName( bool first_item )
msg = CUSTOM_NETLIST_TITLE; msg = CUSTOM_NETLIST_TITLE;
msg << index + 1; msg << index + 1;
if( g_EDA_Appl->m_EDA_Config ) if( wxGetApp().m_EDA_Config )
name = g_EDA_Appl->m_EDA_Config->Read( msg ); name = wxGetApp().m_EDA_Config->Read( msg );
return name; return name;
} }
BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog )
EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick )
EVT_BUTTON( ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist ) EVT_BUTTON( ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist )
EVT_BUTTON( ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPluginData ) EVT_BUTTON( ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPluginData )
EVT_BUTTON( ID_DELETE_PLUGIN, WinEDA_NetlistFrame::DeletePluginPanel ) EVT_BUTTON( ID_DELETE_PLUGIN, WinEDA_NetlistFrame::DeletePluginPanel )
EVT_BUTTON( ID_VALIDATE_PLUGIN, WinEDA_NetlistFrame::ValidatePluginPanel ) EVT_BUTTON( ID_VALIDATE_PLUGIN, WinEDA_NetlistFrame::ValidatePluginPanel )
EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT, WinEDA_NetlistFrame::SelectNetlistType ) EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT,
EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator ) WinEDA_NetlistFrame::SelectNetlistType )
EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator )
END_EVENT_TABLE() END_EVENT_TABLE()
/*******************************/ /*******************************/
/* Functions for these classes */ /* Functions for these classes */
/*******************************/ /*******************************/
/*****************************************************************************/ /*****************************************************************************/
EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title, EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent,
int id_NetType, int idCheckBox, int idCreateFile ) : const wxString& title,
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_SUNKEN ) int id_NetType,
int idCheckBox,
int idCreateFile ) :
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL |
wxBORDER_SUNKEN )
/*****************************************************************************/ /*****************************************************************************/
/** Contructor to create a setup page for one netlist format. /** Contructor to create a setup page for one netlist format.
...@@ -114,14 +117,18 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title, ...@@ -114,14 +117,18 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title,
m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL ); m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 ); UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); UpperBoxSizer->Add( m_RightOptionsBoxSizer,
0,
wxALIGN_CENTER_VERTICAL | wxALL,
5 );
if( idCheckBox ) if( idCheckBox )
{ {
wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) ); wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
m_LeftBoxSizer->Add( text, 0, wxGROW | wxALL, 5 ); m_LeftBoxSizer->Add( text, 0, wxGROW | wxALL, 5 );
m_IsCurrentFormat = new wxCheckBox( this, idCheckBox, _( "Default format" ) ); m_IsCurrentFormat =
new wxCheckBox( this, idCheckBox, _( "Default format" ) );
m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 ); m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
if( g_NetFormat == m_IdNetType ) if( g_NetFormat == m_IdNetType )
...@@ -195,20 +202,23 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ) : ...@@ -195,20 +202,23 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ) :
// Add notebook pages: // Add notebook pages:
// Add Panel FORMAT PCBNEW // Add Panel FORMAT PCBNEW
m_PanelNetType[PANELPCBNEW] = new EDA_NoteBookPage( m_NoteBook, wxT( m_PanelNetType[PANELPCBNEW] = new EDA_NoteBookPage( m_NoteBook,
"Pcbnew" ), NET_TYPE_PCBNEW, wxT( "Pcbnew" ),
NET_TYPE_PCBNEW,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST ); ID_CREATE_NETLIST );
// Add Panel FORMAT ORCADPCB2 // Add Panel FORMAT ORCADPCB2
m_PanelNetType[PANELORCADPCB2] = new EDA_NoteBookPage( m_NoteBook, wxT( m_PanelNetType[PANELORCADPCB2] = new EDA_NoteBookPage( m_NoteBook,
"OrcadPCB2" ), NET_TYPE_ORCADPCB2, wxT( "OrcadPCB2" ),
NET_TYPE_ORCADPCB2,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST ); ID_CREATE_NETLIST );
// Add Panel FORMAT CADSTAR // Add Panel FORMAT CADSTAR
m_PanelNetType[PANELCADSTAR] = new EDA_NoteBookPage( m_NoteBook, wxT( m_PanelNetType[PANELCADSTAR] = new EDA_NoteBookPage( m_NoteBook,
"CadStar" ), NET_TYPE_CADSTAR, wxT( "CadStar" ),
NET_TYPE_CADSTAR,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST ); ID_CREATE_NETLIST );
...@@ -233,10 +243,13 @@ void WinEDA_NetlistFrame::InstallPageSpice() ...@@ -233,10 +243,13 @@ void WinEDA_NetlistFrame::InstallPageSpice()
wxButton* Button; wxButton* Button;
EDA_NoteBookPage* page; EDA_NoteBookPage* page;
page = m_PanelNetType[PANELSPICE] = new EDA_NoteBookPage( m_NoteBook, wxT( page = m_PanelNetType[PANELSPICE] = new EDA_NoteBookPage( m_NoteBook,
"Spice" ), NET_TYPE_SPICE, 0, 0 ); wxT( "Spice" ),
NET_TYPE_SPICE,
0, 0 );
page->m_IsCurrentFormat = new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT, page->m_IsCurrentFormat =
new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
_( "Default format" ) ); _( "Default format" ) );
page->m_IsCurrentFormat->SetValue( g_NetFormat == NET_TYPE_SPICE ); page->m_IsCurrentFormat->SetValue( g_NetFormat == NET_TYPE_SPICE );
page->m_LeftBoxSizer->Add( page->m_IsCurrentFormat, 0, wxGROW | wxALL, 5 ); page->m_LeftBoxSizer->Add( page->m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
...@@ -244,16 +257,17 @@ void WinEDA_NetlistFrame::InstallPageSpice() ...@@ -244,16 +257,17 @@ void WinEDA_NetlistFrame::InstallPageSpice()
wxString netlist_opt[2] = { _( "Use Net Names" ), _( "Use Net Numbers" ) }; wxString netlist_opt[2] = { _( "Use Net Names" ), _( "Use Net Numbers" ) };
m_UseNetNamesInNetlist = new wxRadioBox( page, -1, _( "Netlist Options:" ), m_UseNetNamesInNetlist = new wxRadioBox( page, -1, _( "Netlist Options:" ),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
2, netlist_opt, 1, wxRA_SPECIFY_COLS ); 2, netlist_opt, 1,
wxRA_SPECIFY_COLS );
if( !g_OptNetListUseNames ) if( !g_OptNetListUseNames )
m_UseNetNamesInNetlist->SetSelection( 1 ); m_UseNetNamesInNetlist->SetSelection( 1 );
page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 ); page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 );
page->m_CommandStringCtrl = new WinEDA_EnterText( page, page->m_CommandStringCtrl = new WinEDA_EnterText( page,
_( _( "Simulator command:" ),
"Simulator command:" ),
g_SimulatorCommandLine, g_SimulatorCommandLine,
page->m_LowBoxSizer, wxDefaultSize ); page->m_LowBoxSizer,
wxDefaultSize );
// Add buttons // Add buttons
Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) ); Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) );
...@@ -296,19 +310,23 @@ void WinEDA_NetlistFrame::InstallCustomPages() ...@@ -296,19 +310,23 @@ void WinEDA_NetlistFrame::InstallCustomPages()
if( title.IsEmpty() ) if( title.IsEmpty() )
CurrPage = CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] = m_PanelNetType[PANELCUSTOMBASE + ii] =
new EDA_NoteBookPage( m_NoteBook, _( "Add Plugin" ), new EDA_NoteBookPage( m_NoteBook,
_( "Add Plugin" ),
NET_TYPE_CUSTOM1 + ii, NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_SETUP_PLUGIN ); ID_CURRENT_FORMAT_IS_DEFAULT,
ID_SETUP_PLUGIN );
else /* Install a plugin panel */ else /* Install a plugin panel */
CurrPage = CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] = m_PanelNetType[PANELCUSTOMBASE + ii] =
new EDA_NoteBookPage( m_NoteBook, title, new EDA_NoteBookPage( m_NoteBook,
title,
NET_TYPE_CUSTOM1 + ii, NET_TYPE_CUSTOM1 + ii,
ID_CURRENT_FORMAT_IS_DEFAULT, ID_CREATE_NETLIST ); ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
msg = CUSTOM_NETLIST_COMMAND; msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1; msg << ii + 1;
wxString Command = m_Parent->m_Parent->m_EDA_Config->Read( msg ); wxString Command = wxGetApp().m_EDA_Config->Read( msg );
CurrPage->m_CommandStringCtrl = CurrPage->m_CommandStringCtrl =
new WinEDA_EnterText( CurrPage, new WinEDA_EnterText( CurrPage,
_( "Netlist command:" ), Command, _( "Netlist command:" ), Command,
...@@ -334,7 +352,7 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event ) ...@@ -334,7 +352,7 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
wxString FullFileName, Mask, Path; wxString FullFileName, Mask, Path;
Mask = wxT( "*" ); Mask = wxT( "*" );
Path = g_EDA_Appl->m_BinDir; Path = wxGetApp().m_BinDir;
FullFileName = EDA_FileSelector( _( "Plugin files:" ), FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path, /* Chemin par defaut */ Path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ FullFileName, /* nom fichier par defaut */
...@@ -358,16 +376,16 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event ) ...@@ -358,16 +376,16 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
wxString title = CurrPage->m_TitleStringCtrl->GetValue(); wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( title.IsEmpty() ) if( title.IsEmpty() )
DisplayInfo( this, DisplayInfo( this,
_( _( "Do not forget to choose a title for this netlist control page" ) );
"Do not forget to choose a title for this netlist control page" ) );
} }
/*****************************************************************/ /*****************************************************************/
void WinEDA_NetlistFrame::SelectNetlistType( wxCommandEvent& event ) void WinEDA_NetlistFrame::SelectNetlistType( wxCommandEvent& event )
/*****************************************************************/ /*****************************************************************/
/* Called when the check box "default format" is clicked /* Called when the check box "default format" is clicked
*/ */
{ {
int ii; int ii;
EDA_NoteBookPage* CurrPage; EDA_NoteBookPage* CurrPage;
...@@ -450,7 +468,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event ) ...@@ -450,7 +468,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
Mask = wxT( "*" ) + FileExt + wxT( "*" ); Mask = wxT( "*" ) + FileExt + wxT( "*" );
ChangeFileNameExt( FullFileName, FileExt ); ChangeFileNameExt( FullFileName, FileExt );
FullFileName = FullFileName.AfterLast('/'); FullFileName = FullFileName.AfterLast( '/' );
FullFileName = EDA_FileSelector( _( "Netlist files:" ), FullFileName = EDA_FileSelector( _( "Netlist files:" ),
wxEmptyString, /* Defaut path */ wxEmptyString, /* Defaut path */
FullFileName, /* Defaut filename */ FullFileName, /* Defaut filename */
...@@ -474,7 +492,9 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event ) ...@@ -474,7 +492,9 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
/* Cleanup the entire hierarchy */ /* Cleanup the entire hierarchy */
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( SCH_SCREEN* screen = ScreenList.GetFirst();
screen != NULL;
screen = ScreenList.GetNext() )
{ {
bool ModifyWires; bool ModifyWires;
ModifyWires = screen->SchematicCleanUp( NULL ); ModifyWires = screen->SchematicCleanUp( NULL );
...@@ -559,6 +579,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void ) ...@@ -559,6 +579,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void )
*/ */
{ {
wxString msg, Command; wxString msg, Command;
wxConfig* config = wxGetApp().m_EDA_Config;
NetlistUpdateOpt(); NetlistUpdateOpt();
...@@ -577,7 +598,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void ) ...@@ -577,7 +598,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void )
{ {
msg = CUSTOM_NETLIST_TITLE; msg = CUSTOM_NETLIST_TITLE;
msg << ii + 1; msg << ii + 1;
m_Parent->m_Parent->m_EDA_Config->Write( msg, title ); config->Write( msg, title );
} }
} }
...@@ -586,7 +607,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void ) ...@@ -586,7 +607,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void )
Command = CurrPage->m_CommandStringCtrl->GetValue(); Command = CurrPage->m_CommandStringCtrl->GetValue();
msg = CUSTOM_NETLIST_COMMAND; msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1; msg << ii + 1;
m_Parent->m_Parent->m_EDA_Config->Write( msg, Command ); config->Write( msg, Command );
} }
} }
} }
...@@ -600,7 +621,8 @@ void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event ) ...@@ -600,7 +621,8 @@ void WinEDA_NetlistFrame::DeletePluginPanel( wxCommandEvent& event )
* Remove a panel relative to a netlist plugin * Remove a panel relative to a netlist plugin
*/ */
{ {
EDA_NoteBookPage* CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); EDA_NoteBookPage* CurrPage =
(EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString ); CurrPage->m_CommandStringCtrl->SetValue( wxEmptyString );
CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString ); CurrPage->m_TitleStringCtrl->SetValue( wxEmptyString );
...@@ -622,7 +644,8 @@ void WinEDA_NetlistFrame::ValidatePluginPanel( wxCommandEvent& event ) ...@@ -622,7 +644,8 @@ void WinEDA_NetlistFrame::ValidatePluginPanel( wxCommandEvent& event )
* Validate the panel info relative to a new netlist plugin * Validate the panel info relative to a new netlist plugin
*/ */
{ {
EDA_NoteBookPage* CurrPage = (EDA_NoteBookPage*) m_NoteBook->GetCurrentPage(); EDA_NoteBookPage* CurrPage =
(EDA_NoteBookPage*) m_NoteBook->GetCurrentPage();
if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString ) if( CurrPage->m_CommandStringCtrl->GetValue() == wxEmptyString )
{ {
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
/*******************************/ /*******************************/
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, COMMON_EVENTS_DRAWFRAME
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV,
WinEDA_DrawFrame::OnSockRequestServer ) WinEDA_DrawFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_DrawFrame::OnSockRequest ) EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_DrawFrame::OnSockRequest )
...@@ -128,13 +129,14 @@ END_EVENT_TABLE() ...@@ -128,13 +129,14 @@ END_EVENT_TABLE()
/****************/ /****************/
WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
WinEDA_DrawFrame( father, SCHEMATIC_FRAME, parent, title, pos, size, style ) WinEDA_DrawFrame( father, SCHEMATIC_FRAME, title, pos, size, style )
{ {
wxConfig* config = wxGetApp().m_EDA_Config;
m_FrameName = wxT( "SchematicFrame" ); m_FrameName = wxT( "SchematicFrame" );
m_Draw_Axis = FALSE; // TRUE to show axis m_Draw_Axis = FALSE; // TRUE to show axis
m_Draw_Grid = g_ShowGrid; // TRUE to show a grid m_Draw_Grid = g_ShowGrid; // TRUE to show a grid
...@@ -143,7 +145,8 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, ...@@ -143,7 +145,8 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
m_CurrentField = NULL; m_CurrentField = NULL;
m_Multiflag = 0; m_Multiflag = 0;
m_TextFieldSize = DEFAULT_SIZE_TEXT; m_TextFieldSize = DEFAULT_SIZE_TEXT;
m_LibeditFrame = NULL; // Component editor frame.
m_ViewlibFrame = NULL; // Frame for browsing component libraries
CreateScreens(); CreateScreens();
...@@ -159,11 +162,13 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, ...@@ -159,11 +162,13 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
/* Get config */ /* Get config */
GetSettings(); GetSettings();
g_DrawMinimunLineWidth = if( config )
m_Parent->m_EDA_Config->Read( MINI_DRAW_LINE_WIDTH_KEY, (long) 0 ); {
g_DrawMinimunLineWidth = config->Read( MINI_DRAW_LINE_WIDTH_KEY,
g_PlotPSMinimunLineWidth = (long) 0 );
m_Parent->m_EDA_Config->Read( MINI_PLOTPS_LINE_WIDTH_KEY, (long) 4 ); g_PlotPSMinimunLineWidth = config->Read( MINI_PLOTPS_LINE_WIDTH_KEY,
(long) 4 );
}
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 );
...@@ -183,7 +188,6 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, ...@@ -183,7 +188,6 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
WinEDA_SchematicFrame::~WinEDA_SchematicFrame() WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
{ {
m_Parent->m_SchematicFrame = NULL;
SAFE_DELETE( g_RootSheet ); SAFE_DELETE( g_RootSheet );
SAFE_DELETE( m_CurrentSheet ); //a DrawSheetPath, on the heap. SAFE_DELETE( m_CurrentSheet ); //a DrawSheetPath, on the heap.
m_CurrentSheet = NULL; m_CurrentSheet = NULL;
...@@ -290,10 +294,11 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -290,10 +294,11 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/ /*****************************************************************/
{ {
DrawSheetPath* sheet; DrawSheetPath* sheet;
wxConfig* config = wxGetApp().m_EDA_Config;
if( m_Parent->m_LibeditFrame ) // Can close component editor ? if( m_LibeditFrame ) // Can close component editor ?
{ {
if( !m_Parent->m_LibeditFrame->Close() ) if( !m_LibeditFrame->Close() )
return; return;
} }
...@@ -349,10 +354,12 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -349,10 +354,12 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
SaveSettings(); SaveSettings();
m_Parent->m_EDA_Config->Write( MINI_DRAW_LINE_WIDTH_KEY, if( config )
(long) g_DrawMinimunLineWidth ); {
m_Parent->m_EDA_Config->Write( MINI_PLOTPS_LINE_WIDTH_KEY, config->Write( MINI_DRAW_LINE_WIDTH_KEY, (long) g_DrawMinimunLineWidth );
config->Write( MINI_PLOTPS_LINE_WIDTH_KEY,
(long) g_PlotPSMinimunLineWidth ); (long) g_PlotPSMinimunLineWidth );
}
Destroy(); Destroy();
} }
...@@ -576,16 +583,14 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event ) ...@@ -576,16 +583,14 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
/*************************************************************************/ /*************************************************************************/
{ {
if( m_Parent->m_ViewlibFrame ) if( m_ViewlibFrame )
{ {
m_Parent->m_ViewlibFrame->Show( TRUE ); m_ViewlibFrame->Show( TRUE );
} }
else else
{ {
m_Parent->m_ViewlibFrame = m_ViewlibFrame = new WinEDA_ViewlibFrame( this );
new WinEDA_ViewlibFrame( m_Parent->m_SchematicFrame, m_ViewlibFrame->AdjustScrollBars();
m_Parent );
m_Parent->m_ViewlibFrame->AdjustScrollBars();
} }
} }
...@@ -593,20 +598,18 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event ) ...@@ -593,20 +598,18 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
/*************************************************************************/ /*************************************************************************/
{ {
if( m_Parent->m_LibeditFrame ) if( m_LibeditFrame )
{ {
m_Parent->m_LibeditFrame->Show( TRUE ); m_LibeditFrame->Show( TRUE );
} }
else else
{ {
m_Parent->m_LibeditFrame = m_LibeditFrame = new WinEDA_LibeditFrame( this,
new WinEDA_LibeditFrame( m_Parent->m_SchematicFrame,
m_Parent,
wxT( "Library Editor" ), wxT( "Library Editor" ),
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
ActiveScreen = g_ScreenLib; ActiveScreen = g_ScreenLib;
m_Parent->m_LibeditFrame->AdjustScrollBars(); m_LibeditFrame->AdjustScrollBars();
} }
} }
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -21,7 +20,9 @@ ...@@ -21,7 +20,9 @@
/* Routines locales */ /* Routines locales */
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre ); static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre );
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
static void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos ); static void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos );
/* Variables locales */ /* Variables locales */
...@@ -60,8 +61,12 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event ) ...@@ -60,8 +61,12 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_Parent->DrawPanel->PrepareGraphicContext( &dc ); m_Parent->DrawPanel->PrepareGraphicContext( &dc );
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( m_Parent->DrawPanel,
CurrentDrawItem, g_XorMode ); &dc,
CurrentLibEntry,
wxPoint( 0, 0 ),
CurrentDrawItem,
g_XorMode );
if( g_FlDrawSpecificUnit ) if( g_FlDrawSpecificUnit )
CurrentDrawItem->m_Unit = CurrentUnit; CurrentDrawItem->m_Unit = CurrentUnit;
...@@ -77,22 +82,27 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event ) ...@@ -77,22 +82,27 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawArc*) CurrentDrawItem )->m_Width = m_GraphicShapeWidthCtrl->GetValue(); ( (LibDrawArc*) CurrentDrawItem )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break; break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawCircle*) CurrentDrawItem )->m_Width = m_GraphicShapeWidthCtrl->GetValue(); ( (LibDrawCircle*) CurrentDrawItem )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break; break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawSquare*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawSquare*) CurrentDrawItem )->m_Width = m_GraphicShapeWidthCtrl->GetValue(); ( (LibDrawSquare*) CurrentDrawItem )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
( (LibDrawPolyline*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawPolyline*) CurrentDrawItem )->m_Fill =
( (LibDrawPolyline*) CurrentDrawItem )->m_Width = m_GraphicShapeWidthCtrl-> FlSymbol_Fill;
( (LibDrawPolyline*) CurrentDrawItem )->m_Width =
m_GraphicShapeWidthCtrl->
GetValue(); GetValue();
break; break;
...@@ -104,8 +114,12 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event ) ...@@ -104,8 +114,12 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( m_Parent->DrawPanel,
CurrentDrawItem, g_XorMode ); &dc,
CurrentLibEntry,
wxPoint( 0, 0 ),
CurrentDrawItem,
g_XorMode );
} }
Close(); Close();
...@@ -127,7 +141,8 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, ...@@ -127,7 +141,8 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC,
if( DrawItem == NULL ) if( DrawItem == NULL )
return; return;
WinEDA_bodygraphics_PropertiesFrame* frame = new WinEDA_bodygraphics_PropertiesFrame( this ); WinEDA_bodygraphics_PropertiesFrame* frame =
new WinEDA_bodygraphics_PropertiesFrame( this );
frame->ShowModal(); frame->Destroy(); frame->ShowModal(); frame->Destroy();
} }
...@@ -150,7 +165,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -150,7 +165,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->m_Parent->RedrawActiveWindow( DC, TRUE ); Panel->m_Parent->RedrawActiveWindow( DC, TRUE );
} }
else else
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, g_XorMode ); CurrentDrawItem, g_XorMode );
SAFE_DELETE( CurrentDrawItem ); SAFE_DELETE( CurrentDrawItem );
} }
...@@ -161,7 +176,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -161,7 +176,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = StartCursor; Panel->GetScreen()->m_Curseur = StartCursor;
RedrawWhileMovingCursor( Panel, DC, TRUE ); RedrawWhileMovingCursor( Panel, DC, TRUE );
Panel->GetScreen()->m_Curseur = curpos; Panel->GetScreen()->m_Curseur = curpos;
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, GR_DEFAULT_DRAWMODE ); CurrentDrawItem, GR_DEFAULT_DRAWMODE );
CurrentDrawItem->m_Flags = 0; CurrentDrawItem->m_Flags = 0;
...@@ -303,7 +318,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -303,7 +318,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
else else
{ {
StartMoveDrawSymbol( DC ); StartMoveDrawSymbol( DC );
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry,
wxPoint( 0, 0 ),
Text, g_XorMode ); Text, g_XorMode );
} }
} }
...@@ -376,7 +392,9 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC ) ...@@ -376,7 +392,9 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
/**************************************************************************/ /**************************************************************************/
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase )
/**************************************************************************/ /**************************************************************************/
/* Redraw the graphoc shape while moving /* Redraw the graphoc shape while moving
...@@ -441,7 +459,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos ) ...@@ -441,7 +459,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
int ii, imax = ( (LibDrawPolyline*) CurrentDrawItem )->m_CornersCount * 2; int ii, imax =
( (LibDrawPolyline*) CurrentDrawItem )->m_CornersCount * 2;
int* ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList; int* ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
int dx = mx - ptpoly[0]; int dx = mx - ptpoly[0];
int dy = -my - ptpoly[1]; int dy = -my - ptpoly[1];
...@@ -495,7 +514,8 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC ) ...@@ -495,7 +514,8 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
InitPosition.x = *( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList; InitPosition.x = *( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
InitPosition.y = *( ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList + 1 ); InitPosition.y =
*( ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList + 1 );
break; break;
case COMPONENT_LINE_DRAW_TYPE: case COMPONENT_LINE_DRAW_TYPE:
...@@ -536,11 +556,18 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -536,11 +556,18 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( StateDrawArc == 1 ) if( StateDrawArc == 1 )
{ {
int Color = ReturnLayerColor( LAYER_DEVICE ); int Color = ReturnLayerColor( LAYER_DEVICE );
GRLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY, ArcEndX, -ArcEndY, 0, Color ); GRLine( &panel->m_ClipBox,
DC,
ArcStartX,
-ArcStartY,
ArcEndX,
-ArcEndY,
0,
Color );
} }
else else
{ {
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, DrawMode ); CurrentDrawItem, DrawMode );
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE ) if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{ {
...@@ -575,7 +602,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -575,7 +602,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
dx = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.x - mx; dx = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.x - mx;
dy = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.y + my; dy = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.y + my;
( (LibDrawCircle*) CurrentDrawItem )->m_Rayon = (int) sqrt( ((double)dx * dx) + ((double)dy * dy) ); ( (LibDrawCircle*) CurrentDrawItem )->m_Rayon =
(int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
break; break;
...@@ -587,7 +615,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -587,7 +615,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList; ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
ptpoly += 2 * ( ( (LibDrawPolyline*) CurrentDrawItem )->m_CornersCount - 1 ); ptpoly += 2 *
( ( (LibDrawPolyline*) CurrentDrawItem )->m_CornersCount - 1 );
ptpoly[0] = mx; ptpoly[0] = mx;
ptpoly[1] = -my; ptpoly[1] = -my;
( (LibDrawPolyline*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawPolyline*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
...@@ -608,11 +637,18 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -608,11 +637,18 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( StateDrawArc == 1 ) if( StateDrawArc == 1 )
{ {
int Color = ReturnLayerColor( LAYER_DEVICE ); int Color = ReturnLayerColor( LAYER_DEVICE );
GRLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY, ArcEndX, -ArcEndY, 0, Color ); GRLine( &panel->m_ClipBox,
DC,
ArcStartX,
-ArcStartY,
ArcEndX,
-ArcEndY,
0,
Color );
} }
else else
{ {
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, DrawMode ); CurrentDrawItem, DrawMode );
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE ) if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{ {
...@@ -710,7 +746,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC ) ...@@ -710,7 +746,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
MoveLibDrawItemAt( CurrentDrawItem, pos ); MoveLibDrawItemAt( CurrentDrawItem, pos );
} }
DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), CurrentUnit, DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ), CurrentUnit,
CurrentConvert, GR_DEFAULT_DRAWMODE ); CurrentConvert, GR_DEFAULT_DRAWMODE );
CurrentDrawItem->m_Flags = 0; CurrentDrawItem->m_Flags = 0;
...@@ -745,7 +781,7 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre ) ...@@ -745,7 +781,7 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
/* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */ /* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */
dx = ArcEndX - ArcStartX; dy = ArcEndY - ArcStartY; dx = ArcEndX - ArcStartX; dy = ArcEndY - ArcStartY;
cX -= ArcStartX; cY -= ArcStartY; cX -= ArcStartX; cY -= ArcStartY;
angle = (int) (atan2( (double)dy, (double)dx ) * 1800 / M_PI); angle = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
RotatePoint( &dx, &dy, angle ); /* Le segment dx, dy est horizontal */ RotatePoint( &dx, &dy, angle ); /* Le segment dx, dy est horizontal */
/* -> dx = longueur, dy = 0 */ /* -> dx = longueur, dy = 0 */
RotatePoint( &cX, &cY, angle ); RotatePoint( &cX, &cY, angle );
...@@ -759,14 +795,14 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre ) ...@@ -759,14 +795,14 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
dx = ArcStartX - DrawItem->m_Pos.x; dx = ArcStartX - DrawItem->m_Pos.x;
dy = ArcStartY - DrawItem->m_Pos.y; dy = ArcStartY - DrawItem->m_Pos.y;
DrawItem->m_Rayon = (int) sqrt( ((double)dx * dx) + ((double)dy * dy) ); DrawItem->m_Rayon = (int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
DrawItem->t1 = (int) (atan2( (double)dy, (double)dx ) * 1800 / M_PI); DrawItem->t1 = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
dx = ArcEndX - DrawItem->m_Pos.x; dx = ArcEndX - DrawItem->m_Pos.x;
dy = ArcEndY - DrawItem->m_Pos.y; dy = ArcEndY - DrawItem->m_Pos.y;
DrawItem->t2 = (int) (atan2( (double)dy, (double)dx ) * 1800 / M_PI); DrawItem->t2 = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
DrawItem->m_ArcStart.x = ArcStartX; DrawItem->m_ArcStart.x = ArcStartX;
DrawItem->m_ArcStart.y = ArcStartY; DrawItem->m_ArcStart.y = ArcStartY;
...@@ -787,7 +823,9 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre ) ...@@ -787,7 +823,9 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
wxString msg; wxString msg;
angle = DrawItem->t2 - DrawItem->t1; angle = DrawItem->t2 - DrawItem->t1;
msg.Printf( _( "Arc %.1f deg" ), (float) angle / 10 ); msg.Printf( _( "Arc %.1f deg" ), (float) angle / 10 );
g_EDA_Appl->m_LibeditFrame->PrintMsg( msg ); WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame->PrintMsg( msg );
while( (DrawItem->t2 - DrawItem->t1) >= 1800 ) while( (DrawItem->t2 - DrawItem->t1) >= 1800 )
{ {
...@@ -821,7 +859,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) ...@@ -821,7 +859,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
int* ptpoly; int* ptpoly;
LibDrawPolyline* Poly = (LibDrawPolyline*) CurrentDrawItem; LibDrawPolyline* Poly = (LibDrawPolyline*) CurrentDrawItem;
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, g_XorMode ); CurrentDrawItem, g_XorMode );
while( Poly->m_CornersCount > 2 ) // First segment is kept, only its end point is changed while( Poly->m_CornersCount > 2 ) // First segment is kept, only its end point is changed
...@@ -840,6 +878,6 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) ...@@ -840,6 +878,6 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
int allocsize = 2 * sizeof(int) * Poly->m_CornersCount; int allocsize = 2 * sizeof(int) * Poly->m_CornersCount;
Poly->m_PolyList = (int*) realloc( Poly->m_PolyList, allocsize ); Poly->m_PolyList = (int*) realloc( Poly->m_PolyList, allocsize );
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, g_XorMode ); CurrentDrawItem, g_XorMode );
} }
...@@ -41,10 +41,10 @@ END_EVENT_TABLE() ...@@ -41,10 +41,10 @@ END_EVENT_TABLE()
/******************************************************************************/ /******************************************************************************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent, WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library, LibraryStruct* Library,
wxSemaphore* semaphore ) : wxSemaphore* semaphore ) :
WinEDA_DrawFrame( father, VIEWER_FRAME, parent, _( "Library browser" ), WinEDA_DrawFrame( father, VIEWER_FRAME, _( "Library browser" ),
wxDefaultPosition, wxDefaultSize ) wxDefaultPosition, wxDefaultSize )
/******************************************************************************/ /******************************************************************************/
{ {
...@@ -105,7 +105,9 @@ WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() ...@@ -105,7 +105,9 @@ WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
delete GetScreen(); delete GetScreen();
SetBaseScreen( 0 ); SetBaseScreen( 0 );
m_Parent->m_ViewlibFrame = NULL; WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
frame->m_ViewlibFrame = NULL;
} }
......
...@@ -22,99 +22,104 @@ ...@@ -22,99 +22,104 @@
/****************************************/ /****************************************/
BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow ) COMMON_EVENTS_DRAWFRAME
EVT_SIZE( WinEDA_GerberFrame::OnSize ) EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_GerberFrame::Process_Zoom ) WinEDA_GerberFrame::Process_Zoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_LOAD_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_SAVE_BOARD, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_SAVE_BOARD, WinEDA_GerberFrame::Files_io )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END, EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END,
WinEDA_DrawFrame::ProcessFontPreferences ) WinEDA_DrawFrame::ProcessFontPreferences )
// Menu Files: // Menu Files:
EVT_MENU( ID_MENU_LOAD_FILE, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_MENU_LOAD_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_MENU_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_NEW_BOARD, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_MENU_NEW_BOARD, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_SAVE_BOARD, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_MENU_SAVE_BOARD, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_SAVE_BOARD_AS, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_MENU_SAVE_BOARD_AS, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter ) EVT_MENU( ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, WinEDA_GerberFrame::ExportDataInPcbnewFormat ) EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW,
WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_GerberFrame::Files_io ) WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
// menu Config // menu Config
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END, EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
ID_CONFIG_AND_PREFERENCES_END,
WinEDA_GerberFrame::Process_Config ) WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage ) WinEDA_DrawFrame::SetLanguage )
// menu Postprocess // menu Postprocess
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES,
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// menu Miscellaneous // menu Miscellaneous
EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_PCB_GLOBAL_DELETE,
WinEDA_GerberFrame::Process_Special_Functions )
// Menu Help // Menu Help
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp ) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout ) EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings ) EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( wxID_CUT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( wxID_CUT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( wxID_COPY, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( wxID_PASTE, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_UNDO_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_UNDO_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_GerberFrame::ToPrinter ) EVT_TOOL( ID_GEN_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_DRC_CONTROL, WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER, EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBER_SELECT_TOOL, EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBER_SELECT_TOOL,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// Vertical toolbar: // Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_TRACK_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_TRACK_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT,
WinEDA_GerberFrame::Process_Special_Functions )
// Annulation de commande en cours // Annulation de commande en cours
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
// Pop up menu // Pop up menu
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// Option toolbar // Option toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
// PopUp Menu trait�s dans drawpanel.cpp // PopUp Menu trait�s dans drawpanel.cpp
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -123,14 +128,14 @@ END_EVENT_TABLE() ...@@ -123,14 +128,14 @@ END_EVENT_TABLE()
/****************/ /****************/
WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
WinEDA_BasePcbFrame( father, parent, GERBER_FRAME, title, pos, size, style ) WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT( "GerberFrame" ); m_FrameName = wxT( "GerberFrame" );
//m_AboutTitle = g_GerbviewAboutTitle; //m_AboutTitle = g_GerbviewAboutTitle;
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
...@@ -160,7 +165,6 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, ...@@ -160,7 +165,6 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
WinEDA_GerberFrame::~WinEDA_GerberFrame() WinEDA_GerberFrame::~WinEDA_GerberFrame()
{ {
m_Parent->m_GerberFrame = NULL;
SetBaseScreen( ScreenPcb ); SetBaseScreen( ScreenPcb );
} }
...@@ -237,9 +241,11 @@ void WinEDA_GerberFrame::SetToolbars() ...@@ -237,9 +241,11 @@ void WinEDA_GerberFrame::SetToolbars()
} }
if( m_SelLayerBox->GetSelection() != ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer ) if( m_SelLayerBox->GetSelection() !=
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer )
{ {
m_SelLayerBox->SetSelection( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer ); m_SelLayerBox->SetSelection(
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
} }
if( gerber ) if( gerber )
...@@ -264,8 +270,10 @@ void WinEDA_GerberFrame::SetToolbars() ...@@ -264,8 +270,10 @@ void WinEDA_GerberFrame::SetToolbars()
if( m_OptionsToolBar ) if( m_OptionsToolBar )
{ {
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, m_OptionsToolBar->ToggleTool(
g_UnitMetric == MILLIMETRE ? TRUE : FALSE ); ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric ==
MILLIMETRE ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : FALSE ); g_UnitMetric == INCHES ? TRUE : FALSE );
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "fctsys.h" #include "fctsys.h"
#include <wx/image.h>
#include <wx/file.h> #include <wx/file.h>
#include "common.h" #include "common.h"
...@@ -25,16 +24,16 @@ IMPLEMENT_APP( WinEDA_App ) ...@@ -25,16 +24,16 @@ IMPLEMENT_APP( WinEDA_App )
bool WinEDA_App::OnInit() bool WinEDA_App::OnInit()
{ {
g_EDA_Appl = this; WinEDA_GerberFrame* frame = NULL;
InitEDA_Appl( wxT( "gerbview" ) ); InitEDA_Appl( wxT( "gerbview" ) );
ScreenPcb = new PCB_SCREEN(); ScreenPcb = new PCB_SCREEN();
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER; ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
GetSettings(); GetSettings();
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
{ {
if( !IsOK( NULL, _( "GerbView is already running. Continue?" ) ) ) if( !IsOK( NULL, _( "GerbView is already running. Continue?" ) ) )
...@@ -43,31 +42,33 @@ bool WinEDA_App::OnInit() ...@@ -43,31 +42,33 @@ bool WinEDA_App::OnInit()
g_DrawBgColor = BLACK; g_DrawBgColor = BLACK;
Read_Hotkey_Config( m_PcbFrame, false ); /* Must be called before creating the main frame Read_Hotkey_Config( frame, false ); /* Must be called before creating the main frame
* in order to display the real hotkeys * in order to display the real hotkeys
* in menus or tool tips */ * in menus or tool tips */
m_GerberFrame = new WinEDA_GerberFrame( NULL, this, wxT( "GerbView" ), frame = new WinEDA_GerberFrame( NULL, wxT( "GerbView" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) ); wxPoint( 0, 0 ),
wxSize( 600, 400 ) );
/* Gerbview mainframe title */ /* Gerbview mainframe title */
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
m_GerberFrame->SetTitle( Title ); frame->SetTitle( Title );
m_GerberFrame->m_Pcb = new BOARD( NULL, m_GerberFrame ); frame->m_Pcb = new BOARD( NULL, frame );
SetTopWindow( m_GerberFrame ); // Set GerbView mainframe on top
m_GerberFrame->Show( TRUE ); // Show GerbView mainframe SetTopWindow( frame ); // Set GerbView mainframe on top
m_GerberFrame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame frame->Show( TRUE ); // Show GerbView mainframe
frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame
if( argc > 1 ) if( argc > 1 )
{ {
wxString fileName = MakeFileName( wxEmptyString, argv[1], g_PhotoFilenameExt ); wxString fileName = MakeFileName( wxEmptyString,
argv[1],
g_PhotoFilenameExt );
if( !fileName.IsEmpty() ) if( !fileName.IsEmpty() )
{ {
wxClientDC dc( m_GerberFrame->DrawPanel ); wxClientDC dc( frame->DrawPanel );
m_GerberFrame->DrawPanel->PrepareGraphicContext( &dc ); frame->DrawPanel->PrepareGraphicContext( &dc );
wxString path = wxPathOnly( fileName ); wxString path = wxPathOnly( fileName );
...@@ -77,14 +78,17 @@ bool WinEDA_App::OnInit() ...@@ -77,14 +78,17 @@ bool WinEDA_App::OnInit()
Read_Config(); Read_Config();
// Load all files specified on the command line. // Load all files specified on the command line.
for( int i=1; i<argc; ++i ) for( int i = 1; i<argc; ++i )
{ {
fileName = MakeFileName( wxEmptyString, argv[i], g_PhotoFilenameExt ); fileName = MakeFileName( wxEmptyString,
argv[i],
g_PhotoFilenameExt );
if( wxFileExists( fileName ) ) if( wxFileExists( fileName ) )
{ {
((PCB_SCREEN*)m_GerberFrame->GetScreen())->m_Active_Layer = i-1; ( (PCB_SCREEN*) frame->GetScreen() )->
m_GerberFrame->LoadOneGerberFile( fileName, &dc, FALSE ); m_Active_Layer = i - 1;
frame->LoadOneGerberFile( fileName, &dc, FALSE );
} }
} }
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "gerbview.h" #include "gerbview.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "id.h" #include "id.h"
#include "hotkeys_basic.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "gerbview_config.h" #include "gerbview_config.h"
...@@ -76,7 +75,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event ) ...@@ -76,7 +75,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
AddDelimiterString(FullFileName); AddDelimiterString( FullFileName );
wxString editorname = GetEditorName(); wxString editorname = GetEditorName();
if( !editorname.IsEmpty() ) if( !editorname.IsEmpty() )
ExecuteFile( this, editorname, FullFileName ); ExecuteFile( this, editorname, FullFileName );
...@@ -93,7 +92,8 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event ) ...@@ -93,7 +92,8 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_GerberFrame::Process_Config internal error" ) ); DisplayError( this,
wxT( "WinEDA_GerberFrame::Process_Config internal error" ) );
} }
} }
...@@ -111,7 +111,8 @@ bool Read_Config() ...@@ -111,7 +111,8 @@ bool Read_Config()
*/ */
{ {
g_Prj_Config_Filename_ext = wxT( ".cnf" ); g_Prj_Config_Filename_ext = wxT( ".cnf" );
g_EDA_Appl->ReadProjectConfig( wxT( "gerbview" ), GROUP, ParamCfgList, FALSE ); wxGetApp().ReadProjectConfig( wxT( "gerbview" ), GROUP, ParamCfgList,
FALSE );
/* Inits autres variables */ /* Inits autres variables */
if( ScreenPcb ) if( ScreenPcb )
...@@ -136,9 +137,9 @@ void WinEDA_GerberFrame::Update_config() ...@@ -136,9 +137,9 @@ void WinEDA_GerberFrame::Update_config()
*/ */
{ {
wxString FullFileName; wxString FullFileName;
wxString mask( wxT( "*" ) ), wxString mask( wxT( "*" ) );
g_Prj_Config_Filename_ext = wxT( ".cnf"; ) g_Prj_Config_Filename_ext = wxT( ".cnf" );
mask += g_Prj_Config_Filename_ext; mask += g_Prj_Config_Filename_ext;
FullFileName = wxT( "gerbview" ); FullFileName = wxT( "gerbview" );
...@@ -157,7 +158,7 @@ void WinEDA_GerberFrame::Update_config() ...@@ -157,7 +158,7 @@ void WinEDA_GerberFrame::Update_config()
return; return;
/* ecriture de la configuration */ /* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList ); wxGetApp().WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
} }
...@@ -169,9 +170,12 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose ) ...@@ -169,9 +170,12 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
* Read the hotkey files config for pcbnew and module_edit * Read the hotkey files config for pcbnew and module_edit
*/ */
{ {
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); wxString FullFileName = ReturnHotkeyConfigFilePath(
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile( FullFileName, s_Gerbview_Hokeys_Descr, verbose ); return frame->ReadHotkeyConfigFile( FullFileName,
s_Gerbview_Hokeys_Descr,
verbose );
} }
...@@ -51,9 +51,9 @@ private: ...@@ -51,9 +51,9 @@ private:
}; };
/* Construction de la table des evenements pour WinEDA_ConfigFrame */ /* Construction de la table des evenements pour WinEDA_ConfigFrame */
BEGIN_EVENT_TABLE( WinEDA_ConfigFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_ConfigFrame, wxDialog )
EVT_BUTTON( ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg ) EVT_BUTTON( ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg )
EVT_BUTTON( wxID_OK, WinEDA_ConfigFrame::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_ConfigFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -87,7 +87,7 @@ WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_GerberFrame* parent, ...@@ -87,7 +87,7 @@ WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_GerberFrame* parent,
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
/* Shows the config filename currently used : */ /* Shows the config filename currently used : */
title = _( "from " ) + g_EDA_Appl->m_CurrentOptionFile; title = _( "from " ) + wxGetApp().m_CurrentOptionFile;
SetTitle( title ); SetTitle( title );
LibModified = FALSE; LibModified = FALSE;
...@@ -117,15 +117,18 @@ WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_GerberFrame* parent, ...@@ -117,15 +117,18 @@ WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_GerberFrame* parent,
size.x = LEN_EXT; size.x = LEN_EXT;
size.y = -1; size.y = -1;
TextDrillExt = new WinEDA_EnterText( this, TextDrillExt = new WinEDA_EnterText( this,
_( "Drill File Ext:" ), g_DrillFilenameExt, _( "Drill File Ext:" ),
g_DrillFilenameExt,
LeftBoxSizer, size ); LeftBoxSizer, size );
TextPhotoExt = new WinEDA_EnterText( this, TextPhotoExt = new WinEDA_EnterText( this,
_( "Gerber File Ext:" ), g_PhotoFilenameExt, _( "Gerber File Ext:" ),
g_PhotoFilenameExt,
LeftBoxSizer, size ); LeftBoxSizer, size );
TextPenExt = new WinEDA_EnterText( this, TextPenExt = new WinEDA_EnterText( this,
_( "D code File Ext:" ), g_PenFilenameExt, _( "D code File Ext:" ),
g_PenFilenameExt,
LeftBoxSizer, size ); LeftBoxSizer, size );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
#include "protos.h" #include "protos.h"
#define BITMAP wxBitmap
#include "bitmaps.h" #include "bitmaps.h"
#include "id.h" #include "id.h"
...@@ -116,7 +114,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -116,7 +114,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
// Font selection and setup // Font selection and setup
AddFontSelectionMenu( configmenu ); AddFontSelectionMenu( configmenu );
m_Parent->SetLanguageList( configmenu ); wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ),
...@@ -166,7 +164,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -166,7 +164,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
else // Only an update of the files list else // Only an update of the files list
{ {
wxMenuItem* item; wxMenuItem* item;
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- ) for( ii = max_file - 1; ii >=0; ii-- )
{ {
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) ) if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
...@@ -210,24 +208,24 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -210,24 +208,24 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
SetToolBar( m_HToolBar ); SetToolBar( m_HToolBar );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, BITMAP( new_xpm ), m_HToolBar->AddTool( ID_NEW_BOARD, wxBitmap( new_xpm ),
wxNullBitmap, FALSE, wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "New World" ) ); _( "New World" ) );
m_HToolBar->AddTool( ID_LOAD_FILE, BITMAP( open_xpm ), m_HToolBar->AddTool( ID_LOAD_FILE, wxBitmap( open_xpm ),
wxNullBitmap, FALSE, wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Open existing Layer" ) ); _( "Open existing Layer" ) );
#if 0 #if 0
m_HToolBar->AddTool( ID_SAVE_PROJECT, BITMAP( save_button ), m_HToolBar->AddTool( ID_SAVE_PROJECT, wxBitmap( save_button ),
wxNullBitmap, FALSE, wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Save World" ) ); _( "Save World" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, BITMAP( sheetset_xpm ), m_HToolBar->AddTool( ID_SHEET_SET, wxBitmap( sheetset_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
...@@ -238,32 +236,32 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -238,32 +236,32 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
#if 0 #if 0
m_HToolBar->AddTool( wxID_CUT, BITMAP( cut_button ), m_HToolBar->AddTool( wxID_CUT, wxBitmap( cut_button ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Cut selected item" ) ); _( "Cut selected item" ) );
m_HToolBar->AddTool( wxID_COPY, BITMAP( copy_button ), m_HToolBar->AddTool( wxID_COPY, wxBitmap( copy_button ),
wxNullBitmap, FALSE, wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Copy selected item" ) ); _( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, BITMAP( paste_xpm ), m_HToolBar->AddTool( wxID_PASTE, wxBitmap( paste_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Paste" ) ); _( "Paste" ) );
#endif #endif
m_HToolBar->AddTool( ID_UNDO_BUTT, BITMAP( undelete_xpm ), m_HToolBar->AddTool( ID_UNDO_BUTT, wxBitmap( undelete_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Undelete" ) ); _( "Undelete" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, BITMAP( print_button ), m_HToolBar->AddTool( ID_GEN_PRINT, wxBitmap( print_button ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
...@@ -271,34 +269,34 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -271,34 +269,34 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN ); msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, BITMAP( zoom_in_xpm ), m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxBitmap( zoom_in_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
msg ); msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_OUT ); msg = AddHotkeyName( _( "Zoom out" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, BITMAP( zoom_out_xpm ), m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxBitmap( zoom_out_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
msg ); msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_REDRAW ); msg = AddHotkeyName( _( "Redraw view" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, BITMAP( zoom_redraw_xpm ), m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxBitmap( zoom_redraw_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
msg ); msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, BITMAP( zoom_auto_xpm ), m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxBitmap( zoom_auto_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Zoom auto" ) ); _( "Zoom auto" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_FIND_ITEMS, BITMAP( find_xpm ), m_HToolBar->AddTool( ID_FIND_ITEMS, wxBitmap( find_xpm ),
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
...@@ -354,7 +352,7 @@ create or update the right vertical toolbar ...@@ -354,7 +352,7 @@ create or update the right vertical toolbar
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, m_VToolBar->AddTool( ID_NO_SELECT_BUTT,
BITMAP( cursor_xpm ), wxBitmap( cursor_xpm ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL ); -1, -1, (wxObject*) NULL );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE ); m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
...@@ -362,26 +360,26 @@ create or update the right vertical toolbar ...@@ -362,26 +360,26 @@ create or update the right vertical toolbar
#if 0 #if 0
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_COMPONENT_BUTT, m_VToolBar->AddTool( ID_COMPONENT_BUTT,
BITMAP( component_button ), wxBitmap( component_button ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add Flashes" ) ); _( "Add Flashes" ) );
m_VToolBar->AddTool( ID_BUS_BUTT, m_VToolBar->AddTool( ID_BUS_BUTT,
BITMAP( bus_button ), wxBitmap( bus_button ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add Lines" ) ); _( "Add Lines" ) );
m_VToolBar->AddTool( ID_JUNCTION_BUTT, m_VToolBar->AddTool( ID_JUNCTION_BUTT,
BITMAP( junction_xpm ), wxBitmap( junction_xpm ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add layer alignment target" ) ); _( "Add layer alignment target" ) );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT,
BITMAP( tool_text_xpm ), wxBitmap( tool_text_xpm ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Add Text" ) ); _( "Add Text" ) );
...@@ -389,7 +387,7 @@ create or update the right vertical toolbar ...@@ -389,7 +387,7 @@ create or update the right vertical toolbar
#endif #endif
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT,
BITMAP( delete_body_xpm ), wxBitmap( delete_body_xpm ),
wxNullBitmap, TRUE, wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Delete items" ) ); _( "Delete items" ) );
...@@ -412,27 +410,27 @@ create or update the left vertical toolbar (option toolbar ...@@ -412,27 +410,27 @@ create or update the left vertical toolbar (option toolbar
// creation du tool bar options // creation du tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE ); m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, BITMAP( grid_xpm ), m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxBitmap( grid_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Display Grid OFF" ) ); _( "Display Grid OFF" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, BITMAP( polar_coord_xpm ), m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxBitmap( polar_coord_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Display Polar Coord ON" ) ); _( "Display Polar Coord ON" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
BITMAP( unit_inch_xpm ), wxBitmap( unit_inch_xpm ),
_( "Units in inches" ), wxITEM_CHECK ); _( "Units in inches" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
BITMAP( unit_mm_xpm ), wxBitmap( unit_mm_xpm ),
_( "Units in millimeters" ), wxITEM_CHECK ); _( "Units in millimeters" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, BITMAP( cursor_shape_xpm ), m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxBitmap( cursor_shape_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
...@@ -440,28 +438,28 @@ create or update the left vertical toolbar (option toolbar ...@@ -440,28 +438,28 @@ create or update the left vertical toolbar (option toolbar
m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
BITMAP( pad_sketch_xpm ), wxBitmap( pad_sketch_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show Spots in Sketch Mode" ) ); _( "Show Spots in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
BITMAP( showtrack_xpm ), wxBitmap( showtrack_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show Lines in Sketch Mode" ) ); _( "Show Lines in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
BITMAP( opt_show_polygon_xpm ), wxBitmap( opt_show_polygon_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show Polygons in Sketch Mode" ) ); _( "Show Polygons in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES,
BITMAP( show_dcodenumber_xpm ), wxBitmap( show_dcodenumber_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
......
...@@ -24,14 +24,6 @@ class WinEDA_App : public wxApp ...@@ -24,14 +24,6 @@ class WinEDA_App : public wxApp
public: public:
wxString m_Project; wxString m_Project;
wxSingleInstanceChecker* m_Checker; wxSingleInstanceChecker* m_Checker;
WinEDA_MainFrame* m_MainFrame;
WinEDA_PcbFrame* m_PcbFrame;
WinEDA_ModuleEditFrame* m_ModuleEditFrame;
WinEDA_GerberFrame* m_GerberFrame;
WinEDA_SchematicFrame* m_SchematicFrame; // Edition des Schemas
WinEDA_LibeditFrame* m_LibeditFrame; // Edition des composants
WinEDA_ViewlibFrame* m_ViewlibFrame; // Visualisation des composants
WinEDA_CvpcbFrame* m_CvpcbFrame;
wxPoint m_HelpPos; wxPoint m_HelpPos;
wxSize m_HelpSize; wxSize m_HelpSize;
...@@ -46,9 +38,10 @@ public: ...@@ -46,9 +38,10 @@ public:
* (utilis si KICAD non dfini)*/ * (utilis si KICAD non dfini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargs */ wxArrayString m_LastProject; /* liste des derniers projets chargs */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */ unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv; /* Chemin de kicad dfini dans la variable wxString m_KicadEnv; /* Chemin de kicad dfini dans la
* d'environnement KICAD, * variable d'environnement KICAD,
* typiquement /usr/local/kicad ou c:\kicad */ * typiquement /usr/local/kicad ou
* c:\kicad */
bool m_Env_Defined; // TRUE si variable d'environnement KICAD definie bool m_Env_Defined; // TRUE si variable d'environnement KICAD definie
wxLocale* m_Locale; // Gestion de la localisation wxLocale* m_Locale; // Gestion de la localisation
......
...@@ -276,9 +276,6 @@ COMMON_GLOBL wxString g_ProductName ...@@ -276,9 +276,6 @@ COMMON_GLOBL wxString g_ProductName
#endif #endif
; ;
COMMON_GLOBL WinEDA_App* g_EDA_Appl; /* this is the main application */
/* Gestion des librairies */ /* Gestion des librairies */
COMMON_GLOBL wxString g_RealLibDirBuffer; // Chemin reel des librairies de module COMMON_GLOBL wxString g_RealLibDirBuffer; // Chemin reel des librairies de module
// = UserLibDirBuffer si non vide // = UserLibDirBuffer si non vide
......
...@@ -52,6 +52,8 @@ public: ...@@ -52,6 +52,8 @@ public:
DrawSheetPath* m_CurrentSheet; ///< which sheet we are presently working on. DrawSheetPath* m_CurrentSheet; ///< which sheet we are presently working on.
int m_Multiflag; int m_Multiflag;
wxPoint m_OldPos; wxPoint m_OldPos;
WinEDA_LibeditFrame* m_LibeditFrame;
WinEDA_ViewlibFrame* m_ViewlibFrame;
private: private:
...@@ -62,7 +64,7 @@ private: ...@@ -62,7 +64,7 @@ private:
public: public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent, WinEDA_SchematicFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
...@@ -362,7 +364,7 @@ public: ...@@ -362,7 +364,7 @@ public:
WinEDAChoiceBox* m_SelAliasBox; WinEDAChoiceBox* m_SelAliasBox;
public: public:
WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent, WinEDA_LibeditFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
...@@ -473,7 +475,7 @@ public: ...@@ -473,7 +475,7 @@ public:
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
public: public:
WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent, WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library = NULL, LibraryStruct* Library = NULL,
wxSemaphore* semaphore = NULL ); wxSemaphore* semaphore = NULL );
......
...@@ -61,13 +61,14 @@ public: ...@@ -61,13 +61,14 @@ public:
int m_DisplayModText; // How show module texts int m_DisplayModText; // How show module texts
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, TRUE = filled */ bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, TRUE = filled */
WinEDA3D_DrawFrame* m_Draw3DFrame; WinEDA3D_DrawFrame* m_Draw3DFrame;
WinEDA_ModuleEditFrame* m_ModuleEditFrame;
protected: protected:
GENERAL_COLLECTOR* m_Collector; GENERAL_COLLECTOR* m_Collector;
public: public:
WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype, WinEDA_BasePcbFrame( wxWindow* father, int idtype,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
...@@ -327,7 +328,7 @@ private: ...@@ -327,7 +328,7 @@ private:
void createPopUpBlockMenu( wxMenu* menu ); void createPopUpBlockMenu( wxMenu* menu );
public: public:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, WinEDA_PcbFrame( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
...@@ -743,7 +744,7 @@ private: ...@@ -743,7 +744,7 @@ private:
wxMenu* m_FilesMenu; wxMenu* m_FilesMenu;
public: public:
WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, WinEDA_GerberFrame( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
...@@ -869,7 +870,7 @@ public: ...@@ -869,7 +870,7 @@ public:
wxString m_CurrentLib; wxString m_CurrentLib;
public: public:
WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent, WinEDA_ModuleEditFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
......
...@@ -123,7 +123,6 @@ class WinEDA_BasicFrame : public wxFrame ...@@ -123,7 +123,6 @@ class WinEDA_BasicFrame : public wxFrame
{ {
public: public:
int m_Ident; // Id Type (pcb, schematic, library..) int m_Ident; // Id Type (pcb, schematic, library..)
WinEDA_App* m_Parent;
wxPoint m_FramePos; wxPoint m_FramePos;
wxSize m_FrameSize; wxSize m_FrameSize;
int m_MsgFrameHeight; int m_MsgFrameHeight;
...@@ -138,7 +137,7 @@ public: ...@@ -138,7 +137,7 @@ public:
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_BasicFrame( wxWindow* father, int idtype, WinEDA_App* parent, WinEDA_BasicFrame( wxWindow* father, int idtype,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE); long style = KICAD_DEFAULT_DRAWFRAME_STYLE);
...@@ -216,7 +215,7 @@ protected: ...@@ -216,7 +215,7 @@ protected:
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_App* parent, WinEDA_DrawFrame( wxWindow* father, int idtype,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
......
/*****************************************************************************/ /*****************************************************************************/
/** /**
* @file buildmnu.cpp * @file buildmnu.cpp
* @brief TODO * @brief TODO
...@@ -8,105 +9,99 @@ ...@@ -8,105 +9,99 @@
#include "wx/spinctrl.h" #include "wx/spinctrl.h"
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "kicad.h" #include "kicad.h"
#include "macros.h" #include "macros.h"
#define BITMAP wxBitmap
#include "bitmaps.h" // Common bitmaps #include "bitmaps.h" // Common bitmaps
#include "id.h" #include "id.h"
/*****************************************************************************/ /*****************************************************************************/
BEGIN_EVENT_TABLE(WinEDA_MainFrame, WinEDA_BasicFrame) 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 )
/* Sash drag events */ /* Sash drag events */
EVT_SASH_DRAGGED(ID_LEFT_FRAME, EVT_SASH_DRAGGED( ID_LEFT_FRAME,
WinEDA_MainFrame::OnSashDrag) WinEDA_MainFrame::OnSashDrag )
EVT_SASH_DRAGGED(ID_BOTTOM_FRAME, EVT_SASH_DRAGGED( ID_BOTTOM_FRAME,
WinEDA_MainFrame::OnSashDrag) WinEDA_MainFrame::OnSashDrag )
EVT_SASH_DRAGGED(ID_MAIN_COMMAND, EVT_SASH_DRAGGED( ID_MAIN_COMMAND,
WinEDA_MainFrame::OnSashDrag) WinEDA_MainFrame::OnSashDrag )
/* Toolbar events */ /* Toolbar events */
EVT_TOOL(ID_NEW_PROJECT, EVT_TOOL( ID_NEW_PROJECT,
WinEDA_MainFrame::Process_Files) WinEDA_MainFrame::Process_Files )
EVT_TOOL(ID_LOAD_PROJECT, EVT_TOOL( ID_LOAD_PROJECT,
WinEDA_MainFrame::Process_Files) WinEDA_MainFrame::Process_Files )
EVT_TOOL(ID_SAVE_PROJECT, EVT_TOOL( ID_SAVE_PROJECT,
WinEDA_MainFrame::Process_Files) WinEDA_MainFrame::Process_Files )
EVT_TOOL(ID_SAVE_AND_ZIP_FILES, EVT_TOOL( ID_SAVE_AND_ZIP_FILES,
WinEDA_MainFrame::Process_Files) WinEDA_MainFrame::Process_Files )
/* Menu events */ /* Menu events */
EVT_MENU(ID_SAVE_PROJECT, EVT_MENU( ID_SAVE_PROJECT,
WinEDA_MainFrame::Process_Files) WinEDA_MainFrame::Process_Files )
EVT_MENU(ID_EXIT, EVT_MENU( ID_EXIT,
WinEDA_MainFrame::Process_Special_Functions) WinEDA_MainFrame::Process_Special_Functions )
EVT_MENU(ID_TO_EDITOR, EVT_MENU( ID_TO_EDITOR,
WinEDA_MainFrame::Process_Fct) WinEDA_MainFrame::Process_Fct )
EVT_MENU(ID_BROWSE_AN_SELECT_FILE, EVT_MENU( ID_BROWSE_AN_SELECT_FILE,
WinEDA_MainFrame::Process_Fct) WinEDA_MainFrame::Process_Fct )
EVT_MENU(ID_SELECT_PREFERED_EDITOR, EVT_MENU( ID_SELECT_PREFERED_EDITOR,
WinEDA_MainFrame::Process_Preferences) WinEDA_MainFrame::Process_Preferences )
EVT_MENU(ID_SELECT_DEFAULT_PDF_BROWSER, EVT_MENU( ID_SELECT_DEFAULT_PDF_BROWSER,
WinEDA_MainFrame::Process_Preferences) WinEDA_MainFrame::Process_Preferences )
EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER, EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER,
WinEDA_MainFrame::Process_Preferences) WinEDA_MainFrame::Process_Preferences )
EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER_NAME, EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER_NAME,
WinEDA_MainFrame::Process_Preferences) WinEDA_MainFrame::Process_Preferences )
EVT_MENU(ID_SAVE_AND_ZIP_FILES, EVT_MENU( ID_SAVE_AND_ZIP_FILES,
WinEDA_MainFrame::Process_Files) WinEDA_MainFrame::Process_Files )
EVT_MENU(ID_READ_ZIP_ARCHIVE, EVT_MENU( ID_READ_ZIP_ARCHIVE,
WinEDA_MainFrame::Process_Files) WinEDA_MainFrame::Process_Files )
EVT_MENU(ID_PROJECT_TREE_REFRESH, EVT_MENU( ID_PROJECT_TREE_REFRESH,
WinEDA_MainFrame::OnRefresh) WinEDA_MainFrame::OnRefresh )
EVT_MENU(ID_PREFERENCES_FONT_INFOSCREEN, EVT_MENU( ID_PREFERENCES_FONT_INFOSCREEN,
WinEDA_MainFrame::Process_Preferences) WinEDA_MainFrame::Process_Preferences )
EVT_MENU(ID_GENERAL_HELP, EVT_MENU( ID_GENERAL_HELP,
WinEDA_MainFrame::GetKicadHelp) WinEDA_MainFrame::GetKicadHelp )
EVT_MENU(ID_KICAD_ABOUT, EVT_MENU( ID_KICAD_ABOUT,
WinEDA_MainFrame::GetKicadAbout) WinEDA_MainFrame::GetKicadAbout )
/* Range menu events */ /* Range menu events */
EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, EVT_MENU_RANGE( ID_LANGUAGE_CHOICE,
ID_LANGUAGE_CHOICE_END, ID_LANGUAGE_CHOICE_END,
WinEDA_MainFrame::SetLanguage) WinEDA_MainFrame::SetLanguage )
EVT_MENU_RANGE(ID_LOAD_PROJECT, EVT_MENU_RANGE( ID_LOAD_PROJECT,
ID_LOAD_FILE_10, ID_LOAD_FILE_10,
WinEDA_MainFrame::Process_Files) WinEDA_MainFrame::Process_Files )
/* Button events */ /* Button events */
EVT_BUTTON(ID_TO_PCB, EVT_BUTTON( ID_TO_PCB,
WinEDA_MainFrame::Process_Fct) WinEDA_MainFrame::Process_Fct )
EVT_BUTTON(ID_TO_CVPCB, EVT_BUTTON( ID_TO_CVPCB,
WinEDA_MainFrame::Process_Fct) WinEDA_MainFrame::Process_Fct )
EVT_BUTTON(ID_TO_EESCHEMA, EVT_BUTTON( ID_TO_EESCHEMA,
WinEDA_MainFrame::Process_Fct) WinEDA_MainFrame::Process_Fct )
EVT_BUTTON(ID_TO_GERBVIEW, EVT_BUTTON( ID_TO_GERBVIEW,
WinEDA_MainFrame::Process_Fct) WinEDA_MainFrame::Process_Fct )
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
EVT_BUTTON(ID_RUN_PYTHON, WinEDA_MainFrame::Process_Fct) EVT_BUTTON( ID_RUN_PYTHON, WinEDA_MainFrame::Process_Fct )
#endif #endif
/*****************************************************************************/ /*****************************************************************************/
END_EVENT_TABLE() END_EVENT_TABLE()
/*****************************************************************************/ /*****************************************************************************/
/** /**
* @brief TODO * @brief TODO
*/ */
...@@ -115,7 +110,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() ...@@ -115,7 +110,7 @@ void WinEDA_MainFrame::ReCreateMenuBar()
/*****************************************************************************/ /*****************************************************************************/
{ {
int ii, jj; int ii, jj;
wxMenuBar *menuBar = GetMenuBar() ; wxMenuBar* menuBar = GetMenuBar();
// Check if menubar is empty // Check if menubar is empty
if( menuBar == NULL ) if( menuBar == NULL )
...@@ -125,30 +120,30 @@ void WinEDA_MainFrame::ReCreateMenuBar() ...@@ -125,30 +120,30 @@ void WinEDA_MainFrame::ReCreateMenuBar()
// Open project // Open project
wxMenuItem *item = new wxMenuItem(m_FilesMenu, wxMenuItem* item = new wxMenuItem( m_FilesMenu,
ID_LOAD_PROJECT, ID_LOAD_PROJECT,
_("&Open"), _( "&Open" ),
_("Open an existing project") ); _( "Open an existing project" ) );
item->SetBitmap(open_project_xpm); item->SetBitmap( open_project_xpm );
m_FilesMenu->Append(item); m_FilesMenu->Append( item );
// New project // New project
item = new wxMenuItem(m_FilesMenu, item = new wxMenuItem( m_FilesMenu,
ID_NEW_PROJECT, ID_NEW_PROJECT,
_("&New"), _( "&New" ),
_("Start a new project") ); _( "Start a new project" ) );
item->SetBitmap(new_project_xpm); item->SetBitmap( new_project_xpm );
m_FilesMenu->Append(item); m_FilesMenu->Append( item );
// Save project // Save project
item = new wxMenuItem(m_FilesMenu, item = new wxMenuItem( m_FilesMenu,
ID_SAVE_PROJECT, ID_SAVE_PROJECT,
_("&Save"), _( "&Save" ),
_("Save current project") ); _( "Save current project" ) );
item->SetBitmap(save_project_xpm); item->SetBitmap( save_project_xpm );
m_FilesMenu->Append(item); m_FilesMenu->Append( item );
// Separator // Separator
...@@ -156,21 +151,21 @@ void WinEDA_MainFrame::ReCreateMenuBar() ...@@ -156,21 +151,21 @@ void WinEDA_MainFrame::ReCreateMenuBar()
// Archive project // Archive project
item = new wxMenuItem(m_FilesMenu, item = new wxMenuItem( m_FilesMenu,
ID_SAVE_AND_ZIP_FILES, ID_SAVE_AND_ZIP_FILES,
_("&Archive"), _( "&Archive" ),
_("Archive project files in zip archive") ); _( "Archive project files in zip archive" ) );
item->SetBitmap(zip_xpm); item->SetBitmap( zip_xpm );
m_FilesMenu->Append(item); m_FilesMenu->Append( item );
// Unarchive project // Unarchive project
item = new wxMenuItem(m_FilesMenu, item = new wxMenuItem( m_FilesMenu,
ID_READ_ZIP_ARCHIVE, ID_READ_ZIP_ARCHIVE,
_("&Unarchive"), _( "&Unarchive" ),
_("Unarchive project files from zip file") ); _( "Unarchive project files from zip file" ) );
item->SetBitmap(unzip_xpm); item->SetBitmap( unzip_xpm );
m_FilesMenu->Append(item); m_FilesMenu->Append( item );
// Separator // Separator
...@@ -178,181 +173,177 @@ void WinEDA_MainFrame::ReCreateMenuBar() ...@@ -178,181 +173,177 @@ void WinEDA_MainFrame::ReCreateMenuBar()
// Exit // Exit
item = new wxMenuItem(m_FilesMenu, item = new wxMenuItem( m_FilesMenu,
ID_EXIT, ID_EXIT,
_("E&xit"), _( "E&xit" ),
_("Quit kicad") ); _( "Quit kicad" ) );
item->SetBitmap(exit_xpm); item->SetBitmap( exit_xpm );
m_FilesMenu->Append(item); m_FilesMenu->Append( item );
// Create last 10 project entries // Create last 10 project entries
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
for ( ii = 0; ii < 10; ii++ ) for( ii = 0; ii < 10; ii++ )
{ {
m_MenuBar = menuBar = new wxMenuBar(); m_MenuBar = menuBar = new wxMenuBar();
if ( GetLastProject(ii).IsEmpty() ) if( GetLastProject( ii ).IsEmpty() )
break; break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) ); m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
} }
/*************************************************************************/ /*************************************************************************/
wxMenu *browseMenu = new wxMenu(); wxMenu* browseMenu = new wxMenu();
/*************************************************************************/ /*************************************************************************/
// Editor // Editor
item = new wxMenuItem(browseMenu, // Entry in menu item = new wxMenuItem( browseMenu, // Entry in menu
ID_TO_EDITOR, // Entry ID ID_TO_EDITOR, // Entry ID
_("Text E&ditor"), // Entry text _( "Text E&ditor" ), // Entry text
_("Open prefered text editor") ); // Status bar text _( "Open prefered text editor" ) ); // Status bar text
item->SetBitmap(editor_xpm); // Entry XPM Bitmap item->SetBitmap( editor_xpm ); // Entry XPM Bitmap
browseMenu->Append(item); // Append wxMenuItem to menu browseMenu->Append( item ); // Append wxMenuItem to menu
// Browse files // Browse files
item = new wxMenuItem(browseMenu, item = new wxMenuItem( browseMenu,
ID_BROWSE_AN_SELECT_FILE, ID_BROWSE_AN_SELECT_FILE,
_("&Browse Files"), _( "&Browse Files" ),
_("Read or edit files with text editor") ); _( "Read or edit files with text editor" ) );
item->SetBitmap(browse_files_xpm); item->SetBitmap( browse_files_xpm );
browseMenu->Append(item); browseMenu->Append( item );
/*************************************************************************/ /*************************************************************************/
wxMenu *PreferencesMenu = new wxMenu; wxMenu* PreferencesMenu = new wxMenu;
/*************************************************************************/ /*************************************************************************/
// Fonts // Fonts
item = new wxMenuItem(PreferencesMenu, item = new wxMenuItem( PreferencesMenu,
ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_INFOSCREEN,
_("Fonts"), _( "Fonts" ),
_("Font preferences")); _( "Font preferences" ) );
item->SetBitmap(fonts_xpm); item->SetBitmap( fonts_xpm );
PreferencesMenu->Append(item); PreferencesMenu->Append( item );
// Prefered text editor // Prefered text editor
item = new wxMenuItem(PreferencesMenu, item = new wxMenuItem( PreferencesMenu,
ID_SELECT_PREFERED_EDITOR, ID_SELECT_PREFERED_EDITOR,
_("&Text Editor"), _( "&Text Editor" ),
_("Select your prefered text editor") ); _( "Select your prefered text editor" ) );
item->SetBitmap(editor_xpm); item->SetBitmap( editor_xpm );
PreferencesMenu->Append(item); PreferencesMenu->Append( item );
// Submenu Pdf Browser selection: system browser or user // Submenu Pdf Browser selection: system browser or user
// selected browser (and its name) // selected browser (and its name)
/*************************************************************************/ /*************************************************************************/
wxMenu *SubMenuPdfBrowserChoice = new wxMenu; wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
/*************************************************************************/ /*************************************************************************/
// Default PDF viewer // Default PDF viewer
item = new wxMenuItem(SubMenuPdfBrowserChoice, item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_DEFAULT_PDF_BROWSER, ID_SELECT_DEFAULT_PDF_BROWSER,
_("Default PDF Viewer"), _( "Default PDF Viewer" ),
_("Use the default (system) PDF viewer used to browse datasheets"), _( "Use the default (system) PDF viewer used to browse datasheets" ),
wxITEM_CHECK); wxITEM_CHECK );
SETBITMAPS(datasheet_xpm); SETBITMAPS( datasheet_xpm );
SubMenuPdfBrowserChoice->Append(item); SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->Check(ID_SELECT_DEFAULT_PDF_BROWSER, SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
g_EDA_Appl->m_PdfBrowserIsDefault); wxGetApp().m_PdfBrowserIsDefault );
// Favourite PDF viewer // Favourite PDF viewer
item = new wxMenuItem(SubMenuPdfBrowserChoice, item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER, ID_SELECT_PREFERED_PDF_BROWSER,
_("Favourite PDF Viewer"), _( "Favourite PDF Viewer" ),
_("Use your favourite PDF viewer used to browse datasheets"), _( "Use your favourite PDF viewer used to browse datasheets" ),
wxITEM_CHECK); wxITEM_CHECK );
SETBITMAPS(preference_xpm); SETBITMAPS( preference_xpm );
SubMenuPdfBrowserChoice->Append(item); SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->AppendSeparator(); SubMenuPdfBrowserChoice->AppendSeparator();
SubMenuPdfBrowserChoice->Check(ID_SELECT_PREFERED_PDF_BROWSER, SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER,
!g_EDA_Appl->m_PdfBrowserIsDefault); !wxGetApp().m_PdfBrowserIsDefault );
item = new wxMenuItem(SubMenuPdfBrowserChoice, item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER_NAME, ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_("Select Pdf Viewer"), _( "Select Pdf Viewer" ),
_("Select your favourite PDF viewer used to browse datasheets")); _( "Select your favourite PDF viewer used to browse datasheets" ) );
item->SetBitmap(datasheet_xpm); item->SetBitmap( datasheet_xpm );
SubMenuPdfBrowserChoice->Append(item); SubMenuPdfBrowserChoice->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(PreferencesMenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( PreferencesMenu,
SubMenuPdfBrowserChoice, SubMenuPdfBrowserChoice,
-1, _("Pdf Viewer"), -1, _( "Pdf Viewer" ),
_("Pdf viewer preferences"), _( "Pdf viewer preferences" ),
datasheet_xpm); datasheet_xpm );
PreferencesMenu->AppendSeparator(); PreferencesMenu->AppendSeparator();
m_Parent->SetLanguageList(PreferencesMenu); wxGetApp().SetLanguageList( PreferencesMenu );
/*************************************************************************/ /*************************************************************************/
wxMenu *helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
/*************************************************************************/ /*************************************************************************/
// Contents // Contents
item = new wxMenuItem(helpMenu , item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP, ID_GENERAL_HELP,
_("&Contents"), _( "&Contents" ),
_("Open the kicad manual")); _( "Open the kicad manual" ) );
item->SetBitmap(help_xpm); item->SetBitmap( help_xpm );
helpMenu->Append(item); helpMenu->Append( item );
// About Kicad // About Kicad
item = new wxMenuItem(helpMenu , item = new wxMenuItem( helpMenu,
ID_KICAD_ABOUT, ID_KICAD_ABOUT,
_("&About"), _( "&About" ),
_("About kicad project manager")); _( "About kicad project manager" ) );
item->SetBitmap(info_xpm); item->SetBitmap( info_xpm );
helpMenu->Append(item); helpMenu->Append( item );
// Append menus to menuBar // Append menus to menuBar
menuBar->Append(m_FilesMenu, _("&File")); menuBar->Append( m_FilesMenu, _( "&File" ) );
menuBar->Append(browseMenu, _("&Browse")); menuBar->Append( browseMenu, _( "&Browse" ) );
menuBar->Append(PreferencesMenu, _("&Preferences")); menuBar->Append( PreferencesMenu, _( "&Preferences" ) );
menuBar->Append(helpMenu, _("&Help")); menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menuBar); SetMenuBar( menuBar );
} }
else // TODO (ENGLISH!) simple mise a jour de la liste des fichiers anciens else // TODO (ENGLISH!) simple mise a jour de la liste des fichiers anciens
{ {
wxMenuItem * item; wxMenuItem* item;
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = wxGetApp().m_LastProjectMaxCount;
for ( ii = max_file-1; ii >=0 ; ii-- ) for( ii = max_file - 1; ii >=0; ii-- )
{ {
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{ {
item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii); item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if ( item ) if( item )
delete item; delete item;
} }
} }
for ( jj = 0, ii = 0; ii < max_file; ii++ ) for( jj = 0, ii = 0; ii < max_file; ii++ )
{ {
if (GetLastProject(ii).IsEmpty() ) if( GetLastProject( ii ).IsEmpty() )
break; break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + jj, GetLastProject(ii) ); m_FilesMenu->Append( ID_LOAD_FILE_1 + jj, GetLastProject( ii ) );
jj++; jj++;
} }
} }
} }
/** /**
* @brief TODO * @brief TODO
*/ */
...@@ -361,41 +352,41 @@ void WinEDA_MainFrame::RecreateBaseHToolbar() ...@@ -361,41 +352,41 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
/*****************************************************************************/ /*****************************************************************************/
{ {
// Check if toolbar is not already set // Check if toolbar is not already set
if ( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
// Allocate memory for m_HToolBar // Allocate memory for m_HToolBar
m_HToolBar = new WinEDA_Toolbar(TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE); m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
SetToolBar(m_HToolBar); SetToolBar( m_HToolBar );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool(ID_NEW_PROJECT, // Entry ID m_HToolBar->AddTool( ID_NEW_PROJECT, // Entry ID
BITMAP(new_project_xpm), // XPM Bitmap wxBitmap( new_project_xpm ), // XPM Bitmap
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, -1, -1,
(wxObject *) NULL, (wxObject*) NULL,
_("Start a new project")); // Tooltip _( "Start a new project" ) ); // Tooltip
// Load project // Load project
m_HToolBar->AddTool(ID_LOAD_PROJECT, // Entry ID m_HToolBar->AddTool( ID_LOAD_PROJECT, // Entry ID
BITMAP(open_project_xpm), // XPM Bitmap wxBitmap( open_project_xpm ), // XPM Bitmap
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject *) NULL, -1, -1, (wxObject*) NULL,
_("Load existing project")); // Tooltip _( "Load existing project" ) ); // Tooltip
// Save project // Save project
m_HToolBar->AddTool(ID_SAVE_PROJECT, // Entry ID m_HToolBar->AddTool( ID_SAVE_PROJECT, // Entry ID
BITMAP(save_project_xpm), // XPM Bitmap wxBitmap( save_project_xpm ), // XPM Bitmap
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, -1, -1,
(wxObject *) NULL, (wxObject*) NULL,
_( "Save current project" )); // Tooltip _( "Save current project" ) ); // Tooltip
// Separator // Separator
...@@ -403,12 +394,12 @@ void WinEDA_MainFrame::RecreateBaseHToolbar() ...@@ -403,12 +394,12 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
// Save and archive files // Save and archive files
m_HToolBar->AddTool(ID_SAVE_AND_ZIP_FILES, // Entry ID m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, // Entry ID
BITMAP(zip_xpm), // XPM Bitmap wxBitmap( zip_xpm ), // XPM Bitmap
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject *) NULL, -1, -1, (wxObject*) NULL,
_("Archive all project files")); // Tooltip _( "Archive all project files" ) ); // Tooltip
// Separator // Separator
...@@ -416,12 +407,12 @@ void WinEDA_MainFrame::RecreateBaseHToolbar() ...@@ -416,12 +407,12 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
// Refresh project tree // Refresh project tree
m_HToolBar->AddTool(ID_PROJECT_TREE_REFRESH, // Entry ID m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, // Entry ID
BITMAP(reload_xpm), // XPM Bitmap wxBitmap( reload_xpm ), // XPM Bitmap
wxNullBitmap, wxNullBitmap,
FALSE, FALSE,
-1, -1, (wxObject *) NULL, -1, -1, (wxObject*) NULL,
_("Refresh project tree")); // Tooltip _( "Refresh project tree" ) ); // Tooltip
m_HToolBar->Realize(); // Create m_HToolBar m_HToolBar->Realize(); // Create m_HToolBar
......
...@@ -144,7 +144,8 @@ static void Create_NewPrj_Config( const wxString PrjFullFileName ) ...@@ -144,7 +144,8 @@ static void Create_NewPrj_Config( const wxString PrjFullFileName )
g_BoardFileName = wxFileNameFromPath( PrjFullFileName ); g_BoardFileName = wxFileNameFromPath( PrjFullFileName );
ChangeFileNameExt( g_BoardFileName, g_BoardExtBuffer ); ChangeFileNameExt( g_BoardFileName, g_BoardExtBuffer );
g_EDA_Appl->WriteProjectConfig( PrjFullFileName, wxT( "/general" ), CfgParamList ); wxGetApp().WriteProjectConfig( PrjFullFileName, wxT( "/general" ),
CfgParamList );
} }
...@@ -176,7 +177,8 @@ void WinEDA_MainFrame::UnZipArchive( const wxString FullFileName ) ...@@ -176,7 +177,8 @@ void WinEDA_MainFrame::UnZipArchive( const wxString FullFileName )
PrintMsg( msg ); PrintMsg( msg );
wxString target_dirname = wxDirSelector( _( "Target Directory" ), wxString target_dirname = wxDirSelector( _( "Target Directory" ),
wxEmptyString, 0, wxDefaultPosition, this ); wxEmptyString, 0,
wxDefaultPosition, this );
if( target_dirname.IsEmpty() ) if( target_dirname.IsEmpty() )
return; return;
......
/*****************************************************************************/ /*****************************************************************************/
/** /**
* @file kicad.cpp * @file kicad.cpp
* @brief Main kicad library manager file * @brief Main kicad library manager file
...@@ -6,7 +7,6 @@ ...@@ -6,7 +7,6 @@
/*****************************************************************************/ /*****************************************************************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
...@@ -16,17 +16,12 @@ ...@@ -16,17 +16,12 @@
#include "fctsys.h" #include "fctsys.h"
#include <wx/image.h>
#ifdef USE_SPLASH_IMAGE #ifdef USE_SPLASH_IMAGE
#define SPLASH_IMAGE logo_kicad.png #define SPLASH_IMAGE logo_kicad.png
#include "wx/splash.h" #include "wx/splash.h"
#include "wx/mediactrl.h" #include "wx/mediactrl.h"
#endif #endif
#include <wx/button.h>
#include "wxstruct.h"
#include "common.h" #include "common.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "kicad.h" #include "kicad.h"
...@@ -39,16 +34,17 @@ ...@@ -39,16 +34,17 @@
/* Export functions */ /* Export functions */
/* Import functions */ /* Import functions */
char *GetFileName(char *FullPathName); char* GetFileName( char* FullPathName );
void ShowLogo(char * FonteFileName); void ShowLogo( char* FonteFileName );
/* Local functions */ /* Local functions */
/************************************/ /************************************/
/* Called to initialize the program */ /* Called to initialize the program */
/************************************/ /************************************/
// Create a new application object // Create a new application object
IMPLEMENT_APP(WinEDA_App) IMPLEMENT_APP( WinEDA_App )
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
...@@ -56,36 +52,69 @@ using namespace boost::python; ...@@ -56,36 +52,69 @@ using namespace boost::python;
/*****************************************************************************/ /*****************************************************************************/
// Global functions: // Global functions:
/*****************************************************************************/ /*****************************************************************************/
static WinEDA_MainFrame& GetMainFrame() { return *( wxGetApp().m_MainFrame ); } static WinEDA_MainFrame& GetMainFrame()
static void WinEDAPrint( str msg ) { GetMainFrame().PrintMsg( PyHandler::MakeStr( msg ) + wxT("\n") ); } {
static void WinEDAClear() { GetMainFrame().ClearMsg(); } return *( wxGetApp().m_MainFrame );
static object GetTypeExt( enum TreeFileType type ) { return PyHandler::Convert( WinEDA_PrjFrame::GetFileExt( type ) ); } }
static void WinEDAPrint( str msg )
{
GetMainFrame().PrintMsg( PyHandler::MakeStr( msg ) + wxT( "\n" ) );
}
static void WinEDAClear()
{
GetMainFrame().ClearMsg();
}
static object GetTypeExt( enum TreeFileType type )
{
return PyHandler::Convert( WinEDA_PrjFrame::GetFileExt( type ) );
}
/*****************************************************************************/ /*****************************************************************************/
// WinEDA_MainFrame Special binding functions: // WinEDA_MainFrame Special binding functions:
// (one line functions are simple wrappers) // (one line functions are simple wrappers)
/*****************************************************************************/ /*****************************************************************************/
object WinEDA_MainFrame::GetPrjName() const { return PyHandler::Convert( m_PrjFileName ); } object WinEDA_MainFrame::GetPrjName() const
object WinEDA_MainFrame::ToWx() { return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); } {
WinEDA_PrjFrame* WinEDA_MainFrame::GetTree() const { return m_LeftWin; } return PyHandler::Convert( m_PrjFileName );
}
object WinEDA_MainFrame::ToWx()
{
return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) );
}
WinEDA_PrjFrame* WinEDA_MainFrame::GetTree() const
{
return m_LeftWin;
}
/** /**
* @brief TODO * @brief TODO
*/ */
/*****************************************************************************/ /*****************************************************************************/
void WinEDA_MainFrame::AddFastLaunchPy( object & button ) void WinEDA_MainFrame::AddFastLaunchPy( object& button )
/*****************************************************************************/ /*****************************************************************************/
{ {
wxBitmapButton * btn; wxBitmapButton* btn;
bool success = wxPyConvertSwigPtr( button.ptr(),
(void**) &btn, _T( "wxBitmapButton" ) );
bool success = wxPyConvertSwigPtr( button.ptr(), (void**)&btn, _T("wxBitmapButton")); if( !success )
if(!success)
return; return;
Py_INCREF( button.ptr() ); Py_INCREF( button.ptr() );
...@@ -94,59 +123,70 @@ void WinEDA_MainFrame::AddFastLaunchPy( object & button ) ...@@ -94,59 +123,70 @@ void WinEDA_MainFrame::AddFastLaunchPy( object & button )
} }
/*****************************************************************************/ /*****************************************************************************/
// WinEDA_PrjFrame Special binding functions: // WinEDA_PrjFrame Special binding functions:
// (one line functions are simple wrappers) // (one line functions are simple wrappers)
/*****************************************************************************/ /*****************************************************************************/
// TODO To WxWidgets ? // TODO To WxWidgets ?
object WinEDA_PrjFrame::ToWx() object WinEDA_PrjFrame::ToWx()
{ return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); } {
return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) );
}
// TODO Get ? // TODO Get ?
object WinEDA_PrjFrame::GetFtExPy( enum TreeFileType type ) const object WinEDA_PrjFrame::GetFtExPy( enum TreeFileType type ) const
{ return PyHandler::Convert( GetFileExt( type ) ); } {
return PyHandler::Convert( GetFileExt( type ) );
}
// Get python menu // Get python menu
object WinEDA_PrjFrame::GetMenuPy( enum TreeFileType type ) object WinEDA_PrjFrame::GetMenuPy( enum TreeFileType type )
{ return object( handle<>( borrowed( wxPyMake_wxObject( GetContextMenu( (int) type ), false ) ) ) ); } {
return object( handle<>( borrowed( wxPyMake_wxObject( GetContextMenu( (int) type ), false ) ) ) );
}
// Get tree control // Get tree control
object WinEDA_PrjFrame::GetTreeCtrl() object WinEDA_PrjFrame::GetTreeCtrl()
{ return object( handle<>( borrowed( wxPyMake_wxObject( m_TreeProject, false ) ) ) ); } {
return object( handle<>( borrowed( wxPyMake_wxObject( m_TreeProject, false ) ) ) );
}
// Get current menu // Get current menu
object WinEDA_PrjFrame::GetCurrentMenu() object WinEDA_PrjFrame::GetCurrentMenu()
{ return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) ); } {
return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) );
}
/** /**
* @brief TODO * @brief TODO
*/ */
/*****************************************************************************/ /*****************************************************************************/
void WinEDA_PrjFrame::NewFilePy( const str & name, void WinEDA_PrjFrame::NewFilePy( const str& name,
enum TreeFileType type, enum TreeFileType type,
object & id ) object& id )
/*****************************************************************************/ /*****************************************************************************/
{ {
wxTreeItemId root; wxTreeItemId root;
if (! wxPyConvertSwigPtr( id.ptr(), (void**)&root, _T("wxTreeItemId") ) ) return;
if( !wxPyConvertSwigPtr( id.ptr(), (void**) &root, _T( "wxTreeItemId" ) ) )
return;
NewFile( PyHandler::MakeStr( name ), type, root ); NewFile( PyHandler::MakeStr( name ), type, root );
} }
/** /**
* @brief Add a file to the tree under root, or m_root if conversion is wrong * @brief Add a file to the tree under root, or m_root if conversion is wrong
*/ */
/*****************************************************************************/ /*****************************************************************************/
void WinEDA_PrjFrame::AddFilePy( const str & file, object & root ) void WinEDA_PrjFrame::AddFilePy( const str& file, object& root )
/*****************************************************************************/ /*****************************************************************************/
{ {
wxTreeItemId * theroot = &m_root; wxTreeItemId* theroot = &m_root;
if ( !wxPyConvertSwigPtr( root.ptr(), (void**)&root, _T("wxTreeItemId") ) ) if( !wxPyConvertSwigPtr( root.ptr(), (void**) &root, _T( "wxTreeItemId" ) ) )
{ {
theroot = &m_root; theroot = &m_root;
} }
...@@ -155,46 +195,53 @@ void WinEDA_PrjFrame::AddFilePy( const str & file, object & root ) ...@@ -155,46 +195,53 @@ void WinEDA_PrjFrame::AddFilePy( const str & file, object & root )
} }
/** /**
* @brief convert wxTreeItem into TreePrjItemData * @brief convert wxTreeItem into TreePrjItemData
*/ */
/*****************************************************************************/ /*****************************************************************************/
TreePrjItemData * WinEDA_PrjFrame::GetItemData( const object & item ) TreePrjItemData* WinEDA_PrjFrame::GetItemData( const object& item )
/*****************************************************************************/ /*****************************************************************************/
{ {
wxTreeItemId *id = NULL; wxTreeItemId* id = NULL;
if (!wxPyConvertSwigPtr( item.ptr(), (void**)&id, _T("wxTreeItemId"))) if( !wxPyConvertSwigPtr( item.ptr(), (void**) &id, _T( "wxTreeItemId" ) ) )
{ {
return NULL; return NULL;
} }
return dynamic_cast<TreePrjItemData *>( m_TreeProject->GetItemData( *id ) ); return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( *id ) );
} }
/*****************************************************************************/ /*****************************************************************************/
// TreePrjItemData Special binding functions // TreePrjItemData Special binding functions
// (one line functions are simple wrappers) // (one line functions are simple wrappers)
/*****************************************************************************/ /*****************************************************************************/
// Python rename // Python rename
bool TreePrjItemData::RenamePy( const str & newname, bool check ) bool TreePrjItemData::RenamePy( const str& newname, bool check )
{ return Rename( PyHandler::MakeStr(newname), check ); } {
return Rename( PyHandler::MakeStr( newname ), check );
}
// Get python directory // Get python directory
object TreePrjItemData::GetDirPy() const object TreePrjItemData::GetDirPy() const
{ return PyHandler::Convert( GetDir() ); } {
return PyHandler::Convert( GetDir() );
}
// Get python filename // Get python filename
object TreePrjItemData::GetFileNamePy() const object TreePrjItemData::GetFileNamePy() const
{ return PyHandler::Convert( GetFileName() ); } {
return PyHandler::Convert( GetFileName() );
}
// Get python menu // Get python menu
object TreePrjItemData::GetMenuPy() object TreePrjItemData::GetMenuPy()
{ return object( handle<>( borrowed( wxPyMake_wxObject( &m_fileMenu, false ) ) ) ); } {
return object( handle<>( borrowed( wxPyMake_wxObject( &m_fileMenu, false ) ) ) );
}
/** /**
...@@ -205,16 +252,19 @@ object TreePrjItemData::GetMenuPy() ...@@ -205,16 +252,19 @@ object TreePrjItemData::GetMenuPy()
static void py_kicad_init() static void py_kicad_init()
/*****************************************************************************/ /*****************************************************************************/
{ {
def( "GetMainFrame", &GetMainFrame, return_value_policy< reference_existing_object >() ); def( "GetMainFrame", &GetMainFrame,
return_value_policy< reference_existing_object >() );
def( "GetTypeExtension", &GetTypeExt ); def( "GetTypeExtension", &GetTypeExt );
class_<TreePrjItemData>( "PrjItem" ) class_<TreePrjItemData>( "PrjItem" )
// Internal data: // Internal data:
.def( "GetFileName", &TreePrjItemData::GetFileNamePy ) .def( "GetFileName", &TreePrjItemData::GetFileNamePy )
.def( "GetDir", &TreePrjItemData::GetDirPy ) .def( "GetDir", &TreePrjItemData::GetDirPy )
.def( "GetType", &TreePrjItemData::GetType ) .def( "GetType", &TreePrjItemData::GetType )
.def( "GetId", &TreePrjItemData::GetIdPy ) .def( "GetId", &TreePrjItemData::GetIdPy )
.def( "GetMenu", &TreePrjItemData::GetMenuPy ) .def( "GetMenu", &TreePrjItemData::GetMenuPy )
// Item control // Item control
.def( "SetState", &TreePrjItemData::SetState ) .def( "SetState", &TreePrjItemData::SetState )
.def( "Rename", &TreePrjItemData::RenamePy ) .def( "Rename", &TreePrjItemData::RenamePy )
...@@ -238,16 +288,20 @@ static void py_kicad_init() ...@@ -238,16 +288,20 @@ static void py_kicad_init()
class_<WinEDA_PrjFrame>( "TreeWindow" ) class_<WinEDA_PrjFrame>( "TreeWindow" )
// wx Interface // wx Interface
.def( "ToWx", &WinEDA_PrjFrame::ToWx ) .def( "ToWx", &WinEDA_PrjFrame::ToWx )
// common features // common features
.def( "GetContextMenu", &WinEDA_PrjFrame::GetMenuPy ) .def( "GetContextMenu", &WinEDA_PrjFrame::GetMenuPy )
.def( "GetFileExtension", &WinEDA_PrjFrame::GetFtExPy ) .def( "GetFileExtension", &WinEDA_PrjFrame::GetFtExPy )
// file filters control // file filters control
.def( "AddFilter", &WinEDA_PrjFrame::AddFilter ) .def( "AddFilter", &WinEDA_PrjFrame::AddFilter )
.def( "ClearFilters", &WinEDA_PrjFrame::ClearFilters ) .def( "ClearFilters", &WinEDA_PrjFrame::ClearFilters )
.def( "RemoveFilter", &WinEDA_PrjFrame::RemoveFilterPy ) .def( "RemoveFilter", &WinEDA_PrjFrame::RemoveFilterPy )
.def( "GetFilters", &WinEDA_PrjFrame::GetFilters, return_value_policy < copy_const_reference >() ) .def( "GetFilters", &WinEDA_PrjFrame::GetFilters,
return_value_policy < copy_const_reference >() )
.def( "GetCurrentMenu", &WinEDA_PrjFrame::GetCurrentMenu ) .def( "GetCurrentMenu", &WinEDA_PrjFrame::GetCurrentMenu )
...@@ -283,18 +337,19 @@ static void py_kicad_init() ...@@ -283,18 +337,19 @@ static void py_kicad_init()
class_<WinEDA_MainFrame>( "MainFrame" ) class_<WinEDA_MainFrame>( "MainFrame" )
// Wx interface // Wx interface
.def( "ToWx", &WinEDA_MainFrame::ToWx ) .def( "ToWx", &WinEDA_MainFrame::ToWx )
// Common controls // Common controls
.def( "AddFastLaunch", &WinEDA_MainFrame::AddFastLaunchPy ) .def( "AddFastLaunch", &WinEDA_MainFrame::AddFastLaunchPy )
.def( "Refresh", &WinEDA_MainFrame::OnRefreshPy ) .def( "Refresh", &WinEDA_MainFrame::OnRefreshPy )
.def( "GetProjectName", &WinEDA_MainFrame::GetPrjName ) .def( "GetProjectName", &WinEDA_MainFrame::GetPrjName )
.def( "GetProjectWindow", &WinEDA_MainFrame::GetTree, return_value_policy< reference_existing_object >() ); .def( "GetProjectWindow", &WinEDA_MainFrame::GetTree,
return_value_policy< reference_existing_object >() );
} }
/** /**
* @brief Common python module init * @brief Common python module init
*/ */
...@@ -305,74 +360,77 @@ static void py_common_init() ...@@ -305,74 +360,77 @@ static void py_common_init()
def( "Print", &WinEDAPrint ); def( "Print", &WinEDAPrint );
def( "Clear", &WinEDAClear ); def( "Clear", &WinEDAClear );
} }
#endif
#endif
/*****************************************************************************/ /*****************************************************************************/
bool WinEDA_App::OnInit() bool WinEDA_App::OnInit()
/*****************************************************************************/ /*****************************************************************************/
{ {
wxImage::AddHandler(new wxPNGHandler); WinEDA_MainFrame* frame;
g_EDA_Appl = this; InitEDA_Appl( wxT( "KiCad" ) );
InitEDA_Appl( wxT("KiCad"));
/* init kicad */ /* init kicad */
GetSettings(); // read current setup GetSettings(); // read current setup
/* Make nameless project translatable */ /* Make nameless project translatable */
wxString project_ext = _T(".pro"); wxString project_ext = _T( ".pro" );
wxString nameless_project = _("noname") + project_ext; wxString nameless_project = _( "noname" ) + project_ext;
m_MainFrame = new WinEDA_MainFrame(this, NULL, wxT("KiCad"), frame = new WinEDA_MainFrame( NULL, wxT( "KiCad" ),
wxPoint(30,20), wxSize(600,400) ); wxPoint( 30, 20 ), wxSize( 600, 400 ) );
if(argc > 1 ) if( argc > 1 )
m_MainFrame->m_PrjFileName = argv[1]; frame->m_PrjFileName = argv[1];
else if ( m_EDA_Config ) else if( m_EDA_Config )
{ {
m_MainFrame->m_PrjFileName = m_EDA_Config->Read(wxT("LastProject"), frame->m_PrjFileName = m_EDA_Config->Read( wxT( "LastProject" ),
nameless_project ); nameless_project );
} }
else else
m_MainFrame->m_PrjFileName = nameless_project; frame->m_PrjFileName = nameless_project;
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
Title += wxT(" ") + m_MainFrame->m_PrjFileName; Title += wxT( " " ) + frame->m_PrjFileName;
m_MainFrame->SetTitle(Title); frame->SetTitle( Title );
m_MainFrame->ReCreateMenuBar(); frame->ReCreateMenuBar();
m_MainFrame->RecreateBaseHToolbar(); frame->RecreateBaseHToolbar();
m_MainFrame->m_LeftWin->ReCreateTreePrj(); frame->m_LeftWin->ReCreateTreePrj();
SetTopWindow(m_MainFrame); SetTopWindow( frame );
/* Splash screen logo */ /* Splash screen logo */
#ifdef USE_SPLASH_IMAGE #ifdef USE_SPLASH_IMAGE
wxString logoname( wxString(m_BinDir) + _T("logokicad.png") ); wxString logoname( wxString( m_BinDir ) + _T( "logokicad.png" ) );
wxBitmap splash_screen; wxBitmap splash_screen;
if ( splash_screen.LoadFile( logoname, wxBITMAP_TYPE_PNG ) ) if( splash_screen.LoadFile( logoname, wxBITMAP_TYPE_PNG ) )
{ {
wxSplashScreen *splash = new wxSplashScreen(splash_screen, wxSplashScreen* splash = new wxSplashScreen( splash_screen,
wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT,
3000, m_MainFrame, wxID_ANY, wxDefaultPosition, wxDefaultSize, 3000,
wxSIMPLE_BORDER|wxSTAY_ON_TOP); frame,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
wxSIMPLE_BORDER | wxSTAY_ON_TOP );
} }
#endif /* USE_SPLASH_IMAGE */ #endif /* USE_SPLASH_IMAGE */
m_MainFrame->Show(TRUE); frame->Show( TRUE );
m_MainFrame->Raise(); frame->Raise();
if( wxFileExists(m_MainFrame->m_PrjFileName) ) if( wxFileExists( frame->m_PrjFileName ) )
{ {
m_MainFrame->Load_Prj_Config(); frame->Load_Prj_Config();
} }
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
PyHandler::GetInstance()->AddToModule( wxT("kicad"), &py_kicad_init ); PyHandler::GetInstance()->AddToModule( wxT( "kicad" ), &py_kicad_init );
PyHandler::GetInstance()->AddToModule( wxT("common"), &py_common_init ); PyHandler::GetInstance()->AddToModule( wxT( "common" ), &py_common_init );
#endif #endif
return TRUE; return TRUE;
......
...@@ -52,7 +52,7 @@ private: ...@@ -52,7 +52,7 @@ private:
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_MainFrame( WinEDA_App* eda_app, wxWindow* parent, const wxString& title, WinEDA_MainFrame( wxWindow* parent, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_MainFrame(); ~WinEDA_MainFrame();
......
...@@ -24,17 +24,17 @@ ...@@ -24,17 +24,17 @@
// Constructor // Constructor
/*****************************************************************************/ /*****************************************************************************/
WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app, WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
wxWindow* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size ) : const wxSize& size ) :
WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size ) WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, title, pos, size )
/*****************************************************************************/ /*****************************************************************************/
{ {
wxString msg; wxString msg;
wxString line; wxString line;
wxSize clientsize; wxSize clientsize;
wxConfig* config = wxGetApp().m_EDA_Config;
m_FrameName = wxT( "KicadFrame" ); m_FrameName = wxT( "KicadFrame" );
m_VToolBar = NULL; m_VToolBar = NULL;
...@@ -45,12 +45,11 @@ WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size ) ...@@ -45,12 +45,11 @@ WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size )
m_CommandWin_Height = 82; m_CommandWin_Height = 82;
GetSettings(); GetSettings();
if( m_Parent->m_EDA_Config )
if( config )
{ {
m_Parent->m_EDA_Config->Read( wxT( "LeftWinWidth" ), config->Read( wxT( "LeftWinWidth" ), &m_LeftWin_Width );
&m_LeftWin_Width ); config->Read( wxT( "CommandWinWidth" ), &m_CommandWin_Height );
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 );
...@@ -118,12 +117,14 @@ WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size ) ...@@ -118,12 +117,14 @@ WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size )
WinEDA_MainFrame::~WinEDA_MainFrame() WinEDA_MainFrame::~WinEDA_MainFrame()
/*****************************************************************************/ /*****************************************************************************/
{ {
if( m_Parent->m_EDA_Config ) wxConfig* config = wxGetApp().m_EDA_Config;
if( 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 ); config->Write( wxT( "LeftWinWidth" ), m_LeftWin_Width );
m_Parent->m_EDA_Config->Write( wxT( "CommandWinWidth" ), m_CommandWin_Height ); config->Write( wxT( "CommandWinWidth" ), m_CommandWin_Height );
} }
} }
...@@ -246,11 +247,11 @@ void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -246,11 +247,11 @@ void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event )
SaveSettings(); SaveSettings();
// Close the help frame // Close the help frame
if( m_Parent->m_HtmlCtrl ) if( wxGetApp().m_HtmlCtrl )
{ {
if( m_Parent->m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active
m_Parent->m_HtmlCtrl->GetFrame()->Close( TRUE ); wxGetApp().m_HtmlCtrl->GetFrame()->Close( TRUE );
m_Parent->m_HtmlCtrl = NULL; wxGetApp().m_HtmlCtrl = NULL;
} }
m_LeftWin->Show(false); m_LeftWin->Show(false);
...@@ -287,7 +288,8 @@ void WinEDA_MainFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -287,7 +288,8 @@ void WinEDA_MainFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_MainFrame::Process_Special_Functions error" ) ); DisplayError( this,
wxT( "WinEDA_MainFrame::Process_Special_Functions error" ) );
break; break;
} }
} }
...@@ -383,7 +385,8 @@ void WinEDA_MainFrame::Process_Fct( wxCommandEvent& event ) ...@@ -383,7 +385,8 @@ void WinEDA_MainFrame::Process_Fct( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_MainFrame::Process_Fct Internal Error" ) ); DisplayError( this,
wxT( "WinEDA_MainFrame::Process_Fct Internal Error" ) );
break; break;
} }
} }
......
/******************************************************************/ /******************************************************************/
/* mdiframe.cpp - fonctions de la classe du type WinEDA_MainFrame */ /* mdiframe.cpp - fonctions de la classe du type WinEDA_MainFrame */
/******************************************************************/ /******************************************************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -19,19 +19,21 @@ ...@@ -19,19 +19,21 @@
#include <wx/fontdlg.h> #include <wx/fontdlg.h>
static bool ChoosePdfBrowser(WinEDA_MainFrame * parent_frame) static bool ChoosePdfBrowser( WinEDA_MainFrame* parent_frame )
/* routine to choose the prefered Pdf browser /* routine to choose the prefered Pdf browser
*/ */
{ {
wxString mask(wxT("*")); wxString mask( wxT( "*" ) );
#ifdef __WINDOWS__ #ifdef __WINDOWS__
mask += wxT(".exe"); mask += wxT( ".exe" );
#endif #endif
g_EDA_Appl->ReadPdfBrowserInfos(); wxGetApp().ReadPdfBrowserInfos();
wxString FullFileName = g_EDA_Appl->m_PdfBrowser; wxString FullFileName = wxGetApp().m_PdfBrowser;
FullFileName = EDA_FileSelector( _("Prefered Pdf Browser:"), FullFileName = EDA_FileSelector( _( "Prefered Pdf Browser:" ),
wxPathOnly(FullFileName), /* Default path */ wxPathOnly( FullFileName ), /* Default path */
FullFileName, /* default filename */ FullFileName, /* default filename */
wxEmptyString, /* default filename extension */ wxEmptyString, /* default filename extension */
mask, /* filter for filename list */ mask, /* filter for filename list */
...@@ -39,63 +41,68 @@ mask += wxT(".exe"); ...@@ -39,63 +41,68 @@ mask += wxT(".exe");
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/ wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */ TRUE /* true = keep the current path */
); );
if ( ! FullFileName.IsEmpty() && (g_EDA_Appl->m_PdfBrowser != FullFileName) ) if( !FullFileName.IsEmpty() && (wxGetApp().m_PdfBrowser != FullFileName) )
{ {
g_EDA_Appl->m_PdfBrowser = FullFileName; wxGetApp().m_PdfBrowser = FullFileName;
g_EDA_Appl->WritePdfBrowserInfos(); wxGetApp().WritePdfBrowserInfos();
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
/****************************************************************/ /****************************************************************/
void WinEDA_MainFrame::Process_Preferences(wxCommandEvent& event) void WinEDA_MainFrame::Process_Preferences( wxCommandEvent& event )
/*****************************************************************/ /*****************************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
wxString FullFileName; wxString FullFileName;
wxString mask(wxT("*")); wxString mask( wxT( "*" ) );
#ifdef __WINDOWS__ #ifdef __WINDOWS__
mask += wxT(".exe"); mask += wxT( ".exe" );
#endif #endif
switch (id) switch( id )
{ {
case ID_SELECT_DEFAULT_PDF_BROWSER: case ID_SELECT_DEFAULT_PDF_BROWSER:
g_EDA_Appl->m_PdfBrowserIsDefault = TRUE; wxGetApp().m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, g_EDA_Appl->m_PdfBrowserIsDefault); GetMenuBar()->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, !g_EDA_Appl->m_PdfBrowserIsDefault); wxGetApp().m_PdfBrowserIsDefault );
g_EDA_Appl->WritePdfBrowserInfos(); GetMenuBar()->Check( ID_SELECT_PREFERED_PDF_BROWSER,
!wxGetApp().m_PdfBrowserIsDefault );
wxGetApp().WritePdfBrowserInfos();
break; break;
case ID_SELECT_PREFERED_PDF_BROWSER: case ID_SELECT_PREFERED_PDF_BROWSER:
if ( g_EDA_Appl->m_PdfBrowser.IsEmpty() ) if( wxGetApp().m_PdfBrowser.IsEmpty() )
{ {
DisplayError(this, _("You must choose a PDF viewer before use this option")); DisplayError( this,
ChoosePdfBrowser(this); _( "You must choose a PDF viewer before use this option" ) );
ChoosePdfBrowser( this );
} }
if ( g_EDA_Appl->m_PdfBrowser.IsEmpty() ) if( wxGetApp().m_PdfBrowser.IsEmpty() )
{ {
g_EDA_Appl->m_PdfBrowserIsDefault = TRUE; wxGetApp().m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, TRUE); GetMenuBar()->Check( ID_SELECT_DEFAULT_PDF_BROWSER, TRUE );
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, FALSE); GetMenuBar()->Check( ID_SELECT_PREFERED_PDF_BROWSER, FALSE );
} }
else else
{ {
g_EDA_Appl->m_PdfBrowserIsDefault = FALSE; wxGetApp().m_PdfBrowserIsDefault = FALSE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, FALSE); GetMenuBar()->Check( ID_SELECT_DEFAULT_PDF_BROWSER, FALSE );
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, TRUE); GetMenuBar()->Check( ID_SELECT_PREFERED_PDF_BROWSER, TRUE );
} }
g_EDA_Appl->WritePdfBrowserInfos(); wxGetApp().WritePdfBrowserInfos();
break; break;
case ID_SELECT_PREFERED_PDF_BROWSER_NAME: case ID_SELECT_PREFERED_PDF_BROWSER_NAME:
ChoosePdfBrowser(this); ChoosePdfBrowser( this );
break; break;
case ID_SELECT_PREFERED_EDITOR: case ID_SELECT_PREFERED_EDITOR:
FullFileName = EDA_FileSelector( _("Prefered Editor:"), FullFileName = EDA_FileSelector( _( "Prefered Editor:" ),
wxPathOnly(g_EditorName), /* Default path */ wxPathOnly( g_EditorName ), /* Default path */
g_EditorName, /* default filename */ g_EditorName, /* default filename */
wxEmptyString, /* default filename extension */ wxEmptyString, /* default filename extension */
mask, /* filter for filename list */ mask, /* filter for filename list */
...@@ -103,17 +110,18 @@ mask += wxT(".exe"); ...@@ -103,17 +110,18 @@ mask += wxT(".exe");
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/ wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */ TRUE /* true = keep the current path */
); );
if ( ( !FullFileName.IsEmpty() ) && g_EDA_Appl->m_EDA_CommonConfig) if( ( !FullFileName.IsEmpty() ) && wxGetApp().m_EDA_CommonConfig )
{ {
g_EditorName = FullFileName; g_EditorName = FullFileName;
g_EDA_Appl->m_EDA_CommonConfig->Write(wxT("Editor"), g_EditorName); wxGetApp().m_EDA_CommonConfig->Write( wxT( "Editor" ),
g_EditorName );
} }
break; break;
case ID_PREFERENCES_FONT_INFOSCREEN: case ID_PREFERENCES_FONT_INFOSCREEN:
{ {
wxFont font = wxGetFontFromUser(this, *g_StdFont); wxFont font = wxGetFontFromUser( this, *g_StdFont );
if ( font.Ok() ) if( font.Ok() )
{ {
int pointsize = font.GetPointSize(); int pointsize = font.GetPointSize();
*g_StdFont = font; *g_StdFont = font;
...@@ -121,24 +129,26 @@ mask += wxT(".exe"); ...@@ -121,24 +129,26 @@ mask += wxT(".exe");
g_DialogFontPointSize = pointsize; g_DialogFontPointSize = pointsize;
g_FixedFontPointSize = pointsize; g_FixedFontPointSize = pointsize;
m_LeftWin->ReCreateTreePrj(); m_LeftWin->ReCreateTreePrj();
m_DialogWin->SetFont(* g_StdFont); m_DialogWin->SetFont( *g_StdFont );
m_DialogWin->Refresh(); m_DialogWin->Refresh();
} }
break; break;
} }
default: DisplayError(this, wxT("WinEDA_MainFrame::Process_Preferences Internal Error") ); default:
DisplayError( this,
wxT( "WinEDA_MainFrame::Process_Preferences Internal Error" ) );
break; break;
} }
} }
/********************************************************/ /********************************************************/
void WinEDA_MainFrame::SetLanguage(wxCommandEvent& event) void WinEDA_MainFrame::SetLanguage( wxCommandEvent& event )
/********************************************************/ /********************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
m_Parent->SetLanguageIdentifier(id ); wxGetApp().SetLanguageIdentifier( id );
m_Parent->SetLanguage(); wxGetApp().SetLanguage();
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
#include <pyhandler.h> #include <pyhandler.h>
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "kicad.h" #include "kicad.h"
...@@ -22,13 +23,15 @@ void WinEDA_MainFrame::Load_Prj_Config() ...@@ -22,13 +23,15 @@ void WinEDA_MainFrame::Load_Prj_Config()
{ {
if( !wxFileExists( m_PrjFileName ) ) if( !wxFileExists( m_PrjFileName ) )
{ {
wxString msg = _( "Project File <" ) + m_PrjFileName + _( "> not found" ); wxString msg = _( "Project File <" ) + m_PrjFileName +
_( "> not found" );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
wxSetWorkingDirectory( wxPathOnly( m_PrjFileName ) ); wxSetWorkingDirectory( wxPathOnly( m_PrjFileName ) );
SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) + m_PrjFileName ); SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) +
m_PrjFileName );
ReCreateMenuBar(); ReCreateMenuBar();
m_LeftWin->ReCreateTreePrj(); m_LeftWin->ReCreateTreePrj();
...@@ -70,8 +73,6 @@ void WinEDA_MainFrame::Save_Prj_Config() ...@@ -70,8 +73,6 @@ void WinEDA_MainFrame::Save_Prj_Config()
return; return;
/* ecriture de la configuration */ /* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, wxT( "/general" ), CfgParamList ); wxGetApp().WriteProjectConfig( FullFileName, wxT( "/general" ),
CfgParamList );
} }
// vim: set tabstop=4 : noexpandtab :
...@@ -23,11 +23,10 @@ ...@@ -23,11 +23,10 @@
/*******************************/ /*******************************/
BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame ) BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME
COMMON_EVENTS_DRAWFRAME EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END, ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection ) WinEDA_BasePcbFrame::ProcessItemSelection )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -36,13 +35,12 @@ END_EVENT_TABLE() ...@@ -36,13 +35,12 @@ END_EVENT_TABLE()
/****************/ /****************/
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
WinEDA_App* parent,
int idtype, int idtype,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style) : long style) :
WinEDA_DrawFrame( father, idtype, parent, title, pos, size, style ) WinEDA_DrawFrame( father, idtype, title, pos, size, style )
{ {
m_InternalUnits = 10000; // Internal unit = 1/10000 inch m_InternalUnits = 10000; // Internal unit = 1/10000 inch
m_Pcb = NULL; m_Pcb = NULL;
...@@ -54,6 +52,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, ...@@ -54,6 +52,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
m_DisplayModText = FILLED; // How to show module texts m_DisplayModText = FILLED; // How to show module texts
m_DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = filled */ m_DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = filled */
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL) m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_ModuleEditFrame = NULL; // Frame for footprint edition
m_Collector = new GENERAL_COLLECTOR(); m_Collector = new GENERAL_COLLECTOR();
} }
...@@ -174,10 +173,10 @@ void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event ) ...@@ -174,10 +173,10 @@ void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
} }
#ifdef CVPCB #ifdef CVPCB
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, m_Parent, _( "3D Viewer" ), m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ),
KICAD_DEFAULT_3D_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT ); KICAD_DEFAULT_3D_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
#else #else
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, m_Parent, _( "3D Viewer" ) ); m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) );
#endif #endif
// Show the frame // Show the frame
m_Draw3DFrame->Show( TRUE ); m_Draw3DFrame->Show( TRUE );
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
/****************************************************/ /****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -23,7 +22,9 @@ ...@@ -23,7 +22,9 @@
/* Fonctions exportees */ /* Fonctions exportees */
/* Fonctions Locales */ /* Fonctions Locales */
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
static int MarkItemsInBloc( MODULE* module, static int MarkItemsInBloc( MODULE* module,
EDA_Rect& Rect ); EDA_Rect& Rect );
...@@ -193,7 +194,9 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -193,7 +194,9 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state,
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
...@@ -278,7 +281,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -278,7 +281,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state,
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
} }
...@@ -295,7 +300,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -295,7 +300,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
BOARD_ITEM* item; BOARD_ITEM* item;
wxPoint move_offset; wxPoint move_offset;
MODULE* Currentmodule = g_EDA_Appl->m_ModuleEditFrame->m_Pcb->m_Modules; MODULE* Currentmodule =
( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->m_Pcb->m_Modules;
PtBlock = &screen->BlockLocate; PtBlock = &screen->BlockLocate;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
...@@ -340,8 +346,10 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -340,8 +346,10 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
} }
/* Redessin nouvel affichage */ /* Redessin nouvel affichage */
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x; PtBlock->m_MoveVector.x = screen->m_Curseur.x -
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y; PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y -
PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
PtBlock->Offset( PtBlock->m_MoveVector ); PtBlock->Offset( PtBlock->m_MoveVector );
...@@ -413,7 +421,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset ) ...@@ -413,7 +421,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
TEXTE_MODULE* textm; TEXTE_MODULE * textm;
textm = new TEXTE_MODULE( module ); textm = new TEXTE_MODULE( module );
textm->Copy( (TEXTE_MODULE*) item ); textm->Copy( (TEXTE_MODULE*) item );
textm->m_Selected = IS_SELECTED; textm->m_Selected = IS_SELECTED;
...@@ -421,7 +429,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset ) ...@@ -421,7 +429,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
break; break;
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
EDGE_MODULE* edge; EDGE_MODULE * edge;
edge = new EDGE_MODULE( module ); edge = new EDGE_MODULE( module );
edge->Copy( (EDGE_MODULE*) item ); edge->Copy( (EDGE_MODULE*) item );
edge->m_Selected = IS_SELECTED; edge->m_Selected = IS_SELECTED;
...@@ -429,7 +437,8 @@ void CopyMarkedItems( MODULE* module, wxPoint offset ) ...@@ -429,7 +437,8 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
break; break;
default: default:
DisplayError( NULL, wxT( "Internal Err: CopyMarkedItems: type indefini" ) ); DisplayError( NULL,
wxT( "Internal Err: CopyMarkedItems: type indefini" ) );
break; break;
} }
} }
...@@ -570,15 +579,19 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -570,15 +579,19 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
{ {
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
SETMIRROR( ( (EDGE_MODULE*) item )->m_Start.x ); SETMIRROR( ( (EDGE_MODULE*) item )->m_Start.x );
( (EDGE_MODULE*) item )->m_Start0.x = ( (EDGE_MODULE*) item )->m_Start.x; ( (EDGE_MODULE*) item )->m_Start0.x =
( (EDGE_MODULE*) item )->m_Start.x;
SETMIRROR( ( (EDGE_MODULE*) item )->m_End.x ); SETMIRROR( ( (EDGE_MODULE*) item )->m_End.x );
( (EDGE_MODULE*) item )->m_End0.x = ( (EDGE_MODULE*) item )->m_End.x; ( (EDGE_MODULE*) item )->m_End0.x =
( (EDGE_MODULE*) item )->m_Angle = -( (EDGE_MODULE*) item )->m_Angle; ( (EDGE_MODULE*) item )->m_End.x;
( (EDGE_MODULE*) item )->m_Angle =
-( (EDGE_MODULE*) item )->m_Angle;
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x ); SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x );
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x; ( (TEXTE_MODULE*) item )->m_Pos0.x =
( (TEXTE_MODULE*) item )->GetPosition().x;
break; break;
default: default:
...@@ -624,14 +637,16 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -624,14 +637,16 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
{ {
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
ROTATE( ( (EDGE_MODULE*) item )->m_Start ); ROTATE( ( (EDGE_MODULE*) item )->m_Start );
( (EDGE_MODULE*) item )->m_Start0 = ( (EDGE_MODULE*) item )->m_Start; ( (EDGE_MODULE*) item )->m_Start0 =
( (EDGE_MODULE*) item )->m_Start;
ROTATE( ( (EDGE_MODULE*) item )->m_End ); ROTATE( ( (EDGE_MODULE*) item )->m_End );
( (EDGE_MODULE*) item )->m_End0 = ( (EDGE_MODULE*) item )->m_End; ( (EDGE_MODULE*) item )->m_End0 = ( (EDGE_MODULE*) item )->m_End;
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
ROTATE( ( (TEXTE_MODULE*) item )->GetPosition() ); ROTATE( ( (TEXTE_MODULE*) item )->GetPosition() );
( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition(); ( (TEXTE_MODULE*) item )->m_Pos0 =
( (TEXTE_MODULE*) item )->GetPosition();
( (TEXTE_MODULE*) item )->m_Orient += 900; ( (TEXTE_MODULE*) item )->m_Orient += 900;
break; break;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/*****************************************************************/ /*****************************************************************/
/* cross-probing.cpp */ /* cross-probing.cpp */
/** Handle messages between pcbnew and eeschema via a socket, /** Handle messages between pcbnew and eeschema via a socket,
* the port number is * the port number is
* KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) (eeschema to pcbnew) * KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) (eeschema to pcbnew)
...@@ -40,7 +41,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -40,7 +41,7 @@ void RemoteCommand( const char* cmdline )
char* idcmd; char* idcmd;
char* text; char* text;
MODULE* module = 0; MODULE* module = 0;
WinEDA_PcbFrame* frame = g_EDA_Appl->m_PcbFrame; WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*)wxGetApp().GetTopWindow();
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
...@@ -86,6 +87,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -86,6 +87,7 @@ void RemoteCommand( const char* cmdline )
if( pad ) if( pad )
{ {
netcode = pad->GetNet(); netcode = pad->GetNet();
// put cursor on the pad: // put cursor on the pad:
frame->GetScreen()->m_Curseur = pad->GetPosition(); frame->GetScreen()->m_Curseur = pad->GetPosition();
} }
...@@ -105,12 +107,14 @@ void RemoteCommand( const char* cmdline ) ...@@ -105,12 +107,14 @@ void RemoteCommand( const char* cmdline )
msg.Printf( _( "%s not found" ), modName.GetData() ); msg.Printf( _( "%s not found" ), modName.GetData() );
else if( pad == NULL ) else if( pad == NULL )
{ {
msg.Printf( _( "%s pin %s not found" ), modName.GetData(), pinName.GetData() ); msg.Printf( _( "%s pin %s not found" ),
modName.GetData(), pinName.GetData() );
frame->SetCurItem( module ); frame->SetCurItem( module );
} }
else else
{ {
msg.Printf( _( "%s pin %s found" ), modName.GetData(), pinName.GetData() ); msg.Printf( _( "%s pin %s found" ),
modName.GetData(), pinName.GetData() );
frame->SetCurItem( pad ); frame->SetCurItem( pad );
} }
......
...@@ -40,7 +40,7 @@ dialog_copper_zone::dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_SETTING* z ...@@ -40,7 +40,7 @@ dialog_copper_zone::dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_SETTING* z
/************************************************************************************************/ /************************************************************************************************/
{ {
m_Parent = parent; m_Parent = parent;
m_Config = m_Parent->m_Parent->m_EDA_Config; m_Config = wxGetApp().m_EDA_Config;
m_Zone_Setting = zone_setting; m_Zone_Setting = zone_setting;
m_NetSorting = 1; // 0 = alphabetic sort, 1 = pad count sort, and filtering net names m_NetSorting = 1; // 0 = alphabetic sort, 1 = pad count sort, and filtering net names
if( m_Config ) if( m_Config )
......
...@@ -227,7 +227,7 @@ void dialog_freeroute_exchange::CreateControls() ...@@ -227,7 +227,7 @@ void dialog_freeroute_exchange::CreateControls()
////@end dialog_freeroute_exchange content construction ////@end dialog_freeroute_exchange content construction
wxString msg; wxString msg;
m_Parent->m_Parent->m_EDA_Config->Read( FREEROUTE_URL_KEY, &msg ); wxGetApp().m_EDA_Config->Read( FREEROUTE_URL_KEY, &msg );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
m_FreerouteURLName->SetValue( wxT( "http://www.freerouting.net/" ) ); m_FreerouteURLName->SetValue( wxT( "http://www.freerouting.net/" ) );
else else
...@@ -348,7 +348,7 @@ void dialog_freeroute_exchange::OnCloseWindow( wxCloseEvent& event ) ...@@ -348,7 +348,7 @@ void dialog_freeroute_exchange::OnCloseWindow( wxCloseEvent& event )
if( m_FreeRouteSetupChanged ) // Save new config if( m_FreeRouteSetupChanged ) // Save new config
{ {
m_Parent->m_Parent->m_EDA_Config->Write( FREEROUTE_URL_KEY, wxGetApp().m_EDA_Config->Write( FREEROUTE_URL_KEY,
m_FreerouteURLName->GetValue() ); m_FreerouteURLName->GetValue() );
} }
......
...@@ -94,11 +94,11 @@ wxString title; ...@@ -94,11 +94,11 @@ wxString title;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile; title = _("from ") + wxGetApp().m_CurrentOptionFile;
SetTitle(title); SetTitle(title);
m_ListLibr->InsertItems(g_LibName_List, 0); m_ListLibr->InsertItems(g_LibName_List, 0);
wxString DocModuleFileName = wxString DocModuleFileName =
g_EDA_Appl->m_EDA_CommonConfig->Read( wxT("module_doc_file"), wxGetApp().m_EDA_CommonConfig->Read( wxT("module_doc_file"),
wxT("pcbnew/footprints.pdf")); wxT("pcbnew/footprints.pdf"));
m_TextHelpModulesFileName->SetValue(DocModuleFileName); m_TextHelpModulesFileName->SetValue(DocModuleFileName);
} }
...@@ -318,7 +318,7 @@ void KiConfigPcbnewFrame::SetNewOptions() ...@@ -318,7 +318,7 @@ void KiConfigPcbnewFrame::SetNewOptions()
/********************************************/ /********************************************/
{ {
g_UserLibDirBuffer = m_TextLibDir->GetValue(); g_UserLibDirBuffer = m_TextLibDir->GetValue();
g_EDA_Appl->m_EDA_CommonConfig->Write( wxT("module_doc_file"), wxGetApp().m_EDA_CommonConfig->Write( wxT("module_doc_file"),
m_TextHelpModulesFileName->GetValue()); m_TextHelpModulesFileName->GetValue());
SetRealLibraryPath( wxT("modules") ); SetRealLibraryPath( wxT("modules") );
} }
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "autorout.h" #include "autorout.h"
...@@ -174,19 +172,18 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -174,19 +172,18 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_OPEN_MODULE_EDITOR: case ID_OPEN_MODULE_EDITOR:
if( m_Parent->m_ModuleEditFrame == NULL ) if( m_ModuleEditFrame == NULL )
{ {
m_Parent->m_ModuleEditFrame = m_ModuleEditFrame =
new WinEDA_ModuleEditFrame( this, new WinEDA_ModuleEditFrame( this,
m_Parent, _( "Module Editor" ), _( "Module Editor" ),
wxPoint( -1, wxPoint( -1, -1 ),
-1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
m_Parent->m_ModuleEditFrame->Show( TRUE ); m_ModuleEditFrame->Show( TRUE );
m_Parent->m_ModuleEditFrame->Zoom_Automatique( TRUE ); m_ModuleEditFrame->Zoom_Automatique( TRUE );
} }
else else
m_Parent->m_ModuleEditFrame->Iconize( FALSE ); m_ModuleEditFrame->Iconize( FALSE );
break; break;
case ID_NEW_PROJECT: case ID_NEW_PROJECT:
...@@ -382,7 +379,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -382,7 +379,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_PLACE_MICROVIA: case ID_POPUP_PCB_PLACE_MICROVIA:
if ( ! ((PCB_SCREEN*)GetScreen())->IsMicroViaAcceptable() ) if( !( (PCB_SCREEN*) GetScreen() )->IsMicroViaAcceptable() )
break; break;
case ID_POPUP_PCB_PLACE_VIA: case ID_POPUP_PCB_PLACE_VIA:
...@@ -399,7 +396,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -399,7 +396,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Other_Layer_Route( (TRACK*) GetCurItem(), &dc ); Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
g_DesignSettings.m_CurrentViaType = v_type; g_DesignSettings.m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
((PCB_SCREEN*)GetScreen())->SetRefreshReq(); ( (PCB_SCREEN*) GetScreen() )->SetRefreshReq();
} }
break; break;
...@@ -493,7 +490,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -493,7 +490,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, false ); Start_Move_Zone_Corner( &dc,
zone_cont,
zone_cont->m_CornerSelection,
false );
break; break;
} }
...@@ -501,7 +501,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -501,7 +501,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->m_CornerSelection ); Start_Move_Zone_Drag_Outline_Edge( &dc,
zone_cont,
zone_cont->m_CornerSelection );
break; break;
} }
...@@ -524,10 +526,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -524,10 +526,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
* and start move the new corner * and start move the new corner
*/ */
zone_cont->Draw( DrawPanel, &dc, GR_XOR ); zone_cont->Draw( DrawPanel, &dc, GR_XOR );
zone_cont->m_Poly->InsertCorner( zone_cont->m_CornerSelection, pos.x, pos.y ); zone_cont->m_Poly->InsertCorner( zone_cont->m_CornerSelection,
pos.x,
pos.y );
zone_cont->m_CornerSelection++; zone_cont->m_CornerSelection++;
zone_cont->Draw( DrawPanel, &dc, GR_XOR ); zone_cont->Draw( DrawPanel, &dc, GR_XOR );
Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->m_CornerSelection, true ); Start_Move_Zone_Corner( &dc,
zone_cont,
zone_cont->m_CornerSelection,
true );
break; break;
} }
...@@ -542,15 +549,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -542,15 +549,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_FILL_ALL_ZONES: case ID_POPUP_PCB_FILL_ALL_ZONES:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Fill_All_Zones( ); Fill_All_Zones();
break; break;
case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE: case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
if ( ( GetCurItem())->Type() == TYPE_ZONE_CONTAINER) if( ( GetCurItem() )->Type() == TYPE_ZONE_CONTAINER )
{ {
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER* )GetCurItem(); ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
zone_container->m_FilledPolysList.clear(); zone_container->m_FilledPolysList.clear();
test_1_net_connexion( NULL, zone_container->GetNet( )); test_1_net_connexion( NULL, zone_container->GetNet() );
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -563,6 +570,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -563,6 +570,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_container = m_Pcb->GetArea( ii ); ZONE_CONTAINER* zone_container = m_Pcb->GetArea( ii );
zone_container->m_FilledPolysList.clear();; zone_container->m_FilledPolysList.clear();;
} }
test_connexions( NULL ); test_connexions( NULL );
Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links */ Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links */
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -572,7 +580,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -572,7 +580,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_FILL_ZONE: case ID_POPUP_PCB_FILL_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Fill_Zone( NULL, (ZONE_CONTAINER*) GetCurItem() ); Fill_Zone( NULL, (ZONE_CONTAINER*) GetCurItem() );
test_1_net_connexion( NULL, ((ZONE_CONTAINER* )GetCurItem())->GetNet( )); test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
...@@ -733,9 +741,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -733,9 +741,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_SELECT_LAYER: case ID_POPUP_PCB_SELECT_LAYER:
itmp = SelectLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer, -1, -1 ); itmp = SelectLayer(
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer, -1, -1 );
if( itmp >= 0 ) if( itmp >= 0 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = itmp; ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
...@@ -744,16 +753,21 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -744,16 +753,21 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_SELECT_NO_CU_LAYER: case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
itmp = SelectLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer, FIRST_NO_COPPER_LAYER, -1 ); itmp = SelectLayer(
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer,
FIRST_NO_COPPER_LAYER,
-1 );
if( itmp >= 0 ) if( itmp >= 0 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = itmp; ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_SELECT_CU_LAYER: case ID_POPUP_PCB_SELECT_CU_LAYER:
itmp = SelectLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer, -1, LAST_COPPER_LAYER ); itmp = SelectLayer(
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer, -1,
LAST_COPPER_LAYER );
if( itmp >= 0 ) if( itmp >= 0 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = itmp; ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
break; break;
case ID_POPUP_PCB_SELECT_LAYER_PAIR: case ID_POPUP_PCB_SELECT_LAYER_PAIR:
...@@ -763,7 +777,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -763,7 +777,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
itmp = m_SelLayerBox->GetChoice(); itmp = m_SelLayerBox->GetChoice();
((PCB_SCREEN*)GetScreen())->m_Active_Layer = (int) ( (size_t) m_SelLayerBox->GetClientData( itmp ) ); ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer =
(int) ( (size_t) m_SelLayerBox->GetClientData( itmp ) );
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
...@@ -870,7 +885,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -870,7 +885,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH: case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
{ {
int ii = m_SelTrackWidthBox->GetChoice(); int ii = m_SelTrackWidthBox->GetChoice();
g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidthHistory[ii]; g_DesignSettings.m_CurrentTrackWidth =
g_DesignSettings.m_TrackWidthHistory[ii];
DisplayTrackSettings(); DisplayTrackSettings();
m_SelTrackWidthBox_Changed = FALSE; m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
...@@ -890,13 +906,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -890,13 +906,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
g_DesignSettings.m_UseConnectedTrackWidth = false; g_DesignSettings.m_UseConnectedTrackWidth = false;
{ {
int ii = id - ID_POPUP_PCB_SELECT_WIDTH1; int ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidthHistory[ii]; g_DesignSettings.m_CurrentTrackWidth =
g_DesignSettings.m_TrackWidthHistory[ii];
DisplayTrackSettings(); DisplayTrackSettings();
} }
break; break;
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth; g_DesignSettings.m_UseConnectedTrackWidth =
not g_DesignSettings.m_UseConnectedTrackWidth;
break; break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH: case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
...@@ -910,7 +928,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -910,7 +928,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_AUX_TOOLBAR_PCB_VIA_SIZE: case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
{ {
int ii = m_SelViaSizeBox->GetChoice(); int ii = m_SelViaSizeBox->GetChoice();
g_DesignSettings.m_CurrentViaSize = g_DesignSettings.m_ViaSizeHistory[ii]; g_DesignSettings.m_CurrentViaSize =
g_DesignSettings.m_ViaSizeHistory[ii];
DisplayTrackSettings(); DisplayTrackSettings();
m_SelTrackWidthBox_Changed = FALSE; m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
...@@ -989,7 +1008,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -989,7 +1008,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC: case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
{ {
wxString msg = FindKicadHelpPath(); wxString msg = FindKicadHelpPath();
msg += g_EDA_Appl->m_EDA_CommonConfig->Read( wxT( "module_doc_file" ), msg += wxGetApp().m_EDA_CommonConfig->Read( wxT( "module_doc_file" ),
wxT( "pcbnew/footprints.pdf" ) ); wxT( "pcbnew/footprints.pdf" ) );
GetAssociatedDocument( this, wxEmptyString, msg ); GetAssociatedDocument( this, wxEmptyString, msg );
} }
...@@ -1004,7 +1023,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -1004,7 +1023,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_PcbFrame::Process_Special_Functions() id error" ) ); DisplayError( this,
wxT( "WinEDA_PcbFrame::Process_Special_Functions() id error" ) );
break; break;
} }
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
/************************************************/ /************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -26,35 +25,35 @@ bool GoToEditor = FALSE; ...@@ -26,35 +25,35 @@ bool GoToEditor = FALSE;
/*******************************************************************/ /*******************************************************************/
void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module,
wxDC* DC, const wxPoint& pos ) wxDC* DC,
const wxPoint& pos )
/*******************************************************************/ /*******************************************************************/
/* Fonction relai d'installation de la frame d'dition des proprietes /* Fonction relai d'installation de la frame d'dition des proprietes
* du module*/ * du module*/
{ {
WinEDA_ModulePropertiesFrame* frame = new WinEDA_ModulePropertiesFrame( this, WinEDA_ModulePropertiesFrame* frame =
Module, DC, pos ); new WinEDA_ModulePropertiesFrame( this, Module, DC, pos );
frame->ShowModal(); frame->Destroy(); frame->ShowModal(); frame->Destroy();
if( GoToEditor && GetScreen()->GetCurItem() ) if( GoToEditor && GetScreen()->GetCurItem() )
{ {
if( m_Parent->m_ModuleEditFrame == NULL ) if( m_ModuleEditFrame == NULL )
{ {
m_Parent->m_ModuleEditFrame = new WinEDA_ModuleEditFrame( this, m_ModuleEditFrame = new WinEDA_ModuleEditFrame( this,
m_Parent, _( "Module Editor" ), _( "Module Editor" ),
wxPoint( -1, wxPoint( -1, -1 ),
-1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
} }
m_Parent->m_ModuleEditFrame->Load_Module_Module_From_BOARD( m_ModuleEditFrame->Load_Module_Module_From_BOARD(
(MODULE*) GetScreen()->GetCurItem() ); (MODULE*) GetScreen()->GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
GoToEditor = FALSE; GoToEditor = FALSE;
m_Parent->m_ModuleEditFrame->Show( TRUE ); m_ModuleEditFrame->Show( TRUE );
m_Parent->m_ModuleEditFrame->Iconize( FALSE ); m_ModuleEditFrame->Iconize( FALSE );
} }
} }
...@@ -75,7 +74,8 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC ) ...@@ -75,7 +74,8 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC )
if( pt_mod == NULL ) if( pt_mod == NULL )
return; return;
pt_mod->DrawAncre( DrawPanel, DC, wxPoint( 0, 0 ), DIM_ANCRE_MODULE, GR_XOR ); pt_mod->DrawAncre( DrawPanel, DC, wxPoint( 0, 0 ),
DIM_ANCRE_MODULE, GR_XOR );
deltaX = pt_mod->m_Pos.x - GetScreen()->m_Curseur.x; deltaX = pt_mod->m_Pos.x - GetScreen()->m_Curseur.x;
deltaY = pt_mod->m_Pos.y - GetScreen()->m_Curseur.y; deltaY = pt_mod->m_Pos.y - GetScreen()->m_Curseur.y;
......
...@@ -207,7 +207,7 @@ void WinEDA_PcbFrame::InstallDrillFrame( wxCommandEvent& event ) ...@@ -207,7 +207,7 @@ void WinEDA_PcbFrame::InstallDrillFrame( wxCommandEvent& event )
/* This function displays and deletes the dialog frame for drill tools /* This function displays and deletes the dialog frame for drill tools
*/ */
{ {
wxConfig* Config = m_Parent->m_EDA_Config; wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config ) if( Config )
{ {
...@@ -233,7 +233,7 @@ void WinEDA_DrillFrame::UpdateConfig() ...@@ -233,7 +233,7 @@ void WinEDA_DrillFrame::UpdateConfig()
{ {
SetParams(); SetParams();
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config; wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config ) if( Config )
{ {
Config->Write( ZerosFormatKey, s_Zeros_Format ); Config->Write( ZerosFormatKey, s_Zeros_Format );
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
/* Fichier LIBRAIRI.CPP */ /* Fichier LIBRAIRI.CPP */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -52,7 +51,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) ...@@ -52,7 +51,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
bool Footprint_Is_GPCB_Format = false; bool Footprint_Is_GPCB_Format = false;
wxString mask = wxT("*.*;"); mask += EXT_CMP_MASK; wxString mask = wxT("*.*;"); mask += EXT_CMP_MASK;
wxString LastOpenedPathForLoading; wxString LastOpenedPathForLoading;
wxConfig* Config = m_Parent->m_EDA_Config; wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config ) if( Config )
Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading ); Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading );
...@@ -154,7 +153,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) ...@@ -154,7 +153,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
char Line[1025]; char Line[1025];
FILE* dest; FILE* dest;
wxString msg, path; wxString msg, path;
wxConfig* Config = m_Parent->m_EDA_Config; wxConfig* Config = wxGetApp().m_EDA_Config;
if( ptmod == NULL ) if( ptmod == NULL )
return; return;
......
...@@ -43,17 +43,14 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module ) ...@@ -43,17 +43,14 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
/***************************************************************************/ /***************************************************************************/
{ {
MODULE* NewModule; MODULE* NewModule;
WinEDA_BasePcbFrame* parent = (WinEDA_BasePcbFrame*) GetParent();
if( Module == NULL ) if( Module == NULL )
{ {
if( m_Parent->m_PcbFrame == NULL ) if( parent->m_Pcb == NULL || parent->m_Pcb->m_Modules == NULL )
return;
if( m_Parent->m_PcbFrame->m_Pcb == NULL )
return;
if( m_Parent->m_PcbFrame->m_Pcb->m_Modules == NULL )
return; return;
Module = Select_1_Module_From_BOARD( m_Parent->m_PcbFrame->m_Pcb ); Module = Select_1_Module_From_BOARD( parent->m_Pcb );
} }
if( Module == NULL ) if( Module == NULL )
......
...@@ -167,7 +167,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -167,7 +167,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
// Creation des selections des anciens fichiers // Creation des selections des anciens fichiers
m_FilesMenu->AppendSeparator(); m_FilesMenu->AppendSeparator();
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = wxGetApp().m_LastProjectMaxCount;
for ( ii = 0; ii < max_file; ii++ ) for ( ii = 0; ii < max_file; ii++ )
{ {
if ( GetLastProject(ii).IsEmpty() ) break; if ( GetLastProject(ii).IsEmpty() ) break;
...@@ -201,7 +201,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -201,7 +201,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
// Font selection and setup // Font selection and setup
AddFontSelectionMenu(configmenu); AddFontSelectionMenu(configmenu);
m_Parent->SetLanguageList(configmenu); wxGetApp().SetLanguageList(configmenu);
configmenu->AppendSeparator(); configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save Preferences"), item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save Preferences"),
...@@ -327,7 +327,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -327,7 +327,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
else // simple mise a jour de la liste des fichiers anciens else // simple mise a jour de la liste des fichiers anciens
{ {
wxMenuItem * item; wxMenuItem * item;
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = wxGetApp().m_LastProjectMaxCount;
for ( ii = max_file-1; ii >=0 ; ii-- ) for ( ii = max_file-1; ii >=0 ; ii-- )
{ {
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) ) if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )
......
...@@ -247,7 +247,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -247,7 +247,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
// update module in the current board, // update module in the current board,
// not just add it to the board with total disregard for the netlist... // not just add it to the board with total disregard for the netlist...
WinEDA_PcbFrame* pcbframe = m_Parent->m_PcbFrame; WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) GetParent();
BOARD* mainpcb = pcbframe->m_Pcb; BOARD* mainpcb = pcbframe->m_Pcb;
MODULE* source_module = NULL; MODULE* source_module = NULL;
MODULE* module_in_edit = m_Pcb->m_Modules; MODULE* module_in_edit = m_Pcb->m_Modules;
......
...@@ -146,14 +146,15 @@ END_EVENT_TABLE() ...@@ -146,14 +146,15 @@ END_EVENT_TABLE()
/****************/ /****************/
WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME, WinEDA_BasePcbFrame( father, MODULE_EDITOR_FRAME,
wxEmptyString, pos, size, style ) wxEmptyString, pos, size, style )
{ {
wxConfig* config = wxGetApp().m_EDA_Config;
m_FrameName = wxT( "ModEditFrame" ); m_FrameName = wxT( "ModEditFrame" );
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
...@@ -183,11 +184,11 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, ...@@ -183,11 +184,11 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
GetSettings(); GetSettings();
wxSize GridSize( 500, 500 ); wxSize GridSize( 500, 500 );
if( m_Parent && m_Parent->m_EDA_Config ) if( config )
{ {
long SizeX, SizeY; long SizeX, SizeY;
if( m_Parent->m_EDA_Config->Read( wxT( "ModEditGrid_X" ), &SizeX ) if( config->Read( wxT( "ModEditGrid_X" ), &SizeX )
&& m_Parent->m_EDA_Config->Read( wxT( "ModEditGrid_Y" ), &SizeY ) ) && config->Read( wxT( "ModEditGrid_Y" ), &SizeY ) )
{ {
GridSize.x = SizeX; GridSize.x = SizeX;
GridSize.y = SizeY; GridSize.y = SizeY;
...@@ -211,7 +212,8 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, ...@@ -211,7 +212,8 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame() WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
/****************************************************/ /****************************************************/
{ {
m_Parent->m_ModuleEditFrame = NULL; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*)GetParent();
frame->m_ModuleEditFrame = NULL;
SetBaseScreen( ScreenPcb ); SetBaseScreen( ScreenPcb );
} }
...@@ -220,6 +222,8 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame() ...@@ -220,6 +222,8 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
/**************************************************************/ /**************************************************************/
{ {
wxConfig* config = wxGetApp().m_EDA_Config;
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
{ {
if( !IsOK( this, _( "Module Editor: Module modified! Continue?" ) ) ) if( !IsOK( this, _( "Module Editor: Module modified! Continue?" ) ) )
...@@ -229,13 +233,11 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -229,13 +233,11 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
} }
SaveSettings(); SaveSettings();
if( m_Parent && m_Parent->m_EDA_Config ) if( config )
{ {
wxSize GridSize = GetScreen()->GetGrid(); wxSize GridSize = GetScreen()->GetGrid();
m_Parent->m_EDA_Config->Write( wxT( "ModEditGrid_X" ), config->Write( wxT( "ModEditGrid_X" ), (long) GridSize.x );
(long) GridSize.x ); config->Write( wxT( "ModEditGrid_Y" ), (long) GridSize.y );
m_Parent->m_EDA_Config->Write( wxT( "ModEditGrid_Y" ),
(long) GridSize.y );
} }
Destroy(); Destroy();
} }
...@@ -247,6 +249,7 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -247,6 +249,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
{ {
size_t i; size_t i;
bool active, islib = TRUE; bool active, islib = TRUE;
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) wxGetApp().GetTopWindow();
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
return; return;
...@@ -269,8 +272,7 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -269,8 +272,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
MODULE* module_in_edit = m_Pcb->m_Modules; MODULE* module_in_edit = m_Pcb->m_Modules;
if( module_in_edit && module_in_edit->m_Link ) // this is not a new module ... if( module_in_edit && module_in_edit->m_Link ) // this is not a new module ...
{ {
WinEDA_PcbFrame* pcbframe = m_Parent->m_PcbFrame; BOARD* mainpcb = frame->m_Pcb;
BOARD* mainpcb = pcbframe->m_Pcb;
MODULE* source_module = mainpcb->m_Modules; MODULE* source_module = mainpcb->m_Modules;
// search if the source module was not deleted: // search if the source module was not deleted:
...@@ -303,7 +305,7 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -303,7 +305,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
m_HToolBar->EnableTool( ID_MODEDIT_REDO, GetScreen()->m_RedoList && active ); m_HToolBar->EnableTool( ID_MODEDIT_REDO, GetScreen()->m_RedoList && active );
} }
if( m_Parent->m_PcbFrame->m_Pcb->m_Modules ) if( frame->m_Pcb->m_Modules )
{ {
m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, TRUE ); m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, TRUE );
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "pcbcfg.h" #include "pcbcfg.h"
#include "worksheet.h" #include "worksheet.h"
#include "id.h" #include "id.h"
#include "hotkeys_basic.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "protos.h" #include "protos.h"
...@@ -92,7 +91,9 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event ) ...@@ -92,7 +91,9 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile( FullFileName, s_Pcbnew_Editor_Hokeys_Descr, true ); WriteHotkeyConfigFile( FullFileName,
s_Pcbnew_Editor_Hokeys_Descr,
true );
break; break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS: case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
...@@ -104,7 +105,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event ) ...@@ -104,7 +105,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
AddDelimiterString(FullFileName); AddDelimiterString( FullFileName );
wxString editorname = GetEditorName(); wxString editorname = GetEditorName();
if( !editorname.IsEmpty() ) if( !editorname.IsEmpty() )
ExecuteFile( this, editorname, FullFileName ); ExecuteFile( this, editorname, FullFileName );
...@@ -121,7 +122,8 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event ) ...@@ -121,7 +122,8 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_PcbFrame::Process_Config internal error" ) ); DisplayError( this,
wxT( "WinEDA_PcbFrame::Process_Config internal error" ) );
} }
} }
...@@ -134,11 +136,14 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose ) ...@@ -134,11 +136,14 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
* Read the hotkey files config for pcbnew and module_edit * Read the hotkey files config for pcbnew and module_edit
*/ */
{ {
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); wxString FullFileName = ReturnHotkeyConfigFilePath(
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile( FullFileName, s_Pcbnew_Editor_Hokeys_Descr, verbose ); return frame->ReadHotkeyConfigFile( FullFileName,
s_Pcbnew_Editor_Hokeys_Descr,
verbose );
} }
...@@ -164,7 +169,7 @@ bool Read_Config( const wxString& project_name ) ...@@ -164,7 +169,7 @@ bool Read_Config( const wxString& project_name )
/* Init des valeurs par defaut */ /* Init des valeurs par defaut */
g_LibName_List.Clear(); g_LibName_List.Clear();
g_EDA_Appl->ReadProjectConfig( FullFileName, wxGetApp().ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE ); GROUP, ParamCfgList, FALSE );
/* Traitement des variables particulieres: */ /* Traitement des variables particulieres: */
...@@ -177,8 +182,10 @@ bool Read_Config( const wxString& project_name ) ...@@ -177,8 +182,10 @@ bool Read_Config( const wxString& project_name )
ScreenPcb->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER ); ScreenPcb->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER );
} }
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth; g_DesignSettings.m_TrackWidthHistory[0] =
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize; g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_ViaSizeHistory[0] =
g_DesignSettings.m_CurrentViaSize;
for( ii = 1; ii < HISTORY_NUMBER; ii++ ) for( ii = 1; ii < HISTORY_NUMBER; ii++ )
{ {
g_DesignSettings.m_TrackWidthHistory[ii] = 0; g_DesignSettings.m_TrackWidthHistory[ii] = 0;
...@@ -216,5 +223,6 @@ void WinEDA_PcbFrame::Update_config( wxWindow* displayframe ) ...@@ -216,5 +223,6 @@ void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
Pcbdiv_grille = GetScreen()->m_Diviseur_Grille; Pcbdiv_grille = GetScreen()->m_Diviseur_Grille;
/* ecriture de la configuration */ /* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, wxT( "/pcbnew" ), ParamCfgList ); wxGetApp().WriteProjectConfig( FullFileName, wxT( "/pcbnew" ),
ParamCfgList );
} }
...@@ -191,12 +191,14 @@ END_EVENT_TABLE() ...@@ -191,12 +191,14 @@ END_EVENT_TABLE()
/* Constructeur */ /* Constructeur */
/****************/ /****************/
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style ) : long style ) :
WinEDA_BasePcbFrame( father, parent, PCB_FRAME, title, pos, size, style ) WinEDA_BasePcbFrame( father, PCB_FRAME, title, pos, size, style )
{ {
wxConfig* config = wxGetApp().m_EDA_Config;
m_FrameName = wxT( "PcbFrame" ); m_FrameName = wxT( "PcbFrame" );
//m_AboutTitle = g_PcbnewAboutTitle; //m_AboutTitle = g_PcbnewAboutTitle;
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
...@@ -230,11 +232,10 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, ...@@ -230,11 +232,10 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
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 );
wxSize GridSize( 500, 500 ); wxSize GridSize( 500, 500 );
wxConfig * config = NULL;
if( m_Parent && m_Parent->m_EDA_Config ) if( config )
{ {
long SizeX, SizeY; long SizeX, SizeY;
config = m_Parent->m_EDA_Config;
if( config->Read( wxT( "PcbEditGrid_X" ), &SizeX ) if( config->Read( wxT( "PcbEditGrid_X" ), &SizeX )
&& config->Read( wxT( "PcbEditGrid_Y" ), &SizeY ) ) && config->Read( wxT( "PcbEditGrid_Y" ), &SizeY ) )
...@@ -268,7 +269,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, ...@@ -268,7 +269,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_PcbFrame::~WinEDA_PcbFrame() WinEDA_PcbFrame::~WinEDA_PcbFrame()
/************************************/ /************************************/
{ {
m_Parent->m_PcbFrame = NULL;
SetBaseScreen( ScreenPcb ); SetBaseScreen( ScreenPcb );
delete m_drc; delete m_drc;
...@@ -283,6 +283,7 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -283,6 +283,7 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
/********************************************************/ /********************************************************/
{ {
PCB_SCREEN* screen; PCB_SCREEN* screen;
wxConfig * config = wxGetApp().m_EDA_Config;
DrawPanel->m_AbortRequest = TRUE; DrawPanel->m_AbortRequest = TRUE;
...@@ -331,9 +332,8 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -331,9 +332,8 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
SetBaseScreen( ActiveScreen = ScreenPcb ); SetBaseScreen( ActiveScreen = ScreenPcb );
SaveSettings(); SaveSettings();
if( m_Parent && m_Parent->m_EDA_Config ) if( config )
{ {
wxConfig * config = m_Parent->m_EDA_Config;
wxSize GridSize = GetScreen()->GetGrid(); wxSize GridSize = GetScreen()->GetGrid();
config->Write( wxT( "PcbEditGrid_X" ), (long) GridSize.x ); config->Write( wxT( "PcbEditGrid_X" ), (long) GridSize.x );
config->Write( wxT( "PcbEditGrid_Y" ), (long) GridSize.y ); config->Write( wxT( "PcbEditGrid_Y" ), (long) GridSize.y );
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "fctsys.h" #include "fctsys.h"
#include <wx/image.h>
#include <wx/file.h> #include <wx/file.h>
#include "common.h" #include "common.h"
...@@ -35,8 +34,8 @@ bool WinEDA_App::OnInit() ...@@ -35,8 +34,8 @@ bool WinEDA_App::OnInit()
/****************************/ /****************************/
{ {
wxString FFileName; wxString FFileName;
WinEDA_PcbFrame* frame = NULL;
g_EDA_Appl = this;
InitEDA_Appl( wxT( "pcbnew" ) ); InitEDA_Appl( wxT( "pcbnew" ) );
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
...@@ -56,9 +55,9 @@ bool WinEDA_App::OnInit() ...@@ -56,9 +55,9 @@ bool WinEDA_App::OnInit()
Read_Config( FFileName ); Read_Config( FFileName );
g_DrawBgColor = BLACK; g_DrawBgColor = BLACK;
Read_Hotkey_Config( m_PcbFrame, false ); /* Must be called before creating the main frame Read_Hotkey_Config( frame, false ); /* Must be called before creating the
* in order to display the real hotkeys * main frame in order to display the
* in menus or tool tips */ * real hotkeys in menus or tool tips */
/* allocation de la memoire pour le fichier et autres buffers: */ /* allocation de la memoire pour le fichier et autres buffers: */
...@@ -72,29 +71,29 @@ bool WinEDA_App::OnInit() ...@@ -72,29 +71,29 @@ bool WinEDA_App::OnInit()
printf( "No Memory, Fatal err Memory alloc\n" ); printf( "No Memory, Fatal err Memory alloc\n" );
return FALSE; return FALSE;
} }
m_PcbFrame = new WinEDA_PcbFrame( NULL, this, wxT( "PcbNew" ), frame = new WinEDA_PcbFrame( NULL, wxT( "PcbNew" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) ); wxPoint( 0, 0 ), wxSize( 600, 400 ) );
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
m_PcbFrame->SetTitle( Title ); frame->SetTitle( Title );
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
SetTopWindow( m_PcbFrame ); SetTopWindow( frame );
m_PcbFrame->Show( TRUE ); frame->Show( TRUE );
if( CreateServer( m_PcbFrame, KICAD_PCB_PORT_SERVICE_NUMBER ) ) if( CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER ) )
{ {
SetupServerFunction( RemoteCommand ); SetupServerFunction( RemoteCommand );
} }
m_PcbFrame->Zoom_Automatique( TRUE ); frame->Zoom_Automatique( TRUE );
/* Load file specified in the command line. */ /* Load file specified in the command line. */
if( !FFileName.IsEmpty() ) if( !FFileName.IsEmpty() )
{ {
m_PcbFrame->LoadOnePcbFile( FFileName, FALSE ); frame->LoadOnePcbFile( FFileName, FALSE );
// update the layer names in the listbox // update the layer names in the listbox
m_PcbFrame->ReCreateLayerBox( NULL ); frame->ReCreateLayerBox( NULL );
} }
return TRUE; return TRUE;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/***********************/ /***********************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "plot_common.h" #include "plot_common.h"
...@@ -166,7 +165,7 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event ) ...@@ -166,7 +165,7 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
BOARD* board = m_Parent->m_Pcb; BOARD* board = m_Parent->m_Pcb;
wxConfig* config = m_Parent->m_Parent->m_EDA_Config; // Current config used by application wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
...@@ -607,7 +606,8 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event ) ...@@ -607,7 +606,8 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
m_XScaleAdjust = m_FineAdjustXscaleOpt->GetValue(); m_XScaleAdjust = m_FineAdjustXscaleOpt->GetValue();
m_YScaleAdjust = m_FineAdjustYscaleOpt->GetValue(); m_YScaleAdjust = m_FineAdjustYscaleOpt->GetValue();
wxConfig* config = m_Parent->m_Parent->m_EDA_Config; wxConfig* config = wxGetApp().m_EDA_Config;
if( config ) if( config )
{ {
config->Write( OPTKEY_EDGELAYER_GERBER, g_Exclude_Edges_Pcb ); config->Write( OPTKEY_EDGELAYER_GERBER, g_Exclude_Edges_Pcb );
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <algorithm> // sort #include <algorithm> // sort
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
......
...@@ -534,9 +534,9 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) ...@@ -534,9 +534,9 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
zone->SetNetNameFromNetCode( ); zone->SetNetNameFromNetCode( );
} }
m_Parent->m_EDA_Config->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, wxGetApp().m_EDA_Config->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
&g_Zone_Default_Setting.m_ThermalReliefGapValue ); &g_Zone_Default_Setting.m_ThermalReliefGapValue );
m_Parent->m_EDA_Config->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, wxGetApp().m_EDA_Config->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
&g_Zone_Default_Setting.m_ThermalReliefCopperBridgeValue ); &g_Zone_Default_Setting.m_ThermalReliefCopperBridgeValue );
dialog_copper_zone* frame = new dialog_copper_zone( this, &g_Zone_Default_Setting ); dialog_copper_zone* frame = new dialog_copper_zone( this, &g_Zone_Default_Setting );
......
...@@ -134,9 +134,9 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event ) ...@@ -134,9 +134,9 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
break; break;
} }
if( m_Parent->m_Parent->m_EDA_Config ) if( wxGetApp().m_EDA_Config )
{ {
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, wxGetApp().m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) g_Zone_Default_Setting.m_Zone_HatchingStyle ); (long) g_Zone_Default_Setting.m_Zone_HatchingStyle );
} }
......
...@@ -61,7 +61,7 @@ WinEDA_PrintFrame::WinEDA_PrintFrame( WinEDA_DrawFrame* parent, wxWindowID id, c ...@@ -61,7 +61,7 @@ WinEDA_PrintFrame::WinEDA_PrintFrame( WinEDA_DrawFrame* parent, wxWindowID id, c
m_Parent = parent; m_Parent = parent;
m_XScaleAdjust = m_YScaleAdjust = 1.0; m_XScaleAdjust = m_YScaleAdjust = 1.0;
m_PagesOption = NULL; m_PagesOption = NULL;
wxConfig * Config = m_Parent->m_Parent->m_EDA_Config; wxConfig * Config = wxGetApp().m_EDA_Config;
if ( Config ) if ( Config )
{ {
Config->Read(wxT("PrintPenWidth"), &s_PrintPenMinWidth); Config->Read(wxT("PrintPenWidth"), &s_PrintPenMinWidth);
......
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
/*******************************************************/ /*******************************************************/
WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
WinEDA_App* parent, const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style ) : long style ) :
WinEDA_BasicFrame( father, idtype, parent, title, pos, size, style ) WinEDA_BasicFrame( father, idtype, title, pos, size, style )
{ {
wxSize minsize; wxSize minsize;
...@@ -119,7 +119,7 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame() ...@@ -119,7 +119,7 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
/****************************************/ /****************************************/
{ {
if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL ! if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL !
m_Parent->m_EDA_Config->Write( wxT( "AutoPAN" ), wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ),
DrawPanel->m_AutoPAN_Enable ); DrawPanel->m_AutoPAN_Enable );
} }
...@@ -869,8 +869,8 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event ) ...@@ -869,8 +869,8 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
m_Parent->SetLanguageIdentifier( id ); wxGetApp().SetLanguageIdentifier( id );
m_Parent->SetLanguage(); wxGetApp().SetLanguage();
} }
......
...@@ -137,7 +137,7 @@ WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame( WinEDA_DrawFrame* parent, ...@@ -137,7 +137,7 @@ WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame( WinEDA_DrawFrame* parent,
{ {
m_Parent = parent; m_Parent = parent;
m_ImageXSize_mm = 270; m_ImageXSize_mm = 270;
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config; wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config ) if( Config )
{ {
Config->Read( PLOTSVGPENWIDTH_KEY, &s_SVGPenMinWidth ); Config->Read( PLOTSVGPENWIDTH_KEY, &s_SVGPenMinWidth );
...@@ -519,7 +519,7 @@ void WinEDA_PrintSVGFrame::OnCancelClick( wxCommandEvent& event ) ...@@ -519,7 +519,7 @@ void WinEDA_PrintSVGFrame::OnCancelClick( wxCommandEvent& event )
void WinEDA_PrintSVGFrame::OnCloseWindow( wxCloseEvent& event ) void WinEDA_PrintSVGFrame::OnCloseWindow( wxCloseEvent& event )
{ {
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config; wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config ) if( Config )
{ {
......
...@@ -183,7 +183,7 @@ void WinEDA_PrintFrame::SetOthersDatas() ...@@ -183,7 +183,7 @@ void WinEDA_PrintFrame::SetOthersDatas()
#endif #endif
#if defined (PCBNEW) #if defined (PCBNEW)
wxConfig* config = m_Parent->m_Parent->m_EDA_Config; // Current config used by application wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application
#endif #endif
m_FineAdjustXscaleOpt->SetToolTip( _( "Set X scale adjust for exact scale plotting" ) ); m_FineAdjustXscaleOpt->SetToolTip( _( "Set X scale adjust for exact scale plotting" ) );
...@@ -307,7 +307,7 @@ void WinEDA_PrintFrame::OnClosePrintDialog() ...@@ -307,7 +307,7 @@ void WinEDA_PrintFrame::OnClosePrintDialog()
/* called when WinEDA_PrintFrame is closed /* called when WinEDA_PrintFrame is closed
*/ */
{ {
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config; wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config ) if( Config )
{ {
......
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