Commit c9356247 authored by jean-pierre charras's avatar jean-pierre charras

Use environment KISYS3DMOD to know defaut path for 3D shapes in footprint editors dialogs.

parent 788b38c0
......@@ -31,15 +31,22 @@ KiCad from source.
* bzr - Bazaar version control system
* CMake - Cross-platform make
* GLUT - The OpenGL Utility Library
* GLEW
* wxGTK or wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings
* libbz2 (dev)
* libcairo (dev)
* Boost - Collection of portable C++ source libraries
boost will be automagically downloaded and copied in kicad sources tree,
boost will be automagically downloaded, copied in kicad sources tree and patched,
the first time you compile kicad.
Useful, but not required:
* Doxygen - Documentation system for several programming languages
Required to build Kicad with scripting (using python) support:
Python
Swig
KiCad uses the Bazaar version control system to track source code changes,
and download the boost libraries needed by Kicad.
Be sure you bzr install also includes bzrtools.
......@@ -60,40 +67,43 @@ Install or Build wxWidgets
WARNING:
see wxWidgets_patch_notes.txt for patches and issues in wxWidgets.
If on Windows, download
http://sourceforge.net/projects/wxwindows/files/wxAll/2.9.3/wxWidgets-2.9.3.zip/download
On Windows, download
http://sourceforge.net/projects/wxwindows/files/3.0.0/wxWidgets-3.0.0.zip/download
or a newer version.
Do NOT use previous versions which all have annoying issues for KiCad.
Start msys so you have a bash shell.
Note also since 2.9 versions no need to build a "debug" version of the wxWidgets library,
the release abd the debug version are same.
the release and the debug version are same.
Unzip the wxWidgets zip file into the build directory. Change directories into
there, and then:
mkdir Release
cd Release
../configure --enable-unicode --enable-monolithic=no --disable-shared --with-opengl
../configure --with-opengl
make
and under Linux, but not under Windows:
sudo make install that install wxWidgets libs and headers in /usr/local/
If on linux, you can use your package manager to install the
development versions of the wxWidgets packages which include the C++ headers. An
alternative is to build static libaries from source. Verify that wx-config is in
your path by running it from a command prompt. Linux users then go to next step.
On linux, yo can also download wxWidgets 3.0 (recommandedd)
or you can use your package manager to install the
development versions of the wxWidgets packages which include the C++ headers.
The recommended way is to build wxWidgets from source, and use wxWidgets 3.0
or more recent (Older versions have a print function which does not work).
Verify that wx-config is in your path by running it from a command prompt.
Linux users then go to next step.
Install CMake
-------------
If windows, download the installation binary for windows from cmake.org.
On windows, download the installation binary for windows from cmake.org.
Install that and choose to add cmake to your path during installation. You
will have to restart and command shells for the new path to take effect.
will have to restart your command shell for the new path to take effect.
Verify that cmake is in your path by trying to run it from a command prompt.
If linux, use your package manager to install cmake. You should get cmake 2.6.4
On linux, use your package manager to install cmake. You should get cmake 2.8.4
or later. If only an older one is available in your package repository, build
cmake from source. Verify that cmake is in your path by trying to run it from a
command prompt.
......@@ -106,25 +116,42 @@ To download files from Launchpad repository, you should install bazaar (bzr) th
version control system like subversion, mercurial, git...
Launchpad repository handle 2 branches for KiCda sources:
- a testing branch (used by developers)
- a stable branch (a copy of the testing branch, when this testing branch is near a stable state))
Testing branch:
bzr branch lp:kicad kicad_testing
- a product branch (used by developers, which is most of time usable in production)
- a stable branch (a copy of the testing branch,
when the product branch is a stable state))
Remarks:
- The product branch is actively maintained
- From the product branch, you can go back to any previous version, using bzr features
- The stable branch is poorly or not maintained (and could be removed)
In order to have a working Kicad installtion, you need
- sources to build binaries
- libraries (they are not included in sources)
- documentation and translations (they are not included in sources)
product branch:
bzr branch lp:kicad kicad_src
Stable branch:
bzr branch lp:kicad/stable kicad_stable
bzr branch lp:kicad/stable kicad_src
Components and Footprints libraries
bzr branch lp:~kicad-lib-committers/kicad/library kicad_libraries
all (schematic libs, 3D shapes ...) but new footprints libraries (use Download zip tool)
https://github.com/KiCad/kicad-library/
New footprints libraries (use Download zip tool for each lib you want)
https://github.com/KiCad/ for footprint libs (*.pretty folders)
Note also Kicad is able to read on github.com/KiCad/ the *.pretty folders
without download, using github plugin.
(however the time to read them can be long)
Documentation and translations:
bzr branch lp:~kicad-developers/kicad/doc kicad_doc
Create Makefiles with CMake
---------------------------
If windows, go into your msys shell. Linux and windows users both then make
two "out of source" build directories:
On windows, go into your msys shell.
Linux and windows users both then make two "out of source" build directories:
cd <kicadSource>
mkdir -p build/release
mkdir build/debug (if you want a debug version of KiCad)
......@@ -133,10 +160,10 @@ two "out of source" build directories:
On either cmake command line shown below, you can optionally include
-DCMAKE_INSTALL_PREFIX=<finallInstallDir>
If windows, run the following command:
On windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
If linux, run instead the following command:
On linux, run instead the following command:
cmake -DCMAKE_BUILD_TYPE=Release ../../
Take a look at CMakeCache.txt, and in particular CMAKE_INSTALL_PREFIX, which
......@@ -166,18 +193,15 @@ On either cmake command line shown below, you can optionally include
Although normally you do not install the Debug binaries, you can debug them
where they were built.
If windows, run the following command:
On windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
where <wxInstallDir> is <wxWidgets path>/Release
If linux, run instead the following command:
On linux, run instead the following command:
cmake -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON ../../
Make the Debug binaries:
make
Note: that it is easy to build only a specific binary such as pcbnew alone:
make pcbnew
See ./cmake_config.txt for customizing the KiCad build setting.
......@@ -1249,6 +1249,18 @@ bool EDA_APP::Set3DShapesPath( const wxString& aKiSys3Dmod )
}
#elif defined(__UNIX__) // Linux and non-Apple Unix
// Try the home directory:
path.Empty();
wxGetEnv( wxT("${HOME}", &path )
path += wxT("/kicad/share/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
// Try the standard install path:
path = wxT("/usr/local/kicad/share/") + relpath;
if( wxFileName::DirExists( path ) )
{
......@@ -1256,6 +1268,7 @@ bool EDA_APP::Set3DShapesPath( const wxString& aKiSys3Dmod )
return true;
}
// Try the official distrib standard install path:
path = wxT("/usr/share/kicad/") + relpath;
if( wxFileName::DirExists( path ) )
{
......@@ -1264,7 +1277,11 @@ bool EDA_APP::Set3DShapesPath( const wxString& aKiSys3Dmod )
}
#else // Windows
path = m_BinDir + wxT("../share/") + relpath;
// On Windows, the install path is given by the path of executables
wxFileName fn;
fn.AssignDir( m_BinDir );
fn.RemoveLastDir();
path = fn.GetPathWithSep() + wxT("share/") + relpath;
if( wxFileName::DirExists( path ) )
{
......
......@@ -269,7 +269,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
if( aOnlyOneFile )
{
m_printMaskLayer = printMaskLayer;
suffix = wxT( "-brd" );
suffix = wxT( "brd" );
}
else
{
......
......@@ -242,6 +242,13 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
{
SetFocus();
wxString default_path;
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
#ifdef __WINDOWS__
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
m_textCtrl3DDefaultPath->SetValue( default_path );
m_LastSelected3DShapeIndex = -1;
// Init 3D shape list
......@@ -449,18 +456,25 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
wxFileName fn = fullfilename;
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* If the file path is already in the library search paths
* list, just add the library name to the list. Otherwise, add
* the library name with the full or relative path.
/* If the file path is already in the default search path
* list, just add the name to the list. Otherwise, add
* the name with the full or relative path.
* the relative path, when possible is preferable,
* because it preserve use of default libraries paths, when the path is a
* sub path of these default paths
* because it preserve use of default search path, when the path is a
* sub path
*/
shortfilename =
wxGetApp().ReturnFilenameWithRelativePathInLibPath( fullfilename );
wxFileName aux = shortfilename;
if( aux.IsAbsolute() )
wxString default_path;
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
fn.MakeRelativeTo( default_path );
// Here, we want a path relative only to the default_path
if( fn.GetPathWithSep().StartsWith( wxT("..") ) )
fn = fullfilename; // keep the full file name
shortfilename = fn.GetFullPath();
if( fn.IsAbsolute() )
{ // Absolute path, ask if the user wants a relative one
int diag = wxMessageBox(
_( "Use a relative path?" ),
......@@ -469,8 +483,8 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
if( diag == wxYES )
{ // Make it relative
aux.MakeRelativeTo( wxT(".") );
shortfilename = aux.GetPathWithSep() + aux.GetFullName();
fn.MakeRelativeTo( wxT(".") );
shortfilename = fn.GetFullPath();
}
}
......
......@@ -309,7 +309,14 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
bSizerMain3D->Add( m_staticText3Dname, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_3D_ShapeNameListBox = new wxListBox( m_Panel3D, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE );
bSizerMain3D->Add( m_3D_ShapeNameListBox, 0, wxALL|wxEXPAND, 5 );
bSizerMain3D->Add( m_3D_ShapeNameListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextDefault3DPath = new wxStaticText( m_Panel3D, wxID_ANY, _("Default Path (from KISYS3DMOD environment variable)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDefault3DPath->Wrap( -1 );
bSizerMain3D->Add( m_staticTextDefault3DPath, 0, wxRIGHT|wxLEFT, 5 );
m_textCtrl3DDefaultPath = new wxTextCtrl( m_Panel3D, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bSizerMain3D->Add( m_textCtrl3DDefaultPath, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxBoxSizer* bLowerSizer3D;
bLowerSizer3D = new wxBoxSizer( wxHORIZONTAL );
......@@ -362,7 +369,7 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
bLowerSizer3D->Add( bSizer3DButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizerMain3D->Add( bLowerSizer3D, 1, wxEXPAND, 5 );
bSizerMain3D->Add( bLowerSizer3D, 0, wxEXPAND, 5 );
m_Panel3D->SetSizer( bSizerMain3D );
......
......@@ -106,6 +106,8 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM
wxPanel* m_Panel3D;
wxStaticText* m_staticText3Dname;
wxListBox* m_3D_ShapeNameListBox;
wxStaticText* m_staticTextDefault3DPath;
wxTextCtrl* m_textCtrl3DDefaultPath;
wxBoxSizer* m_bSizerShapeScale;
wxStaticText* m_staticTextShapeScale;
wxBoxSizer* m_bSizerShapeOffset;
......
......@@ -7,10 +7,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2008-2014 Wayne Stambaugh <stambaughw@verizon.net>
* 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
......@@ -91,6 +91,14 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
{
SetFocus();
// Display the default path, given by environment variable KISYS3DMOD
wxString default_path;
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
#ifdef __WINDOWS__
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
m_textCtrl3DDefaultPath->SetValue( default_path );
m_lastSelected3DShapeIndex = -1;
// Init 3D shape list
......@@ -313,17 +321,25 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
wxFileName fn = fullfilename;
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* If the file path is already in the library search paths
* list, just add the library name to the list. Otherwise, add
* the library name with the full or relative path.
/* If the file path is already in the default search path
* list, just add the name to the list. Otherwise, add
* the name with the full or relative path.
* the relative path, when possible is preferable,
* because it preserve use of default libraries paths, when the path is a sub path of these default paths
* because it preserve use of default search path, when the path is a
* sub path
*/
shortfilename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( fullfilename );
wxFileName aux = shortfilename;
wxString default_path;
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
fn.MakeRelativeTo( default_path );
// Here, we want a path relative only to the default_path
if( fn.GetPathWithSep().StartsWith( wxT("..") ) )
fn = fullfilename; // keep the full file name
shortfilename = fn.GetFullPath();
if( aux.IsAbsolute() )
if( fn.IsAbsolute() )
{ // Absolute path, ask if the user wants a relative one
int diag = wxMessageBox(
_( "Use a relative path?" ),
......@@ -332,8 +348,8 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
if( diag == wxYES )
{ // Make it relative
aux.MakeRelativeTo( wxT( "." ) );
shortfilename = aux.GetPathWithSep() + aux.GetFullName();
fn.MakeRelativeTo( wxT( "." ) );
shortfilename = fn.GetFullPath();
}
}
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -238,12 +238,19 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
wxBoxSizer* bSizerMain3D;
bSizerMain3D = new wxBoxSizer( wxVERTICAL );
m_staticText3Dname = new wxStaticText( m_Panel3D, wxID_ANY, _("3D Shape Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3Dname = new wxStaticText( m_Panel3D, wxID_ANY, _("3D Shape Names"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3Dname->Wrap( -1 );
bSizerMain3D->Add( m_staticText3Dname, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_3D_ShapeNameListBox = new wxListBox( m_Panel3D, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE );
bSizerMain3D->Add( m_3D_ShapeNameListBox, 0, wxALL|wxEXPAND, 5 );
bSizerMain3D->Add( m_3D_ShapeNameListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextDefault3DPath = new wxStaticText( m_Panel3D, wxID_ANY, _("Default Path (from KISYS3DMOD environment variable)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDefault3DPath->Wrap( -1 );
bSizerMain3D->Add( m_staticTextDefault3DPath, 0, wxRIGHT|wxLEFT, 5 );
m_textCtrl3DDefaultPath = new wxTextCtrl( m_Panel3D, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bSizerMain3D->Add( m_textCtrl3DDefaultPath, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxBoxSizer* bLowerSizer3D;
bLowerSizer3D = new wxBoxSizer( wxHORIZONTAL );
......@@ -293,7 +300,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
bLowerSizer3D->Add( bSizer3DButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizerMain3D->Add( bLowerSizer3D, 1, wxALL|wxEXPAND, 5 );
bSizerMain3D->Add( bLowerSizer3D, 0, wxALL|wxEXPAND, 5 );
m_Panel3D->SetSizer( bSizerMain3D );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -90,6 +90,8 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM
wxPanel* m_Panel3D;
wxStaticText* m_staticText3Dname;
wxListBox* m_3D_ShapeNameListBox;
wxStaticText* m_staticTextDefault3DPath;
wxTextCtrl* m_textCtrl3DDefaultPath;
wxStaticBoxSizer* m_Sizer3DValues;
wxBoxSizer* m_bSizerShapeScale;
wxStaticText* m_staticTextShapeScale;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment