Commit 8e472c73 authored by Maciej Suminski's avatar Maciej Suminski

Merged upstream.

parents a991cb44 4f784034
......@@ -60,7 +60,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
aVertices[ii].y *= m_MatScale.y;
aVertices[ii].z *= m_MatScale.z;
// adjust rotation
// adjust rotation
if( m_MatRotation.x )
RotatePoint( &aVertices[ii].y, &aVertices[ii].z, m_MatRotation.x * 10 );
......@@ -176,64 +176,39 @@ GLuint EDA_3D_CANVAS::DisplayCubeforTest()
return gllist;
}
VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer )
VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer )
{
wxString text;
wxStaticText* msgtitle;
if( title.IsEmpty() )
text = _( "Vertex " );
else
text = title;
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition, wxSize( -1, -1 ), 0 );
BoxSizer->Add( msgtitle, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM );
wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
BoxSizer->Add( GridSizer, 0, wxGROW | wxALL, 5 );
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
wxString text;
GridSizer->Add( msgtitle, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT , 5 );
m_XValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
wxFlexGridSizer* gridSizer = new wxFlexGridSizer( 0, 2, 0, 0 );
gridSizer->AddGrowableCol( 1 );
gridSizer->SetFlexibleDirection( wxHORIZONTAL );
gridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
GridSizer->Add( m_XValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT, 5 );
aBoxSizer->Add( gridSizer, 0, wxEXPAND, 5 );
msgtitle = new wxStaticText( parent, -1, wxT( "Y:" ), wxDefaultPosition,
wxSize( -1, -1 ), 0 );
wxStaticText* msgtitle = new wxStaticText( aParent, wxID_ANY, wxT( "X:" ) );
gridSizer->Add( msgtitle, 0, wxALL , 5 );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT, 5 );
m_YValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
m_XValueCtrl = new wxTextCtrl( aParent, wxID_ANY, wxEmptyString,
wxDefaultPosition,wxDefaultSize, 0 );
gridSizer->Add( m_XValueCtrl, 0, wxALL|wxEXPAND, 5 );
GridSizer->Add( m_YValueCtrl, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT, 5 );
msgtitle = new wxStaticText( aParent, wxID_ANY, wxT( "Y:" ), wxDefaultPosition,
wxDefaultSize, 0 );
gridSizer->Add( msgtitle, 0, wxALL, 5 );
msgtitle = new wxStaticText( parent, -1, wxT( "Z:" ), wxDefaultPosition,
wxSize( -1, -1 ), 0 );
m_YValueCtrl = new wxTextCtrl( aParent, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize, 0 );
gridSizer->Add( m_YValueCtrl, 0, wxALL|wxEXPAND, 5 );
GridSizer->Add( msgtitle, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT, 5 );
m_ZValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
msgtitle = new wxStaticText( aParent, wxID_ANY, wxT( "Z:" ), wxDefaultPosition,
wxDefaultSize, 0 );
gridSizer->Add( msgtitle, 0, wxALL, 5 );
GridSizer->Add( m_ZValueCtrl, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT, 5 );
m_ZValueCtrl = new wxTextCtrl( aParent, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize, 0 );
gridSizer->Add( m_ZValueCtrl, 0, wxALL|wxEXPAND, 5 );
}
......
......@@ -155,10 +155,9 @@ class VERTEX_VALUE_CTRL
{
private:
wxTextCtrl* m_XValueCtrl, * m_YValueCtrl, * m_ZValueCtrl;
wxStaticText* m_Text;
public:
VERTEX_VALUE_CTRL( wxWindow* parent, const wxString& title, wxBoxSizer* BoxSizer );
VERTEX_VALUE_CTRL( wxWindow* parent, wxBoxSizer* BoxSizer );
~VERTEX_VALUE_CTRL();
......
......@@ -197,10 +197,14 @@ else()
endif()
endif()
#================================================
# 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 )
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
set( KICAD_PLUGINS lib/kicad/plugins
......@@ -209,12 +213,10 @@ if( UNIX )
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 )
# Like all variables, CMAKE_INSTALL_PREFIX can be over-ridden on the command line.
set( CMAKE_INSTALL_PREFIX c:/kicad
CACHE PATH "" )
# Everything without leading / is relative to CMAKE_INSTALL_PREFIX.
set( KICAD_PLUGINS ${KICAD_BIN}/plugins
CACHE PATH "Location of KiCad plugins." )
......@@ -222,6 +224,7 @@ if( MINGW )
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
......
......@@ -81,6 +81,12 @@
/// Definition to compile with Pcbnew footprint library table implementation.
#cmakedefine USE_FP_LIB_TABLE
/// 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
......
......@@ -214,6 +214,7 @@ set(PCB_COMMON_SRCS
../pcbnew/legacy_plugin.cpp
../pcbnew/kicad_plugin.cpp
../pcbnew/gpcb_plugin.cpp
../pcbnew/pcb_netlist.cpp
pcb_plot_params_keywords.cpp
pcb_keywords.cpp
../pcbnew/pcb_parser.cpp
......
......@@ -7,53 +7,70 @@
#include <wx/wx.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/aui/aui.h>
#include <class_layer_box_selector.h>
/* class to display a layer list.
*
*/
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[] ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY )
LAYER_SELECTOR::LAYER_SELECTOR()
{
m_layerorder = true;
m_layerhotkeys = true;
m_hotkeys = NULL;
if( choices != NULL )
ResyncBitmapOnly();
}
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY )
bool LAYER_SELECTOR::SetLayersOrdered( bool value )
{
m_layerorder = true;
m_layerhotkeys = true;
m_hotkeys = NULL;
m_layerorder = value;
return m_layerorder;
}
if( !choices.IsEmpty() )
ResyncBitmapOnly();
bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
{
m_layerhotkeys = value;
return m_layerhotkeys;
}
bool LAYER_BOX_SELECTOR::SetLayersOrdered( bool value )
void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
{
m_layerorder = value;
return m_layerorder;
wxMemoryDC bmpDC;
wxBrush brush;
// Prepare Bitmap
bmpDC.SelectObject( aLayerbmp );
brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
bmpDC.SetPen( *wxBLACK_PEN );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
}
/* class to display a layer list in a wxBitmapComboBox.
*/
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[] ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
LAYER_SELECTOR()
{
if( choices != NULL )
ResyncBitmapOnly();
}
bool LAYER_BOX_SELECTOR::SetLayersHotkeys( bool value )
LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ),
LAYER_SELECTOR()
{
m_layerhotkeys = value;
return m_layerhotkeys;
if( !choices.IsEmpty() )
ResyncBitmapOnly();
}
......@@ -67,6 +84,9 @@ int LAYER_BOX_SELECTOR::GetChoice()
// Get Current Layer
LAYER_NUM LAYER_BOX_SELECTOR::GetLayerSelection() const
{
if( GetSelection() < 0 )
return UNDEFINED_LAYER;
return (LAYER_NUM)(intptr_t) GetClientData( GetSelection() );
}
......@@ -104,21 +124,3 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
SetBitmapLayer( layerbmp, i );
}
}
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
{
wxMemoryDC bmpDC;
wxBrush brush;
// Prepare Bitmap
bmpDC.SelectObject( aLayerbmp );
brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
bmpDC.SetPen( *wxBLACK_PEN );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
}
......@@ -64,18 +64,16 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" );
* the size of the array. */
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / sizeof( struct LANGUAGE_DESCR ) )
// Default font size
#define FONT_DEFAULT_SIZE 10 // Default font size.
// some key strings used to store parameters in config
static wxString backgroundColorKey( wxT( "BackgroundColor" ) );
static wxString showPageLimitsKey( wxT( "ShowPageLimits" ) );
static wxString workingDirKey( wxT( "WorkingDir" ) ) ;
static wxString languageCfgKey( wxT( "LanguageID" ) );
static wxString kicadFpLibPath( wxT( "KicadFootprintLibraryPath" ) );
/**
* The real font size will be computed at run time
* A small class to handle the list on existing translations.
* the locale translation is automatic.
* the selection of languages is mainly for maintainer's convenience
......@@ -354,7 +352,7 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
wxImage::AddHandler( new wxJPEGHandler );
wxFileSystem::AddHandler( new wxZipFSHandler );
// Analise the command line & init binary path
// Analyze the command line & init binary path
SetBinDir();
SetDefaultSearchPaths();
SetLanguagePath();
......@@ -496,24 +494,20 @@ void EDA_APP::SetDefaultSearchPaths( void )
* if the user is savvy enough to set an environment variable they know
* what they are doing. */
if( ::wxGetEnv( wxT( "KICAD" ), NULL ) )
m_searchPaths.AddEnvList( wxT( "KICAD" ) );
tmp.AddEnvList( wxT( "KICAD" ) );
// Add the user's home path.
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetUserDataDir() );
tmp.Add( GetTraits()->GetStandardPaths().GetUserDataDir() );
// Standard application data path if it is different from the binary path.
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
{
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
tmp.Add( GetTraits()->GetStandardPaths().GetDataDir() );
}
// Up one level relative to binary path with "share" appended for Windows.
fn.RemoveLastDir();
m_searchPaths.Add( fn.GetPath() );
fn.AppendDir( wxT( "share" ) );
m_searchPaths.Add( fn.GetPath() );
fn.AppendDir( wxT( "kicad" ) );
m_searchPaths.Add( fn.GetPath() );
tmp.Add( fn.GetPath() );
/* The normal OS program file install paths allow for binary to be
* installed in a different path from the library files. This is
......@@ -524,13 +518,16 @@ void EDA_APP::SetDefaultSearchPaths( void )
#ifdef __WXMSW__
tmp.AddEnvList( wxT( "PROGRAMFILES" ) );
#elif __WXMAC__
m_searchPaths.Add( wxT( "/Library/Application Support/kicad" ) );
m_searchPaths.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) +
wxT("/Library/Application Support/kicad") );
tmp.Add( wxT( "/Library/Application Support" ) );
tmp.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support" ) );
#else
tmp.AddEnvList( wxT( "PATH" ) );
#endif
// This is the equivalent of CMAKE_INSTALL_PREFIX. Useful when installed by `make install`.
tmp.Add( wxT( DEFAULT_INSTALL_PATH ) );
// Add kicad, kicad/share, share, and share/kicad to each possible base path.
for( i = 0; i < tmp.GetCount(); i++ )
{
fn = wxFileName( tmp[i], wxEmptyString );
......@@ -621,6 +618,13 @@ void EDA_APP::SetDefaultSearchPaths( void )
fn.RemoveLastDir();
}
}
#if 0 && defined( DEBUG )
wxLogDebug( wxT( "Library search paths:" ) );
for( unsigned i = 0; i < m_libSearchPaths.GetCount(); i++ )
wxLogDebug( wxT( " %s" ), GetChars( m_libSearchPaths[i] ) );
#endif
}
......@@ -662,11 +666,14 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
}
// FIXME OSX Mountain Lion (10.8)
// Seems that Read doesn't found anything and ColorFromInt Asserts - I'm unable to reproduce on 10.7
// In general terms i think is better have a failsafe default than an uninit variable
// Seems that Read doesn't found anything and ColorFromInt Asserts - I'm unable to reproduce
// on 10.7
// In general terms I think is better have a failsafe default than an uninit variable
int draw_bg_color = (int)BLACK; // Default for all apps but Eeschema
if( m_Id == APP_EESCHEMA_T )
draw_bg_color = (int)WHITE; // Default for Eeschema
m_settings->Read( backgroundColorKey, &draw_bg_color );
g_DrawBgColor = ColorFromInt( draw_bg_color );
......@@ -876,7 +883,7 @@ void EDA_APP::AddMenuLanguageList( wxMenu* MasterMenu )
wxString EDA_APP::FindFileInSearchPaths( const wxString& filename,
const wxArrayString* subdirs )
const wxArrayString* subdirs )
{
size_t i, j;
wxFileName fn;
......@@ -979,21 +986,6 @@ wxString EDA_APP::GetHelpFile( void )
}
wxString EDA_APP::GetLibraryFile( const wxString& filename )
{
wxArrayString subdirs;
subdirs.Add( wxT( "share" ) );
#ifndef __WXMSW__
/* Up on level relative to binary path with "share/kicad" appended for
* all other platforms. */
subdirs.Add( wxT( "kicad" ) );
#endif
return FindFileInSearchPaths( filename, &subdirs );
}
wxString EDA_APP::ReturnLastVisitedLibraryPath( const wxString& aSubPathToSearch )
{
if( !m_LastVisitedLibPath.IsEmpty() )
......@@ -1164,3 +1156,52 @@ bool EDA_APP::LockFile( const wxString& fileName )
return true;
}
bool EDA_APP::SetFootprintLibTablePath()
{
wxString path;
// Set the KISYSMOD environment variable for the current process if it is not already
// defined in the user's environment. This is required to expand the global footprint
// library table paths.
if( wxGetEnv( wxT( "KISYSMOD" ), &path ) && wxFileName::DirExists( path ) )
return true;
// Set the KISYSMOD environment variable to the path defined in the user's configuration
// if it is defined and the path exists.
if( m_commonSettings->Read( kicadFpLibPath, &path ) && wxFileName::DirExists( path ) )
{
wxSetEnv( wxT( "KISYSMOD" ), path );
return true;
}
// Attempt to determine where the footprint libraries were installed using the legacy
// library search paths.
if( !GetLibraryPathList().IsEmpty() )
{
unsigned modFileCount = 0;
wxString bestPath;
wxArrayString tmp;
for( unsigned i = 0; i < GetLibraryPathList().GetCount(); i++ )
{
unsigned cnt = wxDir::GetAllFiles( GetLibraryPathList()[i], &tmp, wxT( "*.mod" ),
wxDIR_FILES );
if( cnt > modFileCount )
{
modFileCount = cnt;
bestPath = GetLibraryPathList()[i];
}
}
if( modFileCount != 0 )
{
wxSetEnv( wxT( "KISYSMOD" ), bestPath );
return true;
}
}
return false;
}
......@@ -39,6 +39,7 @@
#include <footprint_info.h>
#include <io_mgr.h>
#include <fp_lib_table.h>
#include <fpid.h>
#include <class_module.h>
......@@ -182,6 +183,31 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
}
FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString & aFootprintName )
{
BOOST_FOREACH( FOOTPRINT_INFO& footprint, m_List )
{
#if defined( USE_FP_LIB_TABLE )
FPID fpid;
wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL,
wxString::Format( wxT( "<%s> is not a valid FPID." ),
GetChars( aFootprintName ) ) );
wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
wxString footprintName = FROM_UTF8( fpid.GetFootprintName().c_str() );
if( libNickname == footprint.m_libName && footprintName == footprint.m_Module )
return &footprint;
#else
if( aFootprintName.CmpNoCase( footprint.m_Module ) == 0 )
return &footprint;
#endif
}
return NULL;
}
bool FOOTPRINT_INFO::InLibrary( const wxString& aLibrary ) const
{
if( aLibrary.IsEmpty() )
......
......@@ -30,10 +30,15 @@
#include <set>
#include <appl_wxstruct.h>
#include <pcb_netlist.h>
#include <reporter.h>
#include <footprint_info.h>
#include <wildcards_and_files_ext.h>
#include <fpid.h>
#include <fp_lib_table_lexer.h>
#include <fp_lib_table.h>
using namespace FP_LIB_TABLE_T;
......@@ -98,7 +103,6 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
// After (name), remaining (lib) elements are order independent, and in
// some cases optional.
bool sawType = false;
bool sawOpts = false;
bool sawDesc = false;
......@@ -250,6 +254,35 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::findRow( const wxString& aNickName )
}
const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRowByURI( const wxString& aURI )
{
FP_LIB_TABLE* cur = this;
do
{
cur->ensureIndex();
for( unsigned i = 0; i < cur->rows.size(); i++ )
{
wxString uri = ExpandSubstitutions( cur->rows[i].GetFullURI() );
if( wxFileName::GetPathSeparator() == wxChar( '\\' ) && uri.Find( wxChar( '/' ) ) >= 0 )
uri.Replace( wxT( "/" ), wxT( "\\" ) );
if( (wxFileName::IsCaseSensitive() && uri == aURI)
|| (!wxFileName::IsCaseSensitive() && uri.Upper() == aURI.Upper() ) )
{
return &cur->rows[i]; // found
}
}
// not found, search fall back table(s), if any
} while( ( cur = cur->fallBack ) != 0 );
return 0; // not found
}
bool FP_LIB_TABLE::InsertRow( const ROW& aRow, bool doReplace )
{
ensureIndex();
......@@ -280,8 +313,8 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aLibraryNickName
if( !row )
{
wxString msg = wxString::Format( _("lib table contains no logical lib '%s'" ),
GetChars( aLibraryNickName ) );
wxString msg = wxString::Format( _( "lib table contains no logical lib '%s'" ),
GetChars( aLibraryNickName ) );
THROW_IO_ERROR( msg );
}
......@@ -319,23 +352,205 @@ bool FP_LIB_TABLE::IsEmpty() const
}
void FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
bool FP_LIB_TABLE::MissingLegacyLibs( const wxArrayString& aLibNames, wxString* aErrorMsg )
{
wxFileName fn = GetGlobalTableFileName();
bool retv = false;
wxLogDebug( wxT( "Loading global footprint table file: %s" ), GetChars( fn.GetFullPath() ) );
for( unsigned i = 0; i < aLibNames.GetCount(); i++ )
{
wxFileName fn = wxFileName( wxEmptyString, aLibNames[i], LegacyFootprintLibPathExtension );
wxString legacyLibPath = wxGetApp().FindLibraryPath( fn );
if( !fn.FileExists() )
if( legacyLibPath.IsEmpty() )
continue;
if( FindRowByURI( legacyLibPath ) == 0 )
{
retv = true;
if( aErrorMsg )
*aErrorMsg += wxT( "\"" ) + legacyLibPath + wxT( "\"\n" );
}
}
return retv;
}
bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aLibNames,
REPORTER* aReporter ) throw( IO_ERROR )
{
wxString msg;
FPID lastFPID;
COMPONENT* component;
MODULE* module = 0;
bool retv = true;
if( aNetList.IsEmpty() )
return true;
aNetList.SortByFPID();
wxString libPath;
wxFileName fn;
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
for( unsigned ii = 0; ii < aNetList.GetCount(); ii++ )
{
/// @todo call some script to create initial global footprint table.
component = aNetList.GetComponent( ii );
// The footprint hasn't been assigned yet so ignore it.
if( component->GetFPID().empty() )
continue;
if( component->GetFPID() != lastFPID )
{
module = NULL;
for( unsigned ii = 0; ii < aLibNames.GetCount(); ii++ )
{
fn = wxFileName( wxEmptyString, aLibNames[ii], LegacyFootprintLibPathExtension );
libPath = wxGetApp().FindLibraryPath( fn );
if( !libPath )
{
if( aReporter )
{
msg.Printf( _( "Cannot find footprint library file \"%s\" in any of the "
"KiCad legacy library search paths.\n" ),
GetChars( fn.GetFullPath() ) );
aReporter->Report( msg );
}
retv = false;
continue;
}
module = pi->FootprintLoad( libPath,
FROM_UTF8( component->GetFPID().GetFootprintName().c_str() ) );
if( module )
{
lastFPID = component->GetFPID();
break;
}
}
}
if( module == NULL )
{
if( aReporter )
{
msg.Printf( _( "Component `%s` footprint <%s> was not found in any legacy "
"library.\n" ),
GetChars( component->GetReference() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
aReporter->Report( msg );
}
// Clear the footprint assignment since the old library lookup method is no
// longer valid.
FPID emptyFPID;
component->SetFPID( emptyFPID );
retv = false;
continue;
}
else
{
wxString libNickname;
FP_LIB_TABLE* cur = this;
do
{
cur->ensureIndex();
for( unsigned i = 0; i < cur->rows.size(); i++ )
{
wxString uri = ExpandSubstitutions( cur->rows[i].GetFullURI() );
if( wxFileName::GetPathSeparator() == wxChar( '\\' )
&& uri.Find( wxChar( '/' ) ) >= 0 )
uri.Replace( wxT( "/"), wxT( "\\" ) );
if( uri == libPath )
{
libNickname = cur->rows[i].GetNickName();
break;
}
}
} while( ( cur = cur->fallBack ) != 0 && libNickname.IsEmpty() );
if( libNickname.IsEmpty() )
{
if( aReporter )
{
msg.Printf( _( "Component `%s` footprint <%s> legacy library path <%s > "
"was not found in the footprint library table.\n" ),
GetChars( component->GetReference() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
aReporter->Report( msg );
}
retv = false;
}
else
{
FPID newFPID = lastFPID;
newFPID.SetLibNickname( libNickname );
if( !newFPID.IsValid() )
{
msg.Printf( _( "Component `%s` FPID <%s> is not valid.\n" ),
GetChars( component->GetReference() ),
GetChars( FROM_UTF8( newFPID.Format().c_str() ) ) );
aReporter->Report( msg );
retv = false;
}
else
{
// The footprint name should already be set.
component->SetFPID( newFPID );
}
}
}
}
else
return retv;
}
bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
{
bool tableExists = true;
wxFileName fn = GetGlobalTableFileName();
if( !fn.FileExists() )
{
FILE_LINE_READER reader( fn.GetFullPath() );
FP_LIB_TABLE_LEXER lexer( &reader );
tableExists = false;
// Attempt to copy the default global file table from the KiCad template folder to
// the users home configuration path.
wxString fileName( wxT( "fp_global_table" ) );
fileName = wxGetApp().FindLibraryPath( fileName );
aTable.Parse( &lexer );
// The fallback is to create an empty global footprint table for the user to populate.
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
{
FP_LIB_TABLE emptyTable;
FILE_OUTPUTFORMATTER sf( fn.GetFullPath() );
emptyTable.Format( &sf, 0 );
}
}
FILE_LINE_READER reader( fn.GetFullPath() );
FP_LIB_TABLE_LEXER lexer( &reader );
aTable.Parse( &lexer );
return tableExists;
}
......@@ -357,7 +572,26 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
wxString FP_LIB_TABLE::GetFileName()
{
return wxString( wxT( ".fp-lib-table" ) );
return wxString( wxT( "fp-lib-table" ) );
}
void FP_LIB_TABLE::Load( const wxFileName& aFileName, FP_LIB_TABLE* aFallBackTable )
throw( IO_ERROR )
{
wxFileName fn = aFileName;
fallBack = aFallBackTable;
fn.SetName( FP_LIB_TABLE::GetFileName() );
fn.SetExt( wxEmptyString );
if( fn.FileExists() )
{
FILE_LINE_READER reader( fn.GetFullPath() );
FP_LIB_TABLE_LEXER lexer( &reader );
Parse( &lexer );
}
}
......
......@@ -27,6 +27,7 @@
#include <memory>
#include <wx/wx.h> // _()
#include <macros.h> // TO_UTF8()
#include <fpid.h>
......@@ -170,6 +171,12 @@ int FPID::Parse( const std::string& aId )
}
int FPID::Parse( const wxString& aId )
{
return Parse( std::string( TO_UTF8( aId ) ) );
}
FPID::FPID( const std::string& aId ) throw( PARSE_ERROR )
{
int offset = Parse( aId );
......@@ -185,6 +192,23 @@ FPID::FPID( const std::string& aId ) throw( PARSE_ERROR )
}
FPID::FPID( const wxString& aId ) throw( PARSE_ERROR )
{
std::string id = TO_UTF8( aId );
int offset = Parse( id );
if( offset != -1 )
{
THROW_PARSE_ERROR( _( "Illegal character found in FPID string" ),
wxString::FromUTF8( id.c_str() ),
id.c_str(),
0,
offset );
}
}
int FPID::SetLibNickname( const std::string& aLogical )
{
int offset = okLogical( aLogical );
......@@ -198,6 +222,12 @@ int FPID::SetLibNickname( const std::string& aLogical )
}
int FPID::SetLibNickname( const wxString& aLogical )
{
return SetLibNickname( std::string( TO_UTF8( aLogical ) ) );
}
int FPID::SetFootprintName( const std::string& aFootprintName )
{
int separation = int( aFootprintName.find_first_of( "/" ) );
......@@ -216,6 +246,12 @@ int FPID::SetFootprintName( const std::string& aFootprintName )
}
int FPID::SetFootprintName( const wxString& aFootprintName )
{
return SetFootprintName( std::string( TO_UTF8( aFootprintName ) ) );
}
int FPID::SetRevision( const std::string& aRevision )
{
int offset = okRevision( aRevision );
......
/**
* @file class_worksheet_layuout.cpp
* @file class_worksheet_layout.cpp
* @brief description of graphic items and texts to build a title block
*/
......
/**
* @file page_layout_default_description.cpp
* @file common/page_layout/page_layout_default_description.cpp
*/
/*
......
/**
* @file page_layout_reader.cpp
* @file common/page_layout/page_layout_reader.cpp
* @brief read an S expression of description of graphic items and texts
* to build a title block and page layout
*/
......
/**
* @file title_block_shape.cpp
* @file title_block_shapes.cpp
* @brief description of graphic items and texts to build a title block
*/
......
/**
* @file title_block_shape_gost.h
* @file title_block_shapes_gost.cpp
* @brief description of graphic items and texts to build a title block
* using GOST standard
*/
......
/**
* @file page_layout_default_description.cpp
* @file common/page_layout_default_description.cpp
*/
/*
......
/**
* @file page_layout_reader.cpp
* @file common/page_layout_reader.cpp
* @brief read an S expression of description of graphic items and texts
* to build a title block and page layout
*/
......
......@@ -39,6 +39,7 @@ autoplace_cost90
autoplace_cost180
aux_axis_origin
blind
blind_buried_vias_allowed
bold
bottom
center
......
/**
* @file reporter.h
* @file reporter.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
......@@ -43,3 +43,13 @@ REPORTER& WX_TEXT_CTRL_REPORTER::Report( const wxString& aText )
m_textCtrl->AppendText( aText );
return *this;
}
REPORTER& WX_STRING_REPORTER::Report( const wxString& aText )
{
wxCHECK_MSG( m_string != NULL, *this,
wxT( "No wxString object defined in WX_STRING_REPORTER." ) );
*m_string << aText;
return *this;
}
......@@ -9,6 +9,7 @@ include_directories(
./dialogs
../3d-viewer
../pcbnew
../pcbnew/dialogs
../polygon
../common
${INC_AFTER}
......@@ -22,6 +23,8 @@ set( CVPCB_DIALOGS
dialogs/dialog_cvpcb_config_fbp.cpp
dialogs/dialog_display_options.cpp
dialogs/dialog_display_options_base.cpp
../pcbnew/dialogs/dialog_fp_lib_table.cpp
../pcbnew/dialogs/dialog_fp_lib_table_base.cpp
)
set( CVPCB_SRCS
......
......@@ -165,7 +165,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
bool found = false;
m_ListCmp->SetSelection( ii++, true );
if( !component->GetFootprintName().IsEmpty() )
if( !component->GetFPID().empty() )
continue;
BOOST_FOREACH( FOOTPRINT_ALIAS& alias, aliases )
......
/*************/
/** cfg.cpp **/
/*************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jean-pierre.charras
* Copyright (C) 1992-2011 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 cfg.cpp
*/
#include <fctsys.h>
#include <appl_wxstruct.h>
......@@ -9,6 +33,8 @@
#include <gestfich.h>
#include <param_config.h>
#include <wildcards_and_files_ext.h>
#include <fp_lib_table.h>
#include <confirm.h>
#include <cvpcb.h>
#include <cvpcb_mainframe.h>
......@@ -59,8 +85,24 @@ void CVPCB_MAINFRAME::LoadProjectFile( const wxString& aFileName )
if( m_NetlistFileExtension.IsEmpty() )
m_NetlistFileExtension = wxT( "net" );
/* User library path takes precedent over default library search paths. */
// User library path takes precedent over default library search paths.
wxGetApp().InsertLibraryPath( m_UserLibraryPath, 1 );
#if defined( USE_FP_LIB_TABLE )
delete m_footprintLibTable;
// Attempt to load the project footprint library table if it exists.
m_footprintLibTable = new FP_LIB_TABLE();
try
{
m_footprintLibTable->Load( fn, m_globalFootprintTable );
}
catch( IO_ERROR ioe )
{
DisplayError( this, ioe.errorText );
}
#endif
}
......
......@@ -36,6 +36,9 @@
#include <bitmaps.h>
#include <msgpanel.h>
#include <wildcards_and_files_ext.h>
#include <fpid.h>
#include <fp_lib_table.h>
#include <pcbcommon.h>
#include <io_mgr.h>
#include <class_module.h>
......@@ -473,10 +476,59 @@ EDA_COLOR_T DISPLAY_FOOTPRINTS_FRAME::GetGridColor() const
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
{
CVPCB_MAINFRAME* parent = ( CVPCB_MAINFRAME* ) GetParent();
MODULE* footprint = NULL;
try
{
#if defined( USE_FP_LIB_TABLE )
FPID fpid;
if( fpid.Parse( aFootprintName ) >= 0 )
{
DisplayInfoMessage( this, wxString::Format( wxT( "Footprint ID <%s> is not valid." ),
GetChars( aFootprintName ) ) );
return NULL;
}
wxString libName = FROM_UTF8( fpid.GetLibNickname().c_str() );
wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ),
fpid.GetFootprintName().c_str(), fpid.GetLibNickname().c_str() );
const FP_LIB_TABLE::ROW* row;
try
{
row = m_footprintLibTable->FindRow( libName );
if( row == NULL )
{
wxString msg;
msg.Printf( _( "No library named <%s> was found in the footprint library table." ),
fpid.GetLibNickname().c_str() );
DisplayInfoMessage( this, msg );
return NULL;
}
}
catch( IO_ERROR ioe )
{
DisplayError( this, ioe.errorText );
}
wxString footprintName = FROM_UTF8( fpid.GetFootprintName().c_str() );
wxString libPath = row->GetFullURI();
libPath = FP_LIB_TABLE::ExpandSubstitutions( libPath );
wxLogDebug( wxT( "Loading footprint <%s> from library <%s>." ),
GetChars( footprintName ), GetChars( libPath ) );
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::EnumFromStr( row->GetType() ) ) );
footprint = pi->FootprintLoad( libPath, footprintName );
#else
CVPCB_MAINFRAME* parent = ( CVPCB_MAINFRAME* ) GetParent();
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
for( unsigned i = 0; i < parent->m_ModuleLibNames.GetCount(); ++i )
......@@ -493,19 +545,16 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
fn.GetFullName().GetData() );
// @todo we should not be using wxMessageBox directly.
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
wxMessageBox( msg, wxEmptyString, wxOK | wxICON_ERROR, this );
continue;
}
MODULE* footprint = pi->FootprintLoad( libPath, aFootprintName );
footprint = pi->FootprintLoad( libPath, aFootprintName );
if( footprint )
{
footprint->SetParent( (EDA_ITEM*) GetBoard() );
footprint->SetPosition( wxPoint( 0, 0 ) );
return footprint;
}
if( footprint != NULL )
break;
}
#endif
}
catch( IO_ERROR ioe )
{
......@@ -513,6 +562,13 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
return NULL;
}
if( footprint )
{
footprint->SetParent( (EDA_ITEM*) GetBoard() );
footprint->SetPosition( wxPoint( 0, 0 ) );
return footprint;
}
wxString msg = wxString::Format( _( "Footprint '%s' not found" ), aFootprintName.GetData() );
DisplayError( this, msg );
return NULL;
......@@ -532,6 +588,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName );
const wxChar *libname;
if( module_info )
libname = GetChars( module_info->GetLibraryPath() );
else
......
......@@ -22,7 +22,7 @@
*/
/**
* @file class_components_listbox.h
* @file class_components_listbox.cpp
*/
#include <fctsys.h>
......
......@@ -135,8 +135,14 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
{
if( aFilterType == UNFILTERED )
{
#if !defined( USE_FP_LIB_TABLE )
msg.Printf( wxT( "%3zu %s" ), newList.GetCount() + 1,
GetChars( aList.GetItem( ii ).m_Module ) );
#else
msg.Printf( wxT( "%3zu %s:%s" ), newList.GetCount() + 1,
GetChars( aList.GetItem( ii ).GetLibraryName() ),
GetChars( aList.GetItem( ii ).m_Module ) );
#endif
newList.Add( msg );
continue;
}
......@@ -153,8 +159,14 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
&& (aComponent->GetNetCount() != aList.GetItem( ii ).m_padCount) )
continue;
#if !defined( USE_FP_LIB_TABLE )
msg.Printf( wxT( "%3zu %s" ), newList.GetCount() + 1,
aList.GetItem( ii ).m_Module.GetData() );
#else
msg.Printf( wxT( "%3zu %s:%s" ), newList.GetCount() + 1,
GetChars( aList.GetItem( ii ).GetLibraryName() ),
GetChars( aList.GetItem( ii ).m_Module ) );
#endif
newList.Add( msg );
}
......@@ -169,9 +181,24 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
selection = 0;
DeleteAllItems();
SetItemCount( m_footprintList.GetCount() );
SetSelection( selection, true );
Refresh();
if( m_footprintList.GetCount() )
{
SetItemCount( m_footprintList.GetCount() );
SetSelection( selection, true );
RefreshItems( 0L, m_footprintList.GetCount()-1 );
#if defined (__WXGTK__ )
// @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the
// column parameter is -1. This was the only way to prevent GTK3 from
// ellipsizing long strings down to a few characters. It still doesn't set
// the scroll bars correctly (too short) but it's better than any of the
// other alternatives. If someone knows how to fix this, please do.
SetColumnWidth( -1, wxLIST_AUTOSIZE );
#else
SetColumnWidth( 0, wxLIST_AUTOSIZE );
#endif
}
}
......
......@@ -124,7 +124,21 @@ void LIBRARY_LISTBOX::SetLibraryList( const wxArrayString& aList )
if( GetCount() == 0 || oldSelection < 0 || oldSelection >= GetCount() )
SetSelection( 0, true );
Refresh();
if( m_libraryList.Count() )
{
RefreshItems( 0L, m_libraryList.Count()-1 );
#if defined (__WXGTK__ )
// @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the
// column parameter is -1. This was the only way to prevent GTK3 from
// ellipsizing long strings down to a few characters. It still doesn't set
// the scroll bars correctly (too short) but it's better than any of the
// other alternatives. If someone knows how to fix this, please do.
SetColumnWidth( -1, wxLIST_AUTOSIZE );
#else
SetColumnWidth( 0, wxLIST_AUTOSIZE );
#endif
}
}
......
This diff is collapsed.
/*
* 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.
*
* 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 cvpcb.cpp
*/
......@@ -22,7 +46,7 @@
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
/* Constant string definitions for CvPcb */
// Constant string definitions for CvPcb
const wxString RetroFileExtension( wxT( "stf" ) );
const wxString FootprintAliasFileExtension( wxT( "equ" ) );
......@@ -36,7 +60,7 @@ const wxString titleLibLoadError( _( "Library Load Error" ) );
* MacOSX: Needed for file association
* http://wiki.wxwidgets.org/WxMac-specific_topics
*/
void EDA_APP::MacOpenFile(const wxString &fileName)
void EDA_APP::MacOpenFile( const wxString &fileName )
{
wxFileName filename = fileName;
wxString oldPath;
......@@ -48,7 +72,7 @@ void EDA_APP::MacOpenFile(const wxString &fileName)
if( frame->m_NetlistFileName.DirExists() )
oldPath = frame->m_NetlistFileName.GetPath();
/* Update the library search path list. */
// Update the library search path list.
if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
wxGetApp().GetLibraryPathList().Remove( oldPath );
......@@ -58,6 +82,7 @@ void EDA_APP::MacOpenFile(const wxString &fileName)
frame->ReadNetListAndLinkFiles();
}
// Create a new application object
IMPLEMENT_APP( EDA_APP )
......@@ -74,6 +99,10 @@ bool EDA_APP::OnInit()
InitEDA_Appl( wxT( "CvPcb" ), APP_CVPCB_T );
#if defined( USE_FP_LIB_TABLE )
SetFootprintLibTablePath();
#endif
if( m_Checker && m_Checker->IsAnotherRunning() )
{
if( !IsOK( NULL, _( "CvPcb is already running, Continue?" ) ) )
......@@ -88,7 +117,7 @@ bool EDA_APP::OnInit()
// read current setup and reopen last directory if no filename to open in command line
bool reopenLastUsedDirectory = argc == 1;
GetSettings(reopenLastUsedDirectory);
GetSettings( reopenLastUsedDirectory );
g_DrawBgColor = BLACK;
......@@ -97,15 +126,13 @@ bool EDA_APP::OnInit()
// Show the frame
SetTopWindow( frame );
frame->LoadProjectFile( filename.GetFullPath() );
frame->Show( true );
frame->BuildFOOTPRINTS_LISTBOX();
frame->BuildLIBRARY_LISTBOX();
frame->m_NetlistFileExtension = wxT( "net" );
if( filename.IsOk() && filename.FileExists() )
{
frame->m_NetlistFileName = filename;
frame->LoadProjectFile( filename.GetFullPath() );
if( frame->ReadNetListAndLinkFiles() )
{
......@@ -114,9 +141,6 @@ bool EDA_APP::OnInit()
}
}
frame->LoadFootprintFiles();
frame->m_NetlistFileExtension = wxT( "net" );
frame->m_NetlistFileName.Clear();
frame->UpdateTitle();
return true;
......
......@@ -5,21 +5,16 @@
#ifndef __CVPCB_H__
#define __CVPCB_H__
#include <pcbcommon.h>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp>
// config for footprints doc file access
#define DEFAULT_FOOTPRINTS_LIST_FILENAME wxT( "footprints_doc/footprints.pdf" )
// Define print format to display a schematic component line
#define CMP_FORMAT wxT( "%3d %8s - %16s : %-.32s" )
#define CMP_FORMAT wxT( "%3d %8s - %16s : %s" )
#define FILTERFOOTPRINTKEY "FilterFootprint"
#define LISTB_STYLE (wxSUNKEN_BORDER | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL)
#define LISTB_STYLE ( wxSUNKEN_BORDER | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL | \
wxLC_SINGLE_SEL | wxVSCROLL | wxHSCROLL )
extern const wxString FootprintAliasFileExtension;
extern const wxString RetroFileExtension;
......
......@@ -32,5 +32,6 @@ enum id_cvpcb_frm
ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
ID_CVPCB_LIBRARY_LIST
ID_CVPCB_LIBRARY_LIST,
ID_CVPCB_LIB_TABLE_EDIT
};
......@@ -31,12 +31,11 @@
#include <wx/listctrl.h>
#include <wx/filename.h>
#include <netlist_reader.h>
#include <pcb_netlist.h>
#include <footprint_info.h>
#include <wxBasePcbFrame.h>
#include <param_config.h>
#include <cvpcb.h>
/* Forward declarations of all top-level window classes. */
......@@ -46,6 +45,7 @@ class COMPONENTS_LISTBOX;
class LIBRARY_LISTBOX;
class DISPLAY_FOOTPRINTS_FRAME;
class COMPONENT;
class FP_LIB_TABLE;
/**
......@@ -55,6 +55,16 @@ class CVPCB_MAINFRAME : public EDA_BASE_FRAME
{
wxArrayString m_footprintListEntries;
#if defined( USE_FP_LIB_TABLE )
/// The global footprint library table.
FP_LIB_TABLE* m_globalFootprintTable;
/// The project footprint library table. This is a combination of the project
/// footprint library table and the global footprint table. This is the one to
/// use when finding a #MODULE.
FP_LIB_TABLE* m_footprintLibTable;
#endif
public:
bool m_KeepCvpcbOpen;
FOOTPRINTS_LISTBOX* m_FootprintList;
......@@ -92,6 +102,13 @@ public:
*/
void OnSelectComponent( wxListEvent& event );
/**
* Function OnEditFootrprintLibraryTable
* displays the footprint library table editing dialog and updates the global and local
* footprint tables accordingly.
*/
void OnEditFootrprintLibraryTable( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event );
void OnSize( wxSizeEvent& SizeEvent );
......@@ -126,6 +143,15 @@ public:
void LoadNetList( wxCommandEvent& event );
void ConfigCvpcb( wxCommandEvent& event );
/**
* Function OnEditLibraryTable
* envokes the footpirnt library table edit dialog.
*/
#if defined( USE_FP_LIB_TABLE )
void OnEditFootprintLibraryTable( wxCommandEvent& aEvent );
#endif
void OnKeepOpenOnSave( wxCommandEvent& event );
void DisplayModule( wxCommandEvent& event );
......
......@@ -30,7 +30,6 @@
#include <wx/listctrl.h>
#include <cvpcb.h>
/* Forward declarations of all top-level window classes. */
class CVPCB_MAINFRAME;
......
......@@ -110,11 +110,17 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Menu Preferences:
wxMenu* preferencesMenu = new wxMenu;
#if !defined( USE_FP_LIB_TABLE )
// Libraries to load
AddMenuItem( preferencesMenu, wxID_PREFERENCES,
_( "&Libraries" ),
_( "Set footprint libraries to load and library search paths" ),
KiBitmap( config_xpm ) );
#else
AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
_( "Li&brary Tables" ), _( "Setup footprint libraries" ),
KiBitmap( library_table_xpm ) );
#endif
// Language submenu
wxGetApp().AddMenuLanguageList( preferencesMenu );
......
......@@ -31,6 +31,11 @@
#include <common.h>
#include <confirm.h>
#include <build_version.h>
#include <macros.h>
#include <fpid.h>
#include <fp_lib_table.h>
#include <reporter.h>
#include <html_messagebox.h>
#include <cvpcb.h>
#include <cvpcb_mainframe.h>
......@@ -50,7 +55,6 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
return;
// If no component is selected, select the first one
if( m_ListCmp->GetFirstSelected() < 0 )
{
componentIndex = 0;
......@@ -58,11 +62,9 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
}
// iterate over the selection
while( m_ListCmp->GetFirstSelected() != -1)
while( m_ListCmp->GetFirstSelected() != -1 )
{
// Get the component for the current iteration
componentIndex = m_ListCmp->GetFirstSelected();
component = m_netlist.GetComponent( componentIndex );
......@@ -70,22 +72,28 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
return;
// Check to see if the component has already a footprint set.
hasFootprint = !component->GetFPID().empty();
hasFootprint = !(component->GetFootprintName().IsEmpty());
FPID fpid;
component->SetFootprintName( aFootprintName );
if( !aFootprintName.IsEmpty() )
{
wxCHECK_RET( fpid.Parse( aFootprintName ) < 0,
wxString::Format( wxT( "<%s> is not a valid FPID." ),
GetChars( aFootprintName ) ) );
}
// create the new component description
component->SetFPID( fpid );
// create the new component description
description.Printf( CMP_FORMAT, componentIndex + 1,
GetChars( component->GetReference() ),
GetChars( component->GetValue() ),
GetChars( component->GetFootprintName() ) );
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
// If the component hasn't had a footprint associated with it
// it now has, so we decrement the count of components without
// a footprint assigned.
if( !hasFootprint )
{
hasFootprint = true;
......@@ -115,6 +123,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
{
COMPONENT* component;
wxString msg;
bool isLegacy = true;
ReadSchematicNetlist();
......@@ -129,6 +138,87 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
m_ListCmp->Clear();
m_undefinedComponentCnt = 0;
if( m_netlist.AnyFootprintsLinked() )
{
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
component = m_netlist.GetComponent( i );
if( component->GetFPID().empty() )
continue;
if( isLegacy )
{
if( !component->GetFPID().IsLegacy() )
isLegacy = false;
}
}
}
else
{
isLegacy = false; // None of the components have footprints assigned.
}
#if defined( USE_FP_LIB_TABLE )
wxString missingLibs;
// Check if footprint links were generated before the footprint library table was implemented.
if( isLegacy )
{
if( m_footprintLibTable->MissingLegacyLibs( m_ModuleLibNames, &missingLibs ) )
{
msg = wxT( "The following legacy libraries are defined in the project file "
"were not found in the footprint library table:\n\n" ) + missingLibs;
msg += wxT( "\nDo you want to update the footprint library table before "
"attempting to update the assigned footprints?" );
if( IsOK( this, msg ) )
{
wxCommandEvent cmd;
OnEditFootprintLibraryTable( cmd );
}
}
msg = wxT( "Some or all of the assigned footprints contain legacy entries. Would you "
"like CvPcb to attempt to convert them to the new footprint library table "
"format?" );
if( IsOK( this, msg ) )
{
msg.Clear();
WX_STRING_REPORTER reporter( &msg );
if( !m_footprintLibTable->ConvertFromLegacy( m_netlist, m_ModuleLibNames, &reporter ) )
{
HTML_MESSAGE_BOX dlg( this, wxEmptyString );
dlg.MessageSet( wxT( "The following errors occurred attempt to convert the "
"footprint assignments:\n\n" ) );
dlg.ListSet( msg );
dlg.MessageSet( wxT( "\nYou will need to reassign them manually if you want them "
"to be updated correctly the next time you import the "
"netlist in Pcbnew." ) );
dlg.ShowModal();
}
m_modified = true;
}
else
{
// Clear the legacy footprint assignments.
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
FPID emptyFPID;
component = m_netlist.GetComponent( i );
component->SetFPID( emptyFPID );
m_modified = true;
}
}
}
#endif
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
component = m_netlist.GetComponent( i );
......@@ -136,11 +226,15 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
GetChars( component->GetReference() ),
GetChars( component->GetValue() ),
GetChars( component->GetFootprintName() ) );
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
m_ListCmp->AppendLine( msg );
if( component->GetFootprintName().IsEmpty() )
if( component->GetFPID().empty() )
{
m_undefinedComponentCnt += 1;
continue;
}
}
if( !m_netlist.IsEmpty() )
......
......@@ -495,7 +495,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
// add a new field unconditionally to the UI only for this template fieldname
// field id must not be in range 0 - MANDATORY_FIELDS, set before saving to disk
LIB_FIELD fld(-1);
LIB_FIELD fld( m_libEntry, -1 );
// See if field by same name already exists in component.
LIB_FIELD* libField = findfield( cmpFields, it->m_Name );
......
......@@ -194,6 +194,7 @@ again." );
case 'K': // It is a Marker item.
// Markers are no more read from file. they are only created on
// demand in schematic
itemLoaded = true; // Just skip descr and disable err message
break;
case 'N': // It is a NoConnect item.
......@@ -242,6 +243,9 @@ again." );
if( !itemLoaded )
{
msgDiag.Printf( _( "Eeschema file object not loaded at line %d, aborted" ),
reader.LineNumber() );
msgDiag << wxT( "\n" ) << FROM_UTF8( line );
DisplayError( this, msgDiag );
break;
}
......
......@@ -714,6 +714,8 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericLibParts()
wxString sLibpart = wxT( "libpart" );
wxString sLib = wxT( "lib" );
wxString sPart = wxT( "part" );
wxString sAliases = wxT( "aliases" );
wxString sAlias = wxT( "alias" );
wxString sPins = wxT( "pins" ); // key for library component pins list
wxString sPin = wxT( "pin" ); // key for one library component pin descr
wxString sPinNum = wxT( "num" ); // key for one library component pin num
......@@ -744,6 +746,20 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericLibParts()
xlibpart->AddAttribute( sLib, library->GetLogicalName() );
xlibpart->AddAttribute( sPart, lcomp->GetName() );
if( lcomp->GetAliasCount() )
{
wxArrayString aliases = lcomp->GetAliasNames( false );
if( aliases.GetCount() )
{
XNODE* xaliases = node( sAliases );
xlibpart->AddChild( xaliases );
for( unsigned i=0; i<aliases.GetCount(); ++i )
{
xaliases->AddChild( node( sAlias, aliases[i] ) );
}
}
}
//----- show the important properties -------------------------
if( !lcomp->GetAlias( 0 )->GetDescription().IsEmpty() )
xlibpart->AddChild( node( sDescr, lcomp->GetAlias( 0 )->GetDescription() ) );
......
......@@ -32,14 +32,8 @@
#include <common.h>
#include <colors_selection.h>
#include <layers_id_colors_and_visibility.h>
#include <gerbview_frame.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <class_gbr_layer_box_selector.h>
void GBR_LAYER_BOX_SELECTOR::Resync()
......
......@@ -4,14 +4,11 @@
#include <class_layer_box_selector.h>
/* class to display a layer list in GerbView.
*
*/
// class to display a layer list in GerbView.
class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{
public:
GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
GBR_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL )
......@@ -21,16 +18,6 @@ public:
m_layerorder = false;
}
GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices )
:LAYER_BOX_SELECTOR( parent, id, pos, size, choices )
{
m_layerhotkeys = false;
m_layerorder = false;
}
// Reload the Layers names and bitmaps
// Virtual function
void Resync();
......
......@@ -344,8 +344,6 @@ public:
*/
wxString GetHelpFile( void );
wxString GetLibraryFile( const wxString& filename );
/**
* Return the preferred editor name.
*/
......@@ -414,6 +412,25 @@ public:
* @return false if the file was already locked, true otherwise.
*/
bool LockFile( const wxString& fileName );
/**
* Function SetFootprintLibTableEnv
* attempts set the KISYSMOD environment variable to the best possible path.
*
* The path is determined by attempting to find the path with the most footprint library
* files. This may or may not be the best path but it provides the best solution for
* backwards compatibility with the previous library search path implementation. If the
* KISYSMOD environment variable is already set, then it left as is to respect the wishes
* of the user.
*
* @note This must be called after #SetDefaultSearchPaths() is called. Otherwise, the
* list of library search paths will be empty and KISYSMOD will be undefined making
* it impossible for the footprint libraries to be loaded from the footprint library
* table.
*
* @return false if the KISYSMOD path is not valid.
*/
bool SetFootprintLibTablePath();
};
......
......@@ -18,6 +18,7 @@ class BOARD_DESIGN_SETTINGS
{
public:
bool m_MicroViasAllowed; ///< true to allow micro vias
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
/// if true, when creating a new track starting on an existing track, use this track width
......
#ifndef CLASS_LAYER_BOX_SELECTOR_H
#define CLASS_LAYER_BOX_SELECTOR_H 1
#include <hotkeys_basic.h>
#include <wx/bmpcbox.h>
#include <colors.h> // EDA_COLOR_T definition
#include <layers_id_colors_and_visibility.h>
class EDA_HOTKEY_CONFIG;
class wxAuiToolBar;
/* class to display a layer list.
*
/* Basic class to build a layer list.
* this is an basic abstract class to build a layer list selector.
* To display this list, you should therefore derive this class
*/
class LAYER_BOX_SELECTOR : public wxBitmapComboBox
class LAYER_SELECTOR
{
protected:
bool m_layerhotkeys;
......@@ -24,14 +22,7 @@ public:
struct EDA_HOTKEY_CONFIG* m_hotkeys;
public:
LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL );
LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices );
LAYER_SELECTOR();
// Returns a color index from the layer id
// Virtual function because GerbView uses its own functions in a derived class
......@@ -45,7 +36,33 @@ public:
// Virtual function pure because GerbView uses its own functions in a derived class
virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0;
// Get Current Item #
bool SetLayersOrdered(bool value);
bool SetLayersHotkeys(bool value);
protected:
// Fills the layer bitmap aLayerbmp with the layer color
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer );
};
/* class to display a layer list in a wxBitmapComboBox.
*/
class LAYER_BOX_SELECTOR :public wxBitmapComboBox, public LAYER_SELECTOR
{
public:
// Hotkey Info
struct EDA_HOTKEY_CONFIG* m_hotkeys;
public:
LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL );
LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices );
// Get Current Item #
int GetChoice();
// Get Current Layer
......@@ -60,13 +77,6 @@ public:
// Reload the Layers bitmaps colors
void ResyncBitmapOnly();
bool SetLayersOrdered(bool value);
bool SetLayersHotkeys(bool value);
protected:
// Fills the layer bitmap aLayerbmp with the layer color
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer );
};
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
......
......@@ -102,15 +102,7 @@ public:
* @return the item stored in list if found
* @param aFootprintName = the name of item
*/
FOOTPRINT_INFO * GetModuleInfo( const wxString & aFootprintName )
{
BOOST_FOREACH( FOOTPRINT_INFO& footprint, m_List )
{
if( aFootprintName.CmpNoCase( footprint.m_Module ) == 0 )
return &footprint;
}
return NULL;
}
FOOTPRINT_INFO* GetModuleInfo( const wxString & aFootprintName );
/**
* Function GetItem
......@@ -159,6 +151,13 @@ public:
/// FOOTPRINT object list sort function.
inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 )
{
#if defined( USE_FP_LIB_TABLE )
int retv = StrNumCmp( item1.m_libName, item2.m_libName, INT_MAX, true );
if( retv != 0 )
return retv < 0;
#endif
return StrNumCmp( item1.m_Module, item2.m_Module, INT_MAX, true ) < 0;
}
......
......@@ -31,13 +31,16 @@
#include <vector>
#include <map>
//#include <fpid.h>
#include <io_mgr.h>
class wxFileName;
class OUTPUTFORMATTER;
class MODULE;
class FP_LIB_TABLE_LEXER;
class NETLIST;
class REPORTER;
/**
* Class FP_LIB_TABLE
......@@ -355,12 +358,50 @@ public:
*/
const ROW* FindRow( const wxString& aNickName ) throw( IO_ERROR );
/**
* Function FindRowByURI
* returns a #FP_LIB_TABLE::ROW if aURE is found in this table or in any chained
* fallBack table fragments, else NULL.
*/
const ROW* FindRowByURI( const wxString& aURI );
/**
* Function IsEmpty
* @return true if the footprint library table is empty.
*/
bool IsEmpty() const;
/**
* Function MissingLegacyLibs
* tests the list of \a aLibNames by URI to determine if any of them are missing from
* the #FP_LIB_TABLE.
*
* @note The missing legacy footprint library test is performed by using old library
* file path lookup method. If the library is found, it is compared against all
* of the URIs in the table rather than the nickname. This was done because the
* user could change the nicknames from the default table. Using the full path
* is more reliable.
*
* @param aLibNames is the list of legacy library names.
* @param aErrorMsg is a pointer to a wxString object to store the URIs of any missing
* legacy library paths. Can be NULL.
* @return true if there are missing legacy libraries. Otherwise false.
*/
bool MissingLegacyLibs( const wxArrayString& aLibNames, wxString* aErrorMsg = NULL );
/**
* Function ConvertFromLegacy
* converts the footprint names in \a aNetList from the legacy fromat to the #FPID format.
*
* @param aNetList is the #NETLIST object to convert.
* @param aLibNames is the list of legacy footprint library names from the currently loaded
* project.
* @param aReporter is the #REPORTER object to dump messages into.
* @return true if all footprint names were successfully converted to a valid FPID.
*/
bool ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aLibNames,
REPORTER* aReporter = NULL ) throw( IO_ERROR );
/**
* Function ExpandEnvSubsitutions
* replaces any environment variable references with their values and is
......@@ -379,8 +420,11 @@ public:
* time being.
*
* @param aTable the #FP_LIB_TABLE object to load.
* @return true if the global library table exists and is loaded properly.
* @throw IO_ERROR if an error occurs attempting to load the footprint library
* table.
*/
static void LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR );
static bool LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR );
/**
* Function GetGlobalTableFileName
......@@ -394,6 +438,18 @@ public:
*/
static wxString GetFileName();
/**
* Function Load
* loads the footprint library table using the path defined in \a aFileName with
* \a aFallBackTable.
*
* @param aFileName contains the path and possible the file name and extension.
* @param aFallBackTable the fall back footprint library table which can be NULL.
* @throw IO_ERROR if an error occurs attempting to load the footprint library
* table.
*/
void Load( const wxFileName& aFileName, FP_LIB_TABLE* aFallBackTable ) throw( IO_ERROR );
protected:
/**
......
......@@ -70,6 +70,8 @@ public:
*/
FPID( const std::string& aId ) throw( PARSE_ERROR );
FPID( const wxString& aId ) throw( PARSE_ERROR );
/**
* Function Parse
* [re-]stuffs this FPID with the information from @a aId.
......@@ -80,6 +82,8 @@ public:
*/
int Parse( const std::string& aId );
int Parse( const wxString& aId );
/**
* Function GetLibNickname
* returns the logical library name portion of a FPID.
......@@ -98,6 +102,8 @@ public:
*/
int SetLibNickname( const std::string& aNickname );
int SetLibNickname( const wxString& aNickname );
/**
* Function GetFootprintName
* returns the footprint name, i.e. footprintName.
......@@ -110,6 +116,8 @@ public:
*/
int SetFootprintName( const std::string& aFootprintName );
int SetFootprintName( const wxString& aFootprintName );
int SetRevision( const std::string& aRevision );
const std::string& GetRevision() const { return revision; }
......@@ -175,7 +183,9 @@ public:
int compare( const FPID& aFPID ) const;
bool operator <( const FPID& aFPID ) const { return this->compare( aFPID ) < 0; }
bool operator >( const FPID& aFPID ) const { return this->compare( aFPID ) > 0; }
bool operator ==( const FPID& aFPID ) const { return this->compare( aFPID ) == 0; }
bool operator !=( const FPID& aFPID ) const { return !(*this == aFPID); }
#if defined(DEBUG)
static void Test();
......
......@@ -139,14 +139,35 @@ typedef unsigned LAYER_MSK;
#define NO_LAYERS 0x00000000
/** return a one bit layer mask from a layer number
* aLayerNumber = the layer number to convert (0 .. LAYERS-1)
/**
* @return a one bit layer mask from a layer number
* @param aLayerNumber = the layer number to convert (0 .. LAYERS-1)
*/
inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber )
{
return 1 << aLayerNumber;
}
/**
* @return bool if aLayerNumber is a layer contained in aMask
* @param aMask = a layer mask
* @param aLayerNumber is the layer id to test
*/
inline bool IsLayerInList( LAYER_MSK aMask, LAYER_NUM aLayerNumber )
{
return (aMask & GetLayerMask( aLayerNumber )) != 0;
}
/**
* @return bool if 2 layer masks have a comman layer
* @param aMask1 = a layer mask
* @param aMask2 = an other layer mask
*/
inline bool IsLayerMasksIntersect( LAYER_MSK aMask1, LAYER_MSK aMask2 )
{
return (aMask1 & aMask2) != 0;
}
/**
* Count the number of set layers in the mask
*/
......@@ -284,11 +305,11 @@ inline bool IsPcbLayer( LAYER_NUM aLayer )
* Function IsCopperLayer
* tests whether a layer is a copper layer
* @param aLayer = Layer to test
* @return true if aLayer is a valid copper layer
* @return true if aLayer is a valid copper layer
*/
inline bool IsCopperLayer( LAYER_NUM aLayer )
{
return aLayer >= FIRST_COPPER_LAYER
return aLayer >= FIRST_COPPER_LAYER
&& aLayer <= LAST_COPPER_LAYER;
}
......@@ -309,12 +330,12 @@ inline bool IsNonCopperLayer( LAYER_NUM aLayer )
So a layer can be:
- Front
- Back
- Neither (internal or auxiliary)
- Neither (internal or auxiliary)
The check most frequent is for back layers, since it involves flips */
/**
/**
* Layer classification: check if it's a front layer
*/
inline bool IsFrontLayer( LAYER_NUM aLayer )
......@@ -326,7 +347,7 @@ inline bool IsFrontLayer( LAYER_NUM aLayer )
aLayer == SOLDERPASTE_N_FRONT );
}
/**
/**
* Layer classification: check if it's a back layer
*/
inline bool IsBackLayer( LAYER_NUM aLayer )
......@@ -354,7 +375,7 @@ LAYER_MSK FlipLayerMask( LAYER_MSK aMask );
/**
* Extract the set layer from a mask. Returns UNDEFINED_LAYER if more
* than one is set or UNSELECTED_LAYER if none is
* than one is set or UNSELECTED_LAYER if none is
*/
LAYER_NUM ExtractLayer( LAYER_MSK aMask );
......
......@@ -136,4 +136,23 @@ public:
REPORTER& Report( const wxString& aText );
};
/**
* Class WX_STRING_REPROTER
* is a wrapper for reporting to a wxString object.
*/
class WX_STRING_REPORTER : public REPORTER
{
wxString* m_string;
public:
WX_STRING_REPORTER( wxString* aString ) :
REPORTER(),
m_string( aString )
{
}
REPORTER& Report( const wxString& aText );
};
#endif // _REPORTER_H_
......@@ -598,6 +598,8 @@ public:
/**
* Populates the list from a S expr description stored in a string
* @param aPageLayout = the S expr string
* @param Append Do not delete old layout if true and append \a aPageLayout
* the existing one.
*/
void SetPageLayout( const char* aPageLayout, bool Append = false );
......
......@@ -181,6 +181,17 @@ public:
void ViewReloadBoard( const BOARD* aBoard ) const;
/**
* Function SetFootprintLibTable
* set the footprint library table to \a aFootprintLibTable.
*
* @param aFootprintLibTable is a pointer to the #FP_LIB_TABLE object.
*/
void SetFootprintLibTable( FP_LIB_TABLE* aFootprintLibTable )
{
m_footprintLibTable = aFootprintLibTable;
}
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
......@@ -636,11 +647,19 @@ public:
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
// layerhandling:
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter
// is provided)
LAYER_NUM SelectLayer( LAYER_NUM default_layer, LAYER_NUM min_layer, LAYER_NUM max_layer, bool null_layer = false );
void SelectLayerPair();
/** Install the dialog box for layer selection
* @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
* @param aNotAllowedLayersMask = a layer mask for not allowed layers
* (= 0 to show all layers in use)
* @return the selected layer id
*/
LAYER_NUM SelectLayer( LAYER_NUM aDefaultLayer, LAYER_MSK aNotAllowedLayersMask = 0 );
/* Display a list of two copper layers to choose a pair of copper layers
* the layer pair is used to fast switch between copper layers when placing vias
*/
void SelectCopperLayerPair();
virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer );
/**
......
......@@ -211,12 +211,6 @@ protected:
*/
void duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone );
/**
* Function loadFootprintLibTable
* deletes the existing #FP_LIB_TABLE and creates a new one when a new project is loaded.
*/
void loadFootprintLibTable();
public:
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width
......@@ -551,7 +545,15 @@ public:
void ReCreateMicrowaveVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
PCB_LAYER_BOX_SELECTOR* ReCreateLayerBox( wxAuiToolBar* parent );
/**
* Re create the layer Box by clearing the old list, and building
* le new one, from the new layers names and cole layers
* @param aForceResizeToolbar = true to resize the parent toolbar
* false if not needed (mainly in parent toolbar creation,
* or when the layers names are not modified)
*/
void ReCreateLayerBox( bool aForceResizeToolbar = true );
/**
* Function OnModify
......@@ -824,6 +826,7 @@ public:
bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM );
void InstallDrillFrame( wxCommandEvent& event );
void GenD356File( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
......
......@@ -512,7 +512,6 @@ public:
* Function SetCrossHairPosition
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
* @param aPosition The new cross hair position.
* @param aGridOrigin Origin point of the snap grid.
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
* \a aPosition.
*
......@@ -523,7 +522,6 @@ public:
* Function GetCursorPosition
* returns the current cursor position in logical (drawing) units.
* @param aOnGrid Returns the nearest grid position at the current cursor position.
* @param aGridOrigin Origin point of the snap grid.
* @param aGridSize Custom grid size instead of the current grid size. Only valid
* if \a aOnGrid is true.
* @return The current cursor position.
......
......@@ -15,7 +15,7 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
bSizerpanel = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_swItemProperties = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_swItemProperties = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL );
m_swItemProperties->SetScrollRate( 5, 5 );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
......@@ -121,7 +121,7 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
wxBoxSizer* bSizerTsizeX;
bSizerTsizeX = new wxBoxSizer( wxVERTICAL );
m_staticTexTsizeX = new wxStaticText( m_swItemProperties, wxID_ANY, _("Text Height (mm)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTexTsizeX = new wxStaticText( m_swItemProperties, wxID_ANY, _("Text Width (mm)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTexTsizeX->Wrap( -1 );
bSizerTsizeX->Add( m_staticTexTsizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
......@@ -134,7 +134,7 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
wxBoxSizer* bSizerTsizeY;
bSizerTsizeY = new wxBoxSizer( wxVERTICAL );
m_staticTextTsizeY = new wxStaticText( m_swItemProperties, wxID_ANY, _("Text Width (mm)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTsizeY = new wxStaticText( m_swItemProperties, wxID_ANY, _("Text Height (mm)"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTsizeY->Wrap( -1 );
bSizerTsizeY->Add( m_staticTextTsizeY, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
......@@ -436,7 +436,7 @@ PANEL_PROPERTIES_BASE::PANEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, c
m_swItemProperties->Layout();
bSizerMain->Fit( m_swItemProperties );
m_notebook->AddPage( m_swItemProperties, _("Item Properties"), true );
m_swGeneralOpts = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_swGeneralOpts = new wxScrolledWindow( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL );
m_swGeneralOpts->SetScrollRate( 5, 5 );
wxBoxSizer* bSizerGeneralOpts;
bSizerGeneralOpts = new wxBoxSizer( wxVERTICAL );
......
......@@ -167,7 +167,7 @@
<property name="bitmap"></property>
<property name="label">Item Properties</property>
<property name="select">1</property>
<object class="wxScrolledWindow" expanded="0">
<object class="wxScrolledWindow" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -219,7 +219,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxHSCROLL|wxVSCROLL</property>
<property name="window_style">wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
......@@ -1491,7 +1491,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text Height (mm)</property>
<property name="label">Text Width (mm)</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1676,7 +1676,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text Width (mm)</property>
<property name="label">Text Height (mm)</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -5488,7 +5488,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxHSCROLL|wxVSCROLL</property>
<property name="window_style">wxHSCROLL|wxTAB_TRAVERSAL|wxVSCROLL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
......
/**
* @file pagelayout_editor/events_called_functions.cpp
* @file pagelayout_editor/events_functions.cpp
* @brief page layout editor command event functions.
*/
/*
......
/**
* @file pl_editor/files.cpp
* @file pagelayout_editor/files.cpp
*/
/*
......@@ -185,6 +185,15 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
return;
filename = openFileDialog.GetPath();
// Ensure the file has the right extension:
// because a name like name.subname.subsubname is legal,
// add the right extension without replacing the wxFileName
// extension
wxFileName fn(filename);
if( fn.GetExt() != PageLayoutDescrFileExtension )
filename << wxT(".") << PageLayoutDescrFileExtension;
if( !SavePageLayoutDescrFile( filename ) )
{
wxString msg;
......
/**
* @file invoke_pl_editor.h
* @file invoke_pl_editor_dialog.h
*/
/*
......
......@@ -77,6 +77,7 @@ set( PCBNEW_DIALOGS
dialogs/dialog_global_deletion_base.cpp
dialogs/dialog_keepout_area_properties.cpp
dialogs/dialog_keepout_area_properties_base.cpp
dialogs/dialog_layer_selection_base.cpp
dialogs/dialog_layers_setup.cpp
dialogs/dialog_layers_setup_base.cpp
dialogs/dialog_netlist.cpp
......@@ -102,6 +103,7 @@ set( PCBNEW_DIALOGS
dialogs/dialog_SVG_print_base.cpp
dialogs/dialog_set_grid.cpp
dialogs/dialog_set_grid_base.cpp
dialogs/dialog_target_properties_base.cpp
footprint_wizard.cpp
footprint_wizard_frame.cpp
dialogs/dialog_footprint_wizard_list_base.cpp
......@@ -154,6 +156,7 @@ set( PCBNEW_CLASS_SRCS
edit_track_width.cpp
edtxtmod.cpp
event_handlers_tracks_vias_sizes.cpp
export_d356.cpp
export_gencad.cpp
export_vrml.cpp
files.cpp
......@@ -173,7 +176,6 @@ set( PCBNEW_CLASS_SRCS
menubar_modedit.cpp
menubar_pcbframe.cpp
minimun_spanning_tree.cpp
mirepcb.cpp
modedit.cpp
modedit_onclick.cpp
modeditoptions.cpp
......@@ -201,6 +203,7 @@ set( PCBNEW_CLASS_SRCS
specctra_import.cpp
specctra_keywords.cpp
swap_layers.cpp
target_edit.cpp
tool_modedit.cpp
tool_onrightclick.cpp
tool_pcb.cpp
......
......@@ -41,7 +41,7 @@ class cmp
public:
wxString m_Ref;
wxString m_Val;
wxString m_Pkg;
FPID m_fpid;
int m_Id;
int m_CmpCount;
};
......@@ -99,7 +99,8 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
CmpList list;
cmp* comp = NULL;
CmpList::iterator iter;
int i = 1;
int i = 1;
while( Module != NULL )
{
bool valExist = false;
......@@ -109,7 +110,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
{
cmp* current = *iter;
if( (current->m_Val == Module->GetValue()) && (current->m_Pkg == Module->GetLibRef()) )
if( (current->m_Val == Module->GetValue()) && (current->m_fpid == Module->GetFPID()) )
{
current->m_Ref.Append( wxT( ", " ), 1 );
current->m_Ref.Append( Module->GetReference() );
......@@ -127,7 +128,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
comp->m_Id = i++;
comp->m_Val = Module->GetValue();
comp->m_Ref = Module->GetReference();
comp->m_Pkg = Module->GetLibRef();
comp->m_fpid = Module->GetFPID();
comp->m_CmpCount = 1;
list.Append( comp );
}
......@@ -145,7 +146,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
msg << current->m_Id << wxT( ";\"" );
msg << current->m_Ref << wxT( "\";\"" );
msg << current->m_Pkg << wxT( "\";" );
msg << FROM_UTF8( current->m_fpid.Format().c_str() ) << wxT( "\";" );
msg << current->m_CmpCount << wxT( ";\"" );
msg << current->m_Val << wxT( "\";;;\n" );
fprintf( FichBom, "%s", TO_UTF8( msg ) );
......
......@@ -39,7 +39,7 @@
#include <pcbcommon.h>
#include <wxBasePcbFrame.h>
#include <msgpanel.h>
#include <netlist_reader.h>
#include <pcb_netlist.h>
#include <reporter.h>
#include <base_units.h>
......@@ -1513,7 +1513,8 @@ void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDr
ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
LAYER_NUM aStartLayer,
LAYER_NUM aEndLayer )
LAYER_NUM aEndLayer,
int aNetCode )
{
if( aEndLayer < 0 )
aEndLayer = aStartLayer;
......@@ -1533,6 +1534,9 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
if( area->GetState( BUSY ) )
continue;
if( aNetCode >= 0 && area->GetNet() != aNetCode )
continue;
if( area->HitTestFilledArea( aRefPos ) )
return area;
}
......@@ -2387,7 +2391,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
msg.Printf( _( "Checking netlist component footprint \"%s:%s:%s\".\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ),
GetChars( component->GetFootprintName() ) );
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
aReporter->Report( msg );
}
......@@ -2405,7 +2409,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
msg.Printf( _( "Adding new component \"%s:%s\" footprint \"%s\".\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ),
GetChars( component->GetFootprintName() ) );
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
if( aReporter->ReportWarnings() )
aReporter->Report( msg );
......@@ -2416,7 +2420,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
"footprint \"%s\".\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ),
GetChars( component->GetFootprintName() ) );
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
if( aReporter->ReportErrors() )
aReporter->Report( msg );
......@@ -2436,8 +2440,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
else // An existing footprint.
{
// Test for footprint change.
if( !component->GetFootprintName().IsEmpty() &&
footprint->GetLibRef() != component->GetFootprintName() )
if( !component->GetFPID().empty() &&
footprint->GetFPID() != component->GetFPID() )
{
if( aNetlist.GetReplaceFootprints() )
{
......@@ -2449,8 +2453,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
"\"%s\".\n" ),
GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ),
GetChars( footprint->GetLibRef() ),
GetChars( component->GetFootprintName() ) );
GetChars( FROM_UTF8( footprint->GetFPID().Format().c_str() ) ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
if( aReporter->ReportWarnings() )
aReporter->Report( msg );
......@@ -2461,7 +2465,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
"footprint \"%s\".\n" ),
GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ),
GetChars( component->GetFootprintName() ) );
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
if( aReporter->ReportErrors() )
aReporter->Report( msg );
......@@ -2692,7 +2696,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
msg.Printf( _( "** Error: Component \"%s\" pad <%s> not found in footprint \"%s\" **\n" ),
GetChars( component->GetReference() ),
GetChars( padname ),
GetChars( footprint->GetLibRef() ) );
footprint->GetFPID().Format().c_str() );
aReporter->Report( msg );
}
}
......
......@@ -1083,12 +1083,14 @@ public:
* Note: if a zone has its flag BUSY (in .m_State) is set, it is ignored.
* @param aRefPos A wxPoint to test
* @param aStartLayer the first layer to test
* @param aEndLayer the last layer (-1 to ignore it) to test
* @param aEndLayer the last layer to test
* @param aNetCode = the netcode used to filter zones (-1 to to test all zones)
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
*/
ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos,
LAYER_NUM aStartLayer,
LAYER_NUM aEndLayer = UNDEFINED_LAYER );
LAYER_NUM aEndLayer,
int aNetCode );
/**
* Function RedrawAreasOutlines
......
......@@ -70,6 +70,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
// if true, when creating a new track starting on an existing track, use this track width
m_UseConnectedTrackWidth = false;
m_BlindBuriedViaAllowed = false; // true to allow blind/buried vias
m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = DEFAULT_GRAPHIC_THICKNESS; // current graphic line width (not EDGE layer)
......
......@@ -60,9 +60,9 @@ wxString DRC_ITEM::GetErrorText() const
case DRCE_ENDS_PROBLEM3:
case DRCE_ENDS_PROBLEM4:
case DRCE_ENDS_PROBLEM5:
return wxString( _("Two track ends") );
case DRCE_TRACK_UNKNOWN1:
return wxString( _("This looks bad") ); ///< @todo check source code and change this comment
return wxString( _("Two track ends too close") );
case DRCE_TRACK_SEGMENTS_TOO_CLOSE:
return wxString( _("Two parallel track segments too close") );
case DRCE_TRACKS_CROSSING:
return wxString( _("Tracks crossing") );
case DRCE_PAD_NEAR_PAD1:
......
......@@ -86,7 +86,7 @@ MODULE::MODULE( const MODULE& aModule ) :
BOARD_ITEM( aModule )
{
m_Pos = aModule.m_Pos;
m_LibRef = aModule.m_LibRef;
m_fpid = aModule.m_fpid;
m_Layer = aModule.m_Layer;
m_Attributs = aModule.m_Attributs;
m_ModuleStatus = aModule.m_ModuleStatus;
......@@ -201,7 +201,7 @@ void MODULE::Copy( MODULE* aModule )
{
m_Pos = aModule->m_Pos;
m_Layer = aModule->m_Layer;
m_LibRef = aModule->m_LibRef;
m_fpid = aModule->m_fpid;
m_Attributs = aModule->m_Attributs;
m_ModuleStatus = aModule->m_ModuleStatus;
m_Orient = aModule->m_Orient;
......@@ -524,7 +524,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
}
aList.push_back( MSG_PANEL_ITEM( _( "Attrib" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Module" ), m_LibRef, BLUE ) );
aList.push_back( MSG_PANEL_ITEM( _( "Module" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) );
msg = _( "No 3D shape" );
// Search the first active 3D shape in list
......
......@@ -35,11 +35,13 @@
#include <dlist.h>
#include <layers_id_colors_and_visibility.h> // ALL_LAYERS definition.
#include <class_board_item.h>
#include <fpid.h>
#include <class_text_mod.h>
#include <PolyLine.h>
#include "zones.h"
class LINE_READER;
class EDA_3D_CANVAS;
class S3D_MASTER;
......@@ -117,8 +119,8 @@ public:
void SetOrientation( double newangle );
double GetOrientation() const { return m_Orient; }
const wxString& GetLibRef() const { return m_LibRef; }
void SetLibRef( const wxString& aLibRef ) { m_LibRef = aLibRef; }
const FPID& GetFPID() const { return m_fpid; }
void SetFPID( const FPID& aFPID ) { m_fpid = aFPID; }
const wxString& GetDescription() const { return m_Doc; }
void SetDescription( const wxString& aDoc ) { m_Doc = aDoc; }
......@@ -512,7 +514,7 @@ private:
wxPoint m_Pos; ///< Position of module on the board in internal units.
TEXTE_MODULE* m_Reference; ///< Component reference designator value (U34, R18..)
TEXTE_MODULE* m_Value; ///< Component value (74LS00, 22K..)
wxString m_LibRef; ///< Name of the module in the library.
FPID m_fpid; ///< The #FPID of the MODULE.
int m_Attributs; ///< Flag bits ( see Mod_Attribut )
int m_ModuleStatus; ///< For autoplace: flags (LOCKED, AUTOPLACED)
EDA_RECT m_BoundaryBox; ///< Bounding box : coordinates on board, real orientation.
......
......@@ -38,17 +38,9 @@
#include <class_board.h>
#include <hotkeys.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <class_pcb_layer_box_selector.h>
/* class to display a layer list.
*
*/
// class to display a layer list in a wxBitmapComboBox.
// Reload the Layers
void PCB_LAYER_BOX_SELECTOR::Resync()
......@@ -58,9 +50,14 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
static DECLARE_LAYERS_ORDER_LIST( layertranscode );
static DECLARE_LAYERS_HOTKEY( layerhk );
// Tray to fix a minimum width fot the BitmapComboBox
int minwidth = 80, h;
wxClientDC dc( GetParent() ); // The DC for "this" is not always initialized
#define BM_SIZE 14
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
wxBitmap layerbmp( 14, 14 );
wxBitmap layerbmp( BM_SIZE, BM_SIZE );
wxString layername;
LAYER_NUM layerid = i;
......@@ -70,23 +67,33 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
if( ! IsLayerEnabled( layerid ) )
continue;
if( ( m_layerMaskDisable & GetLayerMask( layerid ) ) )
continue;
SetBitmapLayer( layerbmp, layerid );
layername = GetLayerName( layerid );
if( m_layerhotkeys && m_hotkeys != NULL )
layername = AddHotkeyName( layername, m_hotkeys, layerhk[layerid], IS_COMMENT );
layername = AddHotkeyName( layername, m_hotkeys,
layerhk[layerid], IS_COMMENT );
Append( layername, layerbmp, (void*)(intptr_t) layerid );
int w;
dc.GetTextExtent ( layername, &w, &h );
minwidth = std::max( minwidth, w );
}
minwidth += BM_SIZE + 35; // Take in account the bitmap size and margins
SetMinSize( wxSize( minwidth, -1 ) );
}
// Returns true if the layer id is enabled (i.e. is it should be displayed)
bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
wxASSERT( m_boardFrame != NULL );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
return board->IsLayerEnabled( aLayer );
......@@ -96,8 +103,8 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const
// Returns a color index from the layer id
EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
wxASSERT( m_boardFrame != NULL );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
return board->GetLayerColor( aLayer );
......@@ -107,8 +114,8 @@ EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
// Returns the name of the layer id
wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
wxASSERT( m_boardFrame != NULL );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
return board->GetLayerName( aLayer );
......
......@@ -3,41 +3,53 @@
#include <class_layer_box_selector.h>
class PCB_BASE_FRAME;
/* class to display a layer list in Pcbnew.
*
*/
/* class to display a layer list.
*
/* class to display a pcb layer list in a wxBitmapComboBox.
*/
class PCB_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{
PCB_BASE_FRAME * m_boardFrame;
LAYER_MSK m_layerMaskDisable; // A mask to remove some layers from layer list
public:
// Hotkey Info
struct EDA_HOTKEY_CONFIG* m_hotkeys;
public:
PCB_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
// If you are thinking the constructor is a bit curious,
// just remember it is used by automaticallty generated by wxFormBuilder files,
// and it should mimic the wxBitmapComboBox constructor.
// Therefore, value, style are not yet used,
// but they are here for compatibility
PCB_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL )
int n = 0, const wxString choices[] = NULL, int style = 0 )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
}
{
m_boardFrame = NULL;
m_layerMaskDisable = 0;
}
// Accessors
// SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR
// It is not passed through the constructor because when using wxFormBuilder
// we should use a constructor compatible with a wxBitmapComboBox
void SetBoardFrame( PCB_BASE_FRAME * aFrame ) { m_boardFrame = aFrame; };
PCB_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices )
:LAYER_BOX_SELECTOR( parent, id, pos, size, choices )
{
}
// SetLayerMask allows disableing some layers, whiech are not
// shown in list;
void SetLayerMask( LAYER_MSK aMask ) { m_layerMaskDisable = aMask; }
// Reload the Layers names and bitmaps
// Virtual function
void Resync();
private:
// Returns a color index from the layer id
// Virtual function
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
......
......@@ -345,7 +345,7 @@ void PCB_LAYER_WIDGET::ReFill()
void PCB_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor )
{
myframe->GetBoard()->SetLayerColor( aLayer, aColor );
myframe->ReCreateLayerBox( NULL );
myframe->ReCreateLayerBox( false );
myframe->GetCanvas()->Refresh();
}
......
......@@ -117,9 +117,9 @@ void PCB_EDIT_FRAME::Clean_Pcb()
wxBusyCursor( dummy );
TRACKS_CLEANER cleaner( GetBoard() );
cleaner.SetdeleteUnconnectedTracksOpt( dlg.deleteUnconnectedSegm );
cleaner.SetMergeSegmentsOpt( dlg.mergeSegments );
cleaner.SetCleanViasOpt( dlg.cleanVias );
cleaner.SetdeleteUnconnectedTracksOpt( dlg.m_deleteUnconnectedSegm );
cleaner.SetMergeSegmentsOpt( dlg.m_mergeSegments );
cleaner.SetCleanViasOpt( dlg.m_cleanVias );
if( cleaner.CleanupBoard() )
{
......@@ -321,13 +321,16 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
if( track->Type() != PCB_VIA_T )
{
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
track->GetLayer() );
track->GetLayer(),
track->GetLayer(),
track->GetNet() );
}
else
{
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
top_layer, bottom_layer );
top_layer, bottom_layer,
track->GetNet() );
}
}
......@@ -354,7 +357,9 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
{
via->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( via->GetStart(),
bottom_layer, top_layer );
bottom_layer,
top_layer,
via->GetNet() );
}
if( (other == NULL) && (zone == NULL) )
......@@ -376,13 +381,16 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
if( track->Type() != PCB_VIA_T )
{
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
track->GetLayer() );
track->GetLayer(),
track->GetLayer(),
track->GetNet() );
}
else
{
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
top_layer, bottom_layer );
top_layer, bottom_layer,
track->GetNet() );
}
}
......@@ -410,7 +418,8 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
{
via->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( via->GetEnd(),
bottom_layer, top_layer );
bottom_layer, top_layer,
via->GetNet() );
}
if( (other == NULL) && (zone == NULL) )
......
......@@ -155,10 +155,10 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">remove vias on pads with a through hole</property>
<property name="validator_data_type">bool</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NUMERIC</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable">cleanVias</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -243,10 +243,10 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">merge aligned track segments, and remove null segments</property>
<property name="validator_data_type">bool</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NUMERIC</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable">mergeSegments</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -331,10 +331,10 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">delete track segment having a dangling end</property>
<property name="validator_data_type">bool</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NUMERIC</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable">deleteUnconnectedSegm</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......
......@@ -50,9 +50,6 @@ class DIALOG_CLEANING_OPTIONS_BASE : public DIALOG_SHIM
public:
bool cleanVias;
bool mergeSegments;
bool deleteUnconnectedSegm;
DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Cleaning Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 243,146 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_CLEANING_OPTIONS_BASE();
......
......@@ -276,7 +276,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill );
if( m_BrdSettings.m_CurrentViaType != VIA_THROUGH )
if( m_BrdSettings.m_BlindBuriedViaAllowed )
m_OptViaType->SetSelection( 1 );
m_AllowMicroViaCtrl->SetSelection( m_BrdSettings.m_MicroViasAllowed ? 1 : 0 );
......@@ -286,7 +286,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
// Initialize Vias and Tracks sizes lists.
// note we display only extra values, never the current netclass value.
// (the first value in histories list)
// (the first value in history list)
m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList;
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList;
......@@ -579,9 +579,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
/*************************************************/
{
m_BrdSettings.m_CurrentViaType = VIA_THROUGH;
if( m_OptViaType->GetSelection() > 0 )
m_BrdSettings.m_CurrentViaType = VIA_BLIND_BURIED;
m_BrdSettings.m_BlindBuriedViaAllowed = m_OptViaType->GetSelection() > 0;
// Update vias minimum values for DRC
m_BrdSettings.m_ViasMinSize = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl );
......
......@@ -167,11 +167,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
wxStaticBoxSizer* sbViasOptionSizer;
sbViasOptionSizer = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Via Options:") ), wxVERTICAL );
wxString m_OptViaTypeChoices[] = { _("Through via"), _("Blind or buried via") };
wxString m_OptViaTypeChoices[] = { _("Do not allow blind/buried vias"), _("Allow blind/buried vias") };
int m_OptViaTypeNChoices = sizeof( m_OptViaTypeChoices ) / sizeof( wxString );
m_OptViaType = new wxRadioBox( m_panelGolbalDesignRules, wxID_ANY, _("Default Via Type:"), wxDefaultPosition, wxDefaultSize, m_OptViaTypeNChoices, m_OptViaTypeChoices, 1, wxRA_SPECIFY_COLS );
m_OptViaType = new wxRadioBox( m_panelGolbalDesignRules, wxID_ANY, _("Blind/buried Vias:"), wxDefaultPosition, wxDefaultSize, m_OptViaTypeNChoices, m_OptViaTypeChoices, 1, wxRA_SPECIFY_COLS );
m_OptViaType->SetSelection( 0 );
m_OptViaType->SetToolTip( _("Select the current via type.\nTrough via is the usual selection") );
m_OptViaType->SetToolTip( _("Allows or not blind/buried vias.\nDo not allow is the usual selection\nNote: micro vias are a special type of blind vias and are not managed here") );
sbViasOptionSizer->Add( m_OptViaType, 0, wxALL|wxEXPAND, 5 );
......
......@@ -1604,7 +1604,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Through via&quot; &quot;Blind or buried via&quot;</property>
<property name="choices">&quot;Do not allow blind/buried vias&quot; &quot;Allow blind/buried vias&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......@@ -1619,7 +1619,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Default Via Type:</property>
<property name="label">Blind/buried Vias:</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
......@@ -1642,7 +1642,7 @@
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Select the current via type.&#x0A;Trough via is the usual selection</property>
<property name="tooltip">Allows or not blind/buried vias.&#x0A;Do not allow is the usual selection&#x0A;Note: micro vias are a special type of blind vias and are not managed here</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "class_pcb_layer_box_selector.h"
#include "dialog_dimension_editor_base.h"
///////////////////////////////////////////////////////////////////////////
......@@ -21,6 +23,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerMain->Add( m_staticTextDim, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Name = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Name->SetMaxLength( 0 );
m_Name->SetMinSize( wxSize( 400,-1 ) );
bSizerMain->Add( m_Name, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
......@@ -36,6 +39,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft->Add( m_staticTextSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtSizeXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TxtSizeXCtrl->SetMaxLength( 0 );
bSizerLeft->Add( m_TxtSizeXCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextSizeY = new wxStaticText( this, wxID_ANY, _("Size Y"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -43,6 +47,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft->Add( m_staticTextSizeY, 0, wxRIGHT|wxLEFT, 5 );
m_TxtSizeYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TxtSizeYCtrl->SetMaxLength( 0 );
bSizerLeft->Add( m_TxtSizeYCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Width"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -50,6 +55,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft->Add( m_staticTextWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TxtWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TxtWidthCtrl->SetMaxLength( 0 );
bSizerLeft->Add( m_TxtWidthCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextPosX = new wxStaticText( this, wxID_ANY, _("Text position X"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -57,6 +63,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft->Add( m_staticTextPosX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCtrlPosX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlPosX->SetMaxLength( 0 );
bSizerLeft->Add( m_textCtrlPosX, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextPosY = new wxStaticText( this, wxID_ANY, _("Text position Y"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -64,6 +71,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerLeft->Add( m_staticTextPosY, 0, wxRIGHT|wxLEFT, 5 );
m_textCtrlPosY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlPosY->SetMaxLength( 0 );
bSizerLeft->Add( m_textCtrlPosY, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
......@@ -82,7 +90,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
m_staticTextLayer->Wrap( -1 );
bSizerRight->Add( m_staticTextLayer, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_SelLayerBox = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bSizerRight->Add( m_SelLayerBox, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
......
......@@ -42,7 +42,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_DIMENSION_EDITOR_BASE</property>
<property name="pos"></property>
<property name="size">378,328</property>
<property name="size">417,328</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Dimension Properties</property>
......@@ -1341,7 +1341,7 @@
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxComboBox" expanded="1">
<object class="wxBitmapComboBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -1389,7 +1389,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="subclass">PCB_LAYER_BOX_SELECTOR; class_pcb_layer_box_selector.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,9 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
class PCB_LAYER_BOX_SELECTOR;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
......@@ -21,7 +24,7 @@
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/combobox.h>
#include <wx/bmpcbox.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -51,7 +54,7 @@ class DIALOG_DIMENSION_EDITOR_BASE : public DIALOG_SHIM
wxTextCtrl* m_textCtrlPosY;
wxRadioBox* m_rbMirror;
wxStaticText* m_staticTextLayer;
wxComboBox* m_SelLayerBox;
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerBts;
wxButton* m_sdbSizerBtsOK;
......@@ -64,7 +67,7 @@ class DIALOG_DIMENSION_EDITOR_BASE : public DIALOG_SHIM
public:
DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 378,328 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 417,328 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DIMENSION_EDITOR_BASE();
};
......
......@@ -308,19 +308,9 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_CostRot180Ctrl->SetValue( m_CurrentModule->GetPlacementCost180() );
// Initialize 3D parameters
wxBoxSizer* BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Scale = new VERTEX_VALUE_CTRL( m_Panel3D, _( "Shape Scale:" ), BoxSizer );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Offset = new VERTEX_VALUE_CTRL( m_Panel3D, _( "Shape Offset (inch):" ), BoxSizer );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Rotation = new VERTEX_VALUE_CTRL( m_Panel3D,
_( "Shape Rotation (degrees):" ), BoxSizer );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
m_3D_Scale = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeScale );
m_3D_Offset = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeOffset );
m_3D_Rotation = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeRotation );
// if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
if( m_3D_ShapeNameListBox->GetCount() > 0 )
......
......@@ -307,6 +307,33 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
m_Sizer3DValues = new wxStaticBoxSizer( new wxStaticBox( m_Panel3D, wxID_ANY, _("3D Scale and Position") ), wxVERTICAL );
m_bSizerShapeScale = new wxBoxSizer( wxVERTICAL );
m_staticTextShapeScale = new wxStaticText( m_Panel3D, wxID_ANY, _("Shape Scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextShapeScale->Wrap( -1 );
m_bSizerShapeScale->Add( m_staticTextShapeScale, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Sizer3DValues->Add( m_bSizerShapeScale, 0, wxEXPAND, 5 );
m_bSizerShapeOffset = new wxBoxSizer( wxVERTICAL );
m_staticTextShapeOffset = new wxStaticText( m_Panel3D, wxID_ANY, _("Shape Offset (inch):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextShapeOffset->Wrap( -1 );
m_bSizerShapeOffset->Add( m_staticTextShapeOffset, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Sizer3DValues->Add( m_bSizerShapeOffset, 0, wxEXPAND, 5 );
m_bSizerShapeRotation = new wxBoxSizer( wxVERTICAL );
m_staticTextShapeRotation = new wxStaticText( m_Panel3D, wxID_ANY, _("Shape Rotation (degrees):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextShapeRotation->Wrap( -1 );
m_bSizerShapeRotation->Add( m_staticTextShapeRotation, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Sizer3DValues->Add( m_bSizerShapeRotation, 0, wxEXPAND, 5 );
bLowerSizer3D->Add( m_Sizer3DValues, 1, wxALL|wxEXPAND, 5 );
......
......@@ -104,6 +104,12 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM
wxPanel* m_Panel3D;
wxStaticText* m_staticText3Dname;
wxListBox* m_3D_ShapeNameListBox;
wxBoxSizer* m_bSizerShapeScale;
wxStaticText* m_staticTextShapeScale;
wxBoxSizer* m_bSizerShapeOffset;
wxStaticText* m_staticTextShapeOffset;
wxBoxSizer* m_bSizerShapeRotation;
wxStaticText* m_staticTextShapeRotation;
wxButton* m_buttonBrowse;
wxButton* m_buttonAdd;
wxButton* m_buttonRemove;
......
......@@ -114,7 +114,7 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
m_FootprintNameCtrl->SetValue( m_currentModule->GetLibRef() );
m_FootprintNameCtrl->SetValue( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD components" ) );
m_AttributsCtrl->SetItemToolTip( 1,
......@@ -151,18 +151,9 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
m_CostRot180Ctrl->SetValue( m_currentModule->GetPlacementCost180() );
// Initialize 3D parameters
wxBoxSizer* BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Scale = new VERTEX_VALUE_CTRL( m_Panel3D, _( "Shape Scale:" ), BoxSizer );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Offset = new VERTEX_VALUE_CTRL( m_Panel3D, _( "Shape Offset (inch):" ), BoxSizer );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
BoxSizer = new wxBoxSizer( wxVERTICAL );
m_3D_Rotation = new VERTEX_VALUE_CTRL( m_Panel3D, _( "Shape Rotation (degrees):" ), BoxSizer );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
m_3D_Scale = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeScale );
m_3D_Offset = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeOffset );
m_3D_Rotation = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeRotation );
// Initialize dialog relative to masks clearances
m_NetClearanceUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
......@@ -405,7 +396,7 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
// Init footprint name in library
if( ! footprintName.IsEmpty() )
m_currentModule->SetLibRef( footprintName );
m_currentModule->SetFPID( FPID( footprintName ) );
// Init Fields:
m_currentModule->Reference().Copy( m_referenceCopy );
......
......@@ -250,6 +250,33 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa
m_Sizer3DValues = new wxStaticBoxSizer( new wxStaticBox( m_Panel3D, wxID_ANY, _("3D Scale and Position") ), wxVERTICAL );
m_bSizerShapeScale = new wxBoxSizer( wxVERTICAL );
m_staticTextShapeScale = new wxStaticText( m_Panel3D, wxID_ANY, _("Shape Scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextShapeScale->Wrap( -1 );
m_bSizerShapeScale->Add( m_staticTextShapeScale, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Sizer3DValues->Add( m_bSizerShapeScale, 0, wxEXPAND, 5 );
m_bSizerShapeOffset = new wxBoxSizer( wxVERTICAL );
m_staticTextShapeOffset = new wxStaticText( m_Panel3D, wxID_ANY, _("Shape Offset (inch):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextShapeOffset->Wrap( -1 );
m_bSizerShapeOffset->Add( m_staticTextShapeOffset, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Sizer3DValues->Add( m_bSizerShapeOffset, 0, wxEXPAND, 5 );
m_bSizerShapeRotation = new wxBoxSizer( wxVERTICAL );
m_staticTextShapeRotation = new wxStaticText( m_Panel3D, wxID_ANY, _("Shape Rotation (degrees):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextShapeRotation->Wrap( -1 );
m_bSizerShapeRotation->Add( m_staticTextShapeRotation, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_Sizer3DValues->Add( m_bSizerShapeRotation, 0, wxEXPAND, 5 );
bLowerSizer3D->Add( m_Sizer3DValues, 1, wxEXPAND, 5 );
......
......@@ -90,6 +90,13 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM
wxPanel* m_Panel3D;
wxStaticText* m_staticText3Dname;
wxListBox* m_3D_ShapeNameListBox;
wxStaticBoxSizer* m_Sizer3DValues;
wxBoxSizer* m_bSizerShapeScale;
wxStaticText* m_staticTextShapeScale;
wxBoxSizer* m_bSizerShapeOffset;
wxStaticText* m_staticTextShapeOffset;
wxBoxSizer* m_bSizerShapeRotation;
wxStaticText* m_staticTextShapeRotation;
wxButton* m_buttonBrowse;
wxButton* m_buttonRemove;
wxStdDialogButtonSizer* m_sdbSizerStdButtons;
......@@ -107,7 +114,6 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM
public:
wxStaticBoxSizer* m_Sizer3DValues;
DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Module Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 486,462 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MODULE_MODULE_EDITOR_BASE();
......
......@@ -134,6 +134,8 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
// Find the Java web start application on Windows.
#ifdef __WINDOWS__
#if wxCHECK_VERSION( 2, 9, 0 )
// If you thought the registry was brain dead before, now you have to deal with
// accessing it in either 64 or 32 bit mode depending on the build version of
// Windows and the build version of KiCad.
......@@ -164,7 +166,10 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
key.SetName( key.GetName() + wxT( "\\" ) + value );
key.QueryValue( wxT( "Home" ), value );
javaWebStartCommand = value + wxFileName::GetPathSeparator() + javaWebStartCommand;
#endif
#else
#warning Kicad needs wxWidgets >= 2.9.4. version 2.8 is only supported for testing purposes
#endif // wxCHECK_VERSION( 2, 9, 0 )
#endif // __WINDOWS__
// Wrap FullFileName in double quotes in case it has C:\Program Files in it.
// The space is interpreted as an argument separator.
......
......@@ -33,6 +33,7 @@
#include <wxBasePcbFrame.h>
#include <base_units.h>
#include <kicad_string.h>
#include <macros.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
......@@ -156,7 +157,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
if( ! aFilter.IsEmpty() )
{
if( ! WildCompareString( aFilter, module->GetLibRef(), false ) )
if( ! WildCompareString( aFilter, FROM_UTF8( module->GetFPID().Format().c_str() ),
false ) )
continue;
}
......
......@@ -24,6 +24,7 @@
#include <class_drawsegment.h>
#include <dialog_graphic_item_properties_base.h>
#include <class_pcb_layer_box_selector.h>
class DIALOG_GRAPHIC_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
{
......@@ -127,7 +128,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
m_EndPointXLabel->SetLabel(_("Start Point X"));
m_EndPointYLabel->SetLabel(_("Start Point Y"));
// Here the angle is a double, but the UI is still working
// Here the angle is a double, but the UI is still working
// with integers
msg << int( m_Item->GetAngle() );
m_Angle_Ctrl->SetValue(msg);
......@@ -159,20 +160,18 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness );
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER;
layer <= LAST_NON_COPPER_LAYER; ++layer )
// Configure the layers list selector
m_LayerSelectionCtrl->SetLayersHotkeys( false );
m_LayerSelectionCtrl->SetLayerMask( ALL_CU_LAYERS );
m_LayerSelectionCtrl->SetBoardFrame( m_parent );
m_LayerSelectionCtrl->Resync();
if( m_LayerSelectionCtrl->SetLayerSelection( m_Item->GetLayer() ) < 0 )
{
m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) );
wxMessageBox( _("This item has an illegal layer id.\n"
"Now, forced on the drawings layer. Please, fix it") );
m_LayerSelectionCtrl->SetLayerSelection( DRAW_N );
}
LAYER_NUM layer = m_Item->GetLayer();
// It has to be an aux layer
if ( layer < FIRST_NON_COPPER_LAYER )
layer = FIRST_NON_COPPER_LAYER;
if ( layer > LAST_NON_COPPER_LAYER )
layer = LAST_NON_COPPER_LAYER;
m_LayerSelectionCtrl->SetSelection( layer - FIRST_NON_COPPER_LAYER );
}
......@@ -182,7 +181,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event )
{
int thickness;
if( (m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NON_COPPER_LAYER) == EDGE_N )
if( m_LayerSelectionCtrl->GetLayerSelection() == EDGE_N )
thickness = m_brdSettings.m_EdgeSegmentWidth;
else
thickness = m_brdSettings.m_DrawSegmentWidth;
......@@ -221,7 +220,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UserUnit, msg );
m_Item->SetLayer( FIRST_NON_COPPER_LAYER + m_LayerSelectionCtrl->GetCurrentSelection() );
m_Item->SetLayer( m_LayerSelectionCtrl->GetLayerSelection() );
if( m_Item->GetLayer() == EDGE_N )
m_brdSettings.m_EdgeSegmentWidth = thickness;
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "class_pcb_layer_box_selector.h"
#include "dialog_graphic_item_properties_base.h"
///////////////////////////////////////////////////////////////////////////
......@@ -30,6 +32,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
fgUpperLeftGridSizer->Add( m_StartPointXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_Center_StartXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Center_StartXCtrl->SetMaxLength( 0 );
fgUpperLeftGridSizer->Add( m_Center_StartXCtrl, 0, wxEXPAND|wxALL, 5 );
m_StartPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -41,6 +44,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
fgUpperLeftGridSizer->Add( m_StartPointYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_Center_StartYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Center_StartYCtrl->SetMaxLength( 0 );
fgUpperLeftGridSizer->Add( m_Center_StartYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_StartPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -52,6 +56,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
fgUpperLeftGridSizer->Add( m_EndPointXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_EndX_Radius_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_EndX_Radius_Ctrl->SetMaxLength( 0 );
fgUpperLeftGridSizer->Add( m_EndX_Radius_Ctrl, 0, wxEXPAND|wxALL, 5 );
m_EndPointXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -63,6 +68,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
fgUpperLeftGridSizer->Add( m_EndPointYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_EndY_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_EndY_Ctrl->SetMaxLength( 0 );
fgUpperLeftGridSizer->Add( m_EndY_Ctrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_EndPointYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -79,7 +85,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
bUpperRightSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgUpperRightGridSizer;
fgUpperRightGridSizer = new wxFlexGridSizer( 3, 3, 0, 0 );
fgUpperRightGridSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
fgUpperRightGridSizer->AddGrowableCol( 1 );
fgUpperRightGridSizer->SetFlexibleDirection( wxBOTH );
fgUpperRightGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
......@@ -89,6 +95,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
fgUpperRightGridSizer->Add( m_Angle_Text, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_Angle_Ctrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Angle_Ctrl->SetMaxLength( 0 );
fgUpperRightGridSizer->Add( m_Angle_Ctrl, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_AngleUnit = new wxStaticText( this, wxID_ANY, _("0.1 degree"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -100,6 +107,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
fgUpperRightGridSizer->Add( m_ThicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_ThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessCtrl->SetMaxLength( 0 );
fgUpperRightGridSizer->Add( m_ThicknessCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_ThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -111,34 +119,25 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
fgUpperRightGridSizer->Add( m_DefaultThicknessLabel, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
m_DefaultThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_DefaultThicknessCtrl->SetMaxLength( 0 );
fgUpperRightGridSizer->Add( m_DefaultThicknessCtrl, 0, wxALL|wxEXPAND, 5 );
m_DefaulThicknessTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_DefaulThicknessTextUnit->Wrap( -1 );
fgUpperRightGridSizer->Add( m_DefaulThicknessTextUnit, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
bUpperRightSizer->Add( fgUpperRightGridSizer, 0, wxEXPAND, 5 );
wxFlexGridSizer* fgLowerRightSizer;
fgLowerRightSizer = new wxFlexGridSizer( 1, 2, 0, 0 );
fgLowerRightSizer->AddGrowableCol( 1 );
fgLowerRightSizer->SetFlexibleDirection( wxBOTH );
fgLowerRightSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_LayerLabel = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_LayerLabel->Wrap( -1 );
fgLowerRightSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
fgUpperRightGridSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgUpperRightGridSizer->Add( m_LayerSelectionCtrl, 0, wxALL, 5 );
wxArrayString m_LayerSelectionCtrlChoices;
m_LayerSelectionCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_LayerSelectionCtrlChoices, 0 );
m_LayerSelectionCtrl->SetSelection( 0 );
m_LayerSelectionCtrl->SetToolTip( _("Select the layer on which text should lay.") );
fgLowerRightSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxALL, 5 );
fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 );
bUpperRightSizer->Add( fgLowerRightSizer, 1, wxEXPAND, 5 );
bUpperRightSizer->Add( fgUpperRightGridSizer, 0, wxEXPAND, 5 );
bUpperSizer->Add( bUpperRightSizer, 1, wxEXPAND, 5 );
......
......@@ -42,7 +42,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">537,215</property>
<property name="size">576,215</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Graphic Item Properties</property>
......@@ -1250,7 +1250,7 @@
<property name="name">fgUpperRightGridSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">3</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
......@@ -2023,24 +2023,6 @@
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgLowerRightSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">1</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT</property>
......@@ -2124,11 +2106,11 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="0">
<object class="wxBitmapComboBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -2172,22 +2154,23 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="subclass">PCB_LAYER_BOX_SELECTOR; class_pcb_layer_box_selector.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Select the layer on which text should lay.</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnChoice"></event>
<event name="OnCombobox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
......@@ -2209,9 +2192,21 @@
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
</object>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,9 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
class PCB_LAYER_BOX_SELECTOR;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
......@@ -21,7 +24,7 @@
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/choice.h>
#include <wx/bmpcbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -59,7 +62,7 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM
wxTextCtrl* m_DefaultThicknessCtrl;
wxStaticText* m_DefaulThicknessTextUnit;
wxStaticText* m_LayerLabel;
wxChoice* m_LayerSelectionCtrl;
PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_StandardButtonsSizer;
wxButton* m_StandardButtonsSizerOK;
......@@ -73,7 +76,7 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM
public:
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 537,215 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 576,215 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE();
};
......
......@@ -24,6 +24,7 @@
#include <class_edge_mod.h>
#include <dialog_graphic_item_properties_base.h>
#include <class_pcb_layer_box_selector.h>
class DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
{
......@@ -32,7 +33,6 @@ private:
EDGE_MODULE* m_item;
BOARD_DESIGN_SETTINGS m_brdSettings;
MODULE * m_module;
std::vector<LAYER_NUM> m_layerId; // the layer Id with the same order as m_LayerSelectionCtrl widget
public:
DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( FOOTPRINT_EDIT_FRAME* aParent,
......@@ -129,7 +129,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
m_EndPointXLabel->SetLabel(_("Start Point X"));
m_EndPointYLabel->SetLabel(_("Start Point Y"));
// Here the angle is a double, but the UI is still working
// Here the angle is a double, but the UI is still working
// with integers
msg << int( m_item->GetAngle() );
m_Angle_Ctrl->SetValue(msg);
......@@ -154,27 +154,16 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
PutValueInLocalUnits( *m_DefaultThicknessCtrl, m_brdSettings.m_ModuleSegmentWidth );
m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( LAYER_N_BACK ) );
m_layerId.push_back( LAYER_N_BACK );
m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( LAYER_N_FRONT ) );
m_layerId.push_back( LAYER_N_FRONT );
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer )
// Configure the layers list selector
m_LayerSelectionCtrl->SetLayersHotkeys( false );
m_LayerSelectionCtrl->SetLayerMask( INTERNAL_CU_LAYERS|EDGE_LAYER );
m_LayerSelectionCtrl->SetBoardFrame( m_parent );
m_LayerSelectionCtrl->Resync();
if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 )
{
if( layer == EDGE_N )
// Do not use pcb edge layer for footprints, this is a special layer
// So skip it in list
continue;
m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) );
m_layerId.push_back( layer );
}
for( unsigned ii = 0; ii < m_layerId.size(); ii++ )
{
if( m_layerId[ii] == m_item->GetLayer() )
{
m_LayerSelectionCtrl->SetSelection( ii );
break;
}
wxMessageBox( _("This item has an illegal layer id.\n"
"Now, forced on the front silk screen layer. Please, fix it") );
m_LayerSelectionCtrl->SetLayerSelection( SILKSCREEN_N_FRONT );
}
}
......@@ -191,14 +180,8 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
/* Copy values in text control to the item parameters
*/
{
int idx = m_LayerSelectionCtrl->GetCurrentSelection();
if( idx < 0 )
{
wxMessageBox( _("No valid layer selected for this item. Please, select a layer") );
return;
}
LAYER_NUM layer = m_LayerSelectionCtrl->GetLayerSelection();
LAYER_NUM layer = m_layerId[idx];
if( IsCopperLayer( layer ) )
{
/* an edge is put on a copper layer: this it is very dangerous. a
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_layer_selection_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
m_leftGridLayers = new wxGrid( this, ID_LEFT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_leftGridLayers->CreateGrid( 1, 3 );
m_leftGridLayers->EnableEditing( false );
m_leftGridLayers->EnableGridLines( true );
m_leftGridLayers->EnableDragGridSize( false );
m_leftGridLayers->SetMargins( 0, 3 );
// Columns
m_leftGridLayers->EnableDragColMove( false );
m_leftGridLayers->EnableDragColSize( false );
m_leftGridLayers->SetColLabelSize( 0 );
m_leftGridLayers->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_leftGridLayers->EnableDragRowSize( false );
m_leftGridLayers->SetRowLabelSize( 0 );
m_leftGridLayers->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
m_leftGridLayers->SetLabelBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
// Cell Defaults
m_leftGridLayers->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
m_leftGridLayers->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerUpper->Add( m_leftGridLayers, 1, wxALL|wxEXPAND, 5 );
m_rightGridLayers = new wxGrid( this, ID_RIGHT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_rightGridLayers->CreateGrid( 1, 3 );
m_rightGridLayers->EnableEditing( false );
m_rightGridLayers->EnableGridLines( true );
m_rightGridLayers->EnableDragGridSize( false );
m_rightGridLayers->SetMargins( 0, 3 );
// Columns
m_rightGridLayers->EnableDragColMove( false );
m_rightGridLayers->EnableDragColSize( false );
m_rightGridLayers->SetColLabelSize( 0 );
m_rightGridLayers->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_rightGridLayers->EnableDragRowSize( false );
m_rightGridLayers->SetRowLabelSize( 0 );
m_rightGridLayers->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_rightGridLayers->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
m_rightGridLayers->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerUpper->Add( m_rightGridLayers, 1, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_leftGridLayers->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
m_rightGridLayers->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
}
DIALOG_LAYER_SELECTION_BASE::~DIALOG_LAYER_SELECTION_BASE()
{
// Disconnect Events
m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_leftGridLayers->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
m_rightGridLayers->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
}
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL );
m_staticTextTopLayer = new wxStaticText( this, wxID_ANY, _("Top/Front Layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTopLayer->Wrap( -1 );
bSizerLeft->Add( m_staticTextTopLayer, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_leftGridLayers = new wxGrid( this, ID_LEFT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_leftGridLayers->CreateGrid( 1, 3 );
m_leftGridLayers->EnableEditing( false );
m_leftGridLayers->EnableGridLines( true );
m_leftGridLayers->EnableDragGridSize( false );
m_leftGridLayers->SetMargins( 0, 3 );
// Columns
m_leftGridLayers->EnableDragColMove( false );
m_leftGridLayers->EnableDragColSize( false );
m_leftGridLayers->SetColLabelSize( 0 );
m_leftGridLayers->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_leftGridLayers->EnableDragRowSize( false );
m_leftGridLayers->SetRowLabelSize( 0 );
m_leftGridLayers->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
m_leftGridLayers->SetLabelBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
// Cell Defaults
m_leftGridLayers->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
m_leftGridLayers->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerLeft->Add( m_leftGridLayers, 1, wxALL|wxEXPAND, 5 );
bSizerUpper->Add( bSizerLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
m_staticTextBottomLayer = new wxStaticText( this, wxID_ANY, _("Bottom/Back Layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBottomLayer->Wrap( -1 );
bSizerRight->Add( m_staticTextBottomLayer, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_rightGridLayers = new wxGrid( this, ID_RIGHT_LIST, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_rightGridLayers->CreateGrid( 1, 3 );
m_rightGridLayers->EnableEditing( false );
m_rightGridLayers->EnableGridLines( true );
m_rightGridLayers->EnableDragGridSize( false );
m_rightGridLayers->SetMargins( 0, 3 );
// Columns
m_rightGridLayers->EnableDragColMove( false );
m_rightGridLayers->EnableDragColSize( false );
m_rightGridLayers->SetColLabelSize( 0 );
m_rightGridLayers->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_rightGridLayers->EnableDragRowSize( false );
m_rightGridLayers->SetRowLabelSize( 0 );
m_rightGridLayers->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_rightGridLayers->SetDefaultCellBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
m_rightGridLayers->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerRight->Add( m_rightGridLayers, 1, wxALL|wxEXPAND, 5 );
bSizerUpper->Add( bSizerRight, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnOKClick ), NULL, this );
}
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::~DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE()
{
// Disconnect Events
m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnOKClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_LAYER_SELECTION_BASE_H__
#define __DIALOG_LAYER_SELECTION_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/sizer.h>
#include <wx/dialog.h>
#include <wx/stattext.h>
#include <wx/statline.h>
#include <wx/button.h>
///////////////////////////////////////////////////////////////////////////
#define ID_LEFT_LIST 1000
#define ID_RIGHT_LIST 1001
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LAYER_SELECTION_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LAYER_SELECTION_BASE : public wxDialog
{
private:
protected:
wxGrid* m_leftGridLayers;
wxGrid* m_rightGridLayers;
// Virtual event handlers, overide them in your derived class
virtual void OnLeftGridCellClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnLeftButtonReleased( wxMouseEvent& event ) { event.Skip(); }
virtual void OnRightGridCellClick( wxGridEvent& event ) { event.Skip(); }
public:
DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Layer:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 337,183 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_LAYER_SELECTION_BASE();
};
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticTextTopLayer;
wxGrid* m_leftGridLayers;
wxStaticText* m_staticTextBottomLayer;
wxGrid* m_rightGridLayers;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnLeftGridCellClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnRightGridCellClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Copper Layer Pair:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,175 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE();
};
#endif //__DIALOG_LAYER_SELECTION_BASE_H__
......@@ -560,7 +560,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
}
m_Parent->OnModify();
m_Parent->ReCreateLayerBox( NULL );
m_Parent->ReCreateLayerBox();
m_Parent->ReFillLayerWidget();
EndModal( wxID_OK );
......
......@@ -29,11 +29,13 @@
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <confirm.h>
#include <macros.h>
#include <dialog_helpers.h>
#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>
......
......@@ -41,6 +41,7 @@
#include <vector>
#include <wx/wx.h>
#include <dialog_pcb_text_properties_base.h>
#include <class_pcb_layer_box_selector.h>
class PCB_EDIT_FRAME;
......@@ -56,7 +57,6 @@ private:
PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC;
TEXTE_PCB* m_SelectedPCBText;
std::vector<LAYER_NUM> layerList;
void MyInit();
......@@ -126,20 +126,13 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
PutValueInLocalUnits( *m_PositionXCtrl, m_SelectedPCBText->GetTextPosition().x );
PutValueInLocalUnits( *m_PositionYCtrl, m_SelectedPCBText->GetTextPosition().y );
LAYER_MSK enabledLayers = m_Parent->GetBoard()->GetEnabledLayers();
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
if( enabledLayers & GetLayerMask( layer ) )
{
layerList.push_back( layer );
int itemIndex =
m_LayerSelectionCtrl->Append( m_Parent->GetBoard()->GetLayerName( layer ) );
if( m_SelectedPCBText->GetLayer() == layer )
m_LayerSelectionCtrl->SetSelection( itemIndex );
}
}
// Configure the layers list selector
m_LayerSelectionCtrl->SetLayersHotkeys( false );
// A text has no sense on edge cut layer
m_LayerSelectionCtrl->SetLayerMask( EDGE_LAYER );
m_LayerSelectionCtrl->SetBoardFrame( m_Parent );
m_LayerSelectionCtrl->Resync();
m_LayerSelectionCtrl->SetLayerSelection( m_SelectedPCBText->GetLayer() );
wxString orientationStr;
orientationStr << m_SelectedPCBText->GetOrientation();
......@@ -245,7 +238,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
}
// Set the layer on which the PCB text is laying
m_SelectedPCBText->SetLayer( layerList[m_LayerSelectionCtrl->GetSelection()] );
m_SelectedPCBText->SetLayer( m_LayerSelectionCtrl->GetLayerSelection() );
// Set whether the PCB text is mirrored (faced down from layer face perspective)
m_SelectedPCBText->SetMirrored( m_DisplayCtrl->GetSelection() == 1 );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "class_pcb_layer_box_selector.h"
#include "dialog_pcb_text_properties_base.h"
///////////////////////////////////////////////////////////////////////////
......@@ -24,13 +26,14 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
bSizer9->Add( m_TextLabel, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextContentCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_TextContentCtrl->SetMaxLength( 0 );
m_TextContentCtrl->SetToolTip( _("Enter the text placed on selected layer.") );
m_TextContentCtrl->SetMinSize( wxSize( 400,60 ) );
bSizer9->Add( m_TextContentCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 6, 4, 0, 0 );
fgSizer1 = new wxFlexGridSizer( 0, 4, 0, 0 );
fgSizer1->AddGrowableCol( 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->AddGrowableCol( 2 );
......@@ -55,17 +58,15 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( m_staticText10, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_SizeXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_SizeXCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_PositionXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PositionXCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_PositionXCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxArrayString m_LayerSelectionCtrlChoices;
m_LayerSelectionCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_LayerSelectionCtrlChoices, 0 );
m_LayerSelectionCtrl->SetSelection( 0 );
m_LayerSelectionCtrl->SetToolTip( _("Select the layer on which text should lay.") );
fgSizer1->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
fgSizer1->Add( m_LayerSelectionCtrl, 0, wxALL, 5 );
wxString m_DisplayCtrlChoices[] = { _("Normal"), _("Mirrored") };
int m_DisplayCtrlNChoices = sizeof( m_DisplayCtrlChoices ) / sizeof( wxString );
......@@ -90,9 +91,11 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( m_staticText11, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_SizeYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_SizeYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_PositionYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PositionYCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_PositionYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxString m_StyleCtrlChoices[] = { _("Normal"), _("Italic") };
......@@ -122,9 +125,11 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_ThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_ThicknessCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_OrientationCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OrientationCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_OrientationCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
......
......@@ -42,7 +42,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_PCB_TEXT_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">433,450</property>
<property name="size">483,450</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Text Properties</property>
......@@ -288,7 +288,7 @@
<property name="name">fgSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">6</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
......@@ -804,11 +804,11 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="0">
<object class="wxBitmapComboBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -852,22 +852,23 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="subclass">PCB_LAYER_BOX_SELECTOR; class_pcb_layer_box_selector.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Select the layer on which text should lay.</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnChoice"></event>
<event name="OnCombobox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
......@@ -889,6 +890,8 @@
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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