Rework on env. variable KISYS3DMOD. Until now, was used in different files using different ways, so no consistency between files.

code cleanup.
This commit is contained in:
jean-pierre charras 2014-08-24 09:05:07 +02:00
parent f0391648e3
commit 5a38d2b657
75 changed files with 309 additions and 460 deletions

View File

@ -77,7 +77,7 @@ const wxString S3D_MASTER::GetShape3DFullFilename()
return shapeName;
wxString default_path;
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
wxGetEnv( KISYS3DMOD, &default_path );
if( default_path.IsEmpty() )
return shapeName;

View File

@ -40,13 +40,18 @@
#include <3d_struct.h>
#include <info3d_visu.h>
#define KISYS3DMOD "KISYS3DMOD"
/// A variable name whose value holds the path of 3D shape files.
/// Currently an environment variable, eventually a project variable.
#define KISYS3DMOD wxT( "KISYS3DMOD" )
/// All 3D files are expected to be stored in LIB3D_FOLDER, or one of
/// its subdirectory.
#define LIB3D_FOLDER wxT( "packages3d" )
class EDA_3D_CANVAS;
class PCB_BASE_FRAME;
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
#define LIB3D_PATH wxT( "packages3d" )
class EDA_3D_FRAME : public KIWAY_PLAYER

View File

@ -23,49 +23,128 @@
*/
/*
* This file contains the global constants and variables used in the PCB
* applications Pcbnew, CvPcb, and GervView. The goal of this was to
* unobfuscate the original header file design that made it very difficult
* to figure out where these variables lived. Ideally, they should be pushed
* back into the application layer.
* This file contains some functions used in the PCB
* applications Pcbnew and CvPcb.
*/
#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <pcbcommon.h>
#include <plot_common.h>
#include <class_board.h>
#include <class_pad.h>
#include <class_zone_settings.h>
#include <class_board_design_settings.h>
class MODULE;
DISPLAY_OPTIONS DisplayOpt; // Display options for board items
int g_AnchorColor = BLUE;
int g_ModuleTextCMPColor = LIGHTGRAY;
int g_ModuleTextCUColor = MAGENTA;
int g_ModuleTextNOVColor = DARKGRAY;
int g_PadCUColor = GREEN;
int g_PadCMPColor = RED;
#include <3d_viewer.h>
/**
* Used in track creation, a list of track segments currently being created,
* with the newest track at the end of the list, sorted by new-ness. e.g. use
* TRACK->Back() to get the next older track, TRACK->Next() to get the next
* newer track.
* attempts to set the environment variable given by aKiSys3Dmod to a valid path.
* (typically "KISYS3DMOD" )
* If the environment variable is already set, then it left as is to respect
* the wishes of the user.
*
* The path is determined by attempting to find the path modules/packages3d
* files in kicad tree.
* This may or may not be the best path but it provides the best solution for
* backwards compatibility with the previous 3D shapes search path implementation.
*
* @note This must be called after #SetBinDir() is called at least on Windows.
* Otherwise, the kicad path is not known (Windows specific)
*
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
* @param aProcess = the current process
* @return false if the aKiSys3Dmod path is not valid.
*/
DLIST<TRACK> g_CurrentTrackList;
void AccumulateDescription( wxString &aDesc, const wxString &aItem )
bool Set3DShapesDefaultPath( const wxString& aKiSys3Dmod, const PGM_BASE* aProcess )
{
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
wxString path;
// Set the KISYS3DMOD environment variable for the current process,
// if it is not already defined in the user's environment and valid.
if( wxGetEnv( aKiSys3Dmod, &path ) && wxFileName::DirExists( path ) )
return true;
#if 1
// Try to find a valid path is standard KiCad paths
SEARCH_STACK& search = Kiface().KifaceSearch();
path = search.FindValidPath( LIB3D_FOLDER );
if( !path.IsEmpty() )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#endif
// Attempt to determine where the 3D shape libraries were installed using the
// legacy path:
// on Unix: /usr/local/kicad/share/modules/packages3d
// or /usr/share/kicad/modules/packages3d
// On Windows: bin../share/modules/packages3d
wxString relpath( wxT( "modules/" ) );
relpath += LIB3D_FOLDER;
// Apple MacOSx
#ifdef __WXMAC__
path = wxT("/Library/Application Support/kicad/modules/packages3d/");
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
path = wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT("/Library/Application Support/kicad/modules/packages3d/");
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#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 ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
// Try the official distrib standard install path:
path = wxT("/usr/share/kicad/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#else // Windows
// On Windows, the install path is given by the path of executables
wxFileName fn;
fn.AssignDir( aProcess->GetExecutablePath() );
fn.RemoveLastDir();
path = fn.GetPathWithSep() + wxT("share/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#endif
return false;
}

View File

@ -27,7 +27,6 @@
#include <fctsys.h>
#include <macros.h>
#include <gr_basic.h>
#include <pgm_base.h>
#include <project.h>
#include <common.h> // NAMELESS_PROJECT

View File

@ -53,6 +53,8 @@
#include <3d_viewer.h>
DISPLAY_OPTIONS DisplayOpt; // General display options
BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )

View File

@ -1,8 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2007 Jean-Pierre Charras, jp..charras at wanadoo.fr
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.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
@ -29,12 +30,12 @@
#include <fctsys.h>
#include <macros.h>
#include <fp_lib_table.h>
#include <gr_basic.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <wxstruct.h>
#include <confirm.h>
#include <gestfich.h>
#include <3d_viewer.h>
#include <pcbcommon.h>
#include <cvpcb.h>
#include <zones.h>
@ -50,13 +51,11 @@
COLORS_DESIGN_SETTINGS g_ColorsSettings;
// Constant string definitions for CvPcb
const wxString RetroFileExtension( wxT( "stf" ) );
const wxString FootprintAliasFileExtension( wxT( "equ" ) );
// Wildcard for schematic retroannotation (import footprint names in schematic):
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) );
#if 0 // add this logic to OpenProjectFiles()
/*
@ -165,106 +164,6 @@ PGM_BASE& Pgm()
}
/**
* Function set3DShapesPath
* attempts to set the environment variable given by aKiSys3Dmod to a valid path.
* (typically "KISYS3DMOD" )
* If the environment variable is already set,
* then it left as is to respect the wishes of the user.
*
* The path is determined by attempting to find the path modules/packages3d
* files in kicad tree.
* This may or may not be the best path but it provides the best solution for
* backwards compatibility with the previous 3D shapes search path implementation.
*
* @note This must be called after #SetBinDir() is called at least on Windows.
* Otherwise, the kicad path is not known (Windows specific)
*
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
* @return false if the aKiSys3Dmod path is not valid.
*/
static bool set3DShapesPath( const wxString& aKiSys3Dmod )
{
wxString path;
// Set the KISYS3DMOD environment variable for the current process,
// if it is not already defined in the user's environment and valid.
if( wxGetEnv( aKiSys3Dmod, &path ) && wxFileName::DirExists( path ) )
return true;
// Attempt to determine where the 3D shape libraries were installed using the
// legacy path:
// on Unix: /usr/local/kicad/share/modules/packages3d
// or /usr/share/kicad/modules/packages3d
// On Windows: bin../share/modules/packages3d
wxString relpath( wxT( "modules/packages3d" ) );
// Apple MacOSx
#ifdef __WXMAC__
path = wxT("/Library/Application Support/kicad/modules/packages3d/");
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
path = wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT("/Library/Application Support/kicad/modules/packages3d/");
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#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 ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
// Try the official distrib standard install path:
path = wxT("/usr/share/kicad/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#else // Windows
// On Windows, the install path is given by the path of executables
wxFileName fn;
fn.AssignDir( Pgm().GetExecutablePath() );
fn.RemoveLastDir();
path = fn.GetPathWithSep() + wxT("share/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#endif
return false;
}
//!!!!!!!!!!!!!!! This code is obsolete because of the merge into pcbnew, don't bother with it.
FP_LIB_TABLE GFootprintTable;
@ -282,8 +181,10 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
start_common( aCtlBits );
// Set 3D shape path from environment variable KISYS3DMOD
set3DShapesPath( wxT("KISYS3DMOD") );
// Set 3D shape path (environment variable KISYS3DMOD (if not defined or valid)
// Currently, called here, but could be moved ( OpenProjectFiles() ? )
// if KISYS3DMOD is defined in a project config file
Set3DShapesDefaultPath( KISYS3DMOD, aProgram );
/* Now that there are no *.mod files in the standard library, this function
has no utility. User should simply set the variable manually.

View File

@ -17,8 +17,6 @@
wxLC_SINGLE_SEL | wxVSCROLL | wxHSCROLL )
extern const wxString FootprintAliasFileExtension;
extern const wxString RetroFileExtension;
extern const wxString FootprintAliasFileWildcard;

View File

@ -1,3 +1,26 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.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 pcbcommon.h
*/
@ -5,31 +28,35 @@
#ifndef PCBCOMMON_H_
#define PCBCOMMON_H_
class PGM_BASE;
#include <dlist.h>
#include <layers_id_colors_and_visibility.h>
/**
* attempts to set (when not set or valid) the environment variable given by aKiSys3Dmod
* (typically "KISYS3DMOD" ) to a valid path.
* If the environment variable is already set, then it left as is to respect
* the wishes of the user.
*
* The path is determined by attempting to find the path modules/packages3d
* files in kicad tree.
* This may or may not be the best path but it provides the best solution for
* backwards compatibility with the previous 3D shapes search path implementation.
*
* @note This must be called after #SetBinDir() is called at least on Windows.
* Otherwise, the kicad path is not known (Windows specific)
*
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
* @param aProcess = the current process
* @return false if the aKiSys3Dmod path is not valid.
*/
bool Set3DShapesDefaultPath( const wxString& aKiSys3Dmod, const PGM_BASE* aProcess );
#define MIN_DRAW_WIDTH 1 ///< Minimum trace drawing width.
class D_PAD;
class TRACK;
class BOARD;
class DISPLAY_OPTIONS;
extern DISPLAY_OPTIONS DisplayOpt;
extern int g_CurrentVersionPCB;
/// List of segments of the trace currently being drawn.
extern DLIST<TRACK> g_CurrentTrackList;
#define g_CurrentTrackSegment g_CurrentTrackList.GetLast() ///< most recently created segment
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
/// Utility for comma separated lists
void AccumulateDescription( wxString &aDesc, const wxString &aItem );
inline void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}
#endif // PCBCOMMON_H_

View File

@ -37,7 +37,6 @@
#include <wxPcbStruct.h>
#include <gr_basic.h>
#include <macros.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <autorout.h>

View File

@ -34,7 +34,6 @@
#include <common.h>
#include <macros.h>
#include <trigo.h>
#include <pcbcommon.h>
#include <math_for_graphics.h>
#include <class_board.h>
#include <class_track.h>

View File

@ -32,7 +32,6 @@
#include <fctsys.h>
#include <common.h>
#include <pcbcommon.h>
#include <pcbnew.h>
#include <cell.h>

View File

@ -39,7 +39,6 @@
#include <wxPcbStruct.h>
#include <gr_basic.h>
#include <macros.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_track.h>

View File

@ -31,9 +31,7 @@
#include <fctsys.h>
#include <kiface_i.h>
#include <wxstruct.h>
#include <pcbcommon.h>
#include <confirm.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <dialog_helpers.h>
#include <kicad_device_context.h>

View File

@ -33,7 +33,6 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <block_commande.h>
#include <pcbcommon.h>
#include <wxPcbStruct.h>
#include <trigo.h>

View File

@ -36,7 +36,6 @@
#include <fctsys.h>
#include <common.h>
#include <kicad_string.h>
#include <pcbcommon.h>
#include <wxBasePcbFrame.h>
#include <msgpanel.h>
#include <pcb_netlist.h>

View File

@ -31,7 +31,6 @@
#include <fctsys.h>
#include <macros.h>
#include <gr_basic.h>
#include <pcbcommon.h>
#include <trigo.h>
#include <wxstruct.h>
#include <class_drawpanel.h>

View File

@ -38,7 +38,6 @@
#include <class_pcb_screen.h>
#include <colors_selection.h>
#include <trigo.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <pcbnew.h>

View File

@ -42,7 +42,6 @@
#include <macros.h>
#include <math_for_graphics.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <base_units.h>

View File

@ -34,7 +34,6 @@
#include <common.h>
#include <class_drawpanel.h>
#include <kicad_string.h>
#include <pcbcommon.h>
#include <colors_selection.h>
#include <trigo.h>
#include <macros.h>

View File

@ -37,7 +37,6 @@
#include <trigo.h>
#include <confirm.h>
#include <kicad_string.h>
#include <pcbcommon.h>
#include <pcbnew.h>
#include <colors_selection.h>
#include <richio.h>

View File

@ -37,7 +37,6 @@
#include <drawtxt.h>
#include <layers_id_colors_and_visibility.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <pcbnew_id.h> // ID_TRACK_BUTT
#include <pcbnew.h>
#include <class_board.h>

View File

@ -40,7 +40,6 @@
#include <pcbstruct.h> // enum PCB_VISIBLE
#include <layer_widget.h>
#include <macros.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_pcb_layer_widget.h>

View File

@ -35,7 +35,6 @@
#include <drawtxt.h>
#include <kicad_string.h>
#include <trigo.h>
#include <pcbcommon.h>
#include <colors_selection.h>
#include <richio.h>
#include <class_drawpanel.h>

View File

@ -35,7 +35,6 @@
#include <class_drawpanel.h>
#include <drawtxt.h>
#include <kicad_string.h>
#include <pcbcommon.h>
#include <colors_selection.h>
#include <richio.h>
#include <macros.h>

View File

@ -37,7 +37,6 @@
#include <class_drawpanel.h>
#include <class_pcb_screen.h>
#include <drawtxt.h>
#include <pcbcommon.h>
#include <colors_selection.h>
#include <wxstruct.h>
#include <wxBasePcbFrame.h>

View File

@ -31,7 +31,6 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <pcbcommon.h>
#include <wxPcbStruct.h>
#include <pcbnew.h>
#include <class_board.h>

View File

@ -30,7 +30,6 @@
#include <fctsys.h>
#include <common.h>
#include <pcbcommon.h>
#include <macros.h>
#include <wxBasePcbFrame.h>

View File

@ -31,7 +31,6 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <pcbnew_id.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -33,7 +33,6 @@
#include <confirm.h>
#include <wxPcbStruct.h>
#include <macros.h>
#include <pcbcommon.h>
#include <ratsnest_data.h>
#include <class_board.h>

View File

@ -36,7 +36,6 @@
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <pcbstruct.h>
#include <pcbcommon.h>
#include <pcbnew_id.h>

View File

@ -242,7 +242,7 @@ void DIALOG_MODULE_BOARD_EDITOR::ModuleOrientEvent( wxCommandEvent& event )
void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
{
wxString default_path;
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
wxGetEnv( KISYS3DMOD, &default_path );
#ifdef __WINDOWS__
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
@ -393,11 +393,6 @@ void DIALOG_MODULE_BOARD_EDITOR::On3DShapeNameSelected( wxCommandEvent& event )
}
void DIALOG_MODULE_BOARD_EDITOR::Add3DShape( wxCommandEvent& event )
{
Browse3DLib( event );
}
void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event )
{
@ -423,92 +418,72 @@ void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event )
}
void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event )
void DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile()
{
PROJECT& prj = Prj();
SEARCH_STACK& search = Kiface().KifaceSearch();
wxString fullpath;
wxString kisys3dmod = wxGetenv( wxT( KISYS3DMOD ) );
// here, the KISYS3DMOD default path for 3D shape files is expected
// to be already defined (when starting Pcbnew, it is defined
// from the user defined env variable, or set to a default value)
wxFileName fn( wxGetenv( KISYS3DMOD ), wxEmptyString );
wxString default3DPath = fn.GetPathWithSep();
if( !kisys3dmod || !wxFileName::IsDirReadable( kisys3dmod ) )
{
fullpath = search.FindValidPath( LIB3D_PATH );
}
wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
if( !fullpath )
{
fullpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
if( !fullpath )
fullpath = search.LastVisitedPath( LIB3D_PATH );
}
#ifdef __WINDOWS__
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
wxString fullfilename;
wxString shortfilename;
if( !initialpath )
initialpath = default3DPath;
wxString fileFilters = wxGetTranslation( Shapes3DFileWildcard );
fileFilters += wxChar( '|' );
fileFilters += wxGetTranslation( IDF3DFileWildcard );
fullfilename = EDA_FileSelector( _( "3D Shape:" ),
fullpath,
wxEmptyString,
wxEmptyString,
wxGetTranslation( fileFilters ),
this,
wxFD_OPEN,
true
);
wxString filename = EDA_FileSelector( _( "3D Shape:" ), initialpath,
wxEmptyString, wxEmptyString,
fileFilters, this, wxFD_OPEN, true );
if( fullfilename.IsEmpty() )
if( filename.IsEmpty() )
return;
wxFileName fn = fullfilename;
fn = filename;
prj.SetRString( PROJECT::VIEWER_3D_PATH, 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.
* 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
/* If the file path is already in the 3D shape file default path
* just add the file name relative to this path to the list.
* Otherwise, add the file name with a full or relative path.
* The relative path, when possible, is preferable
* because it preserve use of default path, when the path is a sub path of this path
*/
shortfilename = search.FilenameWithRelativePathInSearchList(
fullfilename, wxPathOnly( Prj().GetProjectFullName() ) );
wxString rootpath = filename.SubString( 0, default3DPath.Length()-1 );
bool useRelPath = rootpath.IsSameAs( default3DPath, wxFileName::IsCaseSensitive() );
wxFileName aux = shortfilename;
if( aux.IsAbsolute() )
if( useRelPath )
fn.MakeRelativeTo( default3DPath );
else // Absolute path given, not a subpath of the default path,
// therefore ask if the user wants a relative (to the default path) one
{
// Absolute path, ask if the user wants a relative one
int diag = wxMessageBox(
_( "Use a relative path?" ),
_( "Path type" ),
wxYES_NO | wxICON_QUESTION, this );
wxString msg;
msg.Printf( _( "Use a path relative to '%s'?" ), GetChars( default3DPath ) );
int diag = wxMessageBox( msg, _( "Path type" ),
wxYES_NO | wxICON_QUESTION, this );
if( diag == wxYES )
{
// Make it relative
aux.MakeRelativeTo( wxT(".") );
shortfilename = aux.GetPathWithSep() + aux.GetFullName();
}
if( diag == wxYES ) // Make it relative to the default 3D path
fn.MakeRelativeTo( default3DPath );
}
filename = fn.GetFullPath();
S3D_MASTER* new3DShape = new S3D_MASTER( NULL );
#ifdef __WINDOWS__
// Store filename in Unix notation
shortfilename.Replace( wxT( "\\" ), wxT( "/" ) );
// In Kicad files, filenames and paths are stored using Unix notation
filename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
new3DShape->SetShape3DName( shortfilename );
new3DShape->SetShape3DName( filename );
m_Shapes3D_list.push_back( new3DShape );
m_3D_ShapeNameListBox->Append( shortfilename );
m_3D_ShapeNameListBox->Append( filename );
if( m_LastSelected3DShapeIndex >= 0 )
TransfertDisplayTo3DValues( m_LastSelected3DShapeIndex );

View File

@ -31,16 +31,21 @@ public:
~DIALOG_MODULE_BOARD_EDITOR();
private:
void BrowseAndAdd3DShapeFile();
void InitBoardProperties();
void InitModeditProperties();
void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource );
void TransfertDisplayTo3DValues( int aIndexSelection );
// virtual event functions
void OnEditValue( wxCommandEvent& event );
void OnEditReference( wxCommandEvent& event );
void On3DShapeSelection( wxCommandEvent& event );
void On3DShapeNameSelected( wxCommandEvent& event );
void Browse3DLib( wxCommandEvent& event );
void Add3DShape( wxCommandEvent& event );
void Add3DShape( wxCommandEvent& event )
{
BrowseAndAdd3DShapeFile();
}
void Remove3DShape( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );

View File

@ -93,7 +93,7 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
// Display the default path, given by environment variable KISYS3DMOD
wxString default_path;
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
wxGetEnv( KISYS3DMOD, &default_path );
#ifdef __WINDOWS__
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
@ -288,88 +288,77 @@ void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
}
void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile()
{
PROJECT& prj = Prj();
SEARCH_STACK& search = Kiface().KifaceSearch();
wxString fullpath;
wxString kisys3dmod = wxGetenv( wxT( KISYS3DMOD ) );
// here, the KISYS3DMOD default path for 3D shape files is expected
// to be already defined (when starting Pcbnew, it is defined
// from the user defined env variable, or set to a default value)
wxFileName fn( wxGetenv( KISYS3DMOD ), wxEmptyString );
wxString default3DPath = fn.GetPathWithSep();
if( !kisys3dmod || !wxFileName::IsDirReadable( kisys3dmod ) )
{
fullpath = search.FindValidPath( LIB3D_PATH );
}
wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
if( !fullpath )
{
fullpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
if( !fullpath )
fullpath = search.LastVisitedPath( LIB3D_PATH );
}
if( !initialpath )
initialpath = default3DPath;
#ifdef __WINDOWS__
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
initialpath.Replace( wxT( "/" ), wxT( "\\" ) );
#endif
wxString fullfilename, shortfilename;
wxString fileFilters = wxGetTranslation( Shapes3DFileWildcard );
fileFilters += wxChar( '|' );
fileFilters += wxGetTranslation( IDF3DFileWildcard );
fullfilename = EDA_FileSelector( _( "3D Shape:" ),
fullpath,
wxEmptyString,
wxEmptyString,
wxGetTranslation( fileFilters ),
this,
wxFD_OPEN,
true
);
wxString filename = EDA_FileSelector( _( "3D Shape:" ), initialpath,
wxEmptyString, wxEmptyString,
wxGetTranslation( fileFilters ),
this, wxFD_OPEN, true );
if( fullfilename.IsEmpty() )
if( filename.IsEmpty() )
return;
wxFileName fn = fullfilename;
fn = filename;
prj.SetRString( PROJECT::VIEWER_3D_PATH, 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.
* 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
/* If the file path is already in the 3D shape file default path
* just add the file name relative to this path to the list.
* Otherwise, add the file name with a full or relative path.
* The relative path, when possible, is preferable
* because it preserve use of default path, when the path is a sub path of this path
*/
shortfilename = search.FilenameWithRelativePathInSearchList(
fullfilename, wxPathOnly( Prj().GetProjectFullName() ) );
wxString rootpath = filename.SubString( 0, default3DPath.Length()-1 );
bool useRelPath = rootpath.IsSameAs( default3DPath, wxFileName::IsCaseSensitive() );
wxFileName aux = shortfilename;
if( useRelPath )
fn.MakeRelativeTo( default3DPath );
else // Absolute path given, not a subpath of the default path,
// therefore ask if the user wants a relative (to the default path) one
{
wxString msg;
msg.Printf( _( "Use a path relative to '%s'?" ), GetChars( default3DPath ) );
int diag = wxMessageBox( msg, _( "Path type" ),
wxYES_NO | wxICON_QUESTION, this );
if( aux.IsAbsolute() )
{ // Absolute path, ask if the user wants a relative one
int diag = wxMessageBox(
_( "Use a relative path?" ),
_( "Path type" ),
wxYES_NO | wxICON_QUESTION, this );
if( diag == wxYES )
{ // Make it relative
aux.MakeRelativeTo( wxT( "." ) );
shortfilename = aux.GetPathWithSep() + aux.GetFullName();
}
if( diag == wxYES ) // Make it relative to the default 3D path
fn.MakeRelativeTo( default3DPath );
}
filename = fn.GetFullPath();
S3D_MASTER* new3DShape = new S3D_MASTER(NULL);
#ifdef __WINDOWS__
// Store filename in Unix notation
shortfilename.Replace( wxT( "\\" ), wxT( "/" ) );
filename.Replace( wxT( "\\" ), wxT( "/" ) );
#endif
new3DShape->SetShape3DName( shortfilename );
new3DShape->SetShape3DName( filename );
m_shapes3D_list.push_back( new3DShape );
m_3D_ShapeNameListBox->Append( shortfilename );
m_3D_ShapeNameListBox->Append( filename );
if( m_lastSelected3DShapeIndex >= 0 )
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );

View File

@ -34,14 +34,20 @@ public:
~DIALOG_MODULE_MODULE_EDITOR();
private:
void BrowseAndAdd3DShapeFile();
void initModeditProperties();
void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource );
void TransfertDisplayTo3DValues( int aIndexSelection );
// virtual event functions
void OnEditValue( wxCommandEvent& event );
void OnEditReference( wxCommandEvent& event );
void On3DShapeSelection( wxCommandEvent& event );
void On3DShapeNameSelected( wxCommandEvent& event );
void BrowseAndAdd3DLib( wxCommandEvent& event );
void Add3DShape( wxCommandEvent& event )
{
BrowseAndAdd3DShapeFile();
}
void Remove3DShape( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );

View File

@ -327,7 +327,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
m_button4->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnEditReference ), NULL, this );
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnEditValue ), NULL, this );
m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::BrowseAndAdd3DLib ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Add3DShape ), NULL, this );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Remove3DShape ), NULL, this );
m_sdbSizerStdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerStdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnOkClick ), NULL, this );
@ -339,7 +339,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::~DIALOG_MODULE_MODULE_EDITOR_BASE()
m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnEditReference ), NULL, this );
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnEditValue ), NULL, this );
m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::BrowseAndAdd3DLib ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Add3DShape ), NULL, this );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Remove3DShape ), NULL, this );
m_sdbSizerStdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerStdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnOkClick ), NULL, this );

View File

@ -4173,7 +4173,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">BrowseAndAdd3DLib</event>
<event name="OnButtonClick">Add3DShape</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>

View File

@ -109,7 +109,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM
virtual void OnEditReference( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditValue( wxCommandEvent& event ) { event.Skip(); }
virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void BrowseAndAdd3DLib( wxCommandEvent& event ) { event.Skip(); }
virtual void Add3DShape( wxCommandEvent& event ) { event.Skip(); }
virtual void Remove3DShape( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -9,7 +9,6 @@
#include <fctsys.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <dialog_footprint_wizard_list.h>
#include <class_footprint_wizard.h>

View File

@ -36,6 +36,7 @@
#include <fctsys.h>
#include <project.h>
#include <3d_viewer.h> // for KISYS3DMOD
#include <dialog_fp_lib_table_base.h>
#include <fp_lib_table.h>
#include <fp_lib_table_lexer.h>
@ -713,6 +714,9 @@ private:
// the current project.
unique.insert( PROJECT_VAR_NAME );
unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
// This special environment variable is used to locad 3d shapes
unique.insert( KISYS3DMOD );
unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
m_path_subs_grid->AppendRows( unique.size() );

View File

@ -36,7 +36,6 @@
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <pcbcommon.h>
#include <kicad_string.h>
#include <pcbnew_id.h>
#include <class_board.h>

View File

@ -28,7 +28,6 @@
#include <confirm.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <ratsnest_data.h>
#include <class_board.h>

View File

@ -35,7 +35,6 @@
#include <html_messagebox.h>
#include <base_units.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <pcb_netlist.h>
#include <netlist_reader.h>
#include <reporter.h>

View File

@ -7,7 +7,6 @@
#include <fctsys.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <dialog_scripting.h>

View File

@ -38,7 +38,6 @@
#include <gestfich.h>
#include <kicad_device_context.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <pcbnew_id.h>
#include <pcbnew.h>

View File

@ -33,7 +33,6 @@
#include <confirm.h>
#include <wxPcbStruct.h>
#include <gr_basic.h>
#include <pcbcommon.h>
#include <pcbnew.h>
#include <protos.h>

View File

@ -34,7 +34,6 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -31,7 +31,6 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <trigo.h>
#include <pcbcommon.h>
#include <wxPcbStruct.h>
#include <colors_selection.h>

View File

@ -35,7 +35,6 @@
#include <gestfich.h>
#include <wxPcbStruct.h>
#include <macros.h>
#include <pcbcommon.h>
#include <3d_viewer.h>
#include <richio.h>
#include <filter_reader.h>

View File

@ -8,7 +8,6 @@
#include <wxPcbStruct.h>
#include <dialog_helpers.h>
#include <3d_viewer.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -33,7 +33,6 @@
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <3d_viewer.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <macros.h>

View File

@ -7,7 +7,6 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h>
#include <module_editor_frame.h>
#include <class_board.h>

View File

@ -30,7 +30,6 @@
#include <wxPcbStruct.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -38,7 +38,6 @@
#include <wxPcbStruct.h>
#include <dialog_helpers.h>
#include <filter_reader.h>
#include <pcbcommon.h>
#include <macros.h>
#include <fp_lib_table.h>
#include <validators.h>

View File

@ -36,13 +36,11 @@
#include <kicad_string.h>
#include <pgm_base.h>
#include <kiway.h>
//#include <frame_type.h>
#include <wxPcbStruct.h>
#include <dialog_helpers.h>
#include <filter_reader.h>
#include <gr_basic.h>
#include <macros.h>
#include <pcbcommon.h>
#include <fp_lib_table.h>
#include <fpid.h>

View File

@ -12,7 +12,6 @@
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <macros.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_track.h>

View File

@ -38,7 +38,6 @@
#include <wxPcbStruct.h>
#include <kicad_device_context.h>
#include <macros.h>
#include <pcbcommon.h>
#include <invoke_pcb_dialog.h>
#include <class_board.h>

View File

@ -40,7 +40,6 @@
#include <wxPcbStruct.h>
#include <dialog_helpers.h>
#include <3d_viewer.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <fp_lib_table.h>

View File

@ -35,7 +35,6 @@
#include <wxPcbStruct.h>
#include <trigo.h>
#include <macros.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -35,7 +35,6 @@
#include <pcb_draw_panel_gal.h>
#include <wxPcbStruct.h>
#include <3d_viewer.h>
#include <pcbcommon.h>
#include <dialog_helpers.h>
#include <msgpanel.h>
#include <macros.h>

View File

@ -12,7 +12,6 @@
#include <trigo.h>
#include <block_commande.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -36,7 +36,6 @@
#include <trigo.h>
#include <macros.h>
#include <gr_basic.h>
#include <pcbcommon.h>
#include <class_board.h>

View File

@ -40,7 +40,6 @@
#include <richio.h>
#include <filter_reader.h>
#include <gr_basic.h>
#include <pcbcommon.h>
#include <macros.h>
#include <base_units.h>

View File

@ -33,7 +33,6 @@
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <pcbcommon.h>
#include <boost/bind.hpp>

View File

@ -35,7 +35,6 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <wxPcbStruct.h>
#include <pcbcommon.h> // enum PCB_VISIBLE
#include <collectors.h>
#include <build_version.h>
#include <macros.h>

View File

@ -42,8 +42,6 @@
#include <eda_dde.h>
#include <pcbcommon.h>
#include <colors_selection.h>
#include <gr_basic.h>
#include <3d_viewer.h>
#include <wx/stdpaths.h>
#include <wx/file.h>
@ -52,7 +50,6 @@
#include <gestfich.h>
#include <pcbnew.h>
#include <protos.h>
#include <hotkeys.h>
#include <wildcards_and_files_ext.h>
#include <class_board.h>
@ -81,7 +78,9 @@ int g_MaxLinksShowed;
int g_MagneticPadOption = capture_cursor_in_track_tool;
int g_MagneticTrackOption = capture_cursor_in_track_tool;
wxPoint g_Offset_Module; /* Distance to offset module trace when moving. */
wxPoint g_Offset_Module; // module offset used when moving a footprint
DISPLAY_OPTIONS DisplayOpt; // General display options
/* Name of the document footprint list
* usually located in share/modules/footprints_doc
@ -90,6 +89,13 @@ wxPoint g_Offset_Module; /* Distance to offset module trace when moving.
*/
wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" );
/*
* Used in track creation, a list of track segments currently being created,
* with the newest track at the end of the list, sorted by new-ness. e.g. use
* TRACK->Back() to get the next older track, TRACK->Next() to get the next
* newer track.
*/
DLIST<TRACK> g_CurrentTrackList;
namespace PCB {
@ -205,105 +211,6 @@ PGM_BASE& Pgm()
}
#endif
/**
* Function set3DShapesPath
* attempts to set the environment variable given by aKiSys3Dmod to a valid path.
* (typically "KISYS3DMOD" )
* If the environment variable is already set,
* then it left as is to respect the wishes of the user.
*
* The path is determined by attempting to find the path modules/packages3d
* files in kicad tree.
* This may or may not be the best path but it provides the best solution for
* backwards compatibility with the previous 3D shapes search path implementation.
*
* @note This must be called after #SetBinDir() is called at least on Windows.
* Otherwise, the kicad path is not known (Windows specific)
*
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
* @return false if the aKiSys3Dmod path is not valid.
*/
static bool set3DShapesPath( const wxString& aKiSys3Dmod )
{
wxString path;
// Set the KISYS3DMOD environment variable for the current process,
// if it is not already defined in the user's environment and valid.
if( wxGetEnv( aKiSys3Dmod, &path ) && wxFileName::DirExists( path ) )
return true;
// Attempt to determine where the 3D shape libraries were installed using the
// legacy path:
// on Unix: /usr/local/kicad/share/modules/packages3d
// or /usr/share/kicad/modules/packages3d
// On Windows: bin../share/modules/packages3d
wxString relpath( wxT( "modules/packages3d" ) );
// Apple MacOSx
#ifdef __WXMAC__
path = wxT("/Library/Application Support/kicad/modules/packages3d/");
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
path = wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT("/Library/Application Support/kicad/modules/packages3d/");
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#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 ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
// Try the official distrib standard install path:
path = wxT("/usr/share/kicad/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#else // Windows
// On Windows, the install path is given by the path of executables
wxFileName fn;
fn.AssignDir( Pgm().GetExecutablePath() );
fn.RemoveLastDir();
path = fn.GetPathWithSep() + wxT("share/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#endif
return false;
}
#if defined(KICAD_SCRIPTING)
static bool scriptingSetup()
@ -412,8 +319,10 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// display the real hotkeys in menus or tool tips
ReadHotkeyConfig( wxT( "PcbFrame" ), g_Board_Editor_Hokeys_Descr );
// Set 3D shape path from environment variable KISYS3DMOD
set3DShapesPath( wxT(KISYS3DMOD) );
// Set 3D shape path (environment variable KISYS3DMOD) if not defined or valid
// Currently, called here, but could be moved ( OpenProjectFiles() ? )
// if KISYS3DMOD is defined in a project config file
Set3DShapesDefaultPath( KISYS3DMOD, aProgram );
try
{

View File

@ -8,6 +8,7 @@
#include <fctsys.h> // wxWidgets include.
#include <base_struct.h> // IS_DRAGGED and IN_EDIT definitions.
#include <dlist.h>
#include <convert_to_biu.h> // to define DMils2iu() conversion function
#include <layers_id_colors_and_visibility.h>
@ -37,6 +38,7 @@ enum ENDPOINT_T {
#define TEXTS_MIN_SIZE DMils2iu( 50 ) ///< Minimum text size in Pcbnew units value (50 * 0.0001 mils)
#define TEXTS_MAX_SIZE DMils2iu( 10000 ) ///< Maximum text size in Pcbnew units value (1 inch) )
#define TEXTS_MAX_WIDTH DMils2iu( 5000 ) ///< Maximum text width in Pcbnew units value (0.5 inches)
#define MIN_DRAW_WIDTH 1 ///< Minimum trace drawing width in pixels.
// Flag to force the SKETCH mode to display items (.m_Flags member)
@ -71,6 +73,16 @@ extern int g_MagneticTrackOption;
extern wxPoint g_Offset_Module; // Offset trace when moving footprint.
/// List of segments of the trace currently being drawn.
class TRACK;
extern DLIST<TRACK> g_CurrentTrackList;
#define g_CurrentTrackSegment g_CurrentTrackList.GetLast() ///< most recently created segment
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
class DISPLAY_OPTIONS;
extern DISPLAY_OPTIONS DisplayOpt;
enum MagneticPadOptionValues {
no_effect,
capture_cursor_in_track_tool,

View File

@ -37,7 +37,6 @@
#include <gestfich.h>
#include <xnode.h>
#include <macros.h>
#include <pcbcommon.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <plot_common.h>

View File

@ -36,7 +36,6 @@
#include <drawtxt.h>
#include <trigo.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <macros.h>
#include <class_board.h>

View File

@ -35,7 +35,6 @@
#include <trigo.h>
#include <macros.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -30,8 +30,6 @@
#include <wxPcbStruct.h>
#include <printout_controler.h>
#include <colors_selection.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>

View File

@ -32,7 +32,6 @@
#include <macros.h>
#include <pcbnew_id.h>
#include <view/view_controls.h>
#include <pcbcommon.h>
#include <pcb_painter.h>
#include <dialogs/dialog_pns_settings.h>
#include <dialogs/dialog_track_via_size.h>

View File

@ -32,7 +32,6 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <class_layer_box_selector.h>
#include <class_board.h>
#include <dialogs/dialog_layer_selection_base.h>

View File

@ -35,10 +35,7 @@
#include <wxPcbStruct.h>
#include <3d_viewer.h>
#include <dialog_helpers.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <drc_stuff.h>

View File

@ -33,7 +33,6 @@
#include <class_zone.h>
#include <class_draw_panel_gal.h>
#include <class_pcb_screen.h>
#include <pcbcommon.h>
#include <confirm.h>
#include <gal/graphics_abstraction_layer.h>

View File

@ -35,7 +35,6 @@
#include <kicad_string.h>
#include <wxPcbStruct.h>
#include <macros.h>
#include <pcbcommon.h>
#include <class_board.h>
#include <class_module.h>