Convert global and embedded application pointers to wxGetApp()

This commit is contained in:
stambaughw 2008-12-08 15:27:13 +00:00
parent 0745188d33
commit 2611a54791
75 changed files with 2873 additions and 2416 deletions

View File

@ -27,19 +27,21 @@
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA3D_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D,
WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_MENU( wxID_EXIT, WinEDA3D_DrawFrame::Exit3DFrame )
EVT_MENU( ID_MENU_SCREENCOPY_PNG, WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_SCREENCOPY_JPEG, WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA3D_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D,
WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_MENU( wxID_EXIT, WinEDA3D_DrawFrame::Exit3DFrame )
EVT_MENU( ID_MENU_SCREENCOPY_PNG,
WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_SCREENCOPY_JPEG,
WinEDA3D_DrawFrame::Process_Special_Functions )
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
END_EVENT_TABLE()
/*******************************************************************/
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
WinEDA_App* app_parent, const wxString& title,
const wxString& title,
long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title,
wxPoint( -1, -1 ), wxSize( -1, -1 ), style )
@ -48,7 +50,6 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
m_FrameName = wxT( "Frame3D" );
m_Canvas = NULL;
m_Parent = parent;
m_ParentAppl = app_parent;
m_HToolBar = NULL;
m_VToolBar = NULL;
m_InternalUnits = 10000; // Unites internes = 1/10000 inch
@ -104,21 +105,24 @@ void WinEDA3D_DrawFrame::GetSettings()
/******************************************/
{
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" );
Config->Read( text, &m_FramePos.x );
config->Read( text, &m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" );
Config->Read( text, &m_FramePos.y );
config->Read( text, &m_FramePos.y );
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" );
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_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 );
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_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__
@ -134,7 +138,7 @@ void WinEDA3D_DrawFrame::SaveSettings()
/*******************************************/
{
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 )
return;

View File

@ -87,7 +87,7 @@ private:
public:
Pcb3D_GLCanvas(WinEDA3D_DrawFrame *parent, const wxWindowID id = -1,
int* gl_attrib = NULL);
int* gl_attrib = NULL);
~Pcb3D_GLCanvas();
void ClearLists();
@ -125,7 +125,6 @@ class WinEDA3D_DrawFrame: public wxFrame
{
public:
WinEDA_BasePcbFrame * m_Parent;
WinEDA_App * m_ParentAppl;
Pcb3D_GLCanvas * m_Canvas;
wxToolBar * m_HToolBar;
wxToolBar * m_VToolBar;
@ -138,8 +137,9 @@ private:
// It is "Frame3D"
public:
WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent, WinEDA_App *app_parent,
const wxString& title, long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent,
const wxString& title,
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
void Exit3DFrame(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent & Event);
@ -169,7 +169,7 @@ public:
void Set3DEco1OnOff();
void Set3DEco2OnOff();
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
void SetGLColor(int color);

View File

@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
++pcbnew & gerbview

View File

@ -23,14 +23,14 @@
/*******************************************************/
WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype,
WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style ) :
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style ) :
wxFrame( father, -1, title, pos, size, style )
{
wxSize minsize;
m_Ident = idtype;
m_Parent = parent;
SetFont( *g_StdFont );
m_MenuBar = NULL; // menu du haut d'ecran
m_HToolBar = NULL;
@ -57,9 +57,9 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype,
WinEDA_BasicFrame::~WinEDA_BasicFrame()
/******************************************/
{
if( m_Parent->m_HtmlCtrl )
delete m_Parent->m_HtmlCtrl;
m_Parent->m_HtmlCtrl = NULL;
if( wxGetApp().m_HtmlCtrl )
delete wxGetApp().m_HtmlCtrl;
wxGetApp().m_HtmlCtrl = NULL;
}
@ -76,19 +76,22 @@ void WinEDA_BasicFrame::ReCreateMenuBar()
void WinEDA_BasicFrame::GetSettings()
/*********************************************/
{
wxString text;
int Ypos_min;
wxString text;
int Ypos_min;
wxConfig* config;
if( m_Parent->m_EDA_Config )
config = wxGetApp().m_EDA_Config;
if( config )
{
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" );
m_Parent->m_EDA_Config->Read( text, &m_FramePos.y );
config->Read( text, &m_FramePos.y );
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" );
m_Parent->m_EDA_Config->Read( text, &m_FrameSize.y, 400 );
config->Read( text, &m_FrameSize.y, 400 );
}
// Ensure Window title bar is visible
@ -109,24 +112,24 @@ void WinEDA_BasicFrame::SaveSettings()
/*****************************************/
{
wxString text;
wxConfig* config;
if( !m_Parent || !m_Parent->m_EDA_Config )
return;
config = wxGetApp().m_EDA_Config;
if( !m_Parent->m_EDA_Config || IsIconized() )
if( ( config == NULL ) || IsIconized() )
return;
m_FrameSize = GetSize();
m_FramePos = GetPosition();
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" );
m_Parent->m_EDA_Config->Write( text, (long) m_FramePos.y );
config->Write( text, (long) m_FramePos.y );
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" );
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 )
return;
//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;
#ifdef __WINDOWS__
if( m_Parent->m_LastProject[ii].CmpNoCase( FullFileName ) == 0 )
if( wxGetApp().m_LastProject[ii].CmpNoCase( FullFileName ) == 0 )
#else
if( m_Parent->m_LastProject[ii] == FullFileName )
if( wxGetApp().m_LastProject[ii] == FullFileName )
#endif
{
#if ( ( wxMAJOR_VERSION < 2) || ( ( wxMAJOR_VERSION == 2)&& (wxMINOR_VERSION <= 4 ) ) )
m_Parent->m_LastProject.Remove( ii );
#else
m_Parent->m_LastProject.RemoveAt( ii );
#endif
wxGetApp().m_LastProject.RemoveAt( ii );
}
else
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 ) ) )
files.Remove( files.GetCount() - 1 );
#else
m_Parent->m_LastProject.RemoveAt( m_Parent->m_LastProject.GetCount() - 1 );
#endif
wxGetApp().m_LastProject.RemoveAt( wxGetApp().m_LastProject.GetCount() - 1 );
}
m_Parent->m_LastProject.Insert( FullFileName, 0 );
wxGetApp().m_LastProject.Insert( FullFileName, 0 );
ReCreateMenuBar();
}
@ -216,9 +211,9 @@ wxString WinEDA_BasicFrame::GetLastProject( int rang )
{
if( rang < 0 )
rang = 0;
if( (unsigned) rang >= m_Parent->m_LastProject.GetCount() )
if( (unsigned) rang >= wxGetApp().m_LastProject.GetCount() )
return wxEmptyString;
return m_Parent->m_LastProject[rang];
return wxGetApp().m_LastProject[rang];
}
@ -227,30 +222,30 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/**************************************************************/
{
#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();
m_Parent->m_HtmlCtrl->Display( m_Parent->m_HelpFileName );
wxGetApp().m_HtmlCtrl->DisplayContents();
wxGetApp().m_HtmlCtrl->Display( wxGetApp().m_HelpFileName );
}
else
{
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 );
}
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
wxString fullfilename = FindKicadHelpPath() + m_Parent->m_HelpFileName;
wxString fullfilename = FindKicadHelpPath() + wxGetApp().m_HelpFileName;
if ( wxFileExists(fullfilename) )
GetAssociatedDocument( this, wxEmptyString, fullfilename );
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 );
}

View File

@ -14,14 +14,9 @@
#endif
#include "fctsys.h"
#include <wx/image.h>
#include "wx/html/htmlwin.h"
#include "wx/fs_zip.h"
#include "wxstruct.h"
#include "gr_basic.h"
#include "common.h"
#include "worksheet.h"
#include "id.h"
@ -53,8 +48,7 @@ struct LANGUAGE_DESCR
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[LANGUAGE_DESCR_COUNT] =
static struct LANGUAGE_DESCR s_Language_List[] =
{
{
wxLANGUAGE_DEFAULT,
@ -155,30 +149,26 @@ 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::WinEDA_App()
{
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_Checker = NULL;
m_LastProjectMaxCount = 10;
m_HtmlCtrl = NULL;
m_EDA_CommonConfig = NULL;
m_EDA_Config = NULL;
m_Env_Defined = FALSE;
m_LanguageId = wxLANGUAGE_DEFAULT;
m_Language_Menu = NULL;
m_Locale = NULL;
m_HtmlCtrl = NULL;
m_EDA_CommonConfig = NULL;
m_EDA_Config = NULL;
m_Env_Defined = FALSE;
m_LanguageId = wxLANGUAGE_DEFAULT;
m_Language_Menu = NULL;
m_Locale = NULL;
m_PdfBrowserIsDefault = TRUE;
}
@ -230,7 +220,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
}
/* Prepare On Line Help. Use only lower case for help filenames,
* in order to avoid problems with upper/lower case filenames under windows and unix */
* in order to avoid problems with upper/lower case filenames under windows and unix */
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
m_HelpFileName = name.Lower() + wxT( ".html" );
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
@ -250,14 +240,18 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
g_MsgFontPointSize = FONT_DEFAULT_SIZE;
g_DialogFontPointSize = FONT_DEFAULT_SIZE;
g_FixedFontPointSize = FONT_DEFAULT_SIZE;
g_StdFont = new wxFont( g_StdFontPointSize, 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_StdFont = new wxFont( g_StdFontPointSize, 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,
wxFONTFAMILY_ROMAN,
wxFONTSTYLE_ITALIC,
wxNORMAL );
g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL );
wxFONTFAMILY_ROMAN,
wxFONTSTYLE_ITALIC,
wxNORMAL );
g_FixedFont = new wxFont( g_FixedFontPointSize, wxFONTFAMILY_MODERN,
wxNORMAL, wxNORMAL );
/* installation des gestionnaires de visu d'images (pour help) */
wxImage::AddHandler( new wxPNGHandler );
@ -271,14 +265,15 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
ReadPdfBrowserInfos();
// 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 );
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
PyHandler::GetInstance()->SetAppName( name );
@ -297,12 +292,12 @@ void WinEDA_App::InitOnLineHelp()
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
m_HelpFileName = fullfilename + wxT( ".html" );
fullfilename += wxT( "kicad.hhp" );
fullfilename += wxT( "kicad.hhp" );
if( wxFileExists( fullfilename ) )
{
m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR |
wxHF_CONTENTS | wxHF_PRINT | wxHF_OPEN_FILES
/*| wxHF_SEARCH */ );
m_HtmlCtrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS |
wxHF_PRINT | wxHF_OPEN_FILES
/*| wxHF_SEARCH */ );
m_HtmlCtrl->UseConfig( m_EDA_CommonConfig );
m_HtmlCtrl->SetTitleFormat( wxT( "Kicad Help" ) );
m_HtmlCtrl->AddBook( fullfilename );
@ -335,7 +330,7 @@ bool WinEDA_App::SetBinDir()
return false;
char* native_str = NULL;
int len = CFStringGetMaximumSizeForEncoding( CFStringGetLength( str ),
kCFStringEncodingUTF8 ) + 1;
kCFStringEncodingUTF8 ) + 1;
native_str = new char[len];
CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 );
m_BinDir = CONV_FROM_UTF8( native_str );
@ -396,7 +391,8 @@ void WinEDA_App::GetSettings()
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_ConfigFileLocationChoice = m_EDA_CommonConfig->Read( HOTKEY_CFG_PATH_OPT, 0L );
}
@ -416,10 +412,14 @@ void WinEDA_App::GetSettings()
m_LastProject.Add( Line );
}
g_StdFontPointSize = m_EDA_Config->Read( wxT( "SdtFontSize" ), FONT_DEFAULT_SIZE );
g_MsgFontPointSize = m_EDA_Config->Read( wxT( "MsgFontSize" ), 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 );
g_StdFontPointSize = m_EDA_Config->Read( wxT( "SdtFontSize" ),
FONT_DEFAULT_SIZE );
g_MsgFontPointSize = m_EDA_Config->Read( wxT( "MsgFontSize" ),
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 );
if( !Line.IsEmpty() )
@ -584,7 +584,7 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
s_Language_List[ii].m_Lang_Label :
wxGetTranslation( s_Language_List[ii].m_Lang_Label );
item = new wxMenuItem( m_Language_Menu, s_Language_List[ii].m_KI_Lang_Identifier,
MenuLabel, wxEmptyString, wxITEM_CHECK );
MenuLabel, wxEmptyString, wxITEM_CHECK );
SETBITMAPS( s_Language_List[ii].m_Lang_Icon );
m_Language_Menu->Append( item );
}
@ -593,17 +593,19 @@ wxMenu* WinEDA_App::SetLanguageList( wxMenu* MasterMenu )
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
{
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
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 )
{
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( MasterMenu, m_Language_Menu,
ID_LANGUAGE_CHOICE, _( "Language" ),
_( "Select application language (only for testing!)" ),
language_xpm );
ID_LANGUAGE_CHOICE, _( "Language" ),
_( "Select application language (only for testing!)" ),
language_xpm );
}
return m_Language_Menu;
}

View File

@ -4,32 +4,17 @@
/************************************************/
// 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 <string.h>
#include <ctype.h>
#ifdef __WINDOWS__
#ifndef _MSC_VER
#include <dir.h>
#endif
#endif
#include "fctsys.h"
#include "common.h"
#include "wxstruct.h"
#include "macros.h"
/* List of default paths used to locate help files and kicad library files.
@ -74,8 +59,8 @@ static wxString s_HelpPathList[] = {
#else
wxT( "/usr/share/doc/kicad/help/" ),
wxT( "/usr/local/share/doc/kicad/help/" ),
wxT( "/usr/local/kicad/doc/help/" ), // default install for "universal tarballs" and build for a server (new)
wxT( "/usr/local/kicad/help/" ), // default install for "universal tarballs" and build for a server (old)
wxT( "/usr/local/kicad/doc/help/" ), // default install for "universal tarballs" and build for a server (new)
wxT( "/usr/local/kicad/help/" ), // default install for "universal tarballs" and build for a server (old)
#endif
wxT( "end_list" ) // End of list symbol, do not change
};
@ -114,7 +99,6 @@ static wxString s_KicadBinaryPathList[] = {
#endif
wxT( "end_list" ) // End of list symbol, do not change
};
extern WinEDA_App* g_EDA_Appl;
/***************************************************************************/
@ -210,7 +194,7 @@ wxString MakeFileName( const wxString& dir,
if( !wxIsAbsolutePath( shortname ) )
{
if( !shortname.StartsWith( wxT( "./" ) ) && !shortname.StartsWith( wxT( "../" ) ) )
{ /* no absolute path in shortname, add dir to shortname */
{ /* no absolute path in shortname, add dir to shortname */
fullfilename = dir;
}
}
@ -357,13 +341,13 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti
#endif
fullfilename = wxFileSelector( wxString( Title ),
defaultpath,
defaultname,
Ext,
Mask,
flag, /* open mode wxFD_OPEN, wxFD_SAVE .. */
Frame,
Pos.x, Pos.y );
defaultpath,
defaultname,
Ext,
Mask,
flag, /* open mode wxFD_OPEN, wxFD_SAVE .. */
Frame,
Pos.x, Pos.y );
if( keep_working_directory )
wxSetWorkingDirectory( curr_cwd );
@ -402,12 +386,12 @@ wxString FindKicadHelpPath()
bool PathFound = FALSE;
/* find kicad/help/ */
tmp = g_EDA_Appl->m_BinDir;
tmp = wxGetApp().m_BinDir;
if( tmp.Last() == '/' )
tmp.RemoveLast();
FullPath = tmp.BeforeLast( '/' ); // cd ..
FullPath += wxT( "/doc/help/" );
LocaleString = g_EDA_Appl->m_Locale->GetCanonicalName();
LocaleString = wxGetApp().m_Locale->GetCanonicalName();
wxString path_tmp = FullPath;
#ifdef __WINDOWS__
@ -420,9 +404,9 @@ wxString FindKicadHelpPath()
}
/* 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 ) )
PathFound = TRUE;
}
@ -483,15 +467,15 @@ wxString FindKicadFile( const wxString& shortname )
/* test de la presence du fichier shortname dans le repertoire de
* des binaires de kicad */
FullFileName = g_EDA_Appl->m_BinDir + shortname;
FullFileName = wxGetApp().m_BinDir + shortname;
if( wxFileExists( FullFileName ) )
return FullFileName;
/* test de la presence du fichier shortname dans le repertoire
* 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 ) )
return FullFileName;
}
@ -566,7 +550,7 @@ void SetRealLibraryPath( const wxString& shortlibname )
else
{
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;
}
@ -599,35 +583,36 @@ wxString ReturnKicadDatasPath()
bool PathFound = FALSE;
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;
}
else // Chemin cherche par le chemin des executables
{
// le chemin est bindir../
wxString tmp = g_EDA_Appl->m_BinDir;
wxString tmp = wxGetApp().m_BinDir;
#ifdef __WINDOWS__
tmp.MakeLower();
#endif
if( tmp.Contains( wxT( "kicad" ) ) )
{
#ifdef __WINDOWS__
tmp = g_EDA_Appl->m_BinDir;
tmp = wxGetApp().m_BinDir;
#endif
if( tmp.Last() == '/' )
tmp.RemoveLast();
data_path = tmp.BeforeLast( '/' ); // id cd ../
data_path += UNIX_STRING_DIR_SEP;
// Old versions of kicad use kicad/ as default for data
// and last versions kicad/share/
// So we search for kicad/share/ first
wxString old_path = data_path;
data_path += wxT("share/");
data_path += wxT( "share/" );
if( wxDirExists( data_path ) )
PathFound = TRUE;
else if ( wxDirExists( old_path ) )
else if( wxDirExists( old_path ) )
{
data_path = old_path;
PathFound = TRUE;
@ -683,27 +668,29 @@ wxString GetEditorName()
mask += wxT( ".exe" );
#endif
editorname = EDA_FileSelector( _( "Prefered Editor:" ),
wxEmptyString, /* Default path */
wxEmptyString, /* default filename */
wxEmptyString, /* default filename extension */
mask, /* filter for filename list */
NULL, /* parent frame */
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */
);
wxEmptyString, /* Default path */
wxEmptyString, /* default filename */
wxEmptyString, /* default filename extension */
mask, /* filter for filename list */
NULL, /* parent frame */
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */
);
}
if( ( !editorname.IsEmpty() ) && g_EDA_Appl->m_EDA_CommonConfig )
if( ( !editorname.IsEmpty() ) && wxGetApp().m_EDA_CommonConfig )
{
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;
}
/***********************************/
bool OpenPDF( const wxString& file )
/***********************************/
/** Function OpenPDF
* run the PDF viewer and display a PDF file
* @param file = PDF file to open
@ -713,13 +700,13 @@ bool OpenPDF( const wxString& file )
wxString command;
wxString filename = file;
wxString type;
bool success = false;
bool success = false;
g_EDA_Appl->ReadPdfBrowserInfos();
if( !g_EDA_Appl->m_PdfBrowserIsDefault ) // Run the prefered PDF Browser
wxGetApp().ReadPdfBrowserInfos();
if( !wxGetApp().m_PdfBrowserIsDefault ) // Run the prefered PDF Browser
{
AddDelimiterString( filename );
command = g_EDA_Appl->m_PdfBrowser + wxT( " " ) + filename;
command = wxGetApp().m_PdfBrowser + wxT( " " ) + filename;
}
else
{
@ -730,14 +717,15 @@ bool OpenPDF( const wxString& file )
success = filetype->GetOpenCommand( &command, params );
delete filetype;
#ifndef __WINDOWS__
// 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;
#endif
if( success && !command.IsEmpty() )
{
success = ProcessExecute( command );
if ( success )
if( success )
return success;
}
@ -770,6 +758,7 @@ bool OpenPDF( const wxString& file )
break;
}
}
#endif
}
}
@ -777,17 +766,17 @@ bool OpenPDF( const wxString& file )
if( !command.IsEmpty() )
{
success = ProcessExecute( command );
if ( !success )
if( !success )
{
wxString msg = _("Problem while running the PDF viewer");
msg << _("\n command is ") << command;
wxString msg = _( "Problem while running the PDF viewer" );
msg << _( "\n command is " ) << command;
DisplayError( NULL, msg );
}
}
else
{
wxString msg = _("Unable to find a PDF viewer for");
msg << wxT(" ") << filename;
wxString msg = _( "Unable to find a PDF viewer for" );
msg << wxT( " " ) << filename;
DisplayError( NULL, msg );
success = false;
}
@ -795,6 +784,7 @@ bool OpenPDF( const wxString& file )
return success;
}
/*************************************/
void OpenFile( const wxString& file )
/*************************************/

View File

@ -674,6 +674,8 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
*/
{
wxMenuBar* menu = frame->GetMenuBar();
wxConfig * config = wxGetApp().m_EDA_CommonConfig;
wxASSERT( config != NULL );
switch( id )
{
@ -683,8 +685,7 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
g_ConfigFileLocationChoice = 0;
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, true );
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, false );
frame->m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT,
g_ConfigFileLocationChoice );
config->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
}
break;
@ -694,8 +695,7 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
g_ConfigFileLocationChoice = 1;
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME, false );
menu->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, true );
frame->m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT,
g_ConfigFileLocationChoice );
config->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
}
break;

View File

@ -14,17 +14,18 @@
/*********************************************************************/
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)
* initialise:
* g_Prj_Config
* g_Prj_Config_LocalFilename
* g_Prj_Default_Config_FullFilename
* return:
* TRUE si config locale
* FALSE si default config
* initialise:
* g_Prj_Config
* g_Prj_Config_LocalFilename
* g_Prj_Default_Config_FullFilename
* return:
* TRUE si config locale
* FALSE si default config
*/
{
// free old config
@ -44,8 +45,10 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
if( ForceUseLocalConfig || wxFileExists( g_Prj_Config_LocalFilename ) )
{
g_Prj_Default_Config_FullFilename.Empty();
g_Prj_Config = new wxFileConfig( wxEmptyString, wxEmptyString,
g_Prj_Config_LocalFilename, wxEmptyString,
g_Prj_Config = new wxFileConfig( wxEmptyString,
wxEmptyString,
g_Prj_Config_LocalFilename,
wxEmptyString,
wxCONFIG_USE_RELATIVE_PATH );
g_Prj_Config->DontCreateOnDemand();
@ -73,8 +76,10 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
g_Prj_Config_Filename_ext;
// Recreate new config
g_Prj_Config = new wxFileConfig( wxEmptyString, wxEmptyString,
wxEmptyString, g_Prj_Default_Config_FullFilename,
g_Prj_Config = new wxFileConfig( wxEmptyString,
wxEmptyString,
wxEmptyString,
g_Prj_Default_Config_FullFilename,
wxCONFIG_USE_RELATIVE_PATH );
g_Prj_Config->DontCreateOnDemand();
@ -84,8 +89,9 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
/***************************************************************************************/
void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, PARAM_CFG_BASE** List )
void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName,
PARAM_CFG_BASE** List )
/***************************************************************************************/
/* enregistrement de la config "projet"*/
{
@ -93,11 +99,11 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
wxString msg;
ReCreatePrjConfig( local_config_filename, GroupName,
FORCE_LOCAL_CONFIG );
FORCE_LOCAL_CONFIG );
/* Write date ( surtout pour eviter bug de wxFileConfig
* qui se trompe de rubrique si declaration [xx] en premiere ligne
* (en fait si groupe vide) */
* qui se trompe de rubrique si declaration [xx] en premiere ligne
* (en fait si groupe vide) */
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
msg = DateAndTime();
@ -203,7 +209,8 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
// We use indexlib+1 because first lib name is LibName1
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;
@ -226,20 +233,21 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
/***************************************************************************************/
bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, PARAM_CFG_BASE** List,
bool Load_Only_if_New )
bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName,
PARAM_CFG_BASE** List,
bool Load_Only_if_New )
/***************************************************************************************/
/* Lecture de la config "projet"
*** si Load_Only_if_New == TRUE, elle n'est lue que si elle
*** est differente de la config actuelle (dates differentes)
*
* return:
* TRUE si lue.
* Met a jour en plus:
* g_EDA_Appl->m_CurrentOptionFileDateAndTime
* g_EDA_Appl->m_CurrentOptionFile
* return:
* TRUE si lue.
* Met a jour en plus:
* wxGetApp().m_CurrentOptionFileDateAndTime
* wxGetApp().m_CurrentOptionFile
*/
{
const PARAM_CFG_BASE* pt_cfg;
@ -253,22 +261,22 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
timestamp = g_Prj_Config->Read( wxT( "update" ) );
if( Load_Only_if_New && ( !timestamp.IsEmpty() )
&& (timestamp == g_EDA_Appl->m_CurrentOptionFileDateAndTime) )
&& (timestamp == wxGetApp().m_CurrentOptionFileDateAndTime) )
{
return FALSE;
}
g_EDA_Appl->m_CurrentOptionFileDateAndTime = timestamp;
wxGetApp().m_CurrentOptionFileDateAndTime = timestamp;
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
{
if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() )
g_EDA_Appl->m_CurrentOptionFile =
wxGetApp().m_CurrentOptionFile =
wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename;
else
g_EDA_Appl->m_CurrentOptionFile = g_Prj_Config_LocalFilename;
wxGetApp().m_CurrentOptionFile = g_Prj_Config_LocalFilename;
}
for( ; *List != NULL; List++ )
@ -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,
int default_val, const wxChar* group ) :
int default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{
m_Pt_param = 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,
int default_val, const wxChar* group ) :
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
const wxChar* ident,
int* ptparam,
int default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{
m_Pt_param = 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,
double default_val, double min, double max,
PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
const wxChar* ident,
double* ptparam,
double default_val,
double min,
double max,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
{
@ -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,
int default_val, const wxChar* group ) :
PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
const wxChar* ident,
bool* ptparam,
int default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_BOOL, group )
{
m_Pt_param = 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,
wxString* ptparam, const wxChar* group ) :
wxString* ptparam,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
{
m_Pt_param = ptparam;
@ -508,7 +528,8 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( 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 )
{
m_Pt_param = ptparam;
@ -516,8 +537,9 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
}
PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
wxArrayString* ptparam, const wxChar* group ) :
PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
wxArrayString* ptparam,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_LIBNAME_LIST, group )
{
m_Pt_param = ptparam;

View File

@ -6,7 +6,6 @@
#include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
#include "cvpcb.h"
#include "protos.h"
@ -22,12 +21,12 @@ void Read_Config( const wxString& FileName )
/**************************************************/
/* lit la configuration
* 1 - lit cvpcb.cnf
* 2 - si non trouve lit <chemin de cvpcb.exe>/cvpcb.cnf
* 3 - si non trouve: init des variables aux valeurs par defaut
* 1 - lit cvpcb.cnf
* 2 - si non trouve lit <chemin de cvpcb.exe>/cvpcb.cnf
* 3 - si non trouve: init des variables aux valeurs par defaut
*
* Remarque:
* le chemin de l'executable cvpcb.exe doit etre dans BinDir
* Remarque:
* le chemin de l'executable cvpcb.exe doit etre dans BinDir
*/
{
wxString FullFileName = FileName;
@ -36,8 +35,8 @@ void Read_Config( const wxString& FileName )
g_LibName_List.Clear();
g_ListName_Equ.Clear();
g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE );
wxGetApp().ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE );
if( NetInExtBuffer.IsEmpty() )
NetInExtBuffer = wxT( ".net" );
@ -52,7 +51,7 @@ void WinEDA_CvpcbFrame::Update_Config( wxCommandEvent& event )
/************************************************************/
/* fonction relai d'appel a Save_Config,
* la vraie fonction de sauvegarde de la config
* la vraie fonction de sauvegarde de la config
*/
{
Save_Config( this );
@ -73,18 +72,18 @@ void Save_Config( wxWindow* parent )
path = wxGetCwd();
FullFileName = EDA_FileSelector( _( "Save preferences" ),
path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
parent,
wxFD_SAVE,
TRUE
);
path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
parent,
wxFD_SAVE,
TRUE
);
if( FullFileName.IsEmpty() )
return;
/* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
wxGetApp().WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
}

View File

@ -6,7 +6,6 @@
#include <wx/fontdlg.h>
#include "cvpcb.h"
#include "gr_basic.h"
#include "pcbnew.h"
#include "bitmaps.h"
@ -21,12 +20,14 @@
/*******************************************************/
/* Constructeur de WinEDA_CvpcbFrame: la fenetre generale */
/*******************************************************/
WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( WinEDA_App* parent, const wxString& title, long style ) :
WinEDA_BasicFrame( NULL, CVPCB_FRAME, parent, title, wxDefaultPosition, wxDefaultSize, style )
WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
WinEDA_BasicFrame( NULL, CVPCB_FRAME, title, wxDefaultPosition,
wxDefaultSize, style )
{
m_FrameName = wxT( "CvpcbFrame" );
m_FrameName = wxT( "CvpcbFrame" );
//m_AboutTitle = g_CvpcbAboutTitle;
m_ListCmp = NULL;
m_ListCmp = NULL;
m_FootprintList = NULL;
DrawFrame = NULL;
m_FilesMenu = NULL;
@ -97,10 +98,13 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( WinEDA_App* parent, const wxString& title,
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 );
m_Parent->m_EDA_Config->Write( wxT( FILTERFOOTPRINTKEY ), state );
int state = m_HToolBar->GetToolState(
ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST );
config->Write( wxT( FILTERFOOTPRINTKEY ), state );
}
}
@ -117,86 +121,82 @@ void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event )
/* Event table for WinEDA_CvpcbFrame */
/*************************************/
BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
EVT_MENU_RANGE( ID_LOAD_PROJECT,
ID_LOAD_FILE_10,
WinEDA_CvpcbFrame::LoadNetList )
EVT_MENU_RANGE( ID_LOAD_PROJECT,
ID_LOAD_FILE_10,
WinEDA_CvpcbFrame::LoadNetList )
// Menu events
EVT_MENU( ID_SAVE_PROJECT,
WinEDA_CvpcbFrame::SaveQuitCvpcb )
EVT_MENU( ID_CVPCB_QUIT,
WinEDA_CvpcbFrame::OnQuit )
EVT_MENU( ID_CVPCB_DISPLAY_HELP,
WinEDA_CvpcbFrame::GetKicadHelp )
EVT_MENU( ID_CVPCB_DISPLAY_LICENCE,
WinEDA_CvpcbFrame::GetKicadAbout )
EVT_MENU( ID_CONFIG_REQ,
WinEDA_CvpcbFrame::ConfigCvpcb )
EVT_MENU( ID_CONFIG_SAVE,
WinEDA_CvpcbFrame::Update_Config )
EVT_MENU( ID_SAVE_PROJECT,
WinEDA_CvpcbFrame::SaveQuitCvpcb )
EVT_MENU( ID_CVPCB_QUIT,
WinEDA_CvpcbFrame::OnQuit )
EVT_MENU( ID_CVPCB_DISPLAY_HELP,
WinEDA_CvpcbFrame::GetKicadHelp )
EVT_MENU( ID_CVPCB_DISPLAY_LICENCE,
WinEDA_CvpcbFrame::GetKicadAbout )
EVT_MENU( ID_CONFIG_REQ,
WinEDA_CvpcbFrame::ConfigCvpcb )
EVT_MENU( ID_CONFIG_SAVE,
WinEDA_CvpcbFrame::Update_Config )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN,
ID_PREFERENCES_FONT_END,
WinEDA_CvpcbFrame::ProcessFontPreferences )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE,
ID_LANGUAGE_CHOICE_END,
WinEDA_CvpcbFrame::SetLanguage )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN,
ID_PREFERENCES_FONT_END,
WinEDA_CvpcbFrame::ProcessFontPreferences )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE,
ID_LANGUAGE_CHOICE_END,
WinEDA_CvpcbFrame::SetLanguage )
// Toolbar events
EVT_TOOL( ID_CVPCB_QUIT,
WinEDA_CvpcbFrame::OnQuit )
EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST,
WinEDA_CvpcbFrame::LoadNetList )
EVT_TOOL( ID_CVPCB_SAVEQUITCVPCB,
WinEDA_CvpcbFrame::SaveQuitCvpcb )
EVT_TOOL( ID_CVPCB_CREATE_CONFIGWINDOW,
WinEDA_CvpcbFrame::ConfigCvpcb )
EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP,
WinEDA_CvpcbFrame::DisplayModule )
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA,
WinEDA_CvpcbFrame::ToFirstNA )
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA,
WinEDA_CvpcbFrame::ToPreviousNA )
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS,
WinEDA_CvpcbFrame::DelAssociations )
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE,
WinEDA_CvpcbFrame::AssocieModule )
EVT_TOOL( ID_CVPCB_CREATE_STUFF_FILE,
WinEDA_CvpcbFrame::WriteStuffList )
EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC,
WinEDA_CvpcbFrame::DisplayDocFile )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
WinEDA_CvpcbFrame::OnSelectFilteringFootprint )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
WinEDA_CvpcbFrame::OnSelectFilteringFootprint )
EVT_TOOL( ID_CVPCB_QUIT,
WinEDA_CvpcbFrame::OnQuit )
EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST,
WinEDA_CvpcbFrame::LoadNetList )
EVT_TOOL( ID_CVPCB_SAVEQUITCVPCB,
WinEDA_CvpcbFrame::SaveQuitCvpcb )
EVT_TOOL( ID_CVPCB_CREATE_CONFIGWINDOW,
WinEDA_CvpcbFrame::ConfigCvpcb )
EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP,
WinEDA_CvpcbFrame::DisplayModule )
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA,
WinEDA_CvpcbFrame::ToFirstNA )
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA,
WinEDA_CvpcbFrame::ToPreviousNA )
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS,
WinEDA_CvpcbFrame::DelAssociations )
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE,
WinEDA_CvpcbFrame::AssocieModule )
EVT_TOOL( ID_CVPCB_CREATE_STUFF_FILE,
WinEDA_CvpcbFrame::WriteStuffList )
EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC,
WinEDA_CvpcbFrame::DisplayDocFile )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
WinEDA_CvpcbFrame::OnSelectFilteringFootprint )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
WinEDA_CvpcbFrame::OnSelectFilteringFootprint )
// Frame events
EVT_CHAR_HOOK( WinEDA_CvpcbFrame::OnChar )
EVT_CLOSE( WinEDA_CvpcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_CvpcbFrame::OnSize )
EVT_CHAR_HOOK( WinEDA_CvpcbFrame::OnChar )
EVT_CLOSE( WinEDA_CvpcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_CvpcbFrame::OnSize )
// List item events
EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST,
WinEDA_CvpcbFrame::OnLeftClick )
EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST,
WinEDA_CvpcbFrame::OnLeftDClick )
EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST,
WinEDA_CvpcbFrame::OnSelectComponent )
EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST,
WinEDA_CvpcbFrame::OnLeftClick )
EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST,
WinEDA_CvpcbFrame::OnLeftDClick )
EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST,
WinEDA_CvpcbFrame::OnSelectComponent )
END_EVENT_TABLE()
/******************************************************/
void WinEDA_CvpcbFrame::OnQuit( wxCommandEvent& event )
/******************************************************/
{
Close( TRUE );
Close( TRUE );
}
/**********************************************************/
void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
/**********************************************************/
@ -206,10 +206,10 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
if( modified )
{
unsigned ii;
wxMessageDialog dialog( this, _( "Net and component list modified.\n Save before exit ?" ),
_( "Confirmation" ),
wxYES_NO | wxCANCEL |
wxICON_EXCLAMATION | wxYES_DEFAULT );
wxMessageDialog dialog( this,
_( "Net and component list modified.\n Save before exit ?" ),
_( "Confirmation" ),
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
ii = dialog.ShowModal();
@ -229,7 +229,8 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
modified = 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();
return;
@ -240,10 +241,10 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
}
// 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
m_Parent->m_HtmlCtrl->GetFrame()->Close( TRUE );
if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active
wxGetApp().m_HtmlCtrl->GetFrame()->Close( TRUE );
}
if( !NetInNameBuffer.IsEmpty() )
@ -372,7 +373,8 @@ void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event )
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 );
}
@ -486,8 +488,8 @@ void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event )
{
int id = event.GetId();
m_Parent->SetLanguageIdentifier( id );
m_Parent->SetLanguage();
wxGetApp().SetLanguageIdentifier( id );
wxGetApp().SetLanguage();
}
@ -497,12 +499,13 @@ void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event )
{
wxString DocModuleFileName, fullfilename;
DocModuleFileName = g_EDA_Appl->m_EDA_CommonConfig->Read( DOC_FOOTPRINTS_LIST_KEY,
DEFAULT_FOOTPRINTS_LIST_FILENAME );
if( wxIsAbsolutePath(DocModuleFileName) )
DocModuleFileName = wxGetApp().m_EDA_CommonConfig->Read(
DOC_FOOTPRINTS_LIST_KEY,
DEFAULT_FOOTPRINTS_LIST_FILENAME );
if( wxIsAbsolutePath( DocModuleFileName ) )
fullfilename = DocModuleFileName;
else
fullfilename = FindKicadHelpPath() + wxT("../") + DocModuleFileName;
fullfilename = FindKicadHelpPath() + wxT( "../" ) + DocModuleFileName;
GetAssociatedDocument( this, wxEmptyString, fullfilename );
}
@ -537,7 +540,8 @@ void WinEDA_CvpcbFrame::ProcessFontPreferences( wxCommandEvent& event )
break;
default:
DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) );
DisplayError( this,
wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) );
break;
}
}

View File

@ -1,6 +1,6 @@
/*******************/
/* File: cvpcb.cpp */
/*******************/
/*******************/
/* File: cvpcb.cpp */
/*******************/
#define MAIN
#define eda_global
@ -9,7 +9,6 @@
#include "cvpcb.h"
#include "trigo.h"
#include "gr_basic.h"
#include "zones.h"
#include "bitmaps.h"
@ -18,77 +17,76 @@
#include "id.h"
wxString g_Main_Title = wxT("CVpcb");
wxString g_Main_Title = wxT( "CVpcb" );
// Create a new application object
IMPLEMENT_APP(WinEDA_App)
IMPLEMENT_APP( WinEDA_App )
/* fonctions locales */
/************************************/
/* Called to initialize the program */
/************************************/
/************************************/
/* Called to initialize the program */
/************************************/
bool WinEDA_App::OnInit()
{
wxString msg;
wxString currCWD = wxGetCwd();
wxString msg;
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 ( ! IsOK(NULL, _("Cvpcb is already running, Continue?") ) )
return false;
if( m_Checker && m_Checker->IsAnotherRunning() )
{
if( !IsOK( NULL, _( "Cvpcb is already running, Continue?" ) ) )
return false;
}
GetSettings(); // read current setup
wxSetWorkingDirectory(currCWD); // mofifie par GetSetting
SetRealLibraryPath( wxT("modules") );
GetSettings(); // read current setup
if(argc > 1 )
{
NetInNameBuffer = argv[1];
NetNameBuffer = argv[1];
}
wxSetWorkingDirectory( currCWD ); // mofifie par GetSetting
SetRealLibraryPath( wxT( "modules" ) );
if ( ! NetInNameBuffer.IsEmpty() )
wxSetWorkingDirectory( wxPathOnly(NetInNameBuffer) );
g_DrawBgColor = BLACK;
if( argc > 1 )
{
NetInNameBuffer = argv[1];
NetNameBuffer = argv[1];
}
Read_Config(NetInNameBuffer);
if( !NetInNameBuffer.IsEmpty() )
wxSetWorkingDirectory( wxPathOnly( NetInNameBuffer ) );
g_DrawBgColor = BLACK;
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion();
m_CvpcbFrame = new WinEDA_CvpcbFrame(this, Title);
Read_Config( NetInNameBuffer );
msg.Printf( wxT("Modules: %d"), nblib);
m_CvpcbFrame->SetStatusText(msg,2);
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
frame = new WinEDA_CvpcbFrame( Title );
// Show the frame
SetTopWindow(m_CvpcbFrame);
msg.Printf( wxT( "Modules: %d" ), nblib );
frame->SetStatusText( msg, 2 );
m_CvpcbFrame->Show(TRUE);
// Show the frame
SetTopWindow( frame );
listlib();
m_CvpcbFrame->BuildFootprintListBox();
frame->Show( TRUE );
if( ! NetInNameBuffer.IsEmpty() ) /* nom de fichier passe a la commande */
{
FFileName = MakeFileName(NetDirBuffer,
NetInNameBuffer, NetInExtBuffer);
listlib();
frame->BuildFootprintListBox();
m_CvpcbFrame->ReadNetListe();
}
else /* Mise a jour du titre de la fenetre principale */
{
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion();
msg.Printf( wxT("%s {%s%c} [no file]"),
Title.GetData(), wxGetCwd().GetData(), DIR_SEP);
m_CvpcbFrame->SetTitle(msg);
}
if( !NetInNameBuffer.IsEmpty() ) /* nom de fichier passe a la commande */
{
FFileName = MakeFileName( NetDirBuffer,
NetInNameBuffer, NetInExtBuffer );
return TRUE;
frame->ReadNetListe();
}
else /* Mise a jour du titre de la fenetre principale */
{
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
msg.Printf( wxT( "%s {%s%c} [no file]" ),
Title.GetData(), wxGetCwd().GetData(), DIR_SEP );
frame->SetTitle( msg );
}
return TRUE;
}

View File

@ -39,8 +39,8 @@ private:
// Constructor and destructor
public:
WinEDA_CvpcbFrame( WinEDA_App * parent, const wxString &title,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
WinEDA_CvpcbFrame( const wxString &title,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_CvpcbFrame();
void OnLeftClick( wxListEvent& event );
@ -180,10 +180,10 @@ class WinEDA_DisplayFrame : public WinEDA_BasePcbFrame
public:
public:
WinEDA_DisplayFrame( wxWindow * father, WinEDA_App * parent,
const wxString &title,
const wxPoint &pos, const wxSize &size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
WinEDA_DisplayFrame( wxWindow * father,
const wxString &title,
const wxPoint &pos, const wxSize &size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_DisplayFrame();

View File

@ -72,7 +72,7 @@ wxString title;
m_DoUpdate = TRUE;
Create(parent, id, caption, pos, size, style);
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
title = _("from ") + wxGetApp().m_CurrentOptionFile;
SetTitle(title);
}

View File

@ -5,7 +5,6 @@
#include "fctsys.h"
#include "common.h"
#include "wxstruct.h"
#include "cvpcb.h"
#include "id.h"
#include "bitmaps.h"
@ -32,11 +31,11 @@ END_EVENT_TABLE()
/* 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 wxPoint& pos,
const wxSize& size, long style ) :
WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos,
WinEDA_BasePcbFrame( father, CVPCB_DISPLAY_FRAME, title, pos,
size, style )
{
m_FrameName = wxT( "CmpFrame" );
@ -73,7 +72,7 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
delete m_Pcb;
m_Parent->m_CvpcbFrame->DrawFrame = NULL;
( (WinEDA_CvpcbFrame*) wxGetApp().GetTopWindow() )->DrawFrame = NULL;
}

View File

@ -1,22 +1,9 @@
/***************************************/
/** menucfg : configuration de CVPCB **/
/***************************************/
/***************************************/
/** menucfg : 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 "common.h"
@ -24,20 +11,20 @@
#include "protos.h"
/*****************************************/
/* classe pour la frame de Configuration */
/*****************************************/
/*****************************************/
/* classe pour la frame de Configuration */
/*****************************************/
#include "dialog_cvpcb_config.cpp"
/***************************************************/
void WinEDA_CvpcbFrame::CreateConfigWindow()
/***************************************************/
/* Creation de la fenetre de configuration de CVPCB */
{
KiConfigCvpcbFrame * ConfigFrame = new KiConfigCvpcbFrame(this);
ConfigFrame->ShowModal(); ConfigFrame->Destroy();
KiConfigCvpcbFrame* ConfigFrame = new KiConfigCvpcbFrame( this );
ConfigFrame->ShowModal(); ConfigFrame->Destroy();
}
@ -45,265 +32,299 @@ KiConfigCvpcbFrame * ConfigFrame = new KiConfigCvpcbFrame(this);
void KiConfigCvpcbFrame::SetDialogDatas()
/*********************************************/
{
m_ListLibr->InsertItems(g_LibName_List,0);
m_ListEquiv->InsertItems(g_ListName_Equ,0);
m_ListLibr->InsertItems( g_LibName_List, 0 );
m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
m_LibDirCtrl = new WinEDA_EnterText(this,
_("Lib Dir:"), g_UserLibDirBuffer,
m_RightBoxSizer, wxDefaultSize);
m_LibDirCtrl = new WinEDA_EnterText( this,
_( "Lib Dir:" ), g_UserLibDirBuffer,
m_RightBoxSizer, wxDefaultSize );
m_NetInputExtCtrl = new WinEDA_EnterText(this,
_("Net Input Ext:"),NetInExtBuffer,
m_NetExtBoxSizer, wxDefaultSize);
m_NetInputExtCtrl = new WinEDA_EnterText( this,
_( "Net Input Ext:" ),
NetInExtBuffer,
m_NetExtBoxSizer, wxDefaultSize );
wxString DocModuleFileName =
g_EDA_Appl->m_EDA_CommonConfig->Read( DOC_FOOTPRINTS_LIST_KEY, DEFAULT_FOOTPRINTS_LIST_FILENAME);
m_TextHelpModulesFileName = new WinEDA_EnterText(this,
_("Module Doc File:"), DocModuleFileName,
m_RightBoxSizer, wxDefaultSize);
wxString DocModuleFileName =
wxGetApp().m_EDA_CommonConfig->Read( DOC_FOOTPRINTS_LIST_KEY,
DEFAULT_FOOTPRINTS_LIST_FILENAME );
m_TextHelpModulesFileName = new WinEDA_EnterText( this,
_( "Module Doc File:" ),
DocModuleFileName,
m_RightBoxSizer,
wxDefaultSize );
/* Create info on Files ext */
wxStaticText * StaticText;
wxString text;
text.Printf( wxT("%s %s"), _("Cmp ext:"), g_ExtCmpBuffer.GetData() );
StaticText = new wxStaticText(this, -1,text);
m_FileExtList->Add(StaticText, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE);
/* Create info on Files ext */
wxStaticText* StaticText;
wxString text;
text.Printf( wxT( "%s %s" ), _( "Cmp ext:" ), g_ExtCmpBuffer.GetData() );
StaticText = new wxStaticText( this, -1, text );
m_FileExtList->Add(
StaticText,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
wxADJUST_MINSIZE );
text.Printf( wxT("%s %s"), _("Lib ext:"), LibExtBuffer.GetData());
StaticText = new wxStaticText(this, -1,text);
m_FileExtList->Add(StaticText, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxADJUST_MINSIZE);
text.Printf( wxT( "%s %s" ), _( "Lib ext:" ), LibExtBuffer.GetData() );
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);
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 );
m_FileExtList->Add(
StaticText,
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" ), _( "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);
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();
Close();
Update();
Close();
}
/**********************************/
void KiConfigCvpcbFrame::Update()
/**********************************/
{
wxString msg;
wxString msg;
if ( ! m_DoUpdate ) return;
NetInExtBuffer = m_NetInputExtCtrl->GetValue();
g_EDA_Appl->m_EDA_CommonConfig->Write( DOC_FOOTPRINTS_LIST_KEY,
m_TextHelpModulesFileName->GetValue());
if( !m_DoUpdate )
return;
NetInExtBuffer = m_NetInputExtCtrl->GetValue();
wxGetApp().m_EDA_CommonConfig->Write( DOC_FOOTPRINTS_LIST_KEY,
m_TextHelpModulesFileName->GetValue() );
msg = m_LibDirCtrl->GetValue();
if ( msg != g_UserLibDirBuffer )
{
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") );
listlib();
ListModIsModified = 1;
m_Parent->BuildFootprintListBox();
}
msg = m_LibDirCtrl->GetValue();
if( msg != g_UserLibDirBuffer )
{
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT( "modules" ) );
listlib();
ListModIsModified = 1;
m_Parent->BuildFootprintListBox();
}
}
/****************************************************/
void KiConfigCvpcbFrame::SaveCfg(wxCommandEvent& event)
void KiConfigCvpcbFrame::SaveCfg( wxCommandEvent& event )
/****************************************************/
{
Update();
Save_Config(this);
Update();
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"),
wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
FullFileName, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */
);
if ( FullFileName.IsEmpty() ) return;
if ( ! wxFileExists(FullFileName) )
{
line.Printf( _("File %s not found"), FullFileName.GetData());
DisplayError(this, line); return;
}
FullFileName = EDA_FileSelector( _( "Read config file" ),
wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
FullFileName, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */
);
if( FullFileName.IsEmpty() )
return;
if( !wxFileExists( FullFileName ) )
{
line.Printf( _( "File %s not found" ), FullFileName.GetData() );
DisplayError( this, line ); return;
}
Read_Config( FullFileName );
m_DoUpdate = FALSE;
Close(TRUE);
Read_Config( FullFileName );
m_DoUpdate = FALSE;
Close( TRUE );
}
/*******************************************************/
void KiConfigCvpcbFrame::LibDelFct(wxCommandEvent& event)
void KiConfigCvpcbFrame::LibDelFct( wxCommandEvent& event )
/*******************************************************/
{
int ii;
int ii;
ii = m_ListLibr->GetSelection();
if ( ii < 0 ) return;
ii = m_ListLibr->GetSelection();
if( ii < 0 )
return;
ListModIsModified = 1;
g_LibName_List.RemoveAt(ii);
ListModIsModified = 1;
g_LibName_List.RemoveAt( ii );
/* suppression de la reference dans la liste des librairies */
m_ListLibr->Delete(ii);
/* suppression de la reference dans la liste des librairies */
m_ListLibr->Delete( ii );
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") );
listlib();
m_Parent->BuildFootprintListBox();
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT( "modules" ) );
listlib();
m_Parent->BuildFootprintListBox();
}
/********************************************************/
void KiConfigCvpcbFrame::LibAddFct(wxCommandEvent& event)
void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
/********************************************************/
{
int ii;
wxString FullFileName, ShortLibName, mask;
int ii;
wxString FullFileName, ShortLibName, mask;
ii = m_ListLibr->GetSelection();
if ( event.GetId() == ADD_LIB ) /* Ajout apres selection */
{
ii ++;
}
if ( ii < 0 ) ii = 0;
ii = m_ListLibr->GetSelection();
if( event.GetId() == ADD_LIB ) /* Ajout apres selection */
{
ii++;
}
if( ii < 0 )
ii = 0;
Update();
mask = wxT("*") + LibExtBuffer;
Update();
mask = wxT( "*" ) + LibExtBuffer;
wxFileDialog FilesDialog(this, _("Library files:"), g_RealLibDirBuffer,
wxEmptyString, mask,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE);
wxFileDialog FilesDialog( this, _( "Library files:" ), g_RealLibDirBuffer,
wxEmptyString, mask,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
FilesDialog.ShowModal();
wxArrayString Filenames;
FilesDialog.GetPaths(Filenames);
FilesDialog.ShowModal();
wxArrayString Filenames;
FilesDialog.GetPaths( Filenames );
if ( Filenames.GetCount() == 0 )
return;
if( Filenames.GetCount() == 0 )
return;
for ( unsigned jj = 0; jj < Filenames.GetCount(); jj ++ )
{
FullFileName = Filenames[jj];
ShortLibName = MakeReducedFileName(FullFileName,g_RealLibDirBuffer,LibExtBuffer);
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{
FullFileName = Filenames[jj];
ShortLibName = MakeReducedFileName( FullFileName,
g_RealLibDirBuffer,
LibExtBuffer );
//Add or insert new library name
if ( g_LibName_List.Index(ShortLibName) == wxNOT_FOUND)
{
ListModIsModified = 1;
g_LibName_List.Insert(ShortLibName, ii++);
}
else
{
wxString msg;
msg << wxT("<") << ShortLibName << wxT("> : ") << _("Library already in use");
DisplayError(this, msg);
}
}
//Add or insert new library name
if( g_LibName_List.Index( ShortLibName ) == wxNOT_FOUND )
{
ListModIsModified = 1;
g_LibName_List.Insert( ShortLibName, ii++ );
}
else
{
wxString msg;
msg << wxT( "<" ) << ShortLibName << wxT( "> : " ) << _(
"Library already in use" );
DisplayError( this, msg );
}
}
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") );
listlib();
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT( "modules" ) );
listlib();
m_Parent->BuildFootprintListBox();
m_ListLibr->Clear();
m_ListLibr->InsertItems(g_LibName_List, 0);
m_Parent->BuildFootprintListBox();
m_ListLibr->Clear();
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();
if ( ii < 0 ) return;
ii = m_ListEquiv->GetSelection();
if( ii < 0 )
return;
g_ListName_Equ.RemoveAt(ii);
m_ListEquiv->Delete(ii);
g_ListName_Equ.RemoveAt( ii );
m_ListEquiv->Delete( ii );
}
/********************************************************/
void KiConfigCvpcbFrame::EquAddFct(wxCommandEvent& event)
void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event )
/********************************************************/
{
int ii;
wxString FullFileName, ShortLibName, mask;
int ii;
wxString FullFileName, ShortLibName, mask;
ii = m_ListEquiv->GetSelection();
if ( event.GetId() == ADD_EQU ) ii ++; /* Ajout apres selection */
if ( ii < 0 ) ii = 0;
ii = m_ListEquiv->GetSelection();
if( event.GetId() == ADD_EQU )
ii++; /* Ajout apres selection */
if( ii < 0 )
ii = 0;
Update();
mask = wxT("*") + g_EquivExtBuffer;
Update();
mask = wxT( "*" ) + g_EquivExtBuffer;
wxFileDialog FilesDialog(this, _("Equiv Files:"), g_RealLibDirBuffer,
wxEmptyString, mask,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE);
wxFileDialog FilesDialog( this, _( "Equiv Files:" ), g_RealLibDirBuffer,
wxEmptyString, mask,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
FilesDialog.ShowModal();
wxArrayString Filenames;
FilesDialog.GetFilenames(Filenames);
FilesDialog.ShowModal();
wxArrayString Filenames;
FilesDialog.GetFilenames( Filenames );
if ( Filenames.GetCount() == 0 )
return;
if( Filenames.GetCount() == 0 )
return;
for ( unsigned jj = 0; jj < Filenames.GetCount(); jj ++ )
{
FullFileName = Filenames[jj];
ShortLibName = MakeReducedFileName(FullFileName,g_RealLibDirBuffer,g_EquivExtBuffer);
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{
FullFileName = Filenames[jj];
ShortLibName = MakeReducedFileName( FullFileName,
g_RealLibDirBuffer,
g_EquivExtBuffer );
//Add or insert new equiv library name
if ( g_ListName_Equ.Index(ShortLibName) == wxNOT_FOUND)
{
g_ListName_Equ.Insert(ShortLibName, ii++);
}
else
{
wxString msg;
msg << wxT("<") << ShortLibName << wxT("> : ") << _("Library already in use");
DisplayError(this, msg);
}
}
//Add or insert new equiv library name
if( g_ListName_Equ.Index( ShortLibName ) == wxNOT_FOUND )
{
g_ListName_Equ.Insert( ShortLibName, ii++ );
}
else
{
wxString msg;
msg << wxT( "<" ) << ShortLibName << wxT( "> : " ) << _(
"Library already in use" );
DisplayError( this, msg );
}
}
/* Update display list */
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT("modules") );
listlib();
/* Update display list */
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
SetRealLibraryPath( wxT( "modules" ) );
listlib();
m_ListEquiv->Clear();
m_ListEquiv->InsertItems(g_ListName_Equ, 0);
m_ListEquiv->Clear();
m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
}

View File

@ -4,7 +4,6 @@
#include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
#include "cvpcb.h"
#include "3d_viewer.h"
@ -28,9 +27,9 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
if( DrawFrame == NULL )
{
DrawFrame = new WinEDA_DisplayFrame( this, m_Parent, _( "Module" ),
wxPoint( 0, 0 ), wxSize( 600,
400 ),
DrawFrame = new WinEDA_DisplayFrame( this, _( "Module" ),
wxPoint( 0, 0 ),
wxSize( 600, 400 ),
KICAD_DEFAULT_DRAWFRAME_STYLE |
wxFRAME_FLOAT_ON_PARENT );
IsNew = TRUE;

View File

@ -1,10 +1,8 @@
/***************************************************/
/* tool_cvpcb.cpp: construction du menu principal */
/***************************************************/
/***************************************************/
/* tool_cvpcb.cpp: construction du menu principal */
/***************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "cvpcb.h"
@ -12,8 +10,6 @@
#include "protos.h"
#define BITMAP wxBitmap
#include "bitmaps.h"
#include "id.h"
@ -23,166 +19,180 @@
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);
SetToolBar(m_HToolBar);
if( m_HToolBar != NULL )
return;
m_HToolBar->AddTool(ID_CVPCB_READ_INPUT_NETLIST, BITMAP(open_xpm),
_("Open a NetList file"));
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
SetToolBar( m_HToolBar );
m_HToolBar->AddTool(ID_CVPCB_SAVEQUITCVPCB, BITMAP(save_xpm),
_("Save NetList and Footprints List files"));
m_HToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxBitmap( open_xpm ),
_( "Open a NetList file" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_CREATE_CONFIGWINDOW, BITMAP(config_xpm),
_("Configuration"));
m_HToolBar->AddTool( ID_CVPCB_SAVEQUITCVPCB, wxBitmap( save_xpm ),
_( "Save NetList and Footprints List files" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_CREATE_SCREENCMP, BITMAP(module_xpm),
_("View selected footprint"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxBitmap( config_xpm ),
_( "Configuration" ) );
m_HToolBar->AddTool(ID_CVPCB_AUTO_ASSOCIE, BITMAP(auto_associe_xpm),
_("Automatic Association"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxBitmap( module_xpm ),
_( "View selected footprint" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_GOTO_PREVIOUSNA, BITMAP(left_xpm),
_("Select previous free component"));
m_HToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxBitmap( auto_associe_xpm ),
_( "Automatic Association" ) );
m_HToolBar->AddTool(ID_CVPCB_GOTO_FIRSTNA, BITMAP(right_xpm),
_("Select next free component"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxBitmap( left_xpm ),
_( "Select previous free component" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_DEL_ASSOCIATIONS, BITMAP(delete_association_xpm),
_("Delete all associations"));
m_HToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxBitmap( right_xpm ),
_( "Select next free component" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_CVPCB_CREATE_STUFF_FILE, BITMAP(save_cmpstuff_xpm),
_("Create stuff file (component/footprint list)"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS,
wxBitmap( delete_association_xpm ),
_( "Delete all associations" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_PCB_DISPLAY_FOOTPRINT_DOC, BITMAP(file_footprint_xpm),
_("Display footprints list documentation"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE,
wxBitmap( save_cmpstuff_xpm ),
_( "Create stuff file (component/footprint list)" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddSeparator();
m_HToolBar->AddRadioTool(ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
wxEmptyString, BITMAP(module_filtered_list_xpm),
wxNullBitmap,
_("Display the filtered footprint list for the current component"));
m_HToolBar->AddRadioTool(ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
wxEmptyString, BITMAP(module_full_list_xpm),
wxNullBitmap,
_("Display the full footprint list (without filtering)"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC,
wxBitmap( file_footprint_xpm ),
_( "Display footprints list documentation" ) );
if( m_Parent->m_EDA_Config )
{
wxString key = wxT(FILTERFOOTPRINTKEY);
int opt = m_Parent->m_EDA_Config->Read(key, (long)1);
m_HToolBar->ToggleTool(ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt);
m_HToolBar->ToggleTool(ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, ! opt);
}
m_HToolBar->AddSeparator();
m_HToolBar->AddSeparator();
m_HToolBar->AddRadioTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
wxEmptyString,
wxBitmap( module_filtered_list_xpm ),
wxNullBitmap,
_( "Display the filtered footprint list for the current component" ) );
m_HToolBar->AddRadioTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
wxEmptyString, wxBitmap( module_full_list_xpm ),
wxNullBitmap,
_( "Display the full footprint list (without filtering)" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
m_HToolBar->Realize();
if( config )
{
wxString key = wxT( FILTERFOOTPRINTKEY );
int opt = config->Read( key, (long) 1 );
m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt );
m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, !opt );
}
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
m_HToolBar->Realize();
}
/*******************************************/
void WinEDA_CvpcbFrame::ReCreateMenuBar()
/*******************************************/
/* Creation des menus de la fenetre principale
*/
*/
{
int ii;
wxMenuBar * menuBar = GetMenuBar();
int ii;
wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL )
{
menuBar = new wxMenuBar();
// Associate the menu bar with the frame
SetMenuBar(menuBar);
if( menuBar == NULL )
{
menuBar = new wxMenuBar();
m_FilesMenu = new wxMenu;
wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_LOAD_PROJECT,
_("&Open"),
_("Open a NetList file") );
item->SetBitmap(open_xpm);
m_FilesMenu->Append(item);
// Associate the menu bar with the frame
SetMenuBar( menuBar );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_SAVE_PROJECT,
_("&Save As..."),
_("Save New NetList and Footprints List files") );
item->SetBitmap(save_xpm);
m_FilesMenu->Append(item);
m_FilesMenu = new wxMenu;
wxMenuItem* item = new wxMenuItem( m_FilesMenu, ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a NetList file" ) );
item->SetBitmap( open_xpm );
m_FilesMenu->Append( item );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_CVPCB_QUIT, _("E&xit"), _("Quit Cvpcb" ));
item->SetBitmap(exit_xpm);
m_FilesMenu->Append(item);
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ),
_( "Save New NetList and Footprints List files" ) );
item->SetBitmap( save_xpm );
m_FilesMenu->Append( item );
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_CVPCB_QUIT, _( "E&xit" ),
_( "Quit Cvpcb" ) );
item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item );
// Creation des selections des anciens fichiers
m_FilesMenu->AppendSeparator();
for ( ii = 0; ii < 10; ii++ )
{
if ( GetLastProject(ii).IsEmpty() ) break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
}
m_FilesMenu->AppendSeparator();
for( ii = 0; ii < 10; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
// Menu Configuration:
wxMenu * configmenu = new wxMenu;
item = new wxMenuItem(configmenu, ID_CONFIG_REQ, _("&Configuration"),
_("Setting Libraries, Directories and others..."));
item->SetBitmap(config_xpm);
configmenu->Append(item);
// Menu Configuration:
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_( "Setting Libraries, Directories and others..." ) );
item->SetBitmap( config_xpm );
configmenu->Append( item );
// Font selection and setup
AddFontSelectionMenu(configmenu);
m_Parent->SetLanguageList(configmenu);
// Font selection and setup
AddFontSelectionMenu( configmenu );
configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE,
_("&Save config"),
_("Save configuration in current dir"));
item->SetBitmap(save_setup_xpm);
configmenu->Append(item);
wxGetApp().SetLanguageList( configmenu );
// Menu Help:
wxMenu *helpMenu = new wxMenu;
item = new wxMenuItem(helpMenu , ID_CVPCB_DISPLAY_HELP, _("&Contents"),
_("Open the cvpcb manual"));
item->SetBitmap(help_xpm);
helpMenu->Append(item);
item = new wxMenuItem(helpMenu , ID_CVPCB_DISPLAY_LICENCE, _("&About cvpcb"),
_("About cvpcb schematic to pcb converter"));
item->SetBitmap(info_xpm);
helpMenu->Append(item);
configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE,
_( "&Save config" ),
_( "Save configuration in current dir" ) );
item->SetBitmap( save_setup_xpm );
configmenu->Append( item );
menuBar->Append(m_FilesMenu, _("&File"));
menuBar->Append(configmenu, _("&Preferences"));
menuBar->Append(helpMenu, _("&Help"));
}
// Menu Help:
wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_HELP, _( "&Contents" ),
_( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
item =
new wxMenuItem( helpMenu, ID_CVPCB_DISPLAY_LICENCE,
_( "&About cvpcb" ),
_( "About cvpcb schematic to pcb converter" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
else // simple mise a jour de la liste des fichiers anciens
{
wxMenuItem * item;
int max_file = m_Parent->m_LastProjectMaxCount;
for ( ii = max_file-1; ii >=0 ; ii-- )
{
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )
{
item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii);
if ( item ) delete item;
}
}
for ( ii = 0; ii < max_file; ii++ )
{
if ( GetLastProject(ii).IsEmpty() ) break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
}
}
menuBar->Append( m_FilesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
}
else // simple mise a jour de la liste des fichiers anciens
{
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
}
}

View File

@ -4,7 +4,6 @@
/****************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -19,17 +18,22 @@
/* Fonctions exportees */
/* Fonctions Locales */
static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen,
SCH_ITEM* DrawStruct );
static void CollectStructsToDrag( SCH_SCREEN* screen );
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position );
static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
wxPoint& position );
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static SCH_ITEM * SaveStructListForPaste( SCH_ITEM* DrawStruct );
static bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM * DrawStruct, wxPoint& Center );
static void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center );
static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel,
wxDC* DC,
BASE_SCREEN* screen,
SCH_ITEM* DrawStruct );
static void CollectStructsToDrag( SCH_SCREEN* screen );
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position );
static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
wxPoint& position );
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
static SCH_ITEM* SaveStructListForPaste( SCH_ITEM* DrawStruct );
static bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM* DrawStruct, wxPoint& Center );
static void MirrorOneStruct( SCH_ITEM* DrawStruct,
wxPoint& Center );
/*************************************************************************/
int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
@ -100,7 +104,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
bool err = FALSE;
DrawBlockStruct* block = &GetScreen()->BlockLocate;
SCH_ITEM * NewStruct = NULL;
SCH_ITEM* NewStruct = NULL;
if( DrawPanel->ManageCurseur == NULL )
{
@ -112,7 +116,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
{
wxString msg;
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 );
DisplayError( this, msg );
}
@ -130,9 +135,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( DrawPanel->ManageCurseur )
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;
DrawPanel->Refresh( TRUE );
break;
@ -142,10 +147,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( DrawPanel->ManageCurseur )
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,
(block->m_Command == BLOCK_PRESELECT_MOVE) ? IS_CHANGED : IS_NEW );
SaveCopyInUndoList(
NewStruct,
(block->m_Command ==
BLOCK_PRESELECT_MOVE) ? IS_CHANGED : IS_NEW );
block->m_BlockDrawStruct = NULL;
break;
@ -173,7 +182,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
/* clear struct.m_Flags */
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;
DrawPanel->ManageCurseur = NULL;
@ -187,11 +198,14 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( block->m_BlockDrawStruct )
{
DisplayError( this, wxT( "HandleBlockPLace() error: DrawStruct != Null" ) );
DisplayError( this,
wxT( "HandleBlockPLace() error: DrawStruct != Null" ) );
block->m_BlockDrawStruct = NULL;
}
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
SetToolID( m_ID_current_state,
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
}
@ -206,7 +220,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
* -1 si commande terminee et composants trouves (block delete, block save)
*/
{
int ii = 0;
int ii = 0;
bool zoom_command = FALSE;
DrawBlockStruct* block = &GetScreen()->BlockLocate;
@ -267,7 +281,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
if( block->m_BlockDrawStruct != NULL )
{
ii = -1;
DeleteStruct( DrawPanel, DC, (SCH_ITEM*) block->m_BlockDrawStruct );
DeleteStruct( DrawPanel,
DC,
(SCH_ITEM*) block->m_BlockDrawStruct );
GetScreen()->SetModify();
}
block->m_BlockDrawStruct = NULL;
@ -281,10 +297,11 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL )
{
wxPoint oldpos = GetScreen()->m_Curseur;
wxPoint oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = wxPoint( 0, 0 );
SCH_ITEM * DrawStructCopy =
SaveStructListForPaste( (SCH_ITEM*)block->m_BlockDrawStruct );
SCH_ITEM* DrawStructCopy =
SaveStructListForPaste(
(SCH_ITEM*) block->m_BlockDrawStruct );
PlaceStruct( GetScreen(), DrawStructCopy );
GetScreen()->m_Curseur = oldpos;
ii = -1;
@ -316,7 +333,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
if( block->m_Command == BLOCK_ABORT )
{ /* clear struct.m_Flags */
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;
}
@ -328,7 +347,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = 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 )
@ -412,9 +433,9 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL )
{
wxPoint oldpos = GetScreen()->m_Curseur;
wxPoint oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = wxPoint( 0, 0 );
SCH_ITEM * DrawStructCopy =
SCH_ITEM* DrawStructCopy =
SaveStructListForPaste( (SCH_ITEM*) block->m_BlockDrawStruct );
PlaceStruct( GetScreen(), DrawStructCopy );
GetScreen()->m_Curseur = oldpos;
@ -424,7 +445,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_ZOOM: /* Window Zoom */
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
DrawPanel->SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
DrawPanel->SetCursor(
DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
Window_Zoom( GetScreen()->BlockLocate );
break;
@ -438,13 +460,17 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL )
{
SaveCopyInUndoList( (SCH_ITEM*)block->m_BlockDrawStruct, IS_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) block->m_BlockDrawStruct,
IS_CHANGED );
ii = -1;
/* Compute the mirror centre and put it on grid */
wxPoint Center = block->Centre();
PutOnGrid( &Center );
MirrorStruct( DrawPanel, DC, (SCH_ITEM*)block->m_BlockDrawStruct, Center );
MirrorStruct( DrawPanel,
DC,
(SCH_ITEM*) block->m_BlockDrawStruct,
Center );
GetScreen()->SetModify();
}
TestDanglingEnds( GetScreen()->EEDrawList, DC );
@ -463,7 +489,9 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = 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,
{
DrawStructsInGhost( panel,
DC,
(SCH_ITEM*)PickedList->m_PickedStruct,
(SCH_ITEM*) PickedList->m_PickedStruct,
PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y );
PickedList = (DrawPickedStruct*) PickedList->Next();
@ -508,15 +536,17 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
else
DrawStructsInGhost( panel,
DC,
(SCH_ITEM*)PtBlock->m_BlockDrawStruct,
(SCH_ITEM*) PtBlock->m_BlockDrawStruct,
PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y );
}
/* Redessin nouvel affichage */
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
PtBlock->m_MoveVector.x = screen->m_Curseur.x -
PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y -
PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( DC, g_XorMode );
PtBlock->Offset( PtBlock->m_MoveVector );
@ -532,7 +562,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{
DrawStructsInGhost( panel,
DC,
(SCH_ITEM*)PickedList->m_PickedStruct,
(SCH_ITEM*) PickedList->m_PickedStruct,
PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y );
PickedList = (DrawPickedStruct*) PickedList->Next();
@ -541,7 +571,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
else
DrawStructsInGhost( panel,
DC,
(SCH_ITEM*)PtBlock->m_BlockDrawStruct,
(SCH_ITEM*) PtBlock->m_BlockDrawStruct,
PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y );
}
@ -565,7 +595,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
if( DC )
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 )
RedrawStructList( panel, DC, pickedList, GR_DEFAULT_DRAWMODE );
@ -576,7 +606,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
else
{
if( DC )
panel->PostDirtyRect( DrawStruct->GetBoundingBox());
panel->PostDirtyRect( DrawStruct->GetBoundingBox() );
PlaceStruct( panel->GetScreen(), DrawStruct ); /* Place it in its new position. */
if( DC )
RedrawOneStruct( panel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
@ -594,28 +624,31 @@ 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.
*/
{
int dx, ii, * Points;
DrawPolylineStruct* DrawPoly;
DrawJunctionStruct* DrawConnect;
EDA_DrawLineStruct* DrawSegment;
DrawBusEntryStruct* DrawRaccord;
SCH_COMPONENT* DrawLibItem;
DrawSheetStruct* DrawSheet;
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
DrawMarkerStruct* DrawMarker;
DrawNoConnectStruct* DrawNoConnect;
SCH_TEXT* DrawText;
wxPoint px;
DrawPolylineStruct* DrawPoly;
DrawJunctionStruct* DrawConnect;
EDA_DrawLineStruct* DrawSegment;
DrawBusEntryStruct* DrawRaccord;
SCH_COMPONENT* DrawLibItem;
DrawSheetStruct* DrawSheet;
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
DrawMarkerStruct* DrawMarker;
DrawNoConnectStruct* DrawNoConnect;
SCH_TEXT* DrawText;
wxPoint px;
WinEDA_SchematicFrame* frame;
if( !DrawStruct )
return;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
switch( DrawStruct->Type() )
{
case TYPE_NOT_INIT:
@ -684,7 +717,7 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
MirrorYPoint( px, Center );
px.x -= dx;
g_EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
frame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x;
break;
@ -700,23 +733,23 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
px = DrawText->m_Pos;
MirrorYPoint( px, Center );
g_EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
frame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x;
break;
case TYPE_SCH_COMPONENT:
DrawLibItem = (SCH_COMPONENT*) DrawStruct;
dx = DrawLibItem->m_Pos.x;
g_EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem,
NULL, CMP_MIROIR_Y );
frame->CmpRotationMiroir( DrawLibItem, NULL, CMP_MIROIR_Y );
MirrorYPoint( DrawLibItem->m_Pos, Center );
dx -= DrawLibItem->m_Pos.x;
for( ii = 0; ii < DrawLibItem->GetFieldCount(); ii++ )
{
/* 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;
case DRAW_SHEET_STRUCT_TYPE:
@ -729,7 +762,8 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
{
MirrorYPoint( DrawSheetLabel->m_Pos, Center );
DrawSheetLabel->m_Edge = DrawSheetLabel->m_Edge ? 0 : 1;
DrawSheetLabel = (Hierarchical_PIN_Sheet_Struct*) DrawSheetLabel->Next();
DrawSheetLabel =
(Hierarchical_PIN_Sheet_Struct*) DrawSheetLabel->Next();
}
break;
@ -753,7 +787,10 @@ void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is *
* 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 )
return FALSE;
@ -765,7 +802,7 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct, wxP
if( DC )
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 );
cur->m_PickedStruct->m_Flags = 0;
@ -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,
SCH_ITEM * DrawStruct )
static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel,
wxDC* DC,
BASE_SCREEN* screen,
SCH_ITEM* DrawStruct )
/*****************************************************************************/
/* 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
* Return the new created struct
*/
{
SCH_ITEM * NewDrawStruct;
SCH_ITEM* NewDrawStruct;
DrawPickedStruct* PickedList = NULL;
if( !DrawStruct )
@ -829,9 +868,9 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
case TYPE_SCH_COMPONENT:
{
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL);
( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
}
break;
break;
case DRAW_SHEET_STRUCT_TYPE:
{
@ -894,7 +933,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
case TYPE_SCH_COMPONENT:
( (SCH_COMPONENT*) NewDrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation(NULL);
( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation( NULL );
break;
}
@ -902,7 +941,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
SetaParent( NewDrawStruct, screen );
NewDrawStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = NewDrawStruct;
screen->EEDrawList = NewDrawStruct;
}
/* Free the original DrawPickedStruct chain: */
@ -917,15 +956,15 @@ 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.
* Object is put in Undo list
*/
{
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent;
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent;
if( !DrawStruct )
return;
@ -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
* accessible par la liste globale directement */
frame->SaveCopyInUndoList( (SCH_ITEM*) ( (Hierarchical_PIN_Sheet_Struct*) DrawStruct )->GetParent(), IS_CHANGED );
frame->DeleteSheetLabel( DC ? true : false , (Hierarchical_PIN_Sheet_Struct*) DrawStruct );
frame->SaveCopyInUndoList( (SCH_ITEM*)( (Hierarchical_PIN_Sheet_Struct
*) DrawStruct )->GetParent(),
IS_CHANGED );
frame->DeleteSheetLabel( DC ? true : false,
(Hierarchical_PIN_Sheet_Struct*) DrawStruct );
return;
}
@ -943,14 +985,16 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct )
{
// 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 );
panel->PostDirtyRect( item->GetBoundingBox() );
item->SetNext( 0 );
item->SetBack( 0 );
item->m_Flags = IS_DELETED;
item->m_Flags = IS_DELETED;
}
// Removed items are put onto the Undo list
@ -968,7 +1012,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct )
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); // Currently In TEST
frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); // Currently In TEST
}
else
frame->SaveCopyInUndoList( DrawStruct, IS_DELETED );
@ -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.
@ -987,7 +1031,7 @@ SCH_ITEM * SaveStructListForPaste( SCH_ITEM * DrawStruct )
*/
{
DrawPickedStruct* PickedList;
SCH_ITEM * DrawStructCopy;
SCH_ITEM* DrawStructCopy;
if( !DrawStruct )
return NULL;
@ -1027,7 +1071,7 @@ SCH_ITEM * SaveStructListForPaste( SCH_ITEM * DrawStruct )
*****************************************************************************/
void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
{
SCH_ITEM * DrawStruct;
SCH_ITEM* DrawStruct;
DrawPickedStruct* PickedList = NULL;
if( g_BlockSaveDataList == NULL )
@ -1051,7 +1095,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
if( Struct->Type() == TYPE_SCH_COMPONENT )
{
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL);
( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
SetaParent( Struct, GetScreen() );
}
PickedList = (DrawPickedStruct*) PickedList->Next();
@ -1060,7 +1104,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; )
{
SCH_ITEM * Struct = PickedList->m_PickedStruct;
SCH_ITEM* Struct = PickedList->m_PickedStruct;
Struct->SetNext( GetScreen()->EEDrawList );
SetaParent( Struct, GetScreen() );
GetScreen()->EEDrawList = Struct;
@ -1075,7 +1119,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
if( DrawStruct->Type() == TYPE_SCH_COMPONENT )
{
( (SCH_COMPONENT*) DrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation(NULL);
( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation( NULL );
}
SetaParent( DrawStruct, GetScreen() );
RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
@ -1085,8 +1129,10 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
}
/* clear .m_Flags member for all items */
SCH_ITEM * Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
SCH_ITEM* Struct;
for( Struct = GetScreen()->EEDrawList;
Struct != NULL;
Struct = Struct->Next() )
Struct->m_Flags = 0;
GetScreen()->SetModify();
@ -1098,7 +1144,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
/*****************************************************************************
* Routine to place a given object. *
*****************************************************************************/
bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM * DrawStruct )
bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM* DrawStruct )
{
DrawPickedStruct* DrawStructs;
wxPoint move_vector;
@ -1149,22 +1195,22 @@ 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.
*/
{
int ii, * Points;
DrawPolylineStruct* DrawPoly;
DrawJunctionStruct* DrawConnect;
EDA_DrawLineStruct* DrawSegment;
DrawBusEntryStruct* DrawRaccord;
SCH_COMPONENT* DrawLibItem;
DrawSheetStruct* DrawSheet;
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
DrawMarkerStruct* DrawMarker;
DrawNoConnectStruct* DrawNoConnect;
DrawPolylineStruct* DrawPoly;
DrawJunctionStruct* DrawConnect;
EDA_DrawLineStruct* DrawSegment;
DrawBusEntryStruct* DrawRaccord;
SCH_COMPONENT* DrawLibItem;
DrawSheetStruct* DrawSheet;
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
DrawMarkerStruct* DrawMarker;
DrawNoConnectStruct* DrawNoConnect;
if( !DrawStruct )
return;
@ -1238,7 +1284,7 @@ void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector )
DrawLibItem->m_Pos += move_vector;
for( ii = 0; ii < DrawLibItem->GetFieldCount(); ii++ )
{
DrawLibItem->GetField(ii)->m_Pos += move_vector;
DrawLibItem->GetField( ii )->m_Pos += move_vector;
}
break;
@ -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.
* The new object is not put in draw list (not linked)
*/
{
SCH_ITEM * NewDrawStruct = NULL;
SCH_ITEM* NewDrawStruct = NULL;
if( DrawStruct == NULL )
{
@ -1366,7 +1412,7 @@ SCH_ITEM * DuplicateStruct( SCH_ITEM * DrawStruct )
DrawStruct->Type() << wxT( " " ) << DrawStruct->GetClass();
DisplayError( NULL, msg );
}
break;
break;
}
NewDrawStruct->m_Image = DrawStruct;
@ -1379,7 +1425,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/****************************************************/
{
DrawPickedStruct* DrawStructs, * FirstPicked;
SCH_ITEM * Struct;
SCH_ITEM* Struct;
EDA_DrawLineStruct* SegmStruct;
int ox, oy, fx, fy;
@ -1387,15 +1433,18 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() )
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;
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 )
{
Struct = DrawStructs->m_PickedStruct;
Struct = DrawStructs->m_PickedStruct;
DrawStructs = DrawStructs->Next();
Struct->m_Flags = SELECTED;
}
@ -1416,9 +1465,11 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/* Pour Drag Block: remise sous forme de liste de structure, s'il n'y
* 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;
}
@ -1427,7 +1478,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
while( DrawStructs )
{
Struct = DrawStructs->m_PickedStruct;
Struct = DrawStructs->m_PickedStruct;
DrawStructs = DrawStructs->Next();
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{
@ -1446,10 +1497,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
* fils et connexions hors bloc relies a des pins ou entries elles meme
* draggees */
FirstPicked = DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
FirstPicked = DrawStructs =
(DrawPickedStruct*) screen->BlockLocate.
m_BlockDrawStruct;
while( DrawStructs )
{
Struct = DrawStructs->m_PickedStruct;
Struct = DrawStructs->m_PickedStruct;
DrawStructs = DrawStructs->Next();
if( Struct->Type() == TYPE_SCH_COMPONENT )
{
@ -1458,7 +1511,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos );
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 );
DrawItem = GetNextPinPosition( NULL, pos );
@ -1467,7 +1521,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
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 )
{
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
@ -1491,13 +1546,13 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/******************************************************************/
{
DrawPickedStruct* DrawStructs;
SCH_ITEM * Struct;
SCH_ITEM* Struct;
/* Examen de la liste des elements deja selectionnes */
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
while( DrawStructs )
{
Struct = DrawStructs->m_PickedStruct;
Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Next();
switch( Struct->Type() )
@ -1541,7 +1596,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break;
DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs;
screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
break;
case DRAW_SEGMENT_STRUCT_TYPE:
@ -1553,7 +1609,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{
DrawStructs = new DrawPickedStruct( Struct );
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 &= ~STARTPOINT;
}
@ -1561,7 +1618,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
{
DrawStructs = new DrawPickedStruct( Struct );
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 &= ~ENDPOINT;
}
@ -1582,7 +1640,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break;
DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs;
screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags |= SELECTED;
break;
@ -1596,7 +1655,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break;
DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs;
screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags |= SELECTED;
break;
@ -1621,7 +1681,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break;
DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs;
screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags |= SELECTED;
break;
@ -1634,7 +1695,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break;
DrawStructs = new DrawPickedStruct( Struct );
DrawStructs->SetNext( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = (EDA_BaseStruct*) DrawStructs;
screen->BlockLocate.m_BlockDrawStruct =
(EDA_BaseStruct*) DrawStructs;
Struct->m_Flags |= SELECTED;
break;
@ -1648,7 +1710,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/*********************************************************************************/
static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
wxPoint& position )
wxPoint& position )
/*********************************************************************************/
{
EDA_LibComponentStruct* Entry;
@ -1661,8 +1723,9 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
if( DrawLibItem )
{
NextItem = NULL;
if( ( Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString,
FIND_ROOT ) ) == NULL )
if( ( Entry =
FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString,
FIND_ROOT ) ) == NULL )
return NULL;
DEntry = Entry->m_Drawings;
Multi = DrawLibItem->m_Multi;
@ -1690,10 +1753,10 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
orient = Pin->ReturnPinDrawOrient( TransMat );
/* Calcul de la position du point de reference */
position.x = PartX + (TransMat[0][0] * Pin->m_Pos.x)
+ (TransMat[0][1] * Pin->m_Pos.y);
position.y = PartY + (TransMat[1][0] * Pin->m_Pos.x)
+ (TransMat[1][1] * Pin->m_Pos.y);
position.x = PartX + (TransMat[0][0] *Pin->m_Pos.x)
+ (TransMat[0][1] *Pin->m_Pos.y);
position.y = PartY + (TransMat[1][0] *Pin->m_Pos.x)
+ (TransMat[1][1] *Pin->m_Pos.y);
NextItem = DEntry->Next();
return DEntry;
}

View File

@ -3,7 +3,6 @@
/*****************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -14,18 +13,25 @@
/**********************************************************************************************/
void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor,
int aDrawMode, void* aData, int aTransformMatrix[2][2] )
void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aColor,
int aDrawMode,
void* aData,
int aTransformMatrix[2][2] )
/**********************************************************************************************/
{
// Invisibles pins are only drawn on request.
// 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 ( g_EDA_Appl->m_LibeditFrame && g_EDA_Appl->m_LibeditFrame->IsActive() )
if( frame->m_LibeditFrame && frame->m_LibeditFrame->IsActive() )
aColor = g_InvisibleItemColor;
else if( !g_ShowAllPins )
else if( !g_ShowAllPins )
return;
}
@ -45,16 +51,20 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs
if( DrawPinText )
{
DrawPinTexts( aPanel, aDC, pos1, orient,
Entry->m_TextInside,
Entry->m_DrawPinNum, Entry->m_DrawPinName,
aColor, aDrawMode );
Entry->m_TextInside,
Entry->m_DrawPinNum, Entry->m_DrawPinName,
aColor, aDrawMode );
}
}
/********************************************************************************/
void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aPinPos, int aOrient, int aDrawMode, int aColor )
void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aPinPos,
int aOrient,
int aDrawMode,
int aColor )
/*******************************************************************************/
/* Draw the pin symbol (without texts)
@ -102,11 +112,11 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( m_PinShape & INVERT )
{
GRCircle( &aPanel->m_ClipBox, aDC, MapX1 * INVERT_PIN_RADIUS + x1,
MapY1 * INVERT_PIN_RADIUS + y1,
INVERT_PIN_RADIUS, width, color );
MapY1 * INVERT_PIN_RADIUS + y1,
INVERT_PIN_RADIUS, width, color );
GRMoveTo( MapX1 * INVERT_PIN_RADIUS * 2 + x1,
MapY1 * INVERT_PIN_RADIUS * 2 + y1 );
MapY1 * INVERT_PIN_RADIUS * 2 + y1 );
GRLineTo( &aPanel->m_ClipBox, aDC, posX, posY, width, color );
}
else
@ -120,14 +130,34 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1, y1 + CLOCK_PIN_DIM );
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - MapX1 * CLOCK_PIN_DIM, y1, width, color );
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1 - CLOCK_PIN_DIM, width, color );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1 - MapX1 * CLOCK_PIN_DIM,
y1,
width,
color );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1,
y1 - CLOCK_PIN_DIM,
width,
color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 + CLOCK_PIN_DIM, y1 );
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1 - MapY1 * CLOCK_PIN_DIM, width, color );
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - CLOCK_PIN_DIM, y1, width, color );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1,
y1 - MapY1 * CLOCK_PIN_DIM,
width,
color );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1 - CLOCK_PIN_DIM,
y1,
width,
color );
}
}
@ -136,15 +166,19 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 );
GRLineTo( &aPanel->m_ClipBox, aDC, x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 - IEEE_SYMBOL_PIN_DIM, width, color );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1 - IEEE_SYMBOL_PIN_DIM,
width,
color );
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 );
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - IEEE_SYMBOL_PIN_DIM,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2, width, color );
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2, width, color );
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1, width, color );
}
}
@ -156,27 +190,33 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC,
{
GRMoveTo( x1, y1 - IEEE_SYMBOL_PIN_DIM );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1,
width,
color );
aDC,
x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
y1,
width,
color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 - IEEE_SYMBOL_PIN_DIM, y1 );
GRLineTo( &aPanel->m_ClipBox,
aDC,
x1,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2,
width,
color );
aDC,
x1,
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2,
width,
color );
}
}
/* 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 */
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,
* If TextInside then the text is been put inside,otherwise all is drawn outside.
* Pin Name: substring beteween '~' is negated
*****************************************************************************/
void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
wxPoint& pin_pos, int orient,
int TextInside, bool DrawPinNum, bool DrawPinName,
int Color, int DrawMode )
void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
wxDC* DC,
wxPoint& pin_pos,
int orient,
int TextInside,
bool DrawPinNum,
bool DrawPinName,
int Color,
int DrawMode )
/* DrawMode = GR_OR, XOR ... */
{
int ii, x, y, x1, y1, dx, dy, len;
@ -244,7 +289,8 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
{
if( *textsrc == '~' )
{
PinTextBarPos[PinTextBarCount++] = (int) (PinTxtLen * fPinTextPitch);
PinTextBarPos[PinTextBarCount++] =
(int) ( PinTxtLen * fPinTextPitch );
}
else
{
@ -255,7 +301,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
textsrc++;
}
PinTxtLen = (int) (fPinTextPitch * PinTxtLen);
PinTxtLen = (int) ( fPinTextPitch * PinTxtLen );
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
if( PinText[0] == 0 )
@ -272,10 +318,13 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
if( orient == PIN_RIGHT )
{
x = x1 + TextInside;
DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
DrawGraphicText( panel, DC, wxPoint( x,
y1 ), NameColor,
PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
@ -285,16 +334,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( dx, 0 );
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
{
x = x1 - TextInside;
DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
DrawGraphicText( panel, DC, wxPoint( x,
y1 ), NameColor,
PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
@ -304,7 +361,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( dx - PinTxtLen, 0 );
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,
if( DrawPinNum )
{
DrawGraphicText( panel, DC,
wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ), NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
wxPoint( (x1 + pin_pos.x) / 2,
y1 - TXTMARGE ), NumColor,
StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
}
}
else /* Its a vertical line. */
@ -326,9 +391,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
{
y = y1 + TextInside;
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth );
DrawGraphicText( panel, DC, wxPoint( x1,
y ), NameColor,
PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
@ -338,16 +406,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, PinTxtLen - dx );
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 */
{
y = y1 - TextInside;
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
DrawGraphicText( panel, DC, wxPoint( x1,
y ), NameColor,
PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
@ -357,7 +433,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, -dx );
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,
if( DrawPinNum )
{
DrawGraphicText( panel, DC,
wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ), NumColor,
StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
}
}
}
@ -379,10 +463,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
if( PinText && DrawPinName )
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText( panel, DC, wxPoint( x, y1 - TXTMARGE ),
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
DrawGraphicText( panel, DC, wxPoint( x,
y1 - TXTMARGE ),
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
@ -391,16 +477,23 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( dx, 0 );
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 )
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText( panel, DC, wxPoint( x, y1 + TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth );
DrawGraphicText( panel, DC, wxPoint( x,
y1 + TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
LineWidth );
}
}
else /* Its a vertical line. */
@ -408,10 +501,12 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
if( PinText && DrawPinName )
{
y = (y1 + pin_pos.y) / 2;
DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE, y ),
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE,
y ),
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
for( ii = 0; ii < PinTextBarCount; )
{
@ -420,16 +515,24 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
dx = PinTextBarPos[ii++]; // Get the line pos
GRMoveRel( 0, PinTxtLen - dx );
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 )
{
DrawGraphicText( panel, DC, wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth );
DrawGraphicText( panel, DC,
wxPoint( x1 + TXTMARGE,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, LineWidth );
}
}
}
@ -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 *
* the opposite direction to x2,y2), otherwise all is drawn outside. *
*****************************************************************************/
void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
int TextInside, bool DrawPinNum, bool DrawPinName )
void LibDrawPin::PlotPinTexts( wxPoint& pin_pos,
int orient,
int TextInside,
bool DrawPinNum,
bool DrawPinName )
{
int dx, len, start;
int ii, x, y, x1, y1, cte;
@ -461,7 +567,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
int PinTxtLen = 0;
wxSize PinNameSize = wxSize( m_PinNameSize, m_PinNameSize );
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 */
NameColor = plot_color ? ReturnLayerColor( LAYER_PINNAM ) : -1;
@ -495,7 +602,8 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
{
if( *textsrc == '~' )
{
PinTextBarPos[PinTextBarCount++] = (int) (fPinTextPitch * PinTxtLen);
PinTextBarPos[PinTextBarCount++] =
(int) ( fPinTextPitch * PinTxtLen );
}
else
{
@ -506,7 +614,7 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
textsrc++;
}
PinTxtLen = (int) (fPinTextPitch * PinTxtLen);
PinTxtLen = (int) ( fPinTextPitch * PinTxtLen );
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
if( PinText[0] == 0 )
@ -521,10 +629,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( orient == PIN_RIGHT )
{
x = x1 + TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 ), NameColor, PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
PlotGraphicText( g_PlotFormat, wxPoint( x,
y1 ), NameColor,
PinText,
TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER );
for( ii = 0; ii < PinTextBarCount; )
{
@ -538,10 +649,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
else // orient == PIN_LEFT
{
x = x1 - TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 ),
NameColor, PinText, TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
PlotGraphicText( g_PlotFormat, wxPoint( x,
y1 ),
NameColor, PinText, TEXT_ORIENT_HORIZ,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
for( ii = 0; ii < PinTextBarCount; )
{
@ -556,10 +669,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( DrawPinNum )
{
PlotGraphicText( g_PlotFormat, wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
PlotGraphicText( g_PlotFormat,
wxPoint( (x1 + pin_pos.x) / 2,
y1 - TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
}
}
else /* Its a vertical line. */
@ -570,9 +686,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
{
y = y1 + TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
PlotGraphicText( g_PlotFormat, wxPoint( x1,
y ), NameColor,
PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP );
for( ii = 0; ii < PinTextBarCount; )
{
@ -587,9 +706,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
{
y = y1 - TextInside;
PlotGraphicText( g_PlotFormat, wxPoint( x1, y ), NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
PlotGraphicText( g_PlotFormat, wxPoint( x1,
y ), NameColor,
PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
for( ii = 0; ii < PinTextBarCount; )
{
@ -604,10 +726,13 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( DrawPinNum )
{
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
PlotGraphicText( g_PlotFormat,
wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
}
}
}
@ -619,10 +744,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( PinText && DrawPinName )
{
x = (x1 + pin_pos.x) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 - TXTMARGE ),
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM );
PlotGraphicText( g_PlotFormat, wxPoint( x,
y1 - TXTMARGE ),
NameColor, PinText,
TEXT_ORIENT_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM );
for( ii = 0; ii < PinTextBarCount; )
{
@ -638,9 +765,9 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
{
x = (x1 + pin_pos.x) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x, y1 + TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP );
}
}
else /* Its a vertical line. */
@ -648,10 +775,12 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( PinText && DrawPinName )
{
y = (y1 + pin_pos.y) / 2;
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE, y ),
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER );
PlotGraphicText( g_PlotFormat, wxPoint( x1 - TXTMARGE,
y ),
NameColor, PinText,
TEXT_ORIENT_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER );
for( ii = 0; ii < PinTextBarCount; )
{
@ -666,23 +795,25 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
if( DrawPinNum )
{
PlotGraphicText( g_PlotFormat, wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER );
PlotGraphicText( g_PlotFormat,
wxPoint( x1 + TXTMARGE,
(y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER );
}
}
}
}
/***************************************************************/
LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE )
/***************************************************************/
{
m_PinLen = 300; /* default Pin len */
m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */
m_PinLen = 300; /* default Pin len */
m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */
m_PinShape = NONE; /* Bit a bit: Pin shape (voir enum prec) */
m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */
m_Attributs = 0; /* bit 0 != 0: pin invisible */
@ -733,7 +864,7 @@ int LibDrawPin::ReturnPinDrawOrient( int TransMat[2][2] )
* @param TransMat = transform matrix
*/
{
int orient;
int orient;
wxPoint end; // position of a end pin starting at 0,0 according to its orientation, lenght = 1
switch( m_Orient )
@ -780,7 +911,7 @@ void LibDrawPin::ReturnPinStringNum( wxString& buffer ) const
{
char ascii_buf[5];
memcpy(ascii_buf, &m_PinNum , 4);
memcpy( ascii_buf, &m_PinNum, 4 );
ascii_buf[4] = 0;
buffer = CONV_FROM_UTF8( ascii_buf );
@ -817,9 +948,9 @@ LibDrawPin* LibDrawPin::GenCopy()
{
LibDrawPin* newpin = new LibDrawPin();
newpin->m_Pos = m_Pos;
newpin->m_PinLen = m_PinLen;
newpin->m_Orient = m_Orient;
newpin->m_Pos = m_Pos;
newpin->m_PinLen = m_PinLen;
newpin->m_Orient = m_Orient;
newpin->m_PinShape = m_PinShape;
newpin->m_PinType = m_PinType;
newpin->m_Attributs = m_Attributs;
@ -835,4 +966,3 @@ LibDrawPin* LibDrawPin::GenCopy()
return newpin;
}

View File

@ -3,7 +3,6 @@
/*********************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -15,7 +14,8 @@
/* Routines locales */
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm, EDA_DrawLineStruct* TstSegm );
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
EDA_DrawLineStruct* TstSegm );
/* Variable locales */
@ -30,8 +30,12 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
*/
{
SCH_ITEM* DrawList, * TstDrawList;
int flag;
bool Modify = FALSE;
int flag;
bool Modify = FALSE;
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
DrawList = EEDrawList;
for( ; DrawList != NULL; DrawList = DrawList->Next() )
@ -44,7 +48,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{
flag = TstAlignSegment( (EDA_DrawLineStruct*) DrawList,
(EDA_DrawLineStruct*) TstDrawList );
(EDA_DrawLineStruct*) TstDrawList );
if( flag ) /* Suppression de TstSegm */
{
/* keep the bits set in .m_Flags, because the deleted segment can be flagged */
@ -63,7 +67,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
}
}
g_EDA_Appl->m_SchematicFrame->TestDanglingEnds( EEDrawList, DC );
frame->TestDanglingEnds( EEDrawList, DC );
return Modify;
}
@ -80,7 +84,8 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
if( Screen == NULL )
{
DisplayError( NULL, wxT( "BreakSegmentOnJunction() error: NULL screen" ) );
DisplayError( NULL,
wxT( "BreakSegmentOnJunction() error: NULL screen" ) );
return;
}
@ -149,7 +154,8 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen,
segment = (EDA_DrawLineStruct*) DrawList;
ox = segment->m_Start.x; oy = segment->m_Start.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;
/* Segment connecte: doit etre coupe en 2 si px,py n'est
@ -172,7 +178,7 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen,
}
NewSegment = segment->GenCopy();
NewSegment->m_Start = breakpoint;
segment->m_End = NewSegment->m_Start;
segment->m_End = NewSegment->m_Start;
NewSegment->SetNext( segment->Next() );
segment->SetNext( NewSegment );
DrawList = NewSegment;
@ -256,10 +262,10 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
}
else
{
if( atan2( (double)(RefSegm->m_Start.x - RefSegm->m_End.x),
(double)(RefSegm->m_Start.y - RefSegm->m_End.y) ) ==
atan2( (double)(TstSegm->m_Start.x - TstSegm->m_End.x),
(double)(TstSegm->m_Start.y - TstSegm->m_End.y) ) )
if( atan2( (double) ( RefSegm->m_Start.x - RefSegm->m_End.x ),
(double) ( RefSegm->m_Start.y - RefSegm->m_End.y ) ) ==
atan2( (double) ( TstSegm->m_Start.x - TstSegm->m_End.x ),
(double) ( TstSegm->m_Start.y - TstSegm->m_End.y ) ) )
{
RefSegm->m_End = TstSegm->m_End;
return 1;

View File

@ -36,8 +36,10 @@ void RemoteCommand( const char* cmdline )
char line[1024];
char* idcmd;
char* text;
WinEDA_SchematicFrame* frame = g_EDA_Appl->m_SchematicFrame;
wxString part_ref, msg;
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
strncpy( line, cmdline, sizeof(line) - 1 );
@ -83,8 +85,8 @@ void RemoteCommand( const char* cmdline )
/*****************************************************************************/
void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
SCH_COMPONENT* LibItem )
void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
SCH_COMPONENT* LibItem )
/*****************************************************************************/
/** Send a remote command to eeschema via a socket,
@ -106,17 +108,19 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
{
case DRAW_PART_TEXT_STRUCT_TYPE:
case COMPONENT_FIELD_DRAW_TYPE:
{
if( LibItem == NULL )
break;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField(REFERENCE)->m_Text ) );
SendCommand( MSG_TO_PCB, Line );
}
break;
{
if( LibItem == NULL )
break;
sprintf( Line, "$PART: %s",
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line );
}
break;
case TYPE_SCH_COMPONENT:
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 );
break;
@ -130,10 +134,11 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
wxString pinnum;
Pin->ReturnPinStringNum( pinnum );
sprintf( Line, "$PIN: %s $PART: %s", CONV_TO_UTF8( pinnum ),
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
}
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 );
break;

View File

@ -3,7 +3,6 @@
/*******************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -18,14 +17,16 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
/**************************************************************************/
/* Free (delete) all schematic data (include the sub hierarchy sheets )
* for the hierarchical sheet FirstSheet
* FirstSheet is not deleted.
* for the hierarchical sheet FirstSheet
* FirstSheet is not deleted.
*/
{
EDA_BaseStruct* DrawStruct;
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 )
return;
@ -33,7 +34,7 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE )
{
DisplayError( NULL,
wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) );
wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) );
return;
}
@ -41,8 +42,8 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
if( FirstSheet->m_AssociatedScreen->IsModify() && confirm_deletion )
{
msg.Printf( _( "Sheet %s (file %s) modified. Save it?" ),
FirstSheet->m_SheetName.GetData(),
FirstSheet->GetFileName().GetData() );
FirstSheet->m_SheetName.GetData(),
FirstSheet->GetFileName().GetData() );
if( IsOK( NULL, msg ) )
{
frame->SaveEEFile( FirstSheet->m_AssociatedScreen, FILE_SAVE_AS );
@ -59,7 +60,8 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
EEDrawList = EEDrawList->Next();
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct, confirm_deletion );
DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct,
confirm_deletion );
}
}
@ -78,29 +80,29 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
//this is redundant -- use FreeDrawList, a member of SCH_SCREEN
/*
* {
* EDA_BaseStruct *DrawStruct;
* {
* EDA_BaseStruct *DrawStruct;
*
* while (DrawList != NULL)
* {
* DrawStruct = DrawList;
* DrawList = DrawList->Pnext;
* while (DrawList != NULL)
* {
* DrawStruct = DrawList;
* DrawList = DrawList->Pnext;
*
* if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE)
* {
* DeleteSubHierarchy((DrawSheetStruct*) DrawStruct, confirm_deletion);
* }
* if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE)
* {
* DeleteSubHierarchy((DrawSheetStruct*) DrawStruct, confirm_deletion);
* }
*
* delete DrawStruct;
* }
* }
* delete DrawStruct;
* }
* }
*/
/********************************************************************/
bool ClearProjectDrawList( SCH_SCREEN* screen, bool confirm_deletion )
/********************************************************************/
/* free the draw list screen->EEDrawList and the subhierarchies
* clear the screen datas (filenames ..)
* clear the screen datas (filenames ..)
*/
{
if( screen == NULL )

View File

@ -132,12 +132,15 @@ WinEDA_Build_BOM_Frame::WinEDA_Build_BOM_Frame( WinEDA_DrawFrame* parent,
const wxSize& size,
long style )
{
wxConfig* config = wxGetApp().m_EDA_Config;
wxASSERT( config != NULL );
m_Parent = parent;
/* Get options */
s_OutputFormOpt = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_FORMAT, (long) 0 );
s_OutputSeparatorOpt = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_SEPARATOR, (long) 0 );
long addfields = m_Parent->m_Parent->m_EDA_Config->Read( OPTION_BOM_ADD_FIELD, (long) 0 );
s_OutputFormOpt = config->Read( OPTION_BOM_FORMAT, (long) 0 );
s_OutputSeparatorOpt = config->Read( OPTION_BOM_SEPARATOR, (long) 0 );
long addfields = config->Read( OPTION_BOM_ADD_FIELD, (long) 0 );
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
{
if( (addfields & bitmask) )
@ -491,6 +494,9 @@ void WinEDA_Build_BOM_Frame::OnApplyClick( wxCommandEvent& event )
void WinEDA_Build_BOM_Frame::SavePreferences()
/**************************************************/
{
wxConfig* config = wxGetApp().m_EDA_Config;
wxASSERT( config != NULL );
// Determine current settings of "List items" and "Options" checkboxes
// (NOTE: These 6 settings are restored when the dialog box is next
// invoked, but are *not* still saved after EESchema is next shut down.)
@ -519,8 +525,8 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
s_Add_F8_state = m_AddField8->GetValue();
// Now save current settings of both radiobutton groups
m_Parent->m_Parent->m_EDA_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_FORMAT, (long) s_OutputFormOpt );
config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt );
// Now save current settings of all "Fields to add" checkboxes
long addfields = 0;
@ -531,5 +537,5 @@ void WinEDA_Build_BOM_Frame::SavePreferences()
bitmask <<= 1;
}
m_Parent->m_Parent->m_EDA_Config->Write( OPTION_BOM_ADD_FIELD, addfields );
config->Write( OPTION_BOM_ADD_FIELD, addfields );
}

View File

@ -102,7 +102,7 @@ wxString msg;
Create(parent, id, caption, pos, size, style);
msg = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
msg = _("from ") + wxGetApp().m_CurrentOptionFile;
SetTitle(msg);
SetFormatsNetListes();
m_ListLibr->InsertItems(g_LibName_List, 0);
@ -312,8 +312,8 @@ void KiConfigEeschemaFrame::OnCloseWindow(wxCloseEvent & event)
if ( m_LibListChanged )
{
LoadLibraries(m_Parent);
if ( m_Parent->m_Parent->m_ViewlibFrame )
m_Parent->m_Parent->m_ViewlibFrame->ReCreateListLib();
if ( m_Parent->m_ViewlibFrame )
m_Parent->m_ViewlibFrame->ReCreateListLib();
}
EndModal(0);
}

View File

@ -10,7 +10,6 @@
#include "protos.h"
#include "eeconfig.h"
#include "worksheet.h"
#include "hotkeys_basic.h"
#include "hotkeys.h"
#include "id.h"
@ -44,7 +43,7 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
case ID_OPTIONS_SETUP:
DisplayOptionFrame( this, pos );
DrawPanel->Refresh(TRUE); // Redraw, because grid settings may have changed.
DrawPanel->Refresh( TRUE ); // Redraw, because grid settings may have changed.
break;
case ID_CONFIG_SAVE:
@ -58,14 +57,14 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector( _( "Read config file" ),
wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */
);
wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */
);
if( FullFileName.IsEmpty() )
break;
if( !wxFileExists( FullFileName ) )
@ -75,7 +74,7 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
}
Read_Config( FullFileName, TRUE );
}
break;
break;
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
@ -93,12 +92,12 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
AddDelimiterString(FullFileName);
AddDelimiterString( FullFileName );
wxString editorname = GetEditorName();
if( !editorname.IsEmpty() )
ExecuteFile( this, editorname, FullFileName );
}
break;
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
@ -110,7 +109,9 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
break;
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 )
* Read the hotkey files config for eeschema and libedit
*/
{
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
wxString FullFileName = ReturnHotkeyConfigFilePath(
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile( FullFileName, s_Eeschema_Hokeys_Descr, verbose );
frame->ReadHotkeyConfigFile( FullFileName,
s_Eeschema_Hokeys_Descr,
verbose );
return TRUE;
}
@ -138,16 +142,19 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
/***********************************************************************/
/* lit la configuration, si elle n'a pas deja ete lue
* 1 - lit <nom fichier root>.pro
* 2 - si non trouve lit <chemin des binaires>../template/kicad.pro
* 3 - si non trouve: init des variables aux valeurs par defaut
* 1 - lit <nom fichier root>.pro
* 2 - si non trouve lit <chemin des binaires>../template/kicad.pro
* 3 - si non trouve: init des variables aux valeurs par defaut
*
* Retourne TRUE si lu, FALSE si config non lue
* Retourne TRUE si lu, FALSE si config non lue
*/
{
wxString FullFileName;
bool IsRead = TRUE;
wxArrayString liblist_tmp = g_LibName_List;
wxString FullFileName;
bool IsRead = TRUE;
wxArrayString liblist_tmp = g_LibName_List;
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
if( CfgFileName.IsEmpty() )
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
@ -155,8 +162,9 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
FullFileName = CfgFileName;
g_LibName_List.Clear();
if( !g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE ) ) // Config non lue
if( !wxGetApp().ReadProjectConfig( FullFileName,
GROUP, ParamCfgList,
ForceRereadConfig ? FALSE : TRUE ) ) // Config non lue
{
g_LibName_List = liblist_tmp;
IsRead = FALSE;
@ -172,13 +180,13 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
g_LibName_List.Add( wxT( "device" ) );
}
if( g_EDA_Appl->m_SchematicFrame )
if( frame )
{
g_EDA_Appl->m_SchematicFrame->SetDrawBgColor( g_DrawBgColor );
g_EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid;
frame->SetDrawBgColor( g_DrawBgColor );
frame->m_Draw_Grid = g_ShowGrid;
}
LoadLibraries( g_EDA_Appl->m_SchematicFrame );
LoadLibraries( frame );
return IsRead;
}
@ -198,17 +206,17 @@ void WinEDA_SchematicFrame::Save_Config( wxWindow* displayframe )
path = wxGetCwd();
FullFileName = EDA_FileSelector( _( "Save preferences" ),
path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
displayframe,
wxFD_SAVE,
TRUE
);
path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
displayframe,
wxFD_SAVE,
TRUE
);
if( FullFileName.IsEmpty() )
return;
/* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
wxGetApp().WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
}

View File

@ -11,8 +11,6 @@
#include "fctsys.h"
#include <wx/image.h>
#include "common.h"
#include "program.h"
#include "libcmp.h"
@ -26,7 +24,7 @@
#include "protos.h"
// Global variables
wxString g_Main_Title( wxT( "EESchema" ) );
wxString g_Main_Title( wxT( "EESchema" ) );
/************************************/
/* Called to initialize the program */
@ -42,8 +40,7 @@ IMPLEMENT_APP( WinEDA_App )
bool WinEDA_App::OnInit()
{
wxString FFileName;
g_EDA_Appl = this;
WinEDA_SchematicFrame* frame = NULL;
g_DebugLevel = 0; // Debug level */
@ -61,44 +58,43 @@ bool WinEDA_App::OnInit()
/* init EESCHEMA */
GetSettings(); // read current setup
SeedLayers();
Read_Hotkey_Config( m_SchematicFrame, false ); /* Must be called before creating the main frame
* in order to display the real hotkeys in menus
* or tool tips */
Read_Hotkey_Config( frame, false ); /* Must be called before creating
* the main frame in order to
* display the real hotkeys in menus
* or tool tips */
// Create main frame (schematic frame) :
m_SchematicFrame = new WinEDA_SchematicFrame( NULL, this,
wxT( "EESchema" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
frame = new WinEDA_SchematicFrame( NULL, wxT( "EESchema" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
SetTopWindow( m_SchematicFrame );
m_SchematicFrame->Show( TRUE );
SetTopWindow( frame );
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
// sends EESCHEMA a command
SetupServerFunction( RemoteCommand );
}
ActiveScreen = m_SchematicFrame->GetScreen();
m_SchematicFrame->Zoom_Automatique( TRUE );
ActiveScreen = frame->GetScreen();
frame->Zoom_Automatique( TRUE );
/* Load file specified in the command line. */
if( !FFileName.IsEmpty() )
{
ChangeFileNameExt( FFileName, g_SchExtBuffer );
wxSetWorkingDirectory( wxPathOnly( FFileName ) );
if( m_SchematicFrame->DrawPanel )
if( m_SchematicFrame->LoadOneEEProject( FFileName, FALSE ) <= 0 )
m_SchematicFrame->DrawPanel->Refresh( TRUE ); // File not found or error
if( frame->DrawPanel )
if( frame->LoadOneEEProject( FFileName, FALSE ) <= 0 )
frame->DrawPanel->Refresh( TRUE ); // File not found or error
}
else
{
Read_Config( wxEmptyString, TRUE ); // Read a default config file if no file to load
if( m_SchematicFrame->DrawPanel )
m_SchematicFrame->DrawPanel->Refresh( TRUE );
if( frame->DrawPanel )
frame->DrawPanel->Refresh( TRUE );
}
return TRUE;
}

View File

@ -3,7 +3,6 @@
/*************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
@ -27,21 +26,20 @@ static wxPoint OldPos;
wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
/*******************************************************/
{
wxString name;
WinEDA_ViewlibFrame* Viewer;
wxSemaphore semaphore( 0, 1 );
wxString name;
WinEDA_ViewlibFrame* Viewer;
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 */
if( Viewer )
Viewer->Destroy();
Viewer = parent->m_Parent->m_ViewlibFrame = new
WinEDA_ViewlibFrame(
parent->m_Parent->m_SchematicFrame,
parent->m_Parent,
NULL,
&semaphore );
Viewer = frame->m_ViewlibFrame =
new WinEDA_ViewlibFrame( frame, NULL, &semaphore );
Viewer->AdjustScrollBars();
// Show the library viewer frame until it is closed
@ -57,10 +55,10 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
/**************************************************************************/
SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
const wxString& libname,
wxArrayString& HistoryList,
bool UseLibBrowser )
SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component(wxDC* DC,
const wxString& libname,
wxArrayString& HistoryList,
bool UseLibBrowser )
/**************************************************************************/
/* load from a library and place a component
@ -68,11 +66,11 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
* else search in all loaded libs
*/
{
int ii, CmpCount = 0;
int ii, CmpCount = 0;
LibDrawField* Field;
EDA_LibComponentStruct* Entry = NULL;
SCH_COMPONENT* DrawLibItem = NULL;
LibraryStruct* Library = NULL;
SCH_COMPONENT* DrawLibItem = NULL;
LibraryStruct* Library = NULL;
wxString Name, keys, msg;
bool AllowWildSeach = TRUE;
@ -179,11 +177,11 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
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_ChipName = Name;
DrawLibItem->m_TimeStamp = GetTimeStamp();
DrawLibItem->m_Flags = IS_NEW | IS_MOVED;
DrawLibItem->m_Flags = IS_NEW | IS_MOVED;
/* Init champ Valeur */
DrawLibItem->GetField( VALUE )->m_Pos.x =
@ -203,19 +201,22 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
msg += wxT( "?" );
//update the reference -- just the prefix for now.
DrawLibItem->SetRef(GetSheet(), msg );
DrawLibItem->SetRef( GetSheet(), msg );
/* Init champ Reference */
DrawLibItem->GetField( REFERENCE )->m_Pos.x =
Entry->m_Prefix.m_Pos.x + DrawLibItem->m_Pos.x;
DrawLibItem->GetField( REFERENCE )->m_Pos.y =
Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y;
DrawLibItem->GetField( REFERENCE )->m_Orient = Entry->m_Prefix.m_Orient;
DrawLibItem->GetField( REFERENCE )->m_Size = Entry->m_Prefix.m_Size;
DrawLibItem->GetField( REFERENCE )->m_Orient = Entry->m_Prefix.m_Orient;
DrawLibItem->GetField( REFERENCE )->m_Size = Entry->m_Prefix.m_Size;
DrawLibItem->m_PrefixString = Entry->m_Prefix.m_Text;
DrawLibItem->GetField( REFERENCE )->m_Attributs = Entry->m_Prefix.m_Attributs;
DrawLibItem->GetField( REFERENCE )->m_HJustify = Entry->m_Prefix.m_HJustify;
DrawLibItem->GetField( REFERENCE )->m_VJustify = Entry->m_Prefix.m_VJustify;
DrawLibItem->GetField( REFERENCE )->m_Attributs =
Entry->m_Prefix.m_Attributs;
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 */
for( Field = Entry->Fields; Field != NULL; Field = Field->Next() )
@ -253,14 +254,14 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
/**************************************************************************/
/*** Routine de deplacement du composant. ***/
/*** Routine de deplacement du composant. ***/
/*** Appele par GeneralControle grace a ActiveScreen->ManageCurseur. ***/
/**************************************************************************/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
wxPoint move_vector;
wxPoint move_vector;
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) screen->GetCurItem();
@ -298,7 +299,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
else
{
DrawPanel->PostDirtyRect( DrawComponent->GetBoundingBox());
DrawPanel->PostDirtyRect( DrawComponent->GetBoundingBox() );
}
}
@ -310,7 +311,9 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0,
0 ),
GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC );
}
@ -326,7 +329,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
/* Routine de sortie de la fonction de placement de composant
*/
{
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->GetScreen();
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->GetScreen();
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) screen->GetCurItem();
@ -369,7 +372,8 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL )
return;
LibEntry = FindLibPart( DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
LibEntry = FindLibPart(
DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( LibEntry == NULL )
return;
@ -399,7 +403,8 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
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 );
GetScreen()->SetModify();
@ -408,7 +413,7 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
/************************************************************************/
void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
wxDC* DC )
wxDC* DC )
/************************************************************************/
{
int ii;
@ -417,7 +422,8 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL )
return;
LibEntry = FindLibPart( DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
LibEntry = FindLibPart(
DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( LibEntry == NULL )
return;
@ -440,7 +446,8 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Flags & IS_MOVED )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, 0, 0 );
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 );
GetScreen()->SetModify();
@ -477,7 +484,7 @@ int LookForConvertPart( EDA_LibComponentStruct* LibEntry )
/***********************************************************************************/
void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
wxDC* DC )
wxDC* DC )
/***********************************************************************************/
{
if( Component == NULL )
@ -487,7 +494,8 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
if( Component->m_Flags == 0 )
{
if( g_ItemToUndoCopy ){
if( g_ItemToUndoCopy )
{
SAFE_DELETE( g_ItemToUndoCopy );
}
g_ItemToUndoCopy = Component->GenCopy();
@ -504,6 +512,7 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
memcpy( OldTransMat, Component->m_Transform, sizeof(OldTransMat) );
#if 1
// 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(),
// then by drawing the first time in xor mode so that subsequent xor

View File

@ -6,7 +6,6 @@
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -22,48 +21,46 @@
/* class WinEDA_LibeditFrame */
/*****************************/
BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_LibeditFrame::OnSize )
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_LibeditFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_LibeditFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_LibeditFrame::Process_Zoom )
// Tools et boutons de Libedit:
/* Main horizontal toolbar */
EVT_TOOL_RANGE( ID_LIBEDIT_START_H_TOOL, ID_LIBEDIT_END_H_TOOL,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_PART_NUMBER,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_LIBEDIT_START_H_TOOL, ID_LIBEDIT_END_H_TOOL,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_PART_NUMBER,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS,
WinEDA_LibeditFrame::Process_Special_Functions )
/* Right Vertical toolbar */
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_LibeditFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_LIBEDIT_START_V_TOOL, ID_LIBEDIT_END_V_TOOL,
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,
WinEDA_LibeditFrame::Process_Special_Functions )
/* PopUp events and commands: */
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions )
// Annulation de commande en cours
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_LibeditFrame::Process_Special_Functions )
// PopUp Menus pour Zooms trait<69>s dans drawpanel.cpp
END_EVENT_TABLE()
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
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_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
@ -89,7 +86,9 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
/**********************************************/
{
m_Parent->m_LibeditFrame = NULL;
WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame = NULL;
}

View File

@ -112,7 +112,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
// Create the list of last edited schematic files
m_FilesMenu->AppendSeparator();
int max_file = m_Parent->m_LastProjectMaxCount;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
@ -376,7 +376,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
// Font selection and setup
AddFontSelectionMenu( configmenu );
m_Parent->SetLanguageList( configmenu );
wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator();
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ),
@ -417,7 +417,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
else // Update the list of last edited schematic files
{
wxMenuItem* item;
int max_file = m_Parent->m_LastProjectMaxCount;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )

View File

@ -53,35 +53,38 @@ wxString ReturnUserNetlistTypeName( bool first_item )
msg = CUSTOM_NETLIST_TITLE;
msg << index + 1;
if( g_EDA_Appl->m_EDA_Config )
name = g_EDA_Appl->m_EDA_Config->Read( msg );
if( wxGetApp().m_EDA_Config )
name = wxGetApp().m_EDA_Config->Read( msg );
return name;
}
BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog )
EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick )
EVT_BUTTON( ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist )
EVT_BUTTON( ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPluginData )
EVT_BUTTON( ID_DELETE_PLUGIN, WinEDA_NetlistFrame::DeletePluginPanel )
EVT_BUTTON( ID_VALIDATE_PLUGIN, WinEDA_NetlistFrame::ValidatePluginPanel )
EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT, WinEDA_NetlistFrame::SelectNetlistType )
EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator )
EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick )
EVT_BUTTON( ID_CREATE_NETLIST, WinEDA_NetlistFrame::GenNetlist )
EVT_BUTTON( ID_SETUP_PLUGIN, WinEDA_NetlistFrame::SetupPluginData )
EVT_BUTTON( ID_DELETE_PLUGIN, WinEDA_NetlistFrame::DeletePluginPanel )
EVT_BUTTON( ID_VALIDATE_PLUGIN, WinEDA_NetlistFrame::ValidatePluginPanel )
EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT,
WinEDA_NetlistFrame::SelectNetlistType )
EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator )
END_EVENT_TABLE()
/*******************************/
/* Functions for these classes */
/*******************************/
/*****************************************************************************/
EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title,
int id_NetType, int idCheckBox, int idCreateFile ) :
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_SUNKEN )
EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent,
const wxString& title,
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.
@ -114,14 +117,18 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title,
m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | 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 )
{
wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
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 );
if( g_NetFormat == m_IdNetType )
@ -141,7 +148,7 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title,
m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
m_ButtonCancel =
Button = new wxButton( this, wxID_CANCEL, _( "&Cancel" ) );
Button = new wxButton( this, wxID_CANCEL, _( "&Cancel" ) );
Button->SetForegroundColour( *wxBLUE );
m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
@ -195,20 +202,23 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ) :
// Add notebook pages:
// Add Panel FORMAT PCBNEW
m_PanelNetType[PANELPCBNEW] = new EDA_NoteBookPage( m_NoteBook, wxT(
"Pcbnew" ), NET_TYPE_PCBNEW,
m_PanelNetType[PANELPCBNEW] = new EDA_NoteBookPage( m_NoteBook,
wxT( "Pcbnew" ),
NET_TYPE_PCBNEW,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
// Add Panel FORMAT ORCADPCB2
m_PanelNetType[PANELORCADPCB2] = new EDA_NoteBookPage( m_NoteBook, wxT(
"OrcadPCB2" ), NET_TYPE_ORCADPCB2,
m_PanelNetType[PANELORCADPCB2] = new EDA_NoteBookPage( m_NoteBook,
wxT( "OrcadPCB2" ),
NET_TYPE_ORCADPCB2,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
// Add Panel FORMAT CADSTAR
m_PanelNetType[PANELCADSTAR] = new EDA_NoteBookPage( m_NoteBook, wxT(
"CadStar" ), NET_TYPE_CADSTAR,
m_PanelNetType[PANELCADSTAR] = new EDA_NoteBookPage( m_NoteBook,
wxT( "CadStar" ),
NET_TYPE_CADSTAR,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST );
@ -233,27 +243,31 @@ void WinEDA_NetlistFrame::InstallPageSpice()
wxButton* Button;
EDA_NoteBookPage* page;
page = m_PanelNetType[PANELSPICE] = new EDA_NoteBookPage( m_NoteBook, wxT(
"Spice" ), NET_TYPE_SPICE, 0, 0 );
page = m_PanelNetType[PANELSPICE] = new EDA_NoteBookPage( m_NoteBook,
wxT( "Spice" ),
NET_TYPE_SPICE,
0, 0 );
page->m_IsCurrentFormat = new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
_( "Default format" ) );
page->m_IsCurrentFormat =
new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
_( "Default format" ) );
page->m_IsCurrentFormat->SetValue( g_NetFormat == NET_TYPE_SPICE );
page->m_LeftBoxSizer->Add( page->m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
wxString netlist_opt[2] = { _( "Use Net Names" ), _( "Use Net Numbers" ) };
m_UseNetNamesInNetlist = new wxRadioBox( page, -1, _( "Netlist Options:" ),
wxDefaultPosition, wxDefaultSize,
2, netlist_opt, 1, wxRA_SPECIFY_COLS );
2, netlist_opt, 1,
wxRA_SPECIFY_COLS );
if( !g_OptNetListUseNames )
m_UseNetNamesInNetlist->SetSelection( 1 );
page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 );
page->m_CommandStringCtrl = new WinEDA_EnterText( page,
_(
"Simulator command:" ),
_( "Simulator command:" ),
g_SimulatorCommandLine,
page->m_LowBoxSizer, wxDefaultSize );
page->m_LowBoxSizer,
wxDefaultSize );
// Add buttons
Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) );
@ -277,7 +291,7 @@ void WinEDA_NetlistFrame::InstallCustomPages()
/* create the pages for custom netlist format selection:
*/
{
int ii, CustomCount;
int ii, CustomCount;
wxString title, previoustitle, msg;
EDA_NoteBookPage* CurrPage;
@ -296,19 +310,23 @@ void WinEDA_NetlistFrame::InstallCustomPages()
if( title.IsEmpty() )
CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] =
new EDA_NoteBookPage( m_NoteBook, _( "Add Plugin" ),
new EDA_NoteBookPage( m_NoteBook,
_( "Add Plugin" ),
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 */
CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] =
new EDA_NoteBookPage( m_NoteBook, title,
new EDA_NoteBookPage( m_NoteBook,
title,
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 << ii + 1;
wxString Command = m_Parent->m_Parent->m_EDA_Config->Read( msg );
wxString Command = wxGetApp().m_EDA_Config->Read( msg );
CurrPage->m_CommandStringCtrl =
new WinEDA_EnterText( CurrPage,
_( "Netlist command:" ), Command,
@ -334,7 +352,7 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
wxString FullFileName, Mask, Path;
Mask = wxT( "*" );
Path = g_EDA_Appl->m_BinDir;
Path = wxGetApp().m_BinDir;
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
Path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
@ -358,16 +376,16 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( title.IsEmpty() )
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 )
/*****************************************************************/
/* Called when the check box "default format" is clicked
*/
*/
{
int ii;
EDA_NoteBookPage* CurrPage;
@ -450,7 +468,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
Mask = wxT( "*" ) + FileExt + wxT( "*" );
ChangeFileNameExt( FullFileName, FileExt );
FullFileName = FullFileName.AfterLast('/');
FullFileName = FullFileName.AfterLast( '/' );
FullFileName = EDA_FileSelector( _( "Netlist files:" ),
wxEmptyString, /* Defaut path */
FullFileName, /* Defaut filename */
@ -473,8 +491,10 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
}
/* Cleanup the entire hierarchy */
EDA_ScreenList ScreenList;
for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
EDA_ScreenList ScreenList;
for( SCH_SCREEN* screen = ScreenList.GetFirst();
screen != NULL;
screen = ScreenList.GetNext() )
{
bool ModifyWires;
ModifyWires = screen->SchematicCleanUp( NULL );
@ -559,6 +579,7 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void )
*/
{
wxString msg, Command;
wxConfig* config = wxGetApp().m_EDA_Config;
NetlistUpdateOpt();
@ -577,16 +598,16 @@ void WinEDA_NetlistFrame::WriteCurrentNetlistSetup( void )
{
msg = CUSTOM_NETLIST_TITLE;
msg << ii + 1;
m_Parent->m_Parent->m_EDA_Config->Write( msg, title );
config->Write( msg, title );
}
}
if( CurrPage->m_CommandStringCtrl )
{
Command = CurrPage->m_CommandStringCtrl->GetValue();
msg = CUSTOM_NETLIST_COMMAND;
msg = CUSTOM_NETLIST_COMMAND;
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 )
* 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_TitleStringCtrl->SetValue( wxEmptyString );
@ -622,7 +644,8 @@ void WinEDA_NetlistFrame::ValidatePluginPanel( wxCommandEvent& event )
* 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 )
{

View File

@ -30,8 +30,9 @@
/*******************************/
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV,
WinEDA_DrawFrame::OnSockRequestServer )
COMMON_EVENTS_DRAWFRAME
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV,
WinEDA_DrawFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_DrawFrame::OnSockRequest )
EVT_CLOSE( WinEDA_SchematicFrame::OnCloseWindow )
@ -128,13 +129,14 @@ END_EVENT_TABLE()
/****************/
WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
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_Draw_Axis = FALSE; // TRUE to show axis
m_Draw_Grid = g_ShowGrid; // TRUE to show a grid
@ -143,7 +145,8 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
m_CurrentField = NULL;
m_Multiflag = 0;
m_TextFieldSize = DEFAULT_SIZE_TEXT;
m_LibeditFrame = NULL; // Component editor frame.
m_ViewlibFrame = NULL; // Frame for browsing component libraries
CreateScreens();
@ -159,11 +162,13 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
/* Get config */
GetSettings();
g_DrawMinimunLineWidth =
m_Parent->m_EDA_Config->Read( MINI_DRAW_LINE_WIDTH_KEY, (long) 0 );
g_PlotPSMinimunLineWidth =
m_Parent->m_EDA_Config->Read( MINI_PLOTPS_LINE_WIDTH_KEY, (long) 4 );
if( config )
{
g_DrawMinimunLineWidth = config->Read( MINI_DRAW_LINE_WIDTH_KEY,
(long) 0 );
g_PlotPSMinimunLineWidth = config->Read( MINI_PLOTPS_LINE_WIDTH_KEY,
(long) 4 );
}
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -183,7 +188,6 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
{
m_Parent->m_SchematicFrame = NULL;
SAFE_DELETE( g_RootSheet );
SAFE_DELETE( m_CurrentSheet ); //a DrawSheetPath, on the heap.
m_CurrentSheet = NULL;
@ -290,10 +294,11 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/
{
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;
}
@ -349,10 +354,12 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
SaveSettings();
m_Parent->m_EDA_Config->Write( MINI_DRAW_LINE_WIDTH_KEY,
(long) g_DrawMinimunLineWidth );
m_Parent->m_EDA_Config->Write( MINI_PLOTPS_LINE_WIDTH_KEY,
(long) g_PlotPSMinimunLineWidth );
if( config )
{
config->Write( MINI_DRAW_LINE_WIDTH_KEY, (long) g_DrawMinimunLineWidth );
config->Write( MINI_PLOTPS_LINE_WIDTH_KEY,
(long) g_PlotPSMinimunLineWidth );
}
Destroy();
}
@ -576,16 +583,14 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( 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
{
m_Parent->m_ViewlibFrame =
new WinEDA_ViewlibFrame( m_Parent->m_SchematicFrame,
m_Parent );
m_Parent->m_ViewlibFrame->AdjustScrollBars();
m_ViewlibFrame = new WinEDA_ViewlibFrame( this );
m_ViewlibFrame->AdjustScrollBars();
}
}
@ -593,20 +598,18 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( 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
{
m_Parent->m_LibeditFrame =
new WinEDA_LibeditFrame( m_Parent->m_SchematicFrame,
m_Parent,
wxT( "Library Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
m_LibeditFrame = new WinEDA_LibeditFrame( this,
wxT( "Library Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
ActiveScreen = g_ScreenLib;
m_Parent->m_LibeditFrame->AdjustScrollBars();
m_LibeditFrame->AdjustScrollBars();
}
}

View File

@ -6,7 +6,6 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -21,7 +20,9 @@
/* Routines locales */
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
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 );
/* Variables locales */
@ -60,8 +61,12 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_Parent->DrawPanel->PrepareGraphicContext( &dc );
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, g_XorMode );
DrawLibraryDrawStruct( m_Parent->DrawPanel,
&dc,
CurrentLibEntry,
wxPoint( 0, 0 ),
CurrentDrawItem,
g_XorMode );
if( g_FlDrawSpecificUnit )
CurrentDrawItem->m_Unit = CurrentUnit;
@ -77,23 +82,28 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
{
case COMPONENT_ARC_DRAW_TYPE:
( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawArc*) CurrentDrawItem )->m_Width = m_GraphicShapeWidthCtrl->GetValue();
( (LibDrawArc*) CurrentDrawItem )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break;
case COMPONENT_CIRCLE_DRAW_TYPE:
( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawCircle*) CurrentDrawItem )->m_Width = m_GraphicShapeWidthCtrl->GetValue();
( (LibDrawCircle*) CurrentDrawItem )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break;
case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawSquare*) CurrentDrawItem )->m_Width = m_GraphicShapeWidthCtrl->GetValue();
( (LibDrawSquare*) CurrentDrawItem )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
( (LibDrawPolyline*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawPolyline*) CurrentDrawItem )->m_Width = m_GraphicShapeWidthCtrl->
GetValue();
( (LibDrawPolyline*) CurrentDrawItem )->m_Fill =
FlSymbol_Fill;
( (LibDrawPolyline*) CurrentDrawItem )->m_Width =
m_GraphicShapeWidthCtrl->
GetValue();
break;
default:
@ -104,8 +114,12 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_Parent->GetScreen()->SetModify();
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, g_XorMode );
DrawLibraryDrawStruct( m_Parent->DrawPanel,
&dc,
CurrentLibEntry,
wxPoint( 0, 0 ),
CurrentDrawItem,
g_XorMode );
}
Close();
@ -127,7 +141,8 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC,
if( DrawItem == NULL )
return;
WinEDA_bodygraphics_PropertiesFrame* frame = new WinEDA_bodygraphics_PropertiesFrame( this );
WinEDA_bodygraphics_PropertiesFrame* frame =
new WinEDA_bodygraphics_PropertiesFrame( this );
frame->ShowModal(); frame->Destroy();
}
@ -150,7 +165,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->m_Parent->RedrawActiveWindow( DC, TRUE );
}
else
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, g_XorMode );
SAFE_DELETE( CurrentDrawItem );
}
@ -161,7 +176,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = StartCursor;
RedrawWhileMovingCursor( Panel, DC, TRUE );
Panel->GetScreen()->m_Curseur = curpos;
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, GR_DEFAULT_DRAWMODE );
CurrentDrawItem->m_Flags = 0;
@ -229,7 +244,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
Arc->m_Fill = FlSymbol_Fill;
Arc->m_Width = g_LibSymbolDefaultLineWidth;
}
break;
break;
case COMPONENT_CIRCLE_DRAW_TYPE:
{
@ -241,7 +256,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
Circle->m_Fill = FlSymbol_Fill;
Circle->m_Width = g_LibSymbolDefaultLineWidth;
}
break;
break;
case COMPONENT_RECT_DRAW_TYPE:
{
@ -254,7 +269,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
Square->m_Fill = FlSymbol_Fill;
Square->m_Width = g_LibSymbolDefaultLineWidth;
}
break;
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
{
@ -269,7 +284,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
polyline->m_Fill = FlSymbol_Fill;
polyline->m_Width = g_LibSymbolDefaultLineWidth;
}
break;
break;
case COMPONENT_LINE_DRAW_TYPE:
{
@ -281,7 +296,7 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
Segment->m_End = Segment->m_Pos;
Segment->m_Width = g_LibSymbolDefaultLineWidth;
}
break;
break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
{
@ -303,11 +318,12 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
else
{
StartMoveDrawSymbol( DC );
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry,
wxPoint( 0, 0 ),
Text, g_XorMode );
}
}
break;
break;
}
if( CurrentDrawItem )
@ -364,7 +380,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
wxPoint pos = GetScreen()->m_Curseur;
( (LibDrawPolyline*) CurrentDrawItem )->AddPoint( pos );
}
break;
break;
case COMPONENT_LINE_DRAW_TYPE:
break;
@ -376,14 +392,16 @@ 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
*/
{
BASE_SCREEN* Screen = panel->GetScreen();
wxPoint pos;
wxPoint pos;
/* Erase shape in the old positon*/
if( erase )
@ -414,8 +432,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
{
int dx = mx - ( (LibDrawArc*) CurrentDrawItem )->m_Pos.x;
int dy = -my - ( (LibDrawArc*) CurrentDrawItem )->m_Pos.y;
( (LibDrawArc*) CurrentDrawItem )->m_Pos.x = mx;
( (LibDrawArc*) CurrentDrawItem )->m_Pos.y = -my;
( (LibDrawArc*) CurrentDrawItem )->m_Pos.x = mx;
( (LibDrawArc*) CurrentDrawItem )->m_Pos.y = -my;
( (LibDrawArc*) CurrentDrawItem )->m_ArcStart.x += dx;
( (LibDrawArc*) CurrentDrawItem )->m_ArcStart.y += dy;
( (LibDrawArc*) CurrentDrawItem )->m_ArcEnd.x += dx;
@ -441,17 +459,18 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
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 dx = mx - ptpoly[0];
int dy = -my - ptpoly[1];
int dx = mx - ptpoly[0];
int dy = -my - ptpoly[1];
for( ii = 0; ii < imax; ii += 2 )
{
ptpoly[ii] += dx;
ptpoly[ii + 1] += dy;
}
}
break;
break;
case COMPONENT_LINE_DRAW_TYPE:
break;
@ -495,7 +514,8 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
case COMPONENT_POLYLINE_DRAW_TYPE:
InitPosition.x = *( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
InitPosition.y = *( ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList + 1 );
InitPosition.y =
*( ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList + 1 );
break;
case COMPONENT_LINE_DRAW_TYPE:
@ -526,8 +546,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
int* ptpoly;
int dx, dy;
BASE_SCREEN* Screen = panel->GetScreen();
int mx = Screen->m_Curseur.x,
my = Screen->m_Curseur.y;
int mx = Screen->m_Curseur.x,
my = Screen->m_Curseur.y;
GRSetDrawMode( DC, DrawMode );
@ -536,11 +556,18 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( StateDrawArc == 1 )
{
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
{
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, DrawMode );
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{
@ -575,8 +602,9 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
case COMPONENT_CIRCLE_DRAW_TYPE:
dx = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.x - mx;
dy = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.y + my;
( (LibDrawCircle*) CurrentDrawItem )->m_Rayon = (int) sqrt( ((double)dx * dx) + ((double)dy * dy) );
( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
( (LibDrawCircle*) CurrentDrawItem )->m_Rayon =
(int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
break;
case COMPONENT_RECT_DRAW_TYPE:
@ -586,8 +614,9 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
ptpoly += 2 * ( ( (LibDrawPolyline*) CurrentDrawItem )->m_CornersCount - 1 );
ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
ptpoly += 2 *
( ( (LibDrawPolyline*) CurrentDrawItem )->m_CornersCount - 1 );
ptpoly[0] = mx;
ptpoly[1] = -my;
( (LibDrawPolyline*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
@ -608,11 +637,18 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( StateDrawArc == 1 )
{
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
{
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, DrawMode );
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{
@ -710,7 +746,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
MoveLibDrawItemAt( CurrentDrawItem, pos );
}
DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), CurrentUnit,
DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ), CurrentUnit,
CurrentConvert, GR_DEFAULT_DRAWMODE );
CurrentDrawItem->m_Flags = 0;
@ -745,11 +781,11 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
/* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */
dx = ArcEndX - ArcStartX; dy = ArcEndY - ArcStartY;
cX -= ArcStartX; cY -= ArcStartY;
angle = (int) (atan2( (double)dy, (double)dx ) * 1800 / M_PI);
RotatePoint( &dx, &dy, angle ); /* Le segment dx, dy est horizontal */
/* -> dx = longueur, dy = 0 */
angle = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
RotatePoint( &dx, &dy, angle ); /* Le segment dx, dy est horizontal */
/* -> dx = longueur, dy = 0 */
RotatePoint( &cX, &cY, angle );
cX = dx / 2; /* cX, cY est sur la mediane du segment 0,0 a dx,0 */
cX = dx / 2; /* cX, cY est sur la mediane du segment 0,0 a dx,0 */
RotatePoint( &cX, &cY, -angle );
cX += ArcStartX; cY += ArcStartY;
@ -759,14 +795,14 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
dx = ArcStartX - DrawItem->m_Pos.x;
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;
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.y = ArcStartY;
@ -787,7 +823,9 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
wxString msg;
angle = DrawItem->t2 - DrawItem->t1;
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 )
{
@ -821,7 +859,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
int* ptpoly;
LibDrawPolyline* Poly = (LibDrawPolyline*) CurrentDrawItem;
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentDrawItem, g_XorMode );
while( Poly->m_CornersCount > 2 ) // First segment is kept, only its end point is changed
@ -829,7 +867,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
Poly->m_CornersCount--;
ptpoly = Poly->m_PolyList + ( 2 * (Poly->m_CornersCount - 1) );
if( (ptpoly[0] != GetScreen()->m_Curseur.x)
|| (ptpoly[1] != -GetScreen()->m_Curseur.y) )
|| (ptpoly[1] != -GetScreen()->m_Curseur.y) )
{
ptpoly[0] = GetScreen()->m_Curseur.x;
ptpoly[1] = -( GetScreen()->m_Curseur.y);
@ -840,6 +878,6 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
int allocsize = 2 * sizeof(int) * Poly->m_CornersCount;
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 );
}

View File

@ -41,10 +41,10 @@ END_EVENT_TABLE()
/******************************************************************************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library,
wxSemaphore* semaphore ) :
WinEDA_DrawFrame( father, VIEWER_FRAME, parent, _( "Library browser" ),
WinEDA_DrawFrame( father, VIEWER_FRAME, _( "Library browser" ),
wxDefaultPosition, wxDefaultSize )
/******************************************************************************/
{
@ -105,7 +105,9 @@ WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
delete GetScreen();
SetBaseScreen( 0 );
m_Parent->m_ViewlibFrame = NULL;
WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
frame->m_ViewlibFrame = NULL;
}

View File

@ -22,99 +22,104 @@
/****************************************/
BEGIN_EVENT_TABLE( WinEDA_GerberFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize )
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_GerberFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_GerberFrame::Process_Zoom )
EVT_TOOL( ID_LOAD_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_GERBVIEW_LOAD_DRILL_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_SAVE_BOARD, 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_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_DCODE_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_NEW_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,
WinEDA_DrawFrame::ProcessFontPreferences )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END,
WinEDA_DrawFrame::ProcessFontPreferences )
// Menu Files:
EVT_MENU( ID_MENU_LOAD_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_NEW_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_GEN_PLOT, WinEDA_GerberFrame::ToPlotter )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU( ID_MENU_LOAD_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_NEW_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_GEN_PLOT, WinEDA_GerberFrame::ToPlotter )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW,
WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_GerberFrame::Files_io )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
// menu Config
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END,
WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
ID_CONFIG_AND_PREFERENCES_END,
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_PCB_LOOK_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_PCB_LOOK_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage )
// menu Postprocess
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE,
WinEDA_GerberFrame::Process_Special_Functions )
// 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
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( wxID_CUT, 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( ID_UNDO_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( wxID_CUT, 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( ID_UNDO_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBER_SELECT_TOOL,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBER_SELECT_TOOL,
WinEDA_GerberFrame::Process_Special_Functions )
// Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_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_DELETE_ITEM_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_PCB_ZONES_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT,
WinEDA_GerberFrame::Process_Special_Functions )
// Annulation de commande en cours
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
// Pop up menu
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
WinEDA_GerberFrame::Process_Special_Functions )
// Option toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_GerberFrame::OnSelectOptionToolbar )
// PopUp Menu trait<69>s dans drawpanel.cpp
END_EVENT_TABLE()
@ -122,18 +127,18 @@ END_EVENT_TABLE()
/* Constructeur */
/****************/
WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
WinEDA_App* parent,
WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) :
WinEDA_BasePcbFrame( father, parent, GERBER_FRAME, title, pos, size, style )
const wxPoint& pos,
const wxSize& size,
long style ) :
WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style )
{
m_FrameName = wxT( "GerberFrame" );
m_FrameName = wxT( "GerberFrame" );
//m_AboutTitle = g_GerbviewAboutTitle;
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin<69>
m_Ident = GERBER_FRAME;
m_ZoomMaxValue = 1024;
@ -160,7 +165,6 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
WinEDA_GerberFrame::~WinEDA_GerberFrame()
{
m_Parent->m_GerberFrame = NULL;
SetBaseScreen( ScreenPcb );
}
@ -208,8 +212,8 @@ void WinEDA_GerberFrame::SetToolbars()
* Set the tools state for the toolbars, accordint to display options
*/
{
int layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
GERBER* gerber = g_GERBER_List[layer];
int layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
GERBER* gerber = g_GERBER_List[layer];
if( m_HToolBar == NULL )
return;
@ -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 )
@ -264,31 +270,33 @@ void WinEDA_GerberFrame::SetToolbars()
if( m_OptionsToolBar )
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric ==
MILLIMETRE ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : FALSE );
g_UnitMetric == INCHES ? TRUE : FALSE );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood );
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid );
m_Draw_Grid );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
g_CursorShape );
g_CursorShape );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
!m_DisplayPadFill );
!m_DisplayPadFill );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
!m_DisplayPcbTrackFill );
!m_DisplayPcbTrackFill );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
g_DisplayPolygonsModeSketch == 0 ? 0 : 1 );
g_DisplayPolygonsModeSketch == 0 ? 0 : 1 );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_DCODES,
DisplayOpt.DisplayPadNum );
DisplayOpt.DisplayPadNum );
}
DisplayUnitsMsg();

View File

@ -7,7 +7,6 @@
#include "fctsys.h"
#include <wx/image.h>
#include <wx/file.h>
#include "common.h"
@ -25,16 +24,16 @@ IMPLEMENT_APP( WinEDA_App )
bool WinEDA_App::OnInit()
{
g_EDA_Appl = this;
WinEDA_GerberFrame* frame = NULL;
InitEDA_Appl( wxT( "gerbview" ) );
ScreenPcb = new PCB_SCREEN();
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
ActiveScreen = ScreenPcb;
GetSettings();
if( m_Checker && m_Checker->IsAnotherRunning() )
{
if( !IsOK( NULL, _( "GerbView is already running. Continue?" ) ) )
@ -43,33 +42,35 @@ bool WinEDA_App::OnInit()
g_DrawBgColor = BLACK;
Read_Hotkey_Config( m_PcbFrame, false ); /* Must be called before creating the main frame
* in order to display the real hotkeys
* in menus or tool tips */
Read_Hotkey_Config( frame, false ); /* Must be called before creating the main frame
* in order to display the real hotkeys
* in menus or tool tips */
m_GerberFrame = new WinEDA_GerberFrame( NULL, this, wxT( "GerbView" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
frame = new WinEDA_GerberFrame( NULL, wxT( "GerbView" ),
wxPoint( 0, 0 ),
wxSize( 600, 400 ) );
/* Gerbview mainframe title */
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
m_GerberFrame->SetTitle( Title );
m_GerberFrame->m_Pcb = new BOARD( NULL, m_GerberFrame );
frame->SetTitle( Title );
frame->m_Pcb = new BOARD( NULL, frame );
SetTopWindow( m_GerberFrame ); // Set GerbView mainframe on top
m_GerberFrame->Show( TRUE ); // Show GerbView mainframe
m_GerberFrame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame
SetTopWindow( frame ); // Set GerbView mainframe on top
frame->Show( TRUE ); // Show GerbView mainframe
frame->Zoom_Automatique( TRUE ); // Zoomfit drawing in frame
if( argc > 1 )
{
wxString fileName = MakeFileName( wxEmptyString, argv[1], g_PhotoFilenameExt );
wxString fileName = MakeFileName( wxEmptyString,
argv[1],
g_PhotoFilenameExt );
if( !fileName.IsEmpty() )
{
wxClientDC dc( m_GerberFrame->DrawPanel );
m_GerberFrame->DrawPanel->PrepareGraphicContext( &dc );
wxClientDC dc( frame->DrawPanel );
frame->DrawPanel->PrepareGraphicContext( &dc );
wxString path = wxPathOnly( fileName );
wxString path = wxPathOnly( fileName );
if( path != wxEmptyString )
wxSetWorkingDirectory( path );
@ -77,14 +78,17 @@ bool WinEDA_App::OnInit()
Read_Config();
// 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 ) )
{
((PCB_SCREEN*)m_GerberFrame->GetScreen())->m_Active_Layer = i-1;
m_GerberFrame->LoadOneGerberFile( fileName, &dc, FALSE );
( (PCB_SCREEN*) frame->GetScreen() )->
m_Active_Layer = i - 1;
frame->LoadOneGerberFile( fileName, &dc, FALSE );
}
}
}

View File

@ -10,7 +10,6 @@
#include "gerbview.h"
#include "pcbplot.h"
#include "id.h"
#include "hotkeys_basic.h"
#include "hotkeys.h"
#include "gerbview_config.h"
@ -76,12 +75,12 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
AddDelimiterString(FullFileName);
AddDelimiterString( FullFileName );
wxString editorname = GetEditorName();
if( !editorname.IsEmpty() )
ExecuteFile( this, editorname, FullFileName );
}
break;
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
@ -93,7 +92,8 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
break;
default:
DisplayError( this, wxT( "WinEDA_GerberFrame::Process_Config internal error" ) );
DisplayError( this,
wxT( "WinEDA_GerberFrame::Process_Config internal error" ) );
}
}
@ -103,15 +103,16 @@ bool Read_Config()
/*****************************************************/
/* lit la configuration, si elle n'a pas deja etee lue
* 1 - lit gerbview.cnf
* 2 - si non trouve lit <chemin de gerbview.exe>/gerbview.cnf
* 3 - si non trouve: init des variables aux valeurs par defaut
* 1 - lit gerbview.cnf
* 2 - si non trouve lit <chemin de gerbview.exe>/gerbview.cnf
* 3 - si non trouve: init des variables aux valeurs par defaut
*
* Retourne un pointeur su le message d'erreur a afficher
* Retourne un pointeur su le message d'erreur a afficher
*/
{
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 */
if( ScreenPcb )
@ -132,14 +133,14 @@ void WinEDA_GerberFrame::Update_config()
/******************************************/
/*
* creation du fichier de config
* creation du fichier de config
*/
{
wxString FullFileName;
wxString mask( wxT( "*" ) ),
wxString mask( wxT( "*" ) );
g_Prj_Config_Filename_ext = wxT( ".cnf"; )
mask += g_Prj_Config_Filename_ext;
g_Prj_Config_Filename_ext = wxT( ".cnf" );
mask += g_Prj_Config_Filename_ext;
FullFileName = wxT( "gerbview" );
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
@ -157,7 +158,7 @@ void WinEDA_GerberFrame::Update_config()
return;
/* 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 )
* Read the hotkey files config for pcbnew and module_edit
*/
{
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
wxString FullFileName = ReturnHotkeyConfigFilePath(
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
return frame->ReadHotkeyConfigFile( FullFileName, s_Gerbview_Hokeys_Descr, verbose );
return frame->ReadHotkeyConfigFile( FullFileName,
s_Gerbview_Hokeys_Descr,
verbose );
}

View File

@ -51,9 +51,9 @@ private:
};
/* Construction de la table des evenements pour WinEDA_ConfigFrame */
BEGIN_EVENT_TABLE( WinEDA_ConfigFrame, wxDialog )
EVT_BUTTON( ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg )
EVT_BUTTON( wxID_OK, WinEDA_ConfigFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick )
EVT_BUTTON( ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg )
EVT_BUTTON( wxID_OK, WinEDA_ConfigFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick )
END_EVENT_TABLE()
@ -87,7 +87,7 @@ WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_GerberFrame* parent,
SetFont( *g_DialogFont );
/* Shows the config filename currently used : */
title = _( "from " ) + g_EDA_Appl->m_CurrentOptionFile;
title = _( "from " ) + wxGetApp().m_CurrentOptionFile;
SetTitle( title );
LibModified = FALSE;
@ -117,15 +117,18 @@ WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_GerberFrame* parent,
size.x = LEN_EXT;
size.y = -1;
TextDrillExt = new WinEDA_EnterText( this,
_( "Drill File Ext:" ), g_DrillFilenameExt,
_( "Drill File Ext:" ),
g_DrillFilenameExt,
LeftBoxSizer, size );
TextPhotoExt = new WinEDA_EnterText( this,
_( "Gerber File Ext:" ), g_PhotoFilenameExt,
_( "Gerber File Ext:" ),
g_PhotoFilenameExt,
LeftBoxSizer, size );
TextPenExt = new WinEDA_EnterText( this,
_( "D code File Ext:" ), g_PenFilenameExt,
_( "D code File Ext:" ),
g_PenFilenameExt,
LeftBoxSizer, size );
GetSizer()->Fit( this );

View File

@ -10,8 +10,6 @@
#include "protos.h"
#define BITMAP wxBitmap
#include "bitmaps.h"
#include "id.h"
@ -116,7 +114,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
// Font selection and setup
AddFontSelectionMenu( configmenu );
m_Parent->SetLanguageList( configmenu );
wxGetApp().SetLanguageList( configmenu );
configmenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ),
@ -166,7 +164,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
else // Only an update of the files list
{
wxMenuItem* item;
int max_file = m_Parent->m_LastProjectMaxCount;
int max_file = wxGetApp().m_LastProjectMaxCount;
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
@ -210,24 +208,24 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
SetToolBar( m_HToolBar );
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, BITMAP( new_xpm ),
m_HToolBar->AddTool( ID_NEW_BOARD, wxBitmap( new_xpm ),
wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL,
_( "New World" ) );
m_HToolBar->AddTool( ID_LOAD_FILE, BITMAP( open_xpm ),
m_HToolBar->AddTool( ID_LOAD_FILE, wxBitmap( open_xpm ),
wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL,
_( "Open existing Layer" ) );
#if 0
m_HToolBar->AddTool( ID_SAVE_PROJECT, BITMAP( save_button ),
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxBitmap( save_button ),
wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL,
_( "Save World" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, BITMAP( sheetset_xpm ),
m_HToolBar->AddTool( ID_SHEET_SET, wxBitmap( sheetset_xpm ),
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
@ -238,32 +236,32 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_HToolBar->AddSeparator();
#if 0
m_HToolBar->AddTool( wxID_CUT, BITMAP( cut_button ),
m_HToolBar->AddTool( wxID_CUT, wxBitmap( cut_button ),
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "Cut selected item" ) );
m_HToolBar->AddTool( wxID_COPY, BITMAP( copy_button ),
m_HToolBar->AddTool( wxID_COPY, wxBitmap( copy_button ),
wxNullBitmap, FALSE,
-1, -1, (wxObject*) NULL,
_( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, BITMAP( paste_xpm ),
m_HToolBar->AddTool( wxID_PASTE, wxBitmap( paste_xpm ),
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "Paste" ) );
#endif
m_HToolBar->AddTool( ID_UNDO_BUTT, BITMAP( undelete_xpm ),
m_HToolBar->AddTool( ID_UNDO_BUTT, wxBitmap( undelete_xpm ),
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "Undelete" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, BITMAP( print_button ),
m_HToolBar->AddTool( ID_GEN_PRINT, wxBitmap( print_button ),
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
@ -271,34 +269,34 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_HToolBar->AddSeparator();
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,
FALSE,
-1, -1, (wxObject*) NULL,
msg );
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,
FALSE,
-1, -1, (wxObject*) NULL,
msg );
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,
FALSE,
-1, -1, (wxObject*) NULL,
msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, BITMAP( zoom_auto_xpm ),
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxBitmap( zoom_auto_xpm ),
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "Zoom auto" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_FIND_ITEMS, BITMAP( find_xpm ),
m_HToolBar->AddTool( ID_FIND_ITEMS, wxBitmap( find_xpm ),
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
@ -354,7 +352,7 @@ create or update the right vertical toolbar
// Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT,
BITMAP( cursor_xpm ),
wxBitmap( cursor_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
@ -362,26 +360,26 @@ create or update the right vertical toolbar
#if 0
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_COMPONENT_BUTT,
BITMAP( component_button ),
wxBitmap( component_button ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Add Flashes" ) );
m_VToolBar->AddTool( ID_BUS_BUTT,
BITMAP( bus_button ),
wxBitmap( bus_button ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Add Lines" ) );
m_VToolBar->AddTool( ID_JUNCTION_BUTT,
BITMAP( junction_xpm ),
wxBitmap( junction_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Add layer alignment target" ) );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT,
BITMAP( tool_text_xpm ),
wxBitmap( tool_text_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Add Text" ) );
@ -389,7 +387,7 @@ create or update the right vertical toolbar
#endif
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT,
BITMAP( delete_body_xpm ),
wxBitmap( delete_body_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Delete items" ) );
@ -412,27 +410,27 @@ create or update the left vertical toolbar (option toolbar
// creation du tool bar options
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,
TRUE,
-1, -1, (wxObject*) NULL,
_( "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,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Display Polar Coord ON" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
BITMAP( unit_inch_xpm ),
wxBitmap( unit_inch_xpm ),
_( "Units in inches" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
BITMAP( unit_mm_xpm ),
wxBitmap( unit_mm_xpm ),
_( "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,
TRUE,
-1, -1, (wxObject*) NULL,
@ -440,28 +438,28 @@ create or update the left vertical toolbar (option toolbar
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
BITMAP( pad_sketch_xpm ),
wxBitmap( pad_sketch_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Spots in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
BITMAP( showtrack_xpm ),
wxBitmap( showtrack_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Lines in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
BITMAP( opt_show_polygon_xpm ),
wxBitmap( opt_show_polygon_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Polygons in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES,
BITMAP( show_dcodenumber_xpm ),
wxBitmap( show_dcodenumber_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,

View File

@ -24,14 +24,6 @@ class WinEDA_App : public wxApp
public:
wxString m_Project;
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;
wxSize m_HelpSize;
@ -46,9 +38,10 @@ public:
* (utilisé si KICAD non défini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargés */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv; /* Chemin de kicad défini dans la variable
* d'environnement KICAD,
* typiquement /usr/local/kicad ou c:\kicad */
wxString m_KicadEnv; /* Chemin de kicad défini dans la
* variable d'environnement KICAD,
* typiquement /usr/local/kicad ou
* c:\kicad */
bool m_Env_Defined; // TRUE si variable d'environnement KICAD definie
wxLocale* m_Locale; // Gestion de la localisation

View File

@ -276,9 +276,6 @@ COMMON_GLOBL wxString g_ProductName
#endif
;
COMMON_GLOBL WinEDA_App* g_EDA_Appl; /* this is the main application */
/* Gestion des librairies */
COMMON_GLOBL wxString g_RealLibDirBuffer; // Chemin reel des librairies de module
// = UserLibDirBuffer si non vide

View File

@ -48,21 +48,23 @@ enum fl_rot_cmp {
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* m_SelPartBox;
DrawSheetPath* m_CurrentSheet; ///< which sheet we are presently working on.
int m_Multiflag;
wxPoint m_OldPos;
WinEDAChoiceBox* m_SelPartBox;
DrawSheetPath* m_CurrentSheet; ///< which sheet we are presently working on.
int m_Multiflag;
wxPoint m_OldPos;
WinEDA_LibeditFrame* m_LibeditFrame;
WinEDA_ViewlibFrame* m_ViewlibFrame;
private:
wxMenu* m_FilesMenu;
wxMenu* m_FilesMenu;
SCH_CMP_FIELD* m_CurrentField;
int m_TextFieldSize;
SCH_CMP_FIELD* m_CurrentField;
int m_TextFieldSize;
public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_SchematicFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
@ -362,7 +364,7 @@ public:
WinEDAChoiceBox* m_SelAliasBox;
public:
WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_LibeditFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
@ -473,7 +475,7 @@ public:
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
public:
WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library = NULL,
wxSemaphore* semaphore = NULL );

View File

@ -60,14 +60,15 @@ public:
int m_DisplayModEdge; // How show module drawings
int m_DisplayModText; // How show module texts
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:
GENERAL_COLLECTOR* m_Collector;
public:
WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype,
WinEDA_BasePcbFrame( wxWindow* father, int idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
@ -327,7 +328,7 @@ private:
void createPopUpBlockMenu( wxMenu* menu );
public:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
WinEDA_PcbFrame( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
@ -743,7 +744,7 @@ private:
wxMenu* m_FilesMenu;
public:
WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
WinEDA_GerberFrame( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
@ -869,7 +870,7 @@ public:
wxString m_CurrentLib;
public:
WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_ModuleEditFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );

View File

@ -123,7 +123,6 @@ class WinEDA_BasicFrame : public wxFrame
{
public:
int m_Ident; // Id Type (pcb, schematic, library..)
WinEDA_App* m_Parent;
wxPoint m_FramePos;
wxSize m_FrameSize;
int m_MsgFrameHeight;
@ -138,7 +137,7 @@ public:
public:
// Constructor and destructor
WinEDA_BasicFrame( wxWindow* father, int idtype, WinEDA_App* parent,
WinEDA_BasicFrame( wxWindow* father, int idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE);
@ -216,7 +215,7 @@ protected:
public:
// Constructor and destructor
WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_App* parent,
WinEDA_DrawFrame( wxWindow* father, int idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );

View File

@ -1,4 +1,5 @@
/*****************************************************************************/
/**
* @file buildmnu.cpp
* @brief TODO
@ -8,105 +9,99 @@
#include "wx/spinctrl.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "kicad.h"
#include "macros.h"
#define BITMAP wxBitmap
#include "bitmaps.h" // Common bitmaps
#include "id.h"
/*****************************************************************************/
BEGIN_EVENT_TABLE(WinEDA_MainFrame, WinEDA_BasicFrame)
BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame )
/*****************************************************************************/
/* Window events */
EVT_SIZE(WinEDA_MainFrame::OnSize)
EVT_CLOSE(WinEDA_MainFrame::OnCloseWindow)
/* Window events */
EVT_SIZE( WinEDA_MainFrame::OnSize )
EVT_CLOSE( WinEDA_MainFrame::OnCloseWindow )
/* Sash drag events */
EVT_SASH_DRAGGED(ID_LEFT_FRAME,
WinEDA_MainFrame::OnSashDrag)
EVT_SASH_DRAGGED(ID_BOTTOM_FRAME,
WinEDA_MainFrame::OnSashDrag)
EVT_SASH_DRAGGED(ID_MAIN_COMMAND,
WinEDA_MainFrame::OnSashDrag)
/* Sash drag events */
EVT_SASH_DRAGGED( ID_LEFT_FRAME,
WinEDA_MainFrame::OnSashDrag )
EVT_SASH_DRAGGED( ID_BOTTOM_FRAME,
WinEDA_MainFrame::OnSashDrag )
EVT_SASH_DRAGGED( ID_MAIN_COMMAND,
WinEDA_MainFrame::OnSashDrag )
/* Toolbar events */
EVT_TOOL(ID_NEW_PROJECT,
WinEDA_MainFrame::Process_Files)
EVT_TOOL(ID_LOAD_PROJECT,
WinEDA_MainFrame::Process_Files)
EVT_TOOL(ID_SAVE_PROJECT,
WinEDA_MainFrame::Process_Files)
EVT_TOOL(ID_SAVE_AND_ZIP_FILES,
WinEDA_MainFrame::Process_Files)
/* Toolbar events */
EVT_TOOL( ID_NEW_PROJECT,
WinEDA_MainFrame::Process_Files )
EVT_TOOL( ID_LOAD_PROJECT,
WinEDA_MainFrame::Process_Files )
EVT_TOOL( ID_SAVE_PROJECT,
WinEDA_MainFrame::Process_Files )
EVT_TOOL( ID_SAVE_AND_ZIP_FILES,
WinEDA_MainFrame::Process_Files )
/* Menu events */
EVT_MENU(ID_SAVE_PROJECT,
WinEDA_MainFrame::Process_Files)
EVT_MENU(ID_EXIT,
WinEDA_MainFrame::Process_Special_Functions)
EVT_MENU(ID_TO_EDITOR,
WinEDA_MainFrame::Process_Fct)
EVT_MENU(ID_BROWSE_AN_SELECT_FILE,
WinEDA_MainFrame::Process_Fct)
EVT_MENU(ID_SELECT_PREFERED_EDITOR,
WinEDA_MainFrame::Process_Preferences)
EVT_MENU(ID_SELECT_DEFAULT_PDF_BROWSER,
WinEDA_MainFrame::Process_Preferences)
EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER,
WinEDA_MainFrame::Process_Preferences)
EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER_NAME,
WinEDA_MainFrame::Process_Preferences)
EVT_MENU(ID_SAVE_AND_ZIP_FILES,
WinEDA_MainFrame::Process_Files)
EVT_MENU(ID_READ_ZIP_ARCHIVE,
WinEDA_MainFrame::Process_Files)
EVT_MENU(ID_PROJECT_TREE_REFRESH,
WinEDA_MainFrame::OnRefresh)
EVT_MENU(ID_PREFERENCES_FONT_INFOSCREEN,
WinEDA_MainFrame::Process_Preferences)
EVT_MENU(ID_GENERAL_HELP,
WinEDA_MainFrame::GetKicadHelp)
EVT_MENU(ID_KICAD_ABOUT,
WinEDA_MainFrame::GetKicadAbout)
/* Menu events */
EVT_MENU( ID_SAVE_PROJECT,
WinEDA_MainFrame::Process_Files )
EVT_MENU( ID_EXIT,
WinEDA_MainFrame::Process_Special_Functions )
EVT_MENU( ID_TO_EDITOR,
WinEDA_MainFrame::Process_Fct )
EVT_MENU( ID_BROWSE_AN_SELECT_FILE,
WinEDA_MainFrame::Process_Fct )
EVT_MENU( ID_SELECT_PREFERED_EDITOR,
WinEDA_MainFrame::Process_Preferences )
EVT_MENU( ID_SELECT_DEFAULT_PDF_BROWSER,
WinEDA_MainFrame::Process_Preferences )
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER,
WinEDA_MainFrame::Process_Preferences )
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER_NAME,
WinEDA_MainFrame::Process_Preferences )
EVT_MENU( ID_SAVE_AND_ZIP_FILES,
WinEDA_MainFrame::Process_Files )
EVT_MENU( ID_READ_ZIP_ARCHIVE,
WinEDA_MainFrame::Process_Files )
EVT_MENU( ID_PROJECT_TREE_REFRESH,
WinEDA_MainFrame::OnRefresh )
EVT_MENU( ID_PREFERENCES_FONT_INFOSCREEN,
WinEDA_MainFrame::Process_Preferences )
EVT_MENU( ID_GENERAL_HELP,
WinEDA_MainFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT,
WinEDA_MainFrame::GetKicadAbout )
/* Range menu events */
EVT_MENU_RANGE(ID_LANGUAGE_CHOICE,
ID_LANGUAGE_CHOICE_END,
WinEDA_MainFrame::SetLanguage)
/* Range menu events */
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE,
ID_LANGUAGE_CHOICE_END,
WinEDA_MainFrame::SetLanguage )
EVT_MENU_RANGE(ID_LOAD_PROJECT,
ID_LOAD_FILE_10,
WinEDA_MainFrame::Process_Files)
EVT_MENU_RANGE( ID_LOAD_PROJECT,
ID_LOAD_FILE_10,
WinEDA_MainFrame::Process_Files )
/* Button events */
EVT_BUTTON(ID_TO_PCB,
WinEDA_MainFrame::Process_Fct)
EVT_BUTTON(ID_TO_CVPCB,
WinEDA_MainFrame::Process_Fct)
EVT_BUTTON(ID_TO_EESCHEMA,
WinEDA_MainFrame::Process_Fct)
EVT_BUTTON(ID_TO_GERBVIEW,
WinEDA_MainFrame::Process_Fct)
/* Button events */
EVT_BUTTON( ID_TO_PCB,
WinEDA_MainFrame::Process_Fct )
EVT_BUTTON( ID_TO_CVPCB,
WinEDA_MainFrame::Process_Fct )
EVT_BUTTON( ID_TO_EESCHEMA,
WinEDA_MainFrame::Process_Fct )
EVT_BUTTON( ID_TO_GERBVIEW,
WinEDA_MainFrame::Process_Fct )
#ifdef KICAD_PYTHON
EVT_BUTTON(ID_RUN_PYTHON, WinEDA_MainFrame::Process_Fct)
EVT_BUTTON( ID_RUN_PYTHON, WinEDA_MainFrame::Process_Fct )
#endif
/*****************************************************************************/
END_EVENT_TABLE()
/*****************************************************************************/
/**
* @brief TODO
*/
@ -114,245 +109,241 @@ END_EVENT_TABLE()
void WinEDA_MainFrame::ReCreateMenuBar()
/*****************************************************************************/
{
int ii, jj;
wxMenuBar *menuBar = GetMenuBar() ;
int ii, jj;
wxMenuBar* menuBar = GetMenuBar();
// Check if menubar is empty
if( menuBar == NULL )
{
m_MenuBar = menuBar = new wxMenuBar();
m_FilesMenu = new wxMenu;
// Open project
wxMenuItem *item = new wxMenuItem(m_FilesMenu,
ID_LOAD_PROJECT,
_("&Open"),
_("Open an existing project") );
item->SetBitmap(open_project_xpm);
m_FilesMenu->Append(item);
// New project
item = new wxMenuItem(m_FilesMenu,
ID_NEW_PROJECT,
_("&New"),
_("Start a new project") );
item->SetBitmap(new_project_xpm);
m_FilesMenu->Append(item);
// Save project
item = new wxMenuItem(m_FilesMenu,
ID_SAVE_PROJECT,
_("&Save"),
_("Save current project") );
item->SetBitmap(save_project_xpm);
m_FilesMenu->Append(item);
// Separator
m_FilesMenu->AppendSeparator();
// Archive project
item = new wxMenuItem(m_FilesMenu,
ID_SAVE_AND_ZIP_FILES,
_("&Archive"),
_("Archive project files in zip archive") );
item->SetBitmap(zip_xpm);
m_FilesMenu->Append(item);
// Unarchive project
item = new wxMenuItem(m_FilesMenu,
ID_READ_ZIP_ARCHIVE,
_("&Unarchive"),
_("Unarchive project files from zip file") );
item->SetBitmap(unzip_xpm);
m_FilesMenu->Append(item);
// Separator
m_FilesMenu->AppendSeparator();
// Exit
item = new wxMenuItem(m_FilesMenu,
ID_EXIT,
_("E&xit"),
_("Quit kicad") );
item->SetBitmap(exit_xpm);
m_FilesMenu->Append(item);
// Create last 10 project entries
m_FilesMenu->AppendSeparator();
for ( ii = 0; ii < 10; ii++ )
// Check if menubar is empty
if( menuBar == NULL )
{
m_MenuBar = menuBar = new wxMenuBar();
m_MenuBar = menuBar = new wxMenuBar();
m_FilesMenu = new wxMenu;
if ( GetLastProject(ii).IsEmpty() )
break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
// Open project
wxMenuItem* item = new wxMenuItem( m_FilesMenu,
ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open an existing project" ) );
item->SetBitmap( open_project_xpm );
m_FilesMenu->Append( item );
// New project
item = new wxMenuItem( m_FilesMenu,
ID_NEW_PROJECT,
_( "&New" ),
_( "Start a new project" ) );
item->SetBitmap( new_project_xpm );
m_FilesMenu->Append( item );
// Save project
item = new wxMenuItem( m_FilesMenu,
ID_SAVE_PROJECT,
_( "&Save" ),
_( "Save current project" ) );
item->SetBitmap( save_project_xpm );
m_FilesMenu->Append( item );
// Separator
m_FilesMenu->AppendSeparator();
// Archive project
item = new wxMenuItem( m_FilesMenu,
ID_SAVE_AND_ZIP_FILES,
_( "&Archive" ),
_( "Archive project files in zip archive" ) );
item->SetBitmap( zip_xpm );
m_FilesMenu->Append( item );
// Unarchive project
item = new wxMenuItem( m_FilesMenu,
ID_READ_ZIP_ARCHIVE,
_( "&Unarchive" ),
_( "Unarchive project files from zip file" ) );
item->SetBitmap( unzip_xpm );
m_FilesMenu->Append( item );
// Separator
m_FilesMenu->AppendSeparator();
// Exit
item = new wxMenuItem( m_FilesMenu,
ID_EXIT,
_( "E&xit" ),
_( "Quit kicad" ) );
item->SetBitmap( exit_xpm );
m_FilesMenu->Append( item );
// Create last 10 project entries
m_FilesMenu->AppendSeparator();
for( ii = 0; ii < 10; ii++ )
{
m_MenuBar = menuBar = new wxMenuBar();
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
/*************************************************************************/
wxMenu* browseMenu = new wxMenu();
/*************************************************************************/
// Editor
item = new wxMenuItem( browseMenu, // Entry in menu
ID_TO_EDITOR, // Entry ID
_( "Text E&ditor" ), // Entry text
_( "Open prefered text editor" ) ); // Status bar text
item->SetBitmap( editor_xpm ); // Entry XPM Bitmap
browseMenu->Append( item ); // Append wxMenuItem to menu
// Browse files
item = new wxMenuItem( browseMenu,
ID_BROWSE_AN_SELECT_FILE,
_( "&Browse Files" ),
_( "Read or edit files with text editor" ) );
item->SetBitmap( browse_files_xpm );
browseMenu->Append( item );
/*************************************************************************/
wxMenu* PreferencesMenu = new wxMenu;
/*************************************************************************/
// Fonts
item = new wxMenuItem( PreferencesMenu,
ID_PREFERENCES_FONT_INFOSCREEN,
_( "Fonts" ),
_( "Font preferences" ) );
item->SetBitmap( fonts_xpm );
PreferencesMenu->Append( item );
// Prefered text editor
item = new wxMenuItem( PreferencesMenu,
ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ),
_( "Select your prefered text editor" ) );
item->SetBitmap( editor_xpm );
PreferencesMenu->Append( item );
// Submenu Pdf Browser selection: system browser or user
// selected browser (and its name)
/*************************************************************************/
wxMenu* SubMenuPdfBrowserChoice = new wxMenu;
/*************************************************************************/
// Default PDF viewer
item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_DEFAULT_PDF_BROWSER,
_( "Default PDF Viewer" ),
_( "Use the default (system) PDF viewer used to browse datasheets" ),
wxITEM_CHECK );
SETBITMAPS( datasheet_xpm );
SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
wxGetApp().m_PdfBrowserIsDefault );
// Favourite PDF viewer
item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER,
_( "Favourite PDF Viewer" ),
_( "Use your favourite PDF viewer used to browse datasheets" ),
wxITEM_CHECK );
SETBITMAPS( preference_xpm );
SubMenuPdfBrowserChoice->Append( item );
SubMenuPdfBrowserChoice->AppendSeparator();
SubMenuPdfBrowserChoice->Check( ID_SELECT_PREFERED_PDF_BROWSER,
!wxGetApp().m_PdfBrowserIsDefault );
item = new wxMenuItem( SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_( "Select Pdf Viewer" ),
_( "Select your favourite PDF viewer used to browse datasheets" ) );
item->SetBitmap( datasheet_xpm );
SubMenuPdfBrowserChoice->Append( item );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( PreferencesMenu,
SubMenuPdfBrowserChoice,
-1, _( "Pdf Viewer" ),
_( "Pdf viewer preferences" ),
datasheet_xpm );
PreferencesMenu->AppendSeparator();
wxGetApp().SetLanguageList( PreferencesMenu );
/*************************************************************************/
wxMenu* helpMenu = new wxMenu;
/*************************************************************************/
// Contents
item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP,
_( "&Contents" ),
_( "Open the kicad manual" ) );
item->SetBitmap( help_xpm );
helpMenu->Append( item );
// About Kicad
item = new wxMenuItem( helpMenu,
ID_KICAD_ABOUT,
_( "&About" ),
_( "About kicad project manager" ) );
item->SetBitmap( info_xpm );
helpMenu->Append( item );
// Append menus to menuBar
menuBar->Append( m_FilesMenu, _( "&File" ) );
menuBar->Append( browseMenu, _( "&Browse" ) );
menuBar->Append( PreferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame
SetMenuBar( menuBar );
}
/*************************************************************************/
wxMenu *browseMenu = new wxMenu();
/*************************************************************************/
// Editor
item = new wxMenuItem(browseMenu, // Entry in menu
ID_TO_EDITOR, // Entry ID
_("Text E&ditor"), // Entry text
_("Open prefered text editor") ); // Status bar text
item->SetBitmap(editor_xpm); // Entry XPM Bitmap
browseMenu->Append(item); // Append wxMenuItem to menu
// Browse files
item = new wxMenuItem(browseMenu,
ID_BROWSE_AN_SELECT_FILE,
_("&Browse Files"),
_("Read or edit files with text editor") );
item->SetBitmap(browse_files_xpm);
browseMenu->Append(item);
/*************************************************************************/
wxMenu *PreferencesMenu = new wxMenu;
/*************************************************************************/
// Fonts
item = new wxMenuItem(PreferencesMenu,
ID_PREFERENCES_FONT_INFOSCREEN,
_("Fonts"),
_("Font preferences"));
item->SetBitmap(fonts_xpm);
PreferencesMenu->Append(item);
// Prefered text editor
item = new wxMenuItem(PreferencesMenu,
ID_SELECT_PREFERED_EDITOR,
_("&Text Editor"),
_("Select your prefered text editor") );
item->SetBitmap(editor_xpm);
PreferencesMenu->Append(item);
// Submenu Pdf Browser selection: system browser or user
// selected browser (and its name)
/*************************************************************************/
wxMenu *SubMenuPdfBrowserChoice = new wxMenu;
/*************************************************************************/
// Default PDF viewer
item = new wxMenuItem(SubMenuPdfBrowserChoice,
ID_SELECT_DEFAULT_PDF_BROWSER,
_("Default PDF Viewer"),
_("Use the default (system) PDF viewer used to browse datasheets"),
wxITEM_CHECK);
SETBITMAPS(datasheet_xpm);
SubMenuPdfBrowserChoice->Append(item);
SubMenuPdfBrowserChoice->Check(ID_SELECT_DEFAULT_PDF_BROWSER,
g_EDA_Appl->m_PdfBrowserIsDefault);
// Favourite PDF viewer
item = new wxMenuItem(SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER,
_("Favourite PDF Viewer"),
_("Use your favourite PDF viewer used to browse datasheets"),
wxITEM_CHECK);
SETBITMAPS(preference_xpm);
SubMenuPdfBrowserChoice->Append(item);
SubMenuPdfBrowserChoice->AppendSeparator();
SubMenuPdfBrowserChoice->Check(ID_SELECT_PREFERED_PDF_BROWSER,
!g_EDA_Appl->m_PdfBrowserIsDefault);
item = new wxMenuItem(SubMenuPdfBrowserChoice,
ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_("Select Pdf Viewer"),
_("Select your favourite PDF viewer used to browse datasheets"));
item->SetBitmap(datasheet_xpm);
SubMenuPdfBrowserChoice->Append(item);
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(PreferencesMenu,
SubMenuPdfBrowserChoice,
-1, _("Pdf Viewer"),
_("Pdf viewer preferences"),
datasheet_xpm);
PreferencesMenu->AppendSeparator();
m_Parent->SetLanguageList(PreferencesMenu);
/*************************************************************************/
wxMenu *helpMenu = new wxMenu;
/*************************************************************************/
// Contents
item = new wxMenuItem(helpMenu ,
ID_GENERAL_HELP,
_("&Contents"),
_("Open the kicad manual"));
item->SetBitmap(help_xpm);
helpMenu->Append(item);
// About Kicad
item = new wxMenuItem(helpMenu ,
ID_KICAD_ABOUT,
_("&About"),
_("About kicad project manager"));
item->SetBitmap(info_xpm);
helpMenu->Append(item);
// Append menus to menuBar
menuBar->Append(m_FilesMenu, _("&File"));
menuBar->Append(browseMenu, _("&Browse"));
menuBar->Append(PreferencesMenu, _("&Preferences"));
menuBar->Append(helpMenu, _("&Help"));
// Associate the menu bar with the frame
SetMenuBar(menuBar);
}
else // TODO (ENGLISH!) simple mise a jour de la liste des fichiers anciens
{
wxMenuItem * item;
int max_file = m_Parent->m_LastProjectMaxCount;
for ( ii = max_file-1; ii >=0 ; ii-- )
else // TODO (ENGLISH!) simple mise a jour de la liste des fichiers anciens
{
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )
{
item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii);
wxMenuItem* item;
int max_file = wxGetApp().m_LastProjectMaxCount;
if ( item )
delete item;
}
for( ii = max_file - 1; ii >=0; ii-- )
{
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if( item )
delete item;
}
}
for( jj = 0, ii = 0; ii < max_file; ii++ )
{
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + jj, GetLastProject( ii ) );
jj++;
}
}
for ( jj = 0, ii = 0; ii < max_file; ii++ )
{
if (GetLastProject(ii).IsEmpty() )
break;
m_FilesMenu->Append(ID_LOAD_FILE_1 + jj, GetLastProject(ii) );
jj++;
}
}
}
/**
* @brief TODO
*/
@ -360,69 +351,69 @@ void WinEDA_MainFrame::ReCreateMenuBar()
void WinEDA_MainFrame::RecreateBaseHToolbar()
/*****************************************************************************/
{
// Check if toolbar is not already set
if ( m_HToolBar != NULL )
return;
// Check if toolbar is not already set
if( m_HToolBar != NULL )
return;
// Allocate memory for m_HToolBar
m_HToolBar = new WinEDA_Toolbar(TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE);
SetToolBar(m_HToolBar);
// Allocate memory for m_HToolBar
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
SetToolBar( m_HToolBar );
// Set up toolbar
m_HToolBar->AddTool(ID_NEW_PROJECT, // Entry ID
BITMAP(new_project_xpm), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1,
(wxObject *) NULL,
_("Start a new project")); // Tooltip
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_PROJECT, // Entry ID
wxBitmap( new_project_xpm ), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1,
(wxObject*) NULL,
_( "Start a new project" ) ); // Tooltip
// Load project
m_HToolBar->AddTool(ID_LOAD_PROJECT, // Entry ID
BITMAP(open_project_xpm), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1, (wxObject *) NULL,
_("Load existing project")); // Tooltip
// Load project
m_HToolBar->AddTool( ID_LOAD_PROJECT, // Entry ID
wxBitmap( open_project_xpm ), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "Load existing project" ) ); // Tooltip
// Save project
m_HToolBar->AddTool(ID_SAVE_PROJECT, // Entry ID
BITMAP(save_project_xpm), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1,
(wxObject *) NULL,
_( "Save current project" )); // Tooltip
// Save project
m_HToolBar->AddTool( ID_SAVE_PROJECT, // Entry ID
wxBitmap( save_project_xpm ), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1,
(wxObject*) NULL,
_( "Save current project" ) ); // Tooltip
// Separator
m_HToolBar->AddSeparator();
// Separator
m_HToolBar->AddSeparator();
// Save and archive files
m_HToolBar->AddTool(ID_SAVE_AND_ZIP_FILES, // Entry ID
BITMAP(zip_xpm), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1, (wxObject *) NULL,
_("Archive all project files")); // Tooltip
// Save and archive files
m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, // Entry ID
wxBitmap( zip_xpm ), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "Archive all project files" ) ); // Tooltip
// Separator
m_HToolBar->AddSeparator();
// Separator
m_HToolBar->AddSeparator();
// Refresh project tree
m_HToolBar->AddTool(ID_PROJECT_TREE_REFRESH, // Entry ID
BITMAP(reload_xpm), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1, (wxObject *) NULL,
_("Refresh project tree")); // Tooltip
// Refresh project tree
m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, // Entry ID
wxBitmap( reload_xpm ), // XPM Bitmap
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "Refresh project tree" ) ); // Tooltip
m_HToolBar->Realize(); // Create m_HToolBar
m_HToolBar->Realize(); // Create m_HToolBar
}

View File

@ -36,7 +36,7 @@ void WinEDA_MainFrame::Process_Files( wxCommandEvent& event )
{
int id = event.GetId();
wxString path = wxGetCwd();
wxString fullfilename;
bool IsNew = FALSE;
@ -68,7 +68,7 @@ void WinEDA_MainFrame::Process_Files( wxCommandEvent& event )
case ID_LOAD_PROJECT:
SetLastProject( m_PrjFileName );
fullfilename = EDA_FileSelector( IsNew ? _( "Create Project files:" ) :
_( "Load Project files:" ),
_( "Load Project files:" ),
path, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
@ -115,9 +115,9 @@ static void Create_NewPrj_Config( const wxString PrjFullFileName )
// Init default config filename
g_Prj_Config_LocalFilename.Empty();
g_Prj_Default_Config_FullFilename = ReturnKicadDatasPath() +
wxT( "template/kicad" ) + g_Prj_Config_Filename_ext;
g_Prj_Default_Config_FullFilename = ReturnKicadDatasPath() +
wxT( "template/kicad" ) + g_Prj_Config_Filename_ext;
if( !wxFileExists( g_Prj_Default_Config_FullFilename ) )
{
@ -140,11 +140,12 @@ static void Create_NewPrj_Config( const wxString PrjFullFileName )
g_SchematicRootFileName = wxFileNameFromPath( PrjFullFileName );
ChangeFileNameExt( g_SchematicRootFileName, g_SchExtBuffer );
g_BoardFileName = wxFileNameFromPath( PrjFullFileName );
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 )
PrintMsg( msg );
wxString target_dirname = wxDirSelector( _( "Target Directory" ),
wxEmptyString, 0, wxDefaultPosition, this );
wxEmptyString, 0,
wxDefaultPosition, this );
if( target_dirname.IsEmpty() )
return;
@ -186,7 +188,7 @@ void WinEDA_MainFrame::UnZipArchive( const wxString FullFileName )
wxFileSystem zipfilesys;
zipfilesys.AddHandler( new wxZipFSHandler );
filename += wxT( "#zip:" );
zipfilesys.ChangePathTo( filename );
@ -201,15 +203,15 @@ void WinEDA_MainFrame::UnZipArchive( const wxString FullFileName )
DisplayError( this, wxT( "Zip file read error" ) );
break;
}
wxString unzipfilename = localfilename.AfterLast( ':' );
wxString unzipfilename = localfilename.AfterLast( ':' );
msg = _( "Extract file " ) + unzipfilename;
PrintMsg( msg );
wxInputStream* stream = zipfile->GetStream();
wxFFileOutputStream* ofile = new wxFFileOutputStream( unzipfilename );
wxFFileOutputStream* ofile = new wxFFileOutputStream( unzipfilename );
if( ofile->Ok() )
{
@ -269,20 +271,20 @@ void WinEDA_MainFrame::CreateZipArchive( const wxString FullFileName )
wxT( "*.pdf" ), wxT( "*.txt" ),
NULL
};
int ii = 0;
int ii = 0;
wxString zip_cmd = wxT( "-O " ) + zip_file_fullname;
filename = wxFindFirstFile( Ext_to_arch[ii] );
while( !filename.IsEmpty() )
{
wxFileName name( filename );
wxString fullname = name.GetFullName();
wxString fullname = name.GetFullName();
AddDelimiterString( fullname );
zip_cmd += wxT( " " ) + fullname;
msg = _( "Compress file " ) + fullname + wxT( "\n" );
PrintMsg( msg );

View File

@ -1,4 +1,5 @@
/*****************************************************************************/
/**
* @file kicad.cpp
* @brief Main kicad library manager file
@ -6,7 +7,6 @@
/*****************************************************************************/
#ifdef __GNUG__
#pragma implementation
#endif
@ -16,17 +16,12 @@
#include "fctsys.h"
#include <wx/image.h>
#ifdef USE_SPLASH_IMAGE
#define SPLASH_IMAGE logo_kicad.png
#include "wx/splash.h"
#include "wx/mediactrl.h"
#endif
#include <wx/button.h>
#include "wxstruct.h"
#include "common.h"
#include "bitmaps.h"
#include "kicad.h"
@ -39,16 +34,17 @@
/* Export functions */
/* Import functions */
char *GetFileName(char *FullPathName);
void ShowLogo(char * FonteFileName);
char* GetFileName( char* FullPathName );
void ShowLogo( char* FonteFileName );
/* Local functions */
/************************************/
/* Called to initialize the program */
/************************************/
// Create a new application object
IMPLEMENT_APP(WinEDA_App)
IMPLEMENT_APP( WinEDA_App )
#ifdef KICAD_PYTHON
@ -56,145 +52,196 @@ using namespace boost::python;
/*****************************************************************************/
// Global functions:
/*****************************************************************************/
static WinEDA_MainFrame& GetMainFrame() { return *( wxGetApp().m_MainFrame ); }
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 ) ); }
static WinEDA_MainFrame& GetMainFrame()
{
return *( wxGetApp().m_MainFrame );
}
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:
// (one line functions are simple wrappers)
/*****************************************************************************/
object WinEDA_MainFrame::GetPrjName() const { 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; }
object WinEDA_MainFrame::GetPrjName() const
{
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
*/
/*****************************************************************************/
void WinEDA_MainFrame::AddFastLaunchPy( object & button )
void WinEDA_MainFrame::AddFastLaunchPy( object& button )
/*****************************************************************************/
{
wxBitmapButton * btn;
bool success = wxPyConvertSwigPtr( button.ptr(), (void**)&btn, _T("wxBitmapButton"));
if(!success)
return;
wxBitmapButton* btn;
Py_INCREF( button.ptr() );
bool success = wxPyConvertSwigPtr( button.ptr(),
(void**) &btn, _T( "wxBitmapButton" ) );
if( !success )
return;
Py_INCREF( button.ptr() );
btn->Reparent( m_CommandWin );
m_CommandWin->AddFastLaunch( btn );
m_CommandWin->AddFastLaunch( btn );
}
/*****************************************************************************/
// WinEDA_PrjFrame Special binding functions:
// (one line functions are simple wrappers)
/*****************************************************************************/
// TODO To WxWidgets ?
object WinEDA_PrjFrame::ToWx()
{ return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); }
{
return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) );
}
// TODO Get ?
object WinEDA_PrjFrame::GetFtExPy( enum TreeFileType type ) const
{ return PyHandler::Convert( GetFileExt( type ) ); }
{
return PyHandler::Convert( GetFileExt( type ) );
}
// Get python menu
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
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
object WinEDA_PrjFrame::GetCurrentMenu()
{ return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) ); }
{
return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) );
}
/**
* @brief TODO
*/
/*****************************************************************************/
void WinEDA_PrjFrame::NewFilePy( const str & name,
void WinEDA_PrjFrame::NewFilePy( const str& name,
enum TreeFileType type,
object & id )
object& id )
/*****************************************************************************/
{
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 );
}
/**
* @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") ) )
{
theroot = &m_root;
}
AddFile( PyHandler::MakeStr( file ), *theroot );
if( !wxPyConvertSwigPtr( root.ptr(), (void**) &root, _T( "wxTreeItemId" ) ) )
{
theroot = &m_root;
}
AddFile( PyHandler::MakeStr( file ), *theroot );
}
/**
* @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")))
{
return NULL;
}
if( !wxPyConvertSwigPtr( item.ptr(), (void**) &id, _T( "wxTreeItemId" ) ) )
{
return NULL;
}
return dynamic_cast<TreePrjItemData *>( m_TreeProject->GetItemData( *id ) );
return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( *id ) );
}
/*****************************************************************************/
// TreePrjItemData Special binding functions
// (one line functions are simple wrappers)
/*****************************************************************************/
// Python rename
bool TreePrjItemData::RenamePy( const str & newname, bool check )
{ return Rename( PyHandler::MakeStr(newname), check ); }
bool TreePrjItemData::RenamePy( const str& newname, bool check )
{
return Rename( PyHandler::MakeStr( newname ), check );
}
// Get python directory
object TreePrjItemData::GetDirPy() const
{ return PyHandler::Convert( GetDir() ); }
{
return PyHandler::Convert( GetDir() );
}
// Get python filename
object TreePrjItemData::GetFileNamePy() const
{ return PyHandler::Convert( GetFileName() ); }
{
return PyHandler::Convert( GetFileName() );
}
// Get python menu
object TreePrjItemData::GetMenuPy()
{ return object( handle<>( borrowed( wxPyMake_wxObject( &m_fileMenu, false ) ) ) ); }
{
return object( handle<>( borrowed( wxPyMake_wxObject( &m_fileMenu, false ) ) ) );
}
/**
@ -205,96 +252,104 @@ object TreePrjItemData::GetMenuPy()
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 );
class_<TreePrjItemData>( "PrjItem" )
// Internal data:
.def( "GetFileName", &TreePrjItemData::GetFileNamePy )
.def( "GetDir", &TreePrjItemData::GetDirPy )
.def( "GetType", &TreePrjItemData::GetType )
.def( "GetId", &TreePrjItemData::GetIdPy )
.def( "GetMenu", &TreePrjItemData::GetMenuPy )
// Item control
.def( "SetState", &TreePrjItemData::SetState )
.def( "Rename", &TreePrjItemData::RenamePy )
.def( "Move", &TreePrjItemData::Move )
.def( "Delete", &TreePrjItemData::Delete )
.def( "Activate", &TreePrjItemData::Activate )
;
// Internal data:
.def( "GetFileName", &TreePrjItemData::GetFileNamePy )
.def( "GetDir", &TreePrjItemData::GetDirPy )
.def( "GetType", &TreePrjItemData::GetType )
.def( "GetId", &TreePrjItemData::GetIdPy )
.def( "GetMenu", &TreePrjItemData::GetMenuPy )
// Item control
.def( "SetState", &TreePrjItemData::SetState )
.def( "Rename", &TreePrjItemData::RenamePy )
.def( "Move", &TreePrjItemData::Move )
.def( "Delete", &TreePrjItemData::Delete )
.def( "Activate", &TreePrjItemData::Activate )
;
enum_<TreeFileType>( "FileType" )
.value( "PROJECT", TREE_PROJECT )
.value( "SCHEMA", TREE_SCHEMA )
.value( "BOARD", TREE_PCB )
.value( "PYSCRIPT", TREE_PY )
.value( "GERBER", TREE_GERBER )
.value( "PDF", TREE_PDF )
.value( "TXT", TREE_TXT )
.value( "NETLIST", TREE_NET )
.value( "UNKNOWN", TREE_UNKNOWN )
.value( "DIRECTORY", TREE_DIRECTORY )
.value( "MAX", TREE_MAX );
.value( "PROJECT", TREE_PROJECT )
.value( "SCHEMA", TREE_SCHEMA )
.value( "BOARD", TREE_PCB )
.value( "PYSCRIPT", TREE_PY )
.value( "GERBER", TREE_GERBER )
.value( "PDF", TREE_PDF )
.value( "TXT", TREE_TXT )
.value( "NETLIST", TREE_NET )
.value( "UNKNOWN", TREE_UNKNOWN )
.value( "DIRECTORY", TREE_DIRECTORY )
.value( "MAX", TREE_MAX );
class_<WinEDA_PrjFrame>( "TreeWindow" )
// wx Interface
.def( "ToWx", &WinEDA_PrjFrame::ToWx )
// common features
.def( "GetContextMenu", &WinEDA_PrjFrame::GetMenuPy )
.def( "GetFileExtension", &WinEDA_PrjFrame::GetFtExPy )
// file filters control
.def( "AddFilter", &WinEDA_PrjFrame::AddFilter )
.def( "ClearFilters", &WinEDA_PrjFrame::ClearFilters )
.def( "RemoveFilter", &WinEDA_PrjFrame::RemoveFilterPy )
.def( "GetFilters", &WinEDA_PrjFrame::GetFilters, return_value_policy < copy_const_reference >() )
.def( "GetCurrentMenu", &WinEDA_PrjFrame::GetCurrentMenu )
// wx Interface
.def( "ToWx", &WinEDA_PrjFrame::ToWx )
// common features
.def( "GetContextMenu", &WinEDA_PrjFrame::GetMenuPy )
.def( "GetFileExtension", &WinEDA_PrjFrame::GetFtExPy )
// file filters control
.def( "AddFilter", &WinEDA_PrjFrame::AddFilter )
.def( "ClearFilters", &WinEDA_PrjFrame::ClearFilters )
.def( "RemoveFilter", &WinEDA_PrjFrame::RemoveFilterPy )
.def( "GetFilters", &WinEDA_PrjFrame::GetFilters,
return_value_policy < copy_const_reference >() )
.def( "GetCurrentMenu", &WinEDA_PrjFrame::GetCurrentMenu )
/** Project tree control **/
/** Project tree control **/
// AddState
.def( "AddState",
&WinEDA_PrjFrame::AddStatePy )
// AddState
.def( "AddState",
&WinEDA_PrjFrame::AddStatePy )
// GetTreeCtrl
.def( "GetTreeCtrl",
&WinEDA_PrjFrame::GetTreeCtrl )
// GetTreeCtrl
.def( "GetTreeCtrl",
&WinEDA_PrjFrame::GetTreeCtrl )
// GetItemData
.def( "GetItemData",
&WinEDA_PrjFrame::GetItemData,
return_value_policy < reference_existing_object >() )
// GetItemData
.def( "GetItemData",
&WinEDA_PrjFrame::GetItemData,
return_value_policy < reference_existing_object >() )
// FindItemData
.def( "FindItemData",
&WinEDA_PrjFrame::FindItemData,
return_value_policy < reference_existing_object >() )
// FindItemData
.def( "FindItemData",
&WinEDA_PrjFrame::FindItemData,
return_value_policy < reference_existing_object >() )
// NewFile
.def( "NewFile",
&WinEDA_PrjFrame::NewFilePy )
// NewFile
.def( "NewFile",
&WinEDA_PrjFrame::NewFilePy )
// AddFile
.def( "AddFile",
&WinEDA_PrjFrame::AddFilePy )
// AddFile
.def( "AddFile",
&WinEDA_PrjFrame::AddFilePy )
; /* ENDOF class_<WinEDA_PrjFrame>( "TreeWindow" ) */
class_<WinEDA_MainFrame>( "MainFrame" )
// Wx interface
.def( "ToWx", &WinEDA_MainFrame::ToWx )
// Common controls
.def( "AddFastLaunch", &WinEDA_MainFrame::AddFastLaunchPy )
.def( "Refresh", &WinEDA_MainFrame::OnRefreshPy )
.def( "GetProjectName", &WinEDA_MainFrame::GetPrjName )
.def( "GetProjectWindow", &WinEDA_MainFrame::GetTree, return_value_policy< reference_existing_object >() );
// Wx interface
.def( "ToWx", &WinEDA_MainFrame::ToWx )
// Common controls
.def( "AddFastLaunch", &WinEDA_MainFrame::AddFastLaunchPy )
.def( "Refresh", &WinEDA_MainFrame::OnRefreshPy )
.def( "GetProjectName", &WinEDA_MainFrame::GetPrjName )
.def( "GetProjectWindow", &WinEDA_MainFrame::GetTree,
return_value_policy< reference_existing_object >() );
}
/**
* @brief Common python module init
*/
@ -302,77 +357,80 @@ static void py_kicad_init()
static void py_common_init()
/*****************************************************************************/
{
def( "Print", &WinEDAPrint );
def( "Clear", &WinEDAClear );
def( "Print", &WinEDAPrint );
def( "Clear", &WinEDAClear );
}
#endif
#endif
/*****************************************************************************/
bool WinEDA_App::OnInit()
/*****************************************************************************/
{
wxImage::AddHandler(new wxPNGHandler);
WinEDA_MainFrame* frame;
InitEDA_Appl( wxT( "KiCad" ) );
g_EDA_Appl = this;
InitEDA_Appl( wxT("KiCad"));
/* init kicad */
GetSettings(); // read current setup
/* Make nameless project translatable */
wxString project_ext = _T(".pro");
wxString nameless_project = _("noname") + project_ext;
wxString project_ext = _T( ".pro" );
wxString nameless_project = _( "noname" ) + project_ext;
m_MainFrame = new WinEDA_MainFrame(this, NULL, wxT("KiCad"),
wxPoint(30,20), wxSize(600,400) );
if(argc > 1 )
m_MainFrame->m_PrjFileName = argv[1];
else if ( m_EDA_Config )
frame = new WinEDA_MainFrame( NULL, wxT( "KiCad" ),
wxPoint( 30, 20 ), wxSize( 600, 400 ) );
if( argc > 1 )
frame->m_PrjFileName = argv[1];
else if( m_EDA_Config )
{
m_MainFrame->m_PrjFileName = m_EDA_Config->Read(wxT("LastProject"),
nameless_project );
frame->m_PrjFileName = m_EDA_Config->Read( wxT( "LastProject" ),
nameless_project );
}
else
m_MainFrame->m_PrjFileName = nameless_project;
else
frame->m_PrjFileName = nameless_project;
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion();
Title += wxT(" ") + m_MainFrame->m_PrjFileName;
m_MainFrame->SetTitle(Title);
m_MainFrame->ReCreateMenuBar();
m_MainFrame->RecreateBaseHToolbar();
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
Title += wxT( " " ) + frame->m_PrjFileName;
frame->SetTitle( Title );
frame->ReCreateMenuBar();
frame->RecreateBaseHToolbar();
m_MainFrame->m_LeftWin->ReCreateTreePrj();
SetTopWindow(m_MainFrame);
frame->m_LeftWin->ReCreateTreePrj();
SetTopWindow( frame );
/* Splash screen logo */
#ifdef USE_SPLASH_IMAGE
wxString logoname( wxString(m_BinDir) + _T("logokicad.png") );
wxString logoname( wxString( m_BinDir ) + _T( "logokicad.png" ) );
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,
wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
3000, m_MainFrame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxSIMPLE_BORDER|wxSTAY_ON_TOP);
wxSplashScreen* splash = new wxSplashScreen( splash_screen,
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT,
3000,
frame,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
wxSIMPLE_BORDER | wxSTAY_ON_TOP );
}
#endif /* USE_SPLASH_IMAGE */
m_MainFrame->Show(TRUE);
m_MainFrame->Raise();
frame->Show( TRUE );
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
PyHandler::GetInstance()->AddToModule( wxT("kicad"), &py_kicad_init );
PyHandler::GetInstance()->AddToModule( wxT("common"), &py_common_init );
PyHandler::GetInstance()->AddToModule( wxT( "kicad" ), &py_kicad_init );
PyHandler::GetInstance()->AddToModule( wxT( "common" ), &py_common_init );
#endif
return TRUE;

View File

@ -52,7 +52,7 @@ private:
public:
// 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 );
~WinEDA_MainFrame();

View File

@ -24,17 +24,17 @@
// Constructor
/*****************************************************************************/
WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app,
wxWindow* parent,
WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
const wxString& title,
const wxPoint& pos,
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 line;
wxSize clientsize;
wxString msg;
wxString line;
wxSize clientsize;
wxConfig* config = wxGetApp().m_EDA_Config;
m_FrameName = wxT( "KicadFrame" );
m_VToolBar = NULL;
@ -45,12 +45,11 @@ WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size )
m_CommandWin_Height = 82;
GetSettings();
if( m_Parent->m_EDA_Config )
if( config )
{
m_Parent->m_EDA_Config->Read( wxT( "LeftWinWidth" ),
&m_LeftWin_Width );
m_Parent->m_EDA_Config->Read( wxT( "CommandWinWidth" ),
&m_CommandWin_Height );
config->Read( wxT( "LeftWinWidth" ), &m_LeftWin_Width );
config->Read( wxT( "CommandWinWidth" ), &m_CommandWin_Height );
}
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -118,13 +117,15 @@ WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size )
WinEDA_MainFrame::~WinEDA_MainFrame()
/*****************************************************************************/
{
if( m_Parent->m_EDA_Config )
{
m_LeftWin_Width = m_LeftWin->GetSize().x;
m_CommandWin_Height = m_CommandWin->GetSize().y;
m_Parent->m_EDA_Config->Write( wxT( "LeftWinWidth" ), m_LeftWin_Width );
m_Parent->m_EDA_Config->Write( wxT( "CommandWinWidth" ), m_CommandWin_Height );
}
wxConfig* config = wxGetApp().m_EDA_Config;
if( config )
{
m_LeftWin_Width = m_LeftWin->GetSize().x;
m_CommandWin_Height = m_CommandWin->GetSize().y;
config->Write( wxT( "LeftWinWidth" ), m_LeftWin_Width );
config->Write( wxT( "CommandWinWidth" ), m_CommandWin_Height );
}
}
@ -138,7 +139,7 @@ void WinEDA_MainFrame::PrintMsg( const wxString& text )
m_DialogWin->SetFont( *g_StdFont );
m_DialogWin->AppendText( text );
#ifdef DEBUG
printf("%s\n", (const char*)text.mb_str() );
printf("%s\n", (const char*)text.mb_str() );
#endif
}
@ -217,7 +218,7 @@ void WinEDA_MainFrame::OnSize( wxSizeEvent& event )
layout.LayoutFrame( this );
if( m_CommandWin )
m_CommandWin->Refresh( TRUE );
event.Skip();
}
@ -246,13 +247,13 @@ void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event )
SaveSettings();
// 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
m_Parent->m_HtmlCtrl->GetFrame()->Close( TRUE );
m_Parent->m_HtmlCtrl = NULL;
if( wxGetApp().m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active
wxGetApp().m_HtmlCtrl->GetFrame()->Close( TRUE );
wxGetApp().m_HtmlCtrl = NULL;
}
m_LeftWin->Show(false);
Destroy();
@ -278,18 +279,19 @@ void WinEDA_MainFrame::ReDraw( wxDC* DC )
void WinEDA_MainFrame::Process_Special_Functions( wxCommandEvent& event )
/**********************************************************************/
{
int id = event.GetId();
int id = event.GetId();
switch( id )
{
switch( id )
{
case ID_EXIT:
Close( TRUE );
break;
Close( TRUE );
break;
default:
DisplayError( this, wxT( "WinEDA_MainFrame::Process_Special_Functions error" ) );
break;
}
DisplayError( this,
wxT( "WinEDA_MainFrame::Process_Special_Functions error" ) );
break;
}
}
@ -383,7 +385,8 @@ void WinEDA_MainFrame::Process_Fct( wxCommandEvent& event )
break;
default:
DisplayError( this, wxT( "WinEDA_MainFrame::Process_Fct Internal Error" ) );
DisplayError( this,
wxT( "WinEDA_MainFrame::Process_Fct Internal Error" ) );
break;
}
}

View File

@ -1,6 +1,6 @@
/******************************************************************/
/* mdiframe.cpp - fonctions de la classe du type WinEDA_MainFrame */
/******************************************************************/
/******************************************************************/
/* mdiframe.cpp - fonctions de la classe du type WinEDA_MainFrame */
/******************************************************************/
#ifdef __GNUG__
#pragma implementation
@ -19,126 +19,136 @@
#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
*/
*/
{
wxString mask(wxT("*"));
wxString mask( wxT( "*" ) );
#ifdef __WINDOWS__
mask += wxT(".exe");
mask += wxT( ".exe" );
#endif
g_EDA_Appl->ReadPdfBrowserInfos();
wxString FullFileName = g_EDA_Appl->m_PdfBrowser;
FullFileName = EDA_FileSelector( _("Prefered Pdf Browser:"),
wxPathOnly(FullFileName), /* Default path */
FullFileName, /* default filename */
wxEmptyString, /* default filename extension */
mask, /* filter for filename list */
parent_frame, /* parent frame */
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */
);
if ( ! FullFileName.IsEmpty() && (g_EDA_Appl->m_PdfBrowser != FullFileName) )
{
g_EDA_Appl->m_PdfBrowser = FullFileName;
g_EDA_Appl->WritePdfBrowserInfos();
return TRUE;
}
return FALSE;
wxGetApp().ReadPdfBrowserInfos();
wxString FullFileName = wxGetApp().m_PdfBrowser;
FullFileName = EDA_FileSelector( _( "Prefered Pdf Browser:" ),
wxPathOnly( FullFileName ), /* Default path */
FullFileName, /* default filename */
wxEmptyString, /* default filename extension */
mask, /* filter for filename list */
parent_frame, /* parent frame */
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */
);
if( !FullFileName.IsEmpty() && (wxGetApp().m_PdfBrowser != FullFileName) )
{
wxGetApp().m_PdfBrowser = FullFileName;
wxGetApp().WritePdfBrowserInfos();
return TRUE;
}
return FALSE;
}
/****************************************************************/
void WinEDA_MainFrame::Process_Preferences(wxCommandEvent& event)
void WinEDA_MainFrame::Process_Preferences( wxCommandEvent& event )
/*****************************************************************/
{
int id = event.GetId();
wxString FullFileName;
wxString mask(wxT("*"));
int id = event.GetId();
wxString FullFileName;
wxString mask( wxT( "*" ) );
#ifdef __WINDOWS__
mask += wxT(".exe");
mask += wxT( ".exe" );
#endif
switch (id)
{
case ID_SELECT_DEFAULT_PDF_BROWSER:
g_EDA_Appl->m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, g_EDA_Appl->m_PdfBrowserIsDefault);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, !g_EDA_Appl->m_PdfBrowserIsDefault);
g_EDA_Appl->WritePdfBrowserInfos();
break;
switch( id )
{
case ID_SELECT_DEFAULT_PDF_BROWSER:
wxGetApp().m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check( ID_SELECT_DEFAULT_PDF_BROWSER,
wxGetApp().m_PdfBrowserIsDefault );
GetMenuBar()->Check( ID_SELECT_PREFERED_PDF_BROWSER,
!wxGetApp().m_PdfBrowserIsDefault );
wxGetApp().WritePdfBrowserInfos();
break;
case ID_SELECT_PREFERED_PDF_BROWSER:
if ( g_EDA_Appl->m_PdfBrowser.IsEmpty() )
{
DisplayError(this, _("You must choose a PDF viewer before use this option"));
ChoosePdfBrowser(this);
}
if ( g_EDA_Appl->m_PdfBrowser.IsEmpty() )
{
g_EDA_Appl->m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, TRUE);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, FALSE);
}
else
{
g_EDA_Appl->m_PdfBrowserIsDefault = FALSE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, FALSE);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, TRUE);
}
g_EDA_Appl->WritePdfBrowserInfos();
break;
case ID_SELECT_PREFERED_PDF_BROWSER:
if( wxGetApp().m_PdfBrowser.IsEmpty() )
{
DisplayError( this,
_( "You must choose a PDF viewer before use this option" ) );
ChoosePdfBrowser( this );
}
if( wxGetApp().m_PdfBrowser.IsEmpty() )
{
wxGetApp().m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check( ID_SELECT_DEFAULT_PDF_BROWSER, TRUE );
GetMenuBar()->Check( ID_SELECT_PREFERED_PDF_BROWSER, FALSE );
}
else
{
wxGetApp().m_PdfBrowserIsDefault = FALSE;
GetMenuBar()->Check( ID_SELECT_DEFAULT_PDF_BROWSER, FALSE );
GetMenuBar()->Check( ID_SELECT_PREFERED_PDF_BROWSER, TRUE );
}
wxGetApp().WritePdfBrowserInfos();
break;
case ID_SELECT_PREFERED_PDF_BROWSER_NAME:
ChoosePdfBrowser(this);
break;
case ID_SELECT_PREFERED_PDF_BROWSER_NAME:
ChoosePdfBrowser( this );
break;
case ID_SELECT_PREFERED_EDITOR:
FullFileName = EDA_FileSelector( _("Prefered Editor:"),
wxPathOnly(g_EditorName), /* Default path */
g_EditorName, /* default filename */
wxEmptyString, /* default filename extension */
mask, /* filter for filename list */
this, /* parent frame */
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */
);
if ( ( !FullFileName.IsEmpty() ) && g_EDA_Appl->m_EDA_CommonConfig)
{
g_EditorName = FullFileName;
g_EDA_Appl->m_EDA_CommonConfig->Write(wxT("Editor"), g_EditorName);
}
break;
case ID_SELECT_PREFERED_EDITOR:
FullFileName = EDA_FileSelector( _( "Prefered Editor:" ),
wxPathOnly( g_EditorName ), /* Default path */
g_EditorName, /* default filename */
wxEmptyString, /* default filename extension */
mask, /* filter for filename list */
this, /* parent frame */
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */
);
if( ( !FullFileName.IsEmpty() ) && wxGetApp().m_EDA_CommonConfig )
{
g_EditorName = FullFileName;
wxGetApp().m_EDA_CommonConfig->Write( wxT( "Editor" ),
g_EditorName );
}
break;
case ID_PREFERENCES_FONT_INFOSCREEN:
{
wxFont font = wxGetFontFromUser(this, *g_StdFont);
if ( font.Ok() )
{
int pointsize = font.GetPointSize();
*g_StdFont = font;
g_StdFontPointSize = pointsize;
g_DialogFontPointSize = pointsize;
g_FixedFontPointSize = pointsize;
m_LeftWin->ReCreateTreePrj();
m_DialogWin->SetFont(* g_StdFont);
m_DialogWin->Refresh();
}
break;
}
case ID_PREFERENCES_FONT_INFOSCREEN:
{
wxFont font = wxGetFontFromUser( this, *g_StdFont );
if( font.Ok() )
{
int pointsize = font.GetPointSize();
*g_StdFont = font;
g_StdFontPointSize = pointsize;
g_DialogFontPointSize = pointsize;
g_FixedFontPointSize = pointsize;
m_LeftWin->ReCreateTreePrj();
m_DialogWin->SetFont( *g_StdFont );
m_DialogWin->Refresh();
}
break;
}
default: DisplayError(this, wxT("WinEDA_MainFrame::Process_Preferences Internal Error") );
break;
}
default:
DisplayError( this,
wxT( "WinEDA_MainFrame::Process_Preferences Internal Error" ) );
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 );
m_Parent->SetLanguage();
wxGetApp().SetLanguageIdentifier( id );
wxGetApp().SetLanguage();
}

View File

@ -6,6 +6,7 @@
#ifdef KICAD_PYTHON
#include <pyhandler.h>
#endif
#include "fctsys.h"
#include "common.h"
#include "kicad.h"
@ -22,13 +23,15 @@ void WinEDA_MainFrame::Load_Prj_Config()
{
if( !wxFileExists( m_PrjFileName ) )
{
wxString msg = _( "Project File <" ) + m_PrjFileName + _( "> not found" );
wxString msg = _( "Project File <" ) + m_PrjFileName +
_( "> not found" );
DisplayError( this, msg );
return;
}
wxSetWorkingDirectory( wxPathOnly( m_PrjFileName ) );
SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) + m_PrjFileName );
SetTitle( g_Main_Title + wxT( " " ) + GetBuildVersion() + wxT( " " ) +
m_PrjFileName );
ReCreateMenuBar();
m_LeftWin->ReCreateTreePrj();
@ -38,7 +41,7 @@ void WinEDA_MainFrame::Load_Prj_Config()
#ifdef KICAD_PYTHON
PyHandler::GetInstance()->TriggerEvent( wxT( "kicad::LoadProject" ),
PyHandler::Convert( m_PrjFileName ) );
PyHandler::Convert( m_PrjFileName ) );
#endif
}
@ -57,21 +60,19 @@ void WinEDA_MainFrame::Save_Prj_Config()
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector( _( "Save project file" ),
wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
if( FullFileName.IsEmpty() )
return;
/* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, wxT( "/general" ), CfgParamList );
wxGetApp().WriteProjectConfig( FullFileName, wxT( "/general" ),
CfgParamList );
}
// vim: set tabstop=4 : noexpandtab :

View File

@ -23,11 +23,10 @@
/*******************************/
BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame )
COMMON_EVENTS_DRAWFRAME EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
COMMON_EVENTS_DRAWFRAME
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
END_EVENT_TABLE()
@ -36,13 +35,12 @@ END_EVENT_TABLE()
/****************/
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
WinEDA_App* parent,
int idtype,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
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_Pcb = NULL;
@ -53,7 +51,8 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
m_DisplayModEdge = FILLED; // How to show module drawings
m_DisplayModText = FILLED; // How to show module texts
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();
}
@ -174,10 +173,10 @@ void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
}
#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 );
#else
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, m_Parent, _( "3D Viewer" ) );
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) );
#endif
// Show the frame
m_Draw3DFrame->Show( TRUE );

View File

@ -4,7 +4,6 @@
/****************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
@ -23,8 +22,10 @@
/* Fonctions exportees */
/* Fonctions Locales */
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static int MarkItemsInBloc( MODULE* module,
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
static int MarkItemsInBloc( MODULE* module,
EDA_Rect& Rect );
static void ClearMarkItems( MODULE* module );
@ -193,7 +194,9 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
SetToolID( m_ID_current_state,
DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
DrawPanel->Refresh( TRUE );
}
@ -278,7 +281,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
SetCurItem( NULL );
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,
BASE_SCREEN* screen = panel->GetScreen();
BOARD_ITEM* item;
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;
GRSetDrawMode( DC, g_XorMode );
@ -340,8 +346,10 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
}
/* Redessin nouvel affichage */
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
PtBlock->m_MoveVector.x = screen->m_Curseur.x -
PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y -
PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( DC, g_XorMode );
PtBlock->Offset( PtBlock->m_MoveVector );
@ -413,7 +421,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() )
{
case TYPE_TEXTE_MODULE:
TEXTE_MODULE* textm;
TEXTE_MODULE * textm;
textm = new TEXTE_MODULE( module );
textm->Copy( (TEXTE_MODULE*) item );
textm->m_Selected = IS_SELECTED;
@ -421,7 +429,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
break;
case TYPE_EDGE_MODULE:
EDGE_MODULE* edge;
EDGE_MODULE * edge;
edge = new EDGE_MODULE( module );
edge->Copy( (EDGE_MODULE*) item );
edge->m_Selected = IS_SELECTED;
@ -429,7 +437,8 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
break;
default:
DisplayError( NULL, wxT( "Internal Err: CopyMarkedItems: type indefini" ) );
DisplayError( NULL,
wxT( "Internal Err: CopyMarkedItems: type indefini" ) );
break;
}
}
@ -455,8 +464,8 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
{
if( pad->m_Selected == 0 )
continue;
pad->GetPosition().x += offset.x;
pad->GetPosition().y += offset.y;
pad->GetPosition().x += offset.x;
pad->GetPosition().y += offset.y;
pad->m_Pos0.x += offset.x;
pad->m_Pos0.y += offset.y;
}
@ -470,24 +479,24 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() )
{
case TYPE_TEXTE_MODULE:
( (TEXTE_MODULE*) item )->GetPosition().x += offset.x;
( (TEXTE_MODULE*) item )->GetPosition().y += offset.y;
( (TEXTE_MODULE*) item )->GetPosition().x += offset.x;
( (TEXTE_MODULE*) item )->GetPosition().y += offset.y;
( (TEXTE_MODULE*) item )->m_Pos0.x += offset.x;
( (TEXTE_MODULE*) item )->m_Pos0.y += offset.y;
break;
case TYPE_EDGE_MODULE:
( (EDGE_MODULE*) item )->m_Start.x += offset.x;
( (EDGE_MODULE*) item )->m_Start.y += offset.y;
( (EDGE_MODULE*) item )->m_Start.x += offset.x;
( (EDGE_MODULE*) item )->m_Start.y += offset.y;
( (EDGE_MODULE*) item )->m_End.x += offset.x;
( (EDGE_MODULE*) item )->m_End.y += offset.y;
( (EDGE_MODULE*) item )->m_End.x += offset.x;
( (EDGE_MODULE*) item )->m_End.y += offset.y;
( (EDGE_MODULE*) item )->m_Start0.x += offset.x;
( (EDGE_MODULE*) item )->m_Start0.y += offset.y;
( (EDGE_MODULE*) item )->m_End0.x += offset.x;
( (EDGE_MODULE*) item )->m_End0.y += offset.y;
( (EDGE_MODULE*) item )->m_End0.x += offset.x;
( (EDGE_MODULE*) item )->m_End0.y += offset.y;
break;
default:
@ -506,10 +515,10 @@ void DeleteMarkedItems( MODULE* module )
/* Delete marked items
*/
{
BOARD_ITEM* item;
BOARD_ITEM* next_item;
D_PAD* pad;
D_PAD* next_pad;
BOARD_ITEM* item;
BOARD_ITEM* next_item;
D_PAD* pad;
D_PAD* next_pad;
if( module == NULL )
return;
@ -553,10 +562,10 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
if( pad->m_Selected == 0 )
continue;
SETMIRROR( pad->GetPosition().x );
pad->m_Pos0.x = pad->GetPosition().x;
pad->m_Pos0.x = pad->GetPosition().x;
pad->m_Offset.x = -pad->m_Offset.x;
pad->m_DeltaSize.x = -pad->m_DeltaSize.x;
pad->m_Orient = 1800 - pad->m_Orient;
pad->m_Orient = 1800 - pad->m_Orient;
NORMALIZE_ANGLE( pad->m_Orient );
}
@ -570,15 +579,19 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
{
case TYPE_EDGE_MODULE:
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 );
( (EDGE_MODULE*) item )->m_End0.x = ( (EDGE_MODULE*) item )->m_End.x;
( (EDGE_MODULE*) item )->m_Angle = -( (EDGE_MODULE*) item )->m_Angle;
( (EDGE_MODULE*) item )->m_End0.x =
( (EDGE_MODULE*) item )->m_End.x;
( (EDGE_MODULE*) item )->m_Angle =
-( (EDGE_MODULE*) item )->m_Angle;
break;
case TYPE_TEXTE_MODULE:
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;
default:
@ -624,14 +637,16 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
{
case TYPE_EDGE_MODULE:
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 );
( (EDGE_MODULE*) item )->m_End0 = ( (EDGE_MODULE*) item )->m_End;
break;
case TYPE_TEXTE_MODULE:
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;
break;

View File

@ -3,6 +3,7 @@
/*****************************************************************/
/* cross-probing.cpp */
/** Handle messages between pcbnew and eeschema via a socket,
* the port number is
* KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) (eeschema to pcbnew)
@ -40,7 +41,7 @@ void RemoteCommand( const char* cmdline )
char* idcmd;
char* text;
MODULE* module = 0;
WinEDA_PcbFrame* frame = g_EDA_Appl->m_PcbFrame;
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*)wxGetApp().GetTopWindow();
strncpy( line, cmdline, sizeof(line) - 1 );
@ -86,18 +87,19 @@ void RemoteCommand( const char* cmdline )
if( pad )
{
netcode = pad->GetNet();
// put cursor on the pad:
frame->GetScreen()->m_Curseur = pad->GetPosition();
}
if( netcode > 0 ) /* highlight the pad net*/
{
g_HightLigt_Status = 1;
g_HightLigt_Status = 1;
g_HightLigth_NetCode = netcode;
}
else
{
g_HightLigt_Status = 0;
g_HightLigt_Status = 0;
g_HightLigth_NetCode = 0;
}
@ -105,12 +107,14 @@ void RemoteCommand( const char* cmdline )
msg.Printf( _( "%s not found" ), modName.GetData() );
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 );
}
else
{
msg.Printf( _( "%s pin %s found" ), modName.GetData(), pinName.GetData() );
msg.Printf( _( "%s pin %s found" ),
modName.GetData(), pinName.GetData() );
frame->SetCurItem( pad );
}
@ -151,7 +155,7 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
case TYPE_MODULE:
module = (MODULE*) objectToSync;
sprintf( cmd, "$PART: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ) );
CONV_TO_UTF8( module->m_Reference->m_Text ) );
break;
case TYPE_PAD:
@ -159,8 +163,8 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
pad = (D_PAD*) objectToSync;
msg = pad->ReturnStringPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ),
CONV_TO_UTF8( msg ) );
CONV_TO_UTF8( module->m_Reference->m_Text ),
CONV_TO_UTF8( msg ) );
break;
case TYPE_TEXTE_MODULE:
@ -176,9 +180,9 @@ void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
break;
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ),
text_key,
CONV_TO_UTF8( text_mod->m_Text ) );
CONV_TO_UTF8( module->m_Reference->m_Text ),
text_key,
CONV_TO_UTF8( text_mod->m_Text ) );
break;
default:

View File

@ -40,7 +40,7 @@ dialog_copper_zone::dialog_copper_zone( WinEDA_PcbFrame* parent, ZONE_SETTING* z
/************************************************************************************************/
{
m_Parent = parent;
m_Config = m_Parent->m_Parent->m_EDA_Config;
m_Config = wxGetApp().m_EDA_Config;
m_Zone_Setting = zone_setting;
m_NetSorting = 1; // 0 = alphabetic sort, 1 = pad count sort, and filtering net names
if( m_Config )

View File

@ -227,7 +227,7 @@ void dialog_freeroute_exchange::CreateControls()
////@end dialog_freeroute_exchange content construction
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() )
m_FreerouteURLName->SetValue( wxT( "http://www.freerouting.net/" ) );
else
@ -348,8 +348,8 @@ void dialog_freeroute_exchange::OnCloseWindow( wxCloseEvent& event )
if( m_FreeRouteSetupChanged ) // Save new config
{
m_Parent->m_Parent->m_EDA_Config->Write( FREEROUTE_URL_KEY,
m_FreerouteURLName->GetValue() );
wxGetApp().m_EDA_Config->Write( FREEROUTE_URL_KEY,
m_FreerouteURLName->GetValue() );
}
Destroy();

View File

@ -94,12 +94,12 @@ wxString title;
Create(parent, id, caption, pos, size, style);
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
title = _("from ") + wxGetApp().m_CurrentOptionFile;
SetTitle(title);
m_ListLibr->InsertItems(g_LibName_List, 0);
wxString DocModuleFileName =
g_EDA_Appl->m_EDA_CommonConfig->Read( wxT("module_doc_file"),
wxT("pcbnew/footprints.pdf"));
wxGetApp().m_EDA_CommonConfig->Read( wxT("module_doc_file"),
wxT("pcbnew/footprints.pdf"));
m_TextHelpModulesFileName->SetValue(DocModuleFileName);
}
@ -318,8 +318,8 @@ void KiConfigPcbnewFrame::SetNewOptions()
/********************************************/
{
g_UserLibDirBuffer = m_TextLibDir->GetValue();
g_EDA_Appl->m_EDA_CommonConfig->Write( wxT("module_doc_file"),
m_TextHelpModulesFileName->GetValue());
wxGetApp().m_EDA_CommonConfig->Write( wxT("module_doc_file"),
m_TextHelpModulesFileName->GetValue());
SetRealLibraryPath( wxT("modules") );
}

View File

@ -4,8 +4,6 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#include "autorout.h"
@ -174,19 +172,18 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
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,
m_Parent, _( "Module Editor" ),
wxPoint( -1,
-1 ),
wxSize( 600, 400 ) );
m_Parent->m_ModuleEditFrame->Show( TRUE );
m_Parent->m_ModuleEditFrame->Zoom_Automatique( TRUE );
_( "Module Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
m_ModuleEditFrame->Show( TRUE );
m_ModuleEditFrame->Zoom_Automatique( TRUE );
}
else
m_Parent->m_ModuleEditFrame->Iconize( FALSE );
m_ModuleEditFrame->Iconize( FALSE );
break;
case ID_NEW_PROJECT:
@ -382,7 +379,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_PLACE_MICROVIA:
if ( ! ((PCB_SCREEN*)GetScreen())->IsMicroViaAcceptable() )
if( !( (PCB_SCREEN*) GetScreen() )->IsMicroViaAcceptable() )
break;
case ID_POPUP_PCB_PLACE_VIA:
@ -399,7 +396,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
g_DesignSettings.m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay )
((PCB_SCREEN*)GetScreen())->SetRefreshReq();
( (PCB_SCREEN*) GetScreen() )->SetRefreshReq();
}
break;
@ -493,7 +490,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{
DrawPanel->MouseToCursorSchema();
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;
}
@ -501,7 +501,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{
DrawPanel->MouseToCursorSchema();
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;
}
@ -524,10 +526,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
* and start move the new corner
*/
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->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;
}
@ -542,15 +549,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_FILL_ALL_ZONES:
DrawPanel->MouseToCursorSchema();
Fill_All_Zones( );
Fill_All_Zones();
break;
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();
test_1_net_connexion( NULL, zone_container->GetNet( ));
test_1_net_connexion( NULL, zone_container->GetNet() );
GetScreen()->SetModify();
DrawPanel->Refresh();
}
@ -563,6 +570,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
ZONE_CONTAINER* zone_container = m_Pcb->GetArea( ii );
zone_container->m_FilledPolysList.clear();;
}
test_connexions( NULL );
Tst_Ratsnest( NULL, 0 ); // Recalculate the active ratsnest, i.e. the unconnected links */
GetScreen()->SetModify();
@ -572,7 +580,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_FILL_ZONE:
DrawPanel->MouseToCursorSchema();
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();
break;
@ -733,9 +741,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
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 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = itmp;
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema();
break;
@ -744,16 +753,21 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
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 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = itmp;
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
DrawPanel->MouseToCursorSchema();
break;
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 )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = itmp;
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = itmp;
break;
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
@ -763,7 +777,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TOOLBARH_PCB_SELECT_LAYER:
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 )
DrawPanel->Refresh( TRUE );
break;
@ -870,13 +885,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
{
int ii = m_SelTrackWidthBox->GetChoice();
g_DesignSettings.m_CurrentTrackWidth = g_DesignSettings.m_TrackWidthHistory[ii];
g_DesignSettings.m_CurrentTrackWidth =
g_DesignSettings.m_TrackWidthHistory[ii];
DisplayTrackSettings();
m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
g_DesignSettings.m_UseConnectedTrackWidth = false;
}
break;
break;
case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2:
@ -890,13 +906,15 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
g_DesignSettings.m_UseConnectedTrackWidth = false;
{
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();
}
break;
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;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
@ -910,12 +928,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
{
int ii = m_SelViaSizeBox->GetChoice();
g_DesignSettings.m_CurrentViaSize = g_DesignSettings.m_ViaSizeHistory[ii];
g_DesignSettings.m_CurrentViaSize =
g_DesignSettings.m_ViaSizeHistory[ii];
DisplayTrackSettings();
m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
}
break;
break;
case ID_POPUP_PCB_SELECT_VIASIZE1:
case ID_POPUP_PCB_SELECT_VIASIZE2:
@ -989,11 +1008,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
{
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" ) );
GetAssociatedDocument( this, wxEmptyString, msg );
}
break;
break;
case ID_MENU_ARCHIVE_NEW_MODULES:
Archive_Modules( wxEmptyString, TRUE );
@ -1004,7 +1023,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
default:
DisplayError( this, wxT( "WinEDA_PcbFrame::Process_Special_Functions() id error" ) );
DisplayError( this,
wxT( "WinEDA_PcbFrame::Process_Special_Functions() id error" ) );
break;
}
@ -1106,7 +1126,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
Item->Type() );
DisplayError( this, Line );
}
break;
break;
}
}

View File

@ -4,7 +4,6 @@
/************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
@ -26,35 +25,35 @@ bool GoToEditor = FALSE;
/*******************************************************************/
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
* du module*/
{
WinEDA_ModulePropertiesFrame* frame = new WinEDA_ModulePropertiesFrame( this,
Module, DC, pos );
WinEDA_ModulePropertiesFrame* frame =
new WinEDA_ModulePropertiesFrame( this, Module, DC, pos );
frame->ShowModal(); frame->Destroy();
if( GoToEditor && GetScreen()->GetCurItem() )
{
if( m_Parent->m_ModuleEditFrame == NULL )
if( m_ModuleEditFrame == NULL )
{
m_Parent->m_ModuleEditFrame = new WinEDA_ModuleEditFrame( this,
m_Parent, _( "Module Editor" ),
wxPoint( -1,
-1 ),
wxSize( 600, 400 ) );
m_ModuleEditFrame = new WinEDA_ModuleEditFrame( this,
_( "Module Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
}
m_Parent->m_ModuleEditFrame->Load_Module_Module_From_BOARD(
m_ModuleEditFrame->Load_Module_Module_From_BOARD(
(MODULE*) GetScreen()->GetCurItem() );
SetCurItem( NULL );
GoToEditor = FALSE;
m_Parent->m_ModuleEditFrame->Show( TRUE );
m_Parent->m_ModuleEditFrame->Iconize( FALSE );
m_ModuleEditFrame->Show( TRUE );
m_ModuleEditFrame->Iconize( FALSE );
}
}
@ -75,7 +74,8 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC )
if( pt_mod == NULL )
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;
deltaY = pt_mod->m_Pos.y - GetScreen()->m_Curseur.y;

View File

@ -207,7 +207,7 @@ void WinEDA_PcbFrame::InstallDrillFrame( wxCommandEvent& event )
/* 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 )
{
@ -233,7 +233,7 @@ void WinEDA_DrillFrame::UpdateConfig()
{
SetParams();
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config;
wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config )
{
Config->Write( ZerosFormatKey, s_Zeros_Format );

View File

@ -5,7 +5,6 @@
/* Fichier LIBRAIRI.CPP */
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
@ -52,7 +51,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
bool Footprint_Is_GPCB_Format = false;
wxString mask = wxT("*.*;"); mask += EXT_CMP_MASK;
wxString LastOpenedPathForLoading;
wxConfig* Config = m_Parent->m_EDA_Config;
wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config )
Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading );
@ -154,7 +153,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
char Line[1025];
FILE* dest;
wxString msg, path;
wxConfig* Config = m_Parent->m_EDA_Config;
wxConfig* Config = wxGetApp().m_EDA_Config;
if( ptmod == NULL )
return;

View File

@ -43,17 +43,14 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
/***************************************************************************/
{
MODULE* NewModule;
WinEDA_BasePcbFrame* parent = (WinEDA_BasePcbFrame*) GetParent();
if( Module == NULL )
{
if( m_Parent->m_PcbFrame == NULL )
return;
if( m_Parent->m_PcbFrame->m_Pcb == NULL )
return;
if( m_Parent->m_PcbFrame->m_Pcb->m_Modules == NULL )
if( parent->m_Pcb == NULL || parent->m_Pcb->m_Modules == NULL )
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 )

View File

@ -167,7 +167,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
// Creation des selections des anciens fichiers
m_FilesMenu->AppendSeparator();
int max_file = m_Parent->m_LastProjectMaxCount;
int max_file = wxGetApp().m_LastProjectMaxCount;
for ( ii = 0; ii < max_file; ii++ )
{
if ( GetLastProject(ii).IsEmpty() ) break;
@ -201,7 +201,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
// Font selection and setup
AddFontSelectionMenu(configmenu);
m_Parent->SetLanguageList(configmenu);
wxGetApp().SetLanguageList(configmenu);
configmenu->AppendSeparator();
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save Preferences"),
@ -327,7 +327,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
else // simple mise a jour de la liste des fichiers anciens
{
wxMenuItem * item;
int max_file = m_Parent->m_LastProjectMaxCount;
int max_file = wxGetApp().m_LastProjectMaxCount;
for ( ii = max_file-1; ii >=0 ; ii-- )
{
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )

View File

@ -247,7 +247,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
{
// update module in the current board,
// 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;
MODULE* source_module = NULL;
MODULE* module_in_edit = m_Pcb->m_Modules;

View File

@ -146,14 +146,15 @@ END_EVENT_TABLE()
/****************/
WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) :
WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME,
WinEDA_BasePcbFrame( father, MODULE_EDITOR_FRAME,
wxEmptyString, pos, size, style )
{
wxConfig* config = wxGetApp().m_EDA_Config;
m_FrameName = wxT( "ModEditFrame" );
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
@ -183,11 +184,11 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
GetSettings();
wxSize GridSize( 500, 500 );
if( m_Parent && m_Parent->m_EDA_Config )
if( config )
{
long SizeX, SizeY;
if( m_Parent->m_EDA_Config->Read( wxT( "ModEditGrid_X" ), &SizeX )
&& m_Parent->m_EDA_Config->Read( wxT( "ModEditGrid_Y" ), &SizeY ) )
if( config->Read( wxT( "ModEditGrid_X" ), &SizeX )
&& config->Read( wxT( "ModEditGrid_Y" ), &SizeY ) )
{
GridSize.x = SizeX;
GridSize.y = SizeY;
@ -211,7 +212,8 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
/****************************************************/
{
m_Parent->m_ModuleEditFrame = NULL;
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*)GetParent();
frame->m_ModuleEditFrame = NULL;
SetBaseScreen( ScreenPcb );
}
@ -220,6 +222,8 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
/**************************************************************/
{
wxConfig* config = wxGetApp().m_EDA_Config;
if( GetScreen()->IsModify() )
{
if( !IsOK( this, _( "Module Editor: Module modified! Continue?" ) ) )
@ -229,13 +233,11 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
}
SaveSettings();
if( m_Parent && m_Parent->m_EDA_Config )
if( config )
{
wxSize GridSize = GetScreen()->GetGrid();
m_Parent->m_EDA_Config->Write( wxT( "ModEditGrid_X" ),
(long) GridSize.x );
m_Parent->m_EDA_Config->Write( wxT( "ModEditGrid_Y" ),
(long) GridSize.y );
config->Write( wxT( "ModEditGrid_X" ), (long) GridSize.x );
config->Write( wxT( "ModEditGrid_Y" ), (long) GridSize.y );
}
Destroy();
}
@ -247,6 +249,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
{
size_t i;
bool active, islib = TRUE;
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) wxGetApp().GetTopWindow();
if( m_HToolBar == NULL )
return;
@ -269,9 +272,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
MODULE* module_in_edit = m_Pcb->m_Modules;
if( module_in_edit && module_in_edit->m_Link ) // this is not a new module ...
{
WinEDA_PcbFrame* pcbframe = m_Parent->m_PcbFrame;
BOARD* mainpcb = pcbframe->m_Pcb;
MODULE* source_module = mainpcb->m_Modules;
BOARD* mainpcb = frame->m_Pcb;
MODULE* source_module = mainpcb->m_Modules;
// search if the source module was not deleted:
for( ; source_module != NULL; source_module = source_module->Next() )
@ -303,7 +305,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
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 );
}

View File

@ -12,7 +12,6 @@
#include "pcbcfg.h"
#include "worksheet.h"
#include "id.h"
#include "hotkeys_basic.h"
#include "hotkeys.h"
#include "protos.h"
@ -27,12 +26,12 @@
void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
/***********************************************************/
{
int id = event.GetId();
wxPoint pos;
int id = event.GetId();
wxPoint pos;
wxClientDC dc( DrawPanel );
wxString FullFileName;
wxString FullFileName;
DrawPanel->PrepareGraphicContext( &dc );
@ -69,14 +68,14 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
FullFileName = GetScreen()->m_FileName.AfterLast( '/' );
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector( _( "Read config file" ),
wxPathOnly( GetScreen()->m_FileName ), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
FullFileName, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */
);
wxPathOnly( GetScreen()->m_FileName ), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
FullFileName, /* Masque d'affichage */
this,
wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */
);
if( FullFileName.IsEmpty() )
break;
if( !wxFileExists( FullFileName ) )
@ -92,7 +91,9 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile( FullFileName, s_Pcbnew_Editor_Hokeys_Descr, true );
WriteHotkeyConfigFile( FullFileName,
s_Pcbnew_Editor_Hokeys_Descr,
true );
break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
@ -104,7 +105,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
AddDelimiterString(FullFileName);
AddDelimiterString( FullFileName );
wxString editorname = GetEditorName();
if( !editorname.IsEmpty() )
ExecuteFile( this, editorname, FullFileName );
@ -121,7 +122,8 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
break;
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 )
* Read the hotkey files config for pcbnew and module_edit
*/
{
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
wxString FullFileName = ReturnHotkeyConfigFilePath(
g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME;
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 );
}
@ -147,11 +152,11 @@ bool Read_Config( const wxString& project_name )
/*************************************************************************/
/* lit la configuration, si elle n'a pas deja ete lue
* 1 - lit <nom fichier brd>.pro
* 2 - si non trouve lit <chemin de *.exe>/kicad.pro
* 3 - si non trouve: init des variables aux valeurs par defaut
* 1 - lit <nom fichier brd>.pro
* 2 - si non trouve lit <chemin de *.exe>/kicad.pro
* 3 - si non trouve: init des variables aux valeurs par defaut
*
* Retourne TRUE si lu, FALSE si config non lue ou non modifiée
* Retourne TRUE si lu, FALSE si config non lue ou non modifiée
*/
{
wxString FullFileName;
@ -164,8 +169,8 @@ bool Read_Config( const wxString& project_name )
/* Init des valeurs par defaut */
g_LibName_List.Clear();
g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE );
wxGetApp().ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE );
/* Traitement des variables particulieres: */
@ -177,8 +182,10 @@ bool Read_Config( const wxString& project_name )
ScreenPcb->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER );
}
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
g_DesignSettings.m_TrackWidthHistory[0] =
g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_ViaSizeHistory[0] =
g_DesignSettings.m_CurrentViaSize;
for( ii = 1; ii < HISTORY_NUMBER; ii++ )
{
g_DesignSettings.m_TrackWidthHistory[ii] = 0;
@ -202,19 +209,20 @@ void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector( _( "Save preferences" ),
wxPathOnly( GetScreen()->m_FileName ), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
displayframe,
wxFD_SAVE,
TRUE
);
wxPathOnly( GetScreen()->m_FileName ), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */
mask, /* Masque d'affichage */
displayframe,
wxFD_SAVE,
TRUE
);
if( FullFileName.IsEmpty() )
return;
Pcbdiv_grille = GetScreen()->m_Diviseur_Grille;
/* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig( FullFileName, wxT( "/pcbnew" ), ParamCfgList );
wxGetApp().WriteProjectConfig( FullFileName, wxT( "/pcbnew" ),
ParamCfgList );
}

View File

@ -191,12 +191,14 @@ END_EVENT_TABLE()
/* Constructeur */
/****************/
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos, const wxSize& size,
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_AboutTitle = g_PcbnewAboutTitle;
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
@ -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 );
wxSize GridSize( 500, 500 );
wxConfig * config = NULL;
if( m_Parent && m_Parent->m_EDA_Config )
if( config )
{
long SizeX, SizeY;
config = m_Parent->m_EDA_Config;
if( config->Read( wxT( "PcbEditGrid_X" ), &SizeX )
&& config->Read( wxT( "PcbEditGrid_Y" ), &SizeY ) )
@ -268,7 +269,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_PcbFrame::~WinEDA_PcbFrame()
/************************************/
{
m_Parent->m_PcbFrame = NULL;
SetBaseScreen( ScreenPcb );
delete m_drc;
@ -283,6 +283,7 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
/********************************************************/
{
PCB_SCREEN* screen;
wxConfig * config = wxGetApp().m_EDA_Config;
DrawPanel->m_AbortRequest = TRUE;
@ -331,9 +332,8 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
SetBaseScreen( ActiveScreen = ScreenPcb );
SaveSettings();
if( m_Parent && m_Parent->m_EDA_Config )
if( config )
{
wxConfig * config = m_Parent->m_EDA_Config;
wxSize GridSize = GetScreen()->GetGrid();
config->Write( wxT( "PcbEditGrid_X" ), (long) GridSize.x );
config->Write( wxT( "PcbEditGrid_Y" ), (long) GridSize.y );

View File

@ -7,7 +7,6 @@
#include "fctsys.h"
#include <wx/image.h>
#include <wx/file.h>
#include "common.h"
@ -34,9 +33,9 @@ IMPLEMENT_APP( WinEDA_App )
bool WinEDA_App::OnInit()
/****************************/
{
wxString FFileName;
wxString FFileName;
WinEDA_PcbFrame* frame = NULL;
g_EDA_Appl = this;
InitEDA_Appl( wxT( "pcbnew" ) );
if( m_Checker && m_Checker->IsAnotherRunning() )
@ -56,9 +55,9 @@ bool WinEDA_App::OnInit()
Read_Config( FFileName );
g_DrawBgColor = BLACK;
Read_Hotkey_Config( m_PcbFrame, false ); /* Must be called before creating the main frame
* in order to display the real hotkeys
* in menus or tool tips */
Read_Hotkey_Config( frame, false ); /* Must be called before creating the
* main frame in order to display the
* real hotkeys in menus or tool tips */
/* allocation de la memoire pour le fichier et autres buffers: */
@ -72,29 +71,29 @@ bool WinEDA_App::OnInit()
printf( "No Memory, Fatal err Memory alloc\n" );
return FALSE;
}
m_PcbFrame = new WinEDA_PcbFrame( NULL, this, wxT( "PcbNew" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
frame = new WinEDA_PcbFrame( NULL, wxT( "PcbNew" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
m_PcbFrame->SetTitle( Title );
ActiveScreen = ScreenPcb;
frame->SetTitle( Title );
ActiveScreen = ScreenPcb;
SetTopWindow( m_PcbFrame );
m_PcbFrame->Show( TRUE );
SetTopWindow( frame );
frame->Show( TRUE );
if( CreateServer( m_PcbFrame, KICAD_PCB_PORT_SERVICE_NUMBER ) )
if( CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER ) )
{
SetupServerFunction( RemoteCommand );
}
m_PcbFrame->Zoom_Automatique( TRUE );
frame->Zoom_Automatique( TRUE );
/* Load file specified in the command line. */
if( !FFileName.IsEmpty() )
{
m_PcbFrame->LoadOnePcbFile( FFileName, FALSE );
frame->LoadOnePcbFile( FFileName, FALSE );
// update the layer names in the listbox
m_PcbFrame->ReCreateLayerBox( NULL );
frame->ReCreateLayerBox( NULL );
}
return TRUE;

View File

@ -3,7 +3,6 @@
/***********************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "plot_common.h"
@ -166,7 +165,7 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
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 );
@ -607,7 +606,8 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
m_XScaleAdjust = m_FineAdjustXscaleOpt->GetValue();
m_YScaleAdjust = m_FineAdjustYscaleOpt->GetValue();
wxConfig* config = m_Parent->m_Parent->m_EDA_Config;
wxConfig* config = wxGetApp().m_EDA_Config;
if( config )
{
config->Write( OPTKEY_EDGELAYER_GERBER, g_Exclude_Edges_Pcb );

View File

@ -6,7 +6,6 @@
#include <algorithm> // sort
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"

View File

@ -534,9 +534,9 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
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 );
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 );
dialog_copper_zone* frame = new dialog_copper_zone( this, &g_Zone_Default_Setting );

View File

@ -134,9 +134,9 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
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 );
}

View File

@ -61,7 +61,7 @@ WinEDA_PrintFrame::WinEDA_PrintFrame( WinEDA_DrawFrame* parent, wxWindowID id, c
m_Parent = parent;
m_XScaleAdjust = m_YScaleAdjust = 1.0;
m_PagesOption = NULL;
wxConfig * Config = m_Parent->m_Parent->m_EDA_Config;
wxConfig * Config = wxGetApp().m_EDA_Config;
if ( Config )
{
Config->Read(wxT("PrintPenWidth"), &s_PrintPenMinWidth);

View File

@ -39,10 +39,10 @@
/*******************************************************/
WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
WinEDA_App* parent, const wxString& title,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style ) :
WinEDA_BasicFrame( father, idtype, parent, title, pos, size, style )
WinEDA_BasicFrame( father, idtype, title, pos, size, style )
{
wxSize minsize;
@ -119,7 +119,7 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
/****************************************/
{
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 );
}
@ -869,8 +869,8 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
{
int id = event.GetId();
m_Parent->SetLanguageIdentifier( id );
m_Parent->SetLanguage();
wxGetApp().SetLanguageIdentifier( id );
wxGetApp().SetLanguage();
}

View File

@ -137,7 +137,7 @@ WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame( WinEDA_DrawFrame* parent,
{
m_Parent = parent;
m_ImageXSize_mm = 270;
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config;
wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config )
{
Config->Read( PLOTSVGPENWIDTH_KEY, &s_SVGPenMinWidth );
@ -519,7 +519,7 @@ void WinEDA_PrintSVGFrame::OnCancelClick( wxCommandEvent& event )
void WinEDA_PrintSVGFrame::OnCloseWindow( wxCloseEvent& event )
{
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config;
wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config )
{

View File

@ -183,7 +183,7 @@ void WinEDA_PrintFrame::SetOthersDatas()
#endif
#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
m_FineAdjustXscaleOpt->SetToolTip( _( "Set X scale adjust for exact scale plotting" ) );
@ -307,7 +307,7 @@ void WinEDA_PrintFrame::OnClosePrintDialog()
/* called when WinEDA_PrintFrame is closed
*/
{
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config;
wxConfig* Config = wxGetApp().m_EDA_Config;
if( Config )
{