diff --git a/CMakeLists.txt b/CMakeLists.txt index 28ce819099..85ec648c38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -307,40 +307,22 @@ set( KIFACE_PREFIX "_" ) #================================================ # Locations for install targets. -set( KICAD_BIN bin - CACHE PATH "Location of KiCad binaries." ) - -set( KICAD_FP_LIB_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}" - CACHE PATH "Default path where footprint libraries are installed." ) - -if( UNIX AND NOT APPLE ) +#================================================ +if( NOT APPLE ) # Everything without leading / is relative to CMAKE_INSTALL_PREFIX. + set( KICAD_BIN bin + CACHE PATH "Location of KiCad binaries." ) set( KICAD_PLUGINS lib/kicad/plugins CACHE PATH "Location of KiCad plugins." ) set( KICAD_DATA share/kicad CACHE PATH "Location of KiCad data files." ) set( KICAD_DOCS share/doc/kicad CACHE PATH "Location of KiCad documentation files." ) - set( KICAD_FP_LIB_INSTALL_PATH "${KICAD_FP_LIB_INSTALL_PATH}/share/kicad/modules" ) -endif() - -if( MINGW ) - # Everything without leading / is relative to CMAKE_INSTALL_PREFIX. - set( KICAD_PLUGINS ${KICAD_BIN}/plugins - CACHE PATH "Location of KiCad plugins." ) - set( KICAD_DATA share - CACHE PATH "Location of KiCad data files." ) - set( KICAD_DOCS doc - CACHE PATH "Location of KiCad documentation files." ) - set( KICAD_FP_LIB_INSTALL_PATH "${KICAD_FP_LIB_INSTALL_PATH}/modules" ) -endif() - -set( KICAD_DEMOS ${KICAD_DATA}/demos - CACHE PATH "Location of KiCad demo files." ) -set( KICAD_TEMPLATE ${KICAD_DATA}/template - CACHE PATH "Location of KiCad template files." ) - -if( APPLE ) + set( KICAD_DEMOS ${KICAD_DATA}/demos + CACHE PATH "Location of KiCad demo files." ) + set( KICAD_TEMPLATE ${KICAD_DATA}/template + CACHE PATH "Location of KiCad template files." ) +else() # everything without leading / is relative to CMAKE_INSTALL_PREFIX. # CMAKE_INSTALL_PREFIX is root of .dmg image set( KICAD_BIN ${CMAKE_INSTALL_PREFIX} @@ -376,10 +358,6 @@ if( APPLE ) set( KICAD_DEMOS demos CACHE PATH "Location of KiCad demo files." FORCE ) - # used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used - # set it to correct value just in case (see common.cpp) - set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" ) - # Override default paths for fixup_bundle set( OSX_BUNDLE_OVERRIDE_PATHS " function( gp_item_default_embedded_path_override item default_embedded_path_var ) @@ -557,7 +535,9 @@ if( KICAD_SKIP_BOOST ) message( FATAL_ERROR "Boost 1.54+ libraries are required." ) endif() - add_custom_target( boost ) # it is required to meet some further dependencies + # Keeps CMake from complaining about undefined boost dependencies even though Boost was + # found. Sigh!!!!! + add_custom_target( boost ) message( WARNING " WARNING: You decided to skip building boost library. diff --git a/CMakeModules/config.h.cmake b/CMakeModules/config.h.cmake index ca228b70ea..d5aaf1843e 100644 --- a/CMakeModules/config.h.cmake +++ b/CMakeModules/config.h.cmake @@ -61,9 +61,6 @@ /// The install prefix defined in CMAKE_INSTALL_PREFIX. #define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX@" -/// Default footprint library install path when installed with `make install`. -#define DEFAULT_FP_LIB_PATH "@KICAD_FP_LIB_INSTALL_PATH@" - /// When defined, build the GITHUB_PLUGIN for pcbnew. #cmakedefine BUILD_GITHUB_PLUGIN diff --git a/INSTALL.txt b/INSTALL.txt index 0a21ae500b..208c508f73 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -24,87 +24,43 @@ Installation from binary packages Installation from binary packages for Windows --------------------------------------------- - KiCad can be installed in 'C:\kicad', 'D:\kicad', 'C:\Program files\kicad', -'D:\Program files\kicad'. +The KiCad binary archive can be installed anywhere on the system that as long as the user +has write privileges. - For example, for an installation in the folder 'C:\kicad', unzip KiCad -packages: - - kicad-{version}.zip - kicad-doc-{version}.zip - kicad-library-{version}.zip - -to the folder 'C:\kicad'. - - The main program is the project manager (kicad.exe) and from it you can run -the other programs (schematic editor - eeschema, pcb editor - pcbnew, -utilities: cvpcb and gerbview). - - You can create a shortcut to 'C:\kicad\bin\kicad.exe'. +You can create a shortcut to '${prefix}\bin\kicad.exe' where ${prefix} is the install path. Installation from binary packages for Linux ------------------------------------------- - KiCad can be installed in '/usr' or '/usr/local'. +KiCad can be installed in '/usr' or '/usr/local'. You must have "root" access for installation. - You must have "root" access for installation. +cd / +tar -xjf kicad-{version}.tbz2 +tar -xjf kicad-doc-{version}.tbz2 +tar -xjf kicad-library-{version}.tbz2 - cd / - tar -xjf kicad-{version}.tbz2 - tar -xjf kicad-doc-{version}.tbz2 - tar -xjf kicad-library-{version}.tbz2 - - The main program is '/usr/bin/kicad'. +The main program is '/usr/bin/kicad'. -Windows KiCad tree ------------------- +Linux and Windows KiCad install tree +------------------------------------- -kicad/bin - Binaries (executable files). -kicad/doc - Various documentation. -kicad/doc/help - Interactive help. -kicad/share/demos - Sample schematics and printed boards. -kicad/share/internat - Interface localization files. -kicad/share/library - Libraries for schematic. -kicad/share/modules - Module libraries for printed boards. -kicad/share/modules/packages3d - 3D component models (.wrl and .wings format). +${prefix}/bin - Binaries (executable files). +${prefix}/share/doc/kicad/ - Various documentation. +${prefix}/share/doc/kicad/help - Interactive help. +${prefix}/share/kicad/demos - Sample schematics and printed boards. +${prefix}/share/kicad/internat - Dictionaries for interface localization. +${prefix}/share/kicad/library - Interface localization files. +${prefix}/share/kicad/modules - Module libraries for printed boards. +${prefix}/share/kicad/modules/packages3d - 3D component models (.wrl and .wings format). - Files '*.mod' are libraries, and files '*.brd' are printed boards you can -view with pcbnew. - Files *.brd show the existing modules (and 3D shapes) in libraries. - - -Linux KiCad tree ----------------- -KiCad can use the Windows tree or the below tree. -When Kicad is coming from Linux distribution, the tree is: - -/usr/bin - Binaries (executable files). -/usr/share/doc/kicad/ - Various documentation. -/usr/share/doc/kicad/help - Interactive help. -/usr/share/kicad/demos - Sample schematics and printed boards. -/usr/share/kicad/internat - Dictionaries for interface localization. -/usr/share/kicad/library - Interface localization files. -/usr/share/kicad/modules - Module libraries for printed boards. -/usr/share/kicad/modules/packages3d - 3D component models (.wrl and .wings format). - -if KiCad does not found its files in usr/share, the search is made in -/usr/local/kicad -and kicad uses the same tree as the Windows KiCad tree above - -*** When KiCad comes from .tgz archive from http://iut-tice.ujf-grenoble.fr/cao/, -it must me installed in /usr/local and uses the Windows tree ***. - - - Files '*.mod' are the libraries, and files '*.brd' are printed boards you can -view with pcbnew. - Files *.brd show the existing modules (and 3D shapes) in libraries. +KiCad searches for the libraries, templates, 3D models, etc. bin/../share. Warning: -Do not change the KiCad tree, or the location of binary files, -else KiCad will not be able to find its required files (configuration, -libraries, etc.). +Do not change the KiCad tree, or the location of binary files. Otherwise +KiCad may not be able to find some or all of its required files. + Mac OS X KiCad tree ------------------- @@ -122,35 +78,35 @@ User files can be the same as the system wide files but only inside the users ho $HOME/Library/Application Support/kicad Warning: -These paths are hardcoded into KiCad, if you put them somewhere else KiCad will not find them when a new -project is created. +These paths are hardcoded into KiCad, if you put them somewhere else KiCad will not find +them when a new project is created. Installation from source code ----------------------------- Some dependencies must be satisfied for the correct installation of KiCad: -under Linux: -wxWidgets >= 2.8.11 http://www.wxwidgets.org/ -(needs to be compiled with unicode support) -under Windows:MacOSX -wxWidgets >= 2.9.4 http://www.wxwidgets.org/ -CMake >= 2.8.1 http://www.cmake.org/ +wxWidgets >= 3.0.0 http://www.wxwidgets.org/ + +CMake >= 2.8.4 http://www.cmake.org/ + Boost C++ Libraries: files used by kicad are autmatically downloaded and patched if needed from boost site ( http://www.boost.org/ ) + OpenGL Linux: Mesa 3D Graphics Library http://www.mesa3d.org/ Windows: built-in + Zlib Compression Library http://www.zlib.net/ - In source-tree-build are mostly unwanted, so make a subdir called "build" and +In source-tree-build are mostly unwanted, so make a subdir called "build" and change to it. - Call cmake with the path to KiCad. E.g., when your build-folder is "build" +Call cmake with the path to KiCad. E.g., when your build-folder is "build" within source-tree, type "cmake ../". - Now your system get checked if it is able compiling KiCad and cmake generates +Now your system get checked if it is able compiling KiCad and cmake generates the Makefiles. After calling cmake just type "make" and build begins. @@ -185,14 +141,6 @@ Required for Windows platform. -DwxWidgets_USE_DEBUG=ON Can be used only with -DCMAKE_BUILD_TYPE=Debug --DwxWidgets_USE_STATIC=ON -For building statically linked executables. Can be used only if wxWidgets -configured and builded with "--enable-monolithic --disable-shared" parameters. - --DwxWidgets_USE_STATIC=OFF -For building dinamically linked executables. Can be used only if wxWidgets -configured and builded with "--disable-monolithic --enable-shared" parameters. - -DKICAD_KEEPCASE=ON Build the KiCad with no component name conversion to uppercase (if you want your ADuC.../Si.../bq... components named as just so). @@ -207,7 +155,7 @@ When more output is wanted use this cmake parameter or call "make VERBOSE=1". Extra CFLAGS and linker flags ----------------------------- - If you require extra flags for compiler and linker you may give them via +If you require extra flags for compiler and linker you may give them via environment variables "CXXFLAGS" (c++ compiler) "LDFLAGS" (for linker) diff --git a/common/common_plotGERBER_functions.cpp b/common/common_plotGERBER_functions.cpp index 614e78520b..50d1802eb8 100644 --- a/common/common_plotGERBER_functions.cpp +++ b/common/common_plotGERBER_functions.cpp @@ -119,8 +119,7 @@ bool GERBER_PLOTTER::StartPlot() if( ! m_attribFunction.IsEmpty() ) { - fprintf( outputFile, "%%TF.FileFunction,%s*%%\n", - TO_UTF8( m_attribFunction ) ); + fprintf( outputFile, "%s\n", TO_UTF8( m_attribFunction ) ); } // Set coordinate format to 3.6 or 4.5 absolute, leading zero omitted diff --git a/eeschema/plot_schematic_DXF.cpp b/eeschema/plot_schematic_DXF.cpp index 17c25a309f..3786ee82de 100644 --- a/eeschema/plot_schematic_DXF.cpp +++ b/eeschema/plot_schematic_DXF.cpp @@ -98,9 +98,9 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef ) m_MessagesBox->AppendText( msg ); } - catch (IO_ERROR& e) + catch( IO_ERROR& e ) { - msg.Printf( _( "DXF Plotter Exception : '%s'"), wxString(e.errorText ) ); + msg.Printf( wxT( "DXF Plotter Exception : '%s'"), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); schframe->SetCurrentSheet( oldsheetpath ); schframe->GetCurrentSheet().UpdateAllScreenReferences(); diff --git a/eeschema/plot_schematic_HPGL.cpp b/eeschema/plot_schematic_HPGL.cpp index 89c6bea205..979e24f40f 100644 --- a/eeschema/plot_schematic_HPGL.cpp +++ b/eeschema/plot_schematic_HPGL.cpp @@ -195,9 +195,9 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef ) if( !aPlotAll ) break; } - catch (IO_ERROR& e) + catch( IO_ERROR& e ) { - msg.Printf( _( "HPGL Plotter Exception : '%s'"), wxString(e.errorText ) ); + msg.Printf( wxT( "HPGL Plotter Exception : '%s'"), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); } diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp index f8fa9cc4c8..0d59493fc4 100644 --- a/eeschema/plot_schematic_PDF.cpp +++ b/eeschema/plot_schematic_PDF.cpp @@ -110,10 +110,10 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef ) first_page = false; } - catch (const IO_ERROR& e) + catch( const IO_ERROR& e ) { // Cannot plot PDF file - msg.Printf( _( "PDF Plotter Exception : <%s>"), wxString(e.errorText ) ); + msg.Printf( wxT( "PDF Plotter Exception : <%s>"), GetChars( e.errorText ) ); restoreEnvironment(plotter, oldsheetpath, msg); return; } diff --git a/eeschema/plot_schematic_PS.cpp b/eeschema/plot_schematic_PS.cpp index 6e97f31f08..ce221d6795 100644 --- a/eeschema/plot_schematic_PS.cpp +++ b/eeschema/plot_schematic_PS.cpp @@ -129,9 +129,9 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef ) m_MessagesBox->AppendText( msg ); } - catch (IO_ERROR& e) + catch( IO_ERROR& e ) { - msg.Printf( _( "PS Plotter Exception : '%s'"), wxString(e.errorText ) ); + msg.Printf( wxT( "PS Plotter Exception : '%s'"), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); } diff --git a/eeschema/plot_schematic_SVG.cpp b/eeschema/plot_schematic_SVG.cpp index a929b0271b..2f8a869678 100644 --- a/eeschema/plot_schematic_SVG.cpp +++ b/eeschema/plot_schematic_SVG.cpp @@ -101,10 +101,10 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef ) m_MessagesBox->AppendText( msg ); } - catch (const IO_ERROR& e) + catch( const IO_ERROR& e ) { // Cannot plot SVG file - msg.Printf( _( "SVG Plotter Exception : '%s'" ), wxString( e.errorText ) ); + msg.Printf( wxT( "SVG Plotter Exception : '%s'" ), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); m_parent->SetCurrentSheet( oldsheetpath ); @@ -143,10 +143,10 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef ) } m_MessagesBox->AppendText( msg ); } - catch (const IO_ERROR& e) + catch( const IO_ERROR& e ) { // Cannot plot SVG file - msg.Printf( _( "SVG Plotter Exception : <%s>"), wxString(e.errorText ) ); + msg.Printf( wxT( "SVG Plotter Exception : <%s>"), GetChars( e.errorText ) ); m_MessagesBox->AppendText( msg ); return; } diff --git a/pcbnew/exporters/gen_modules_placefile.cpp b/pcbnew/exporters/gen_modules_placefile.cpp index fe90791e30..edcef62669 100644 --- a/pcbnew/exporters/gen_modules_placefile.cpp +++ b/pcbnew/exporters/gen_modules_placefile.cpp @@ -493,7 +493,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, const wxString& ref = list[ii].m_Reference; const wxString& val = list[ii].m_Value; - const wxString& pkg = list[ii].m_Module->GetFPID().Format(); + const wxString& pkg = list[ii].m_Module->GetFPID().GetFootprintName(); sprintf( line, "%-8.8s %-16.16s %-16.16s", TO_UTF8( ref ), TO_UTF8( val ), TO_UTF8( pkg ) ); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 03605e3fb1..19ca312d7b 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -79,6 +79,7 @@ #include #include +#include #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) #include @@ -211,11 +212,12 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool ) -#ifdef KICAD_SCRIPTING_WXPYTHON + + // has meaning only with KICAD_SCRIPTING_WXPYTHON enabled EVT_TOOL( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::ScriptingConsoleEnableDisable ) EVT_UPDATE_UI( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::OnUpdateScriptingConsoleState ) -#endif + // Option toolbar EVT_TOOL( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnSelectOptionToolbar ) @@ -992,34 +994,23 @@ void PCB_EDIT_FRAME::UpdateTitle() } -#if defined(KICAD_SCRIPTING_WXPYTHON) +wxSize PYTHON_CONSOLE_FRAME::m_frameSize; ///< The size of the PYTHON_CONSOLE_FRAME frame, stored during a session +wxPoint PYTHON_CONSOLE_FRAME::m_framePos; ///< The position ofPYTHON_CONSOLE_FRAME the frame, stored during a session + void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent ) { - wxMiniFrame * pythonPanelFrame = (wxMiniFrame *) findPythonConsole(); + wxWindow * pythonPanelFrame = findPythonConsole(); bool pythonPanelShown = false; if( pythonPanelFrame == NULL ) - { - long style = wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxFRAME_FLOAT_ON_PARENT; - pythonPanelFrame = new wxMiniFrame( this, wxID_ANY, wxT("Python console"), wxDefaultPosition, wxDefaultSize, - style, pythonConsoleNameId() ); - wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); - - wxWindow * pythonPanel = CreatePythonShellWindow( pythonPanelFrame ); - sizer->Add( pythonPanel, 1, wxEXPAND | wxALL, 5 ); - pythonPanelFrame->SetSizer( sizer ); - pythonPanelFrame->SetSize( wxSize( 600, 300 ) ); - pythonPanelFrame->Layout(); - pythonPanelFrame->Centre(); - } + pythonPanelFrame = new PYTHON_CONSOLE_FRAME( this, pythonConsoleNameId() ); else pythonPanelShown = pythonPanelFrame->IsShown(); pythonPanelShown = ! pythonPanelShown; pythonPanelFrame->Show( pythonPanelShown ); } -#endif void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent ) diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index b252c882db..76028d145e 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -84,9 +84,10 @@ const wxString GetGerberExtension( LAYER_NUM aLayer ) } -wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer ) +wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer, + bool aUseX1CompatibilityMode ) { - wxString attrib = wxEmptyString; + wxString attrib; switch( aLayer ) { @@ -178,11 +179,18 @@ wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer ) attrib += wxString( wxT( ",Mixed" ) ); break; default: - ; // do nothing (but avoid a warning for unhandled LAYER_T values from GCC) + break; // do nothing (but avoid a warning for unhandled LAYER_T values from GCC) } } - return attrib; + wxString fileFct; + + if( aUseX1CompatibilityMode ) + fileFct.Printf( "G04 #@! TF.FileFunction,%s*", GetChars( attrib ) ); + else + fileFct.Printf( "%%TF.FileFunction,%s*%%", GetChars( attrib ) ); + + return fileFct; } diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 3ac861bbfa..3efcef7116 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -258,9 +258,12 @@ const wxString GetGerberExtension( LAYER_NUM aLayer ); * the "%TF.FileFunction" attribute prefix and the "*%" suffix. * @param aBoard = the board, needed to get the total count of copper layers * @param aLayer = the layer number to create the attribute for + * @param aUseX1CompatibilityMode = true to use a file function attribute like G04 comment + * , compatible with X1 (rx274) notation (G04#@!TF.FileFunction) * @return The attribute, as a text string */ -extern wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer ); +extern wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer, + bool aUseX1CompatibilityMode ); // PLOTGERB.CPP void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index e320209ece..865418f556 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -1005,8 +1005,12 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, if( plotter->OpenFile( aFullFileName ) ) { // For the Gerber "file function" attribute, set the layer number - if( plotter->GetPlotterType() == PLOT_FORMAT_GERBER && plotOpts.GetUseGerberAttributes() ) - plotter->SetLayerAttribFunction( GetGerberFileFunction( aBoard, aLayer ) ); + if( plotter->GetPlotterType() == PLOT_FORMAT_GERBER ) + { + bool useX2mode = plotOpts.GetUseGerberAttributes(); + plotter->SetLayerAttribFunction( GetGerberFileFunction( aBoard, aLayer, + useX2mode ? false : true ) ); + } plotter->StartPlot(); diff --git a/pcbnew/scripting/python_console_frame.h b/pcbnew/scripting/python_console_frame.h new file mode 100644 index 0000000000..8cb9a32ddc --- /dev/null +++ b/pcbnew/scripting/python_console_frame.h @@ -0,0 +1,99 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file python_console_frame.h + */ + +#ifndef PYTHON_CONSOLE_FRAME_H_ +#define PYTHON_CONSOLE_FRAME_H_ + +#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) +#include +#endif + + +/** + * Class PYTHON_CONSOLE_FRAME is a simple derived class from wxMiniFrame + * to handle the scripting python console + */ +class PYTHON_CONSOLE_FRAME : public wxMiniFrame +{ +private: + static wxSize m_frameSize; ///< The size of the frame, stored during a session + static wxPoint m_framePos; ///< The position of the frame, stored during a session + +public: + + PYTHON_CONSOLE_FRAME( wxWindow* aParent, const wxString& aFramenameId ) + : wxMiniFrame( aParent, wxID_ANY, wxT("Python console"), wxDefaultPosition, wxDefaultSize, + wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER|wxFRAME_FLOAT_ON_PARENT, + aFramenameId ) + { + wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); + +#if defined(KICAD_SCRIPTING_WXPYTHON) + wxWindow * pythonPanel = CreatePythonShellWindow( this ); + sizer->Add( pythonPanel, 1, wxEXPAND | wxALL, 5 ); +#endif + SetSizer( sizer ); + SetMinSize( wxSize( 400, 200 ) ); + + if( m_frameSize.x <= 0 || m_frameSize.y <= 0 ) + SetSize( wxSize( 600, 300 ) ); + else + SetSize( m_frameSize ); + + if( m_framePos.x == 0 && m_framePos.y == 0 ) + Centre(); + else + SetPosition( m_framePos ); + + Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PYTHON_CONSOLE_FRAME::OnClose ) ); + } + + ~PYTHON_CONSOLE_FRAME() + { + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PYTHON_CONSOLE_FRAME::OnClose ) ); + } + +private: + + void OnClose( wxCloseEvent& event ) + { + if( !IsIconized() ) + { + m_frameSize = GetSize(); + m_framePos = GetPosition(); + } + + event.Skip(); + } +}; + +#endif // PYTHON_CONSOLE_FRAME_H_ diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index ea60a5079b..4ec9569bef 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -309,7 +309,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() _( "Fast access to the Web Based FreeROUTE advanced router" ) ); // Access to the scripting console -#ifdef KICAD_SCRIPTING_WXPYTHON +#if defined(KICAD_SCRIPTING_WXPYTHON) m_mainToolBar->AddSeparator(); m_mainToolBar->AddTool( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, wxEmptyString, @@ -631,7 +631,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox() msg = _( "Track " ) + CoordinateToString( GetDesignSettings().m_TrackWidthList[ii], true ); if( ii == 0 ) - msg << _( " *" ); + msg << wxT( " *" ); m_SelTrackWidthBox->Append( msg ); } @@ -662,7 +662,7 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox() << CoordinateToString( GetDesignSettings().m_ViasDimensionsList[ii].m_Drill, true ); if( ii == 0 ) - msg << _( " *" ); + msg << wxT( " *" ); m_SelViaSizeBox->Append( msg ); }