7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 12:30:14 +00:00

Merged upstream.

This commit is contained in:
Maciej Suminski 2014-03-06 09:42:16 +01:00
commit 5ed0980dd5
71 changed files with 1149 additions and 485 deletions
3d-viewer
CMakeLists.txt
Documentation/compiling
INSTALL.txt
common
cvpcb
eeschema
include
kicad
packaging/windows/nsis
pcbnew

View File

@ -84,7 +84,7 @@ public:
GLuint DisplayCubeforTest(); // Just a test function
void SetView3D( int keycode );
void DisplayStatus();
void Redraw( bool finish = false );
void Redraw();
void Render();
/**

View File

@ -52,8 +52,15 @@ void S3D_MATERIAL::SetMaterial()
#if 0
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
#endif
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
#endif
}
void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial )
{
aMaterial->SetNext( m_Materials );
m_Materials = aMaterial;
}

View File

@ -50,7 +50,6 @@
#include <3d_draw_basic_functions.h>
// Imported function:
extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
extern void CheckGLError();
/* returns true if aLayer should be displayed, false otherwise
@ -99,7 +98,7 @@ static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
}
void EDA_3D_CANVAS::Redraw( bool finish )
void EDA_3D_CANVAS::Redraw()
{
// SwapBuffer requires the window to be shown before calling
if( !IsShown() )
@ -139,11 +138,6 @@ void EDA_3D_CANVAS::Redraw( bool finish )
else
CreateDrawGL_List();
glFlush();
if( finish )
glFinish();
SwapBuffers();
}
@ -593,8 +587,11 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// draw modules 3D shapes
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
module->ReadAndInsert3DComponentShape( this );
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
{
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
module->ReadAndInsert3DComponentShape( this );
}
}
@ -831,41 +828,32 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
{
// Draw module shape: 3D shape if exists (or module outlines if not exists)
S3D_MASTER* struct3D = m_3D_Drawings;
// Read from disk and draws the footprint 3D shapes if exists
S3D_MASTER* shape3D = m_3D_Drawings;
double zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( IsFlipped() );
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
glPushMatrix();
glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
-m_Pos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
zpos );
if( m_Orient )
glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 );
if( IsFlipped() )
{
double zpos;
if( IsFlipped() )
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( true );
else
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( false );
glPushMatrix();
glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
-m_Pos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
zpos );
if( m_Orient )
glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 );
if( IsFlipped() )
{
glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 );
}
for( ; struct3D != NULL; struct3D = struct3D->Next() )
{
if( struct3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
struct3D->ReadData();
}
glPopMatrix();
glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 );
}
for( ; shape3D != NULL; shape3D = shape3D->Next() )
{
if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
shape3D->ReadData();
}
glPopMatrix();
}

View File

@ -38,9 +38,6 @@
#include "3d_struct.h"
#include "modelparsers.h"
// Imported function:
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
const wxString aExtension )
@ -96,9 +93,7 @@ const wxString S3D_MASTER::GetShape3DFullFilename()
int S3D_MASTER::ReadData()
{
if( m_Shape3DName.IsEmpty() )
{
return 1;
}
wxString filename = GetShape3DFullFilename();
@ -135,15 +130,3 @@ int S3D_MASTER::ReadData()
return -1;
}
int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum )
{
char line[512];
while( GetLine( file, line, LineNum, 512 ) )
{
}
return -1;
}

View File

@ -117,12 +117,7 @@ public:
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
S3D_MASTER* Back() const { return (S3D_MASTER*) Pback; }
void Insert( S3D_MATERIAL* aMaterial )
{
aMaterial->SetNext( m_Materials );
m_Materials = aMaterial;
}
void Insert( S3D_MATERIAL* aMaterial );
void Copy( S3D_MASTER* pattern );
int ReadData();
@ -171,8 +166,6 @@ public:
STRUCT_3D_SHAPE* Next() const { return (STRUCT_3D_SHAPE*) Pnext; }
STRUCT_3D_SHAPE* Back() const { return (STRUCT_3D_SHAPE*) Pback; }
int ReadData( FILE* file, int* LineNum );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif

View File

@ -88,8 +88,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
if( bbbox.GetWidth() == 0 && bbbox.GetHeight() == 0 )
{
bbbox.SetWidth( 100 * IU_PER_MM );
bbbox.SetHeight( 100 * IU_PER_MM );
bbbox.SetWidth( Millimeter2iu( 100 ) );
bbbox.SetHeight( Millimeter2iu( 100 ) );
}
m_BoardSettings = &aBoard->GetDesignSettings();
@ -131,6 +131,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
// Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness
// Solder mask and Solder paste have the same Z position
for( ; layer <= LAST_COPPER_LAYER; layer++ )
{
m_LayerZcoord[layer] = m_EpoxyThickness;
@ -144,21 +145,21 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
switch( layer_id )
{
case ADHESIVE_N_BACK:
zpos = zpos_copper_back - 4 * zpos_offset;
break;
case ADHESIVE_N_FRONT:
zpos = zpos_copper_front + 4 * zpos_offset;
break;
case SOLDERPASTE_N_BACK:
zpos = zpos_copper_back - 3 * zpos_offset;
break;
case SOLDERPASTE_N_FRONT:
case ADHESIVE_N_FRONT:
zpos = zpos_copper_front + 3 * zpos_offset;
break;
case SOLDERPASTE_N_BACK:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERPASTE_N_FRONT:
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SOLDERMASK_N_BACK:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
@ -177,7 +178,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NON_COPPER_LAYER + 5) * zpos_offset;
(layer_id - FIRST_NON_COPPER_LAYER + 4) * zpos_offset;
break;
}

View File

@ -148,9 +148,10 @@ public: INFO3D_VISU();
*/
int GetCopperThicknessBIU() const
{
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
bool use_thickness = GetFlag( FL_USE_COPPER_THICKNESS )
// || GetFlag( FL_USE_REALISTIC_MODE )
;
return use_thickness ?
KiROUND( m_CopperThickness / m_BiuTo3Dunits )
: 0;
}
@ -173,9 +174,10 @@ public: INFO3D_VISU();
*/
int GetNonCopperLayerThicknessBIU() const
{
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
bool use_thickness = GetFlag( FL_USE_COPPER_THICKNESS )
// || GetFlag( FL_USE_REALISTIC_MODE )
;
return use_thickness ?
KiROUND( m_NonCopperLayerThickness / m_BiuTo3Dunits )
: 0;
}

View File

@ -68,6 +68,8 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if ( text == NULL )
continue;
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 )
{
@ -280,8 +282,6 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
}
#define BUFSIZE 2000
void VRML_MODEL_PARSER::readCoordsList( FILE* file, char* text_buffer,
std::vector< double >& aList, int* LineNum )
{
@ -371,6 +371,9 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
strcpy( buffer, line );
text = strtok( buffer, sep_chars );
if( text == NULL )
continue;
if( *text == '}' )
{
err = 0;
@ -381,7 +384,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
{
text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 )
if( text && stricmp( text, "true" ) == 0 )
{
}
else
@ -395,7 +398,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
{
text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 )
if( text && stricmp( text, "true" ) == 0 )
{
}
else

View File

@ -66,8 +66,6 @@ option( KICAD_BUILD_DYNAMIC
)
# WARNING: KiCad developers strongly advise you to build Boost with supplied patches,
# as it is known to work with KiCad. Other versions may contain bugs that may result
# WARNING: KiCad developers strongly advise you to build Boost with supplied patches,
# as it is known to work with KiCad. Other versions may contain bugs that may result
# in KiCad errors.
@ -100,9 +98,9 @@ set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} )
if( UNIX )
set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specifig KiCad config files" )
set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specific KiCad config files" )
elseif( MINGW )
set( KICAD_USER_CONFIG_DIR $ENV{%APPDATA%} CACHE PATH "Location of user specifig KiCad config files" )
set( KICAD_USER_CONFIG_DIR $ENV{%APPDATA%} CACHE PATH "Location of user specific KiCad config files" )
endif()
mark_as_advanced( KICAD_USER_CONFIG_DIR )

View File

@ -212,4 +212,5 @@ Make the Debug binaries:
make
See ./cmake_config.txt for customizing the KiCad build setting.
See Documentation/compiling/build-config.txt for a list of all CMake options
available when compiling KiCad.

View File

@ -1,5 +1,6 @@
Bazaar
------
======
KiCad uses the Bazaar version control system to track source code changes,
and download the boost libraries needed by Kicad.
The easiest way to get a copy of the KiCad source is to use Bazaar.
@ -11,7 +12,8 @@ Be sure bzrtools is also installed.
boost libraries will be downloaded the first time you build Kicad.
CMake
-----
=====
KiCad uses CMake to generate the build files specific for the target platform
specified by the developer. This document attempts to define some of the more
common CMake and KiCad build configuration settings. You can use CMake either
@ -23,7 +25,8 @@ http://www.cmake.org/cmake/help/documentation.html.
Useful CMake Build Settings.
----------------------------
============================
This section defines some of the more common CMake build configuration setting
used when configuring KiCad. These settings are valid for all projects that
use CMake.
@ -39,14 +42,18 @@ switch on the command line. Please note, only a small subset of these project
generators are supported. If you want to use Eclipse on Linux to build KiCad,
you may be in for a lot of work.
CMAKE_BUILD_TYPE (Release/Debug/RelWithDebInfo/MinSizeRel)
----------------------------------------------------------
Default: Release
When configuring the KiCad build for the command line you must specify build
type. To create a debug build, set CMAKE_BUILD_TYPE to Debug. To create a
release build, set CMAKE_BUILD_TYPE to Release. See the CMake documentation
for other build types. For IDE project files, the build type can be selected
by the IDE configuration manager.
CMAKE_INSTALL_PATH (InstallPath)
--------------------------------
By default CMake will select the correct install path for your platform. If
@ -57,7 +64,8 @@ installed on your system.
wxWidgets Library Configuration.
--------------------------------
================================
KiCad is built using the wxWidgets library. The following options allow you
to specifically tailor the wxWidgets library configuration. For the complete
list of wxWidgets setting see CMakeModules/FindwxWidgets.cmake in the KiCad
@ -69,85 +77,147 @@ CMake looks in the standard platform locations to find the default version of
the wxWidgets library. If you wish to use a custom built wxWidgets library,
set wxWidgets_ROOT_DIR to the correct path.
wxWidgets_USE_DEBUG (ON/OFF)
----------------------------
Default: OFF
When creating a debug build of KiCad, it is often useful to link against the
debug build of the wxWidgets. To use the debug build of wxWidgets, set
wxWidgets_USE_DEBUG to ON.
wxWidgets_USE_UNICODE (ON/OFF)
------------------------------
Default: ON (wxWidgets 2.9 or later), OFF (older versions)
If your platform supports Unicode and you wish to build KiCad with Unicode
support, set wxWidgets_USE_UNICODE to ON. Please note as of the 2.9 branch
this option is not required.
KiCad Specific Options
----------------------
======================
All of the configuration settings below are specific to the KiCad project.
If for any reason you add or remove a build option to the KiCad CMake files,
please update the list below.
KICAD_SKIP_BOOST (ON/OFF)
--------------------------
Skips building the required boost library components.
WARNING: KiCad developers strongly advise you to build the bundled boost library, as it is
known to work with KiCad. Other versions may contain bugs that may result in KiCad errors.
Default: OFF
Use the version of the Boost library installed on the system rather than
building a local copy.
WARNING: The KiCad developers strongly advise you to build the bundled copy of
the Boost library, as it is known to work with KiCad. Other versions may
contain bugs that may result in KiCad errors.
USE_WX_GRAPHICS_CONTEXT (ON/OFF)
--------------------------------
This option is *Experimental* and used the advanced drawing library code
using wxGraphicsContext and should only be used for testing purposes.
Under Windows, a very recent version of mingw is needed. It also requires
wxWidgets to be built with the --enable-graphics_ctx configuration switch.
Default: OFF
This option is *Experimental*. It enables advanced drawing library code using
wxGraphicsContext and should only be used for testing purposes. Under Windows,
a very recent version of mingw is needed. It also requires wxWidgets to be
built with the --enable-graphics_ctx configuration switch.
USE_IMAGES_IN_MENUS (ON/OFF)
----------------------------
Default: OFF for OSX, ON for other platforms.
This option is used to enable or disable building KiCad with images in menu
items. If this is not defined when CMake is used to create the build files,
images will be included in menu items on all platforms except OSX.
DOWNLOAD_DIR (PATH)
-------------------
Default: <source directory>/.downloads-by-cmake
Some external dependencies are automatically download and built when you
compile KiCad. This option specifies which directory they are stored in. If you
are building multiple copies of KiCad (e.g., to test different features or your
own modifications), it is recommended you set this option to a global directory
to avoid download and building the dependencies multiple times.
KICAD_USER_CONFIG_DIR (PATH)
----------------------------
Default: Home directory (Unix-based systems), Application data directory (Windows)
This option specifies where to store user-specific configuration information.
KICAD_KEEPCASE (ON/OFF)
-----------------------
This option enables or disables turning off the automatic component name
conversion to uppercase. The default is OFF which means component names will
be converted to upper case.
Default: ON
If this is OFF, component names are automatically converted to uppercase meaning
they are case insensitive. If it is ON, component names are not changed and
are therefore case sensitive.
USE_WX_OVERLAY (ON/OFF)
-----------------------
This option enables or disables wxOverlay for drawing operation on OSX. It is
OFF by default on all platforms except OSX. Warning, this is experimental!
Default: ON for OSX, OFF for other platforms.
This option enables or disables the use of wxOverlay for drawing operations.
Warning, this is experimental!
KICAD_SCRIPTING (ON/OFF)
------------------------
This option enables or disables building Python scripting support for KiCad.
The default is OFF. Currently only Pcbnew is supported. This option requires
that SWIG and Python are installed on the system.
Default: OFF
This option enables or disables building Python scripting support within KiCad.
Currently only Pcbnew is supported. This option requires SWIG and Python to be
installed on the system.
KICAD_SCRIPTING_MODULES (ON/OFF)
--------------------------------
This option enables or disables building the KiCad modules that can be used
from scripting languages. The default is OFF. Currently only Pcbnew is
supported. This option requires that SWIG and Python are installed on the
system.
Default: OFF
This option enables or disables building KiCad Python modules that can be used
externally by Python. Currently only Pcbnew is supported. This option
requires SWIG and Python to be installed on the system.
KICAD_SCRIPTING_WXPYTHON (ON/OFF)
---------------------------------
This option enables or disables building wxPython support into KiCad for
python and py.shell. The default is OFF. Currently only Pcbnew is
supported. This option requires that SWIG, Python, and wxPython are
installed on the system.
Default: OFF
This option enables or disables building wxPython support into the KiCad
scripting support. Currently only Pcbnew is supported. This option requires
SWIG, Python, and wxPython to be installed on the system.
PYTHON_SITE_PACKAGE_PATH (PATH)
-------------------------------
Default: System site library path
When building KiCad with Python scripting enable, the Python site library path
is used by default. If you want to install the KiCad Python extension in a
different path, set this variable to the desired path.
USE_FP_LIB_TABLE (ON/OFF)
-------------------------
This option enable or disables building KiCad with the new footprint library
table support. The default setting (OFF) builds KiCad with the legacy library
path support. This option is experimental until the library table support is
ready for release.
BUILD_GITHUB_PLUGIN (ON/OFF)
----------------------------
Default: OFF
This option enables or disables building KiCad with a pcbnew plugin for loading
footprints from a GitHub repository.
KICAD_REPO_NAME (STRING)
------------------------
Default: "product"
The name of the repository this copy of KiCad was compiled from. This is
reported in the "About" dialog and is useful for people who are working with
multiple copies of the code from different sources. The default value is
"product", the name of the main development branch on Launchpad.

View File

@ -170,6 +170,9 @@ build directory.
Important parameters to cmake
-----------------------------
See Documentation/compiling/build-config.txt for a list of all CMake options
available when compiling KiCad.
-DCMAKE_BUILD_TYPE=<buildtype>
<buildtype> may current one of "Debug" and "Release".

View File

@ -119,7 +119,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
// The first shows translated strings, the second contains not translated strings
m_paperSizeComboBox->Clear();
for( unsigned ii = 0; ii<DIM(pageFmts); ii++ )
for( unsigned ii = 0; ii < DIM(pageFmts); ii++ )
{
m_pageFmt.Add( pageFmts[ii] );
m_paperSizeComboBox->Append( wxGetTranslation( pageFmts[ii] ) );

View File

@ -35,7 +35,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
wxString m_paperSizeComboBoxChoices[] = { _("dummy text") };
int m_paperSizeComboBoxNChoices = sizeof( m_paperSizeComboBoxChoices ) / sizeof( wxString );
m_paperSizeComboBox = new wxChoice( this, ID_CHICE_PAGE_SIZE, wxDefaultPosition, wxDefaultSize, m_paperSizeComboBoxNChoices, m_paperSizeComboBoxChoices, 0 );
m_paperSizeComboBox = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_paperSizeComboBoxNChoices, m_paperSizeComboBoxChoices, 0 );
m_paperSizeComboBox->SetSelection( 0 );
bleftSizer->Add( m_paperSizeComboBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );

View File

@ -390,7 +390,7 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_CHICE_PAGE_SIZE</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>

View File

@ -37,27 +37,26 @@ class DIALOG_SHIM;
///////////////////////////////////////////////////////////////////////////
#define ID_CHICE_PAGE_SIZE 1000
#define ID_CHOICE_PAGE_ORIENTATION 1001
#define ID_TEXTCTRL_USER_PAGE_SIZE_Y 1002
#define ID_TEXTCTRL_USER_PAGE_SIZE_X 1003
#define ID_TEXTCTRL_DATE 1004
#define ID_BTN_APPLY_DATE 1005
#define ID_PICKER_DATE 1006
#define ID_CHECKBOX_DATE 1007
#define ID_TEXTCTRL_REVISION 1008
#define ID_CHECKBOX_REVISION 1009
#define ID_TEXTCTRL_TITLE 1010
#define ID_TEXTCTRL_COMPANY 1011
#define ID_CHECKBOX_COMPANY 1012
#define ID_TEXTCTRL_COMMENT1 1013
#define ID_CHECKBOX_COMMENT1 1014
#define ID_TEXTCTRL_COMMENT2 1015
#define ID_CHECKBOX_COMMENT2 1016
#define ID_TEXTCTRL_COMMENT3 1017
#define ID_CHECKBOX_COMMENT3 1018
#define ID_TEXTCTRL_COMMENT4 1019
#define ID_CHECKBOX_COMMENT4 1020
#define ID_CHOICE_PAGE_ORIENTATION 1000
#define ID_TEXTCTRL_USER_PAGE_SIZE_Y 1001
#define ID_TEXTCTRL_USER_PAGE_SIZE_X 1002
#define ID_TEXTCTRL_DATE 1003
#define ID_BTN_APPLY_DATE 1004
#define ID_PICKER_DATE 1005
#define ID_CHECKBOX_DATE 1006
#define ID_TEXTCTRL_REVISION 1007
#define ID_CHECKBOX_REVISION 1008
#define ID_TEXTCTRL_TITLE 1009
#define ID_TEXTCTRL_COMPANY 1010
#define ID_CHECKBOX_COMPANY 1011
#define ID_TEXTCTRL_COMMENT1 1012
#define ID_CHECKBOX_COMMENT1 1013
#define ID_TEXTCTRL_COMMENT2 1014
#define ID_CHECKBOX_COMMENT2 1015
#define ID_TEXTCTRL_COMMENT3 1016
#define ID_CHECKBOX_COMMENT3 1017
#define ID_TEXTCTRL_COMMENT4 1018
#define ID_CHECKBOX_COMMENT4 1019
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PAGES_SETTINGS_BASE

View File

@ -799,10 +799,13 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
wxString uri = cur->rows[i].GetFullURI( true );
if( wxFileName::GetPathSeparator() == wxChar( '\\' )
&& uri.Find( wxChar( '/' ) ) >= 0 )
&& uri.Find( wxChar( '/' ) ) >= 0 )
uri.Replace( wxT( "/"), wxT( "\\" ) );
#ifdef __WINDOWS__
if( uri.CmpNoCase( libPath ) )
#else
if( uri == libPath )
#endif
{
libNickname = cur->rows[i].GetNickName();
break;
@ -827,7 +830,6 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
else
{
FPID newFPID = lastFPID;
newFPID.SetLibNickname( libNickname );
if( !newFPID.IsValid() )

View File

@ -1,8 +1,8 @@
#ifndef HELP_MESSAGE_FILE_H
#define HELP_MESSAGE_FILE_H
#define LOAD_FILE_HELP _( "Open a net list file" )
#define SAVE_HLP_MSG _( "Save the component/footprint link file (.cmp file)" )
#define SAVE_AS_HLP_MSG _( "Save the component/footprint link file (.cmp file) with a new name" )
#define LOAD_FILE_HELP _( "Open netlist file" )
#define SAVE_HLP_MSG _( "Save component/footprint link file (.cmp file)" )
#define SAVE_AS_HLP_MSG _( "Save component/footprint link file (.cmp file) with new name" )
#endif // HELP_MESSAGE_FILE_H

View File

@ -606,6 +606,9 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
libraryName = m_LibraryList->GetSelectedLibrary();
m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter );
// Tell AuiMgr that objects are changed !
m_auimgr.Update();
if( component == NULL )
return;

View File

@ -66,7 +66,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Open
AddMenuItem( filesMenu,
ID_LOAD_PROJECT,
_( "&Open" ), LOAD_FILE_HELP, KiBitmap( open_document_xpm ) );
_( "&Open Netlist" ), LOAD_FILE_HELP, KiBitmap( open_document_xpm ) );
// Open Recent submenu
static wxMenu* openRecentMenu;
@ -81,7 +81,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
wxGetApp().GetFileHistory().AddFilesToMenu();
AddMenuItem( filesMenu, openRecentMenu, -1,
_( "Open &Recent" ),
_( "Open a recent opened netlist document" ),
_( "Open recent netlist" ),
KiBitmap( open_project_xpm ) );
// Separator
@ -111,7 +111,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
wxMenu* preferencesMenu = new wxMenu;
AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
_( "Li&brary Tables" ), _( "Setup footprint libraries" ),
_( "Edit Li&brary Table" ), _( "Setup footprint libraries" ),
KiBitmap( library_table_xpm ) );
// Language submenu
@ -134,7 +134,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
AddMenuItem( preferencesMenu, ID_SAVE_PROJECT_AS,
_( "&Save Project File As" ),
_( "Save changes to the project configuration to a new file" ),
_( "Save changes to a new project configuration file" ),
KiBitmap( save_setup_xpm ) );
// Menu Help:
@ -143,12 +143,12 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Version info
AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
AddMenuItem( helpMenu, wxID_HELP, _( "&Contents" ),
_( "Open the CvPcb handbook" ),
// Manual Contents
AddMenuItem( helpMenu, wxID_HELP, _( "&CvPcb Manual" ),
_( "Open CvPcb manual" ),
KiBitmap( online_help_xpm ) );
// About
// About CvPcb
AddMenuItem( helpMenu, wxID_ABOUT,
_( "&About CvPcb" ),
_( "About CvPcb footprint selector" ),

View File

@ -58,7 +58,7 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxEmptyString,
KiBitmap( config_xpm ),
_( "Configuration" ) );
_( "Set CvPcb config (paths and equ files)" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString,
@ -72,21 +72,21 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
KiBitmap( left_xpm ),
_( "Select previous free component" ) );
_( "Select previous unlinked component" ) );
m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString,
KiBitmap( right_xpm ),
_( "Select next free component" ) );
_( "Select next unlinked component" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
KiBitmap( delete_association_xpm ),
_( "Delete all associations" ) );
_( "Delete all associations (links)" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString,
KiBitmap( datasheet_xpm ),
_( "Display footprints list documentation" ) );
_( "Display footprint documentation" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddSeparator();
@ -94,20 +94,20 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
KiBitmap( module_filtered_list_xpm ),
wxNullBitmap,
true, NULL,
_( "Filter the footprint list for the current component key words" ),
_( "Filter footprint list by keywords" ),
wxEmptyString );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
KiBitmap( module_pin_filtered_list_xpm ),
wxNullBitmap,
true, NULL,
_( "Filter the footprint list by pin count for the current component" ),
_( "Filter footprint list by pin count" ),
wxEmptyString );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
KiBitmap( module_library_list_xpm ),
wxNullBitmap, true, NULL,
_( "Filter the footprint list by the selected library" ),
_( "Filter footprint list by library" ),
wxEmptyString );
if( config )

View File

@ -141,8 +141,6 @@ void COMPONENT_TREE_SEARCH_CONTAINER::AddAliasList( const wxString& aNodeName,
const wxArrayString& aAliasNameList,
CMP_LIBRARY* aOptionalLib )
{
static const wxChar unitLetter[] = wxT( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
TREE_NODE* const lib_node = new TREE_NODE( TREE_NODE::TYPE_LIB, NULL, NULL,
aNodeName, wxEmptyString, wxEmptyString );
nodes.push_back( lib_node );
@ -168,9 +166,20 @@ void COMPONENT_TREE_SEARCH_CONTAINER::AddAliasList( const wxString& aNodeName,
if( !a->GetDescription().empty() )
{
// Preformatting. Unfortunately, the tree widget doesn't have columns
display_info.Printf( wxT(" %s[ %s ]"),
( a->GetName().length() <= 8 ) ? wxT("\t\t") : wxT("\t"),
GetChars( a->GetDescription() ) );
// and using tabs does not work very well or does not work at all
// (depending on OS versions). So indent with spaces in fixed-font width.
// The 98%-ile of length of strings found in the standard library is 15
// characters. Use this as a reasonable cut-off point for aligned indentation.
// For the few component names longer than that, the description is indented a
// bit more.
// The max found in the default lib would be 20 characters, but that creates too
// much visible whitespace for the less extreme component names.
const int COLUMN_DESCR_POS = 15;
const int indent_len = COLUMN_DESCR_POS - a->GetName().length();
display_info = wxString::Format( wxT( " %*s [ %s ]" ),
indent_len > 0 ? indent_len : 0, wxT( "" ),
GetChars( a->GetDescription() ) );
}
TREE_NODE* alias_node = new TREE_NODE( TREE_NODE::TYPE_ALIAS, lib_node,
@ -178,21 +187,28 @@ void COMPONENT_TREE_SEARCH_CONTAINER::AddAliasList( const wxString& aNodeName,
nodes.push_back( alias_node );
if( a->GetComponent()->IsMulti() ) // Add all units as sub-nodes.
for ( int u = 0; u < a->GetComponent()->GetPartCount(); ++u )
{
for( int u = 1; u <= a->GetComponent()->GetPartCount(); ++u )
{
const wxString unitName = unitLetter[u];
TREE_NODE* unit_node = new TREE_NODE(TREE_NODE::TYPE_UNIT, alias_node, a,
_("Unit ") + unitName,
wxEmptyString, wxEmptyString );
unit_node->Unit = u + 1;
wxString unitName = _("Unit");
unitName += wxT( " " ) + LIB_COMPONENT::ReturnSubReference( u, false );
TREE_NODE* unit_node = new TREE_NODE( TREE_NODE::TYPE_UNIT,
alias_node, a,
unitName,
wxEmptyString, wxEmptyString );
unit_node->Unit = u;
nodes.push_back( unit_node );
}
}
}
}
LIB_ALIAS* COMPONENT_TREE_SEARCH_CONTAINER::GetSelectedAlias( int* aUnit )
{
if( tree == NULL )
return NULL;
const wxTreeItemId& select_id = tree->GetSelection();
BOOST_FOREACH( TREE_NODE* node, nodes )

View File

@ -97,7 +97,7 @@ public:
/** Function GetSelectedAlias
*
* @param if not-NULL, the selected sub-unit is set here.
* @return the selected alias or NULL if there is none.
* @return the selected alias or NULL if there is none, or there is no tree.
*/
LIB_ALIAS* GetSelectedAlias( int* aUnit );

View File

@ -47,19 +47,29 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( wxWindow* aParent, const wxStr
m_search_container->SetTree( m_libraryComponentTree );
m_searchBox->SetFocus();
m_componentDetails->SetEditable( false );
#if wxCHECK_VERSION( 3, 0, 0 )
m_libraryComponentTree->ScrollTo( m_libraryComponentTree->GetFocusedItem() );
#endif
// The tree showing libs and component uses a fixed font,
// because we want controle the position of some info when drawing the
// tree. Using tabs does not work very well (does not work on Windows)
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
m_libraryComponentTree->SetFont( wxFont( font.GetPointSize(),
wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
}
// After this dialog is done: return the alias that has been selected, or an
// empty string if there is none.
wxString DIALOG_CHOOSE_COMPONENT::GetSelectedAliasName( int* aUnit ) const
DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT()
{
LIB_ALIAS *alias = m_search_container->GetSelectedAlias( aUnit );
m_search_container->SetTree( NULL );
}
if( alias )
return alias->GetName();
return wxEmptyString;
LIB_ALIAS* DIALOG_CHOOSE_COMPONENT::GetSelectedAlias( int* aUnit ) const
{
return m_search_container->GetSelectedAlias( aUnit );
}
@ -131,7 +141,11 @@ void DIALOG_CHOOSE_COMPONENT::OnTreeSelect( wxTreeEvent& aEvent )
}
void DIALOG_CHOOSE_COMPONENT::OnDoubleClickTreeSelect( wxTreeEvent& aEvent )
// Test strategy for OnDoubleClickTreeActivation()/OnTreeMouseUp() work around wxWidgets bug:
// - search for an item.
// - use the mouse to double-click on an item in the tree.
// -> The dialog should close, and the component should _not_ be immediately placed
void DIALOG_CHOOSE_COMPONENT::OnDoubleClickTreeActivation( wxTreeEvent& aEvent )
{
if( !updateSelection() )
return;
@ -152,6 +166,27 @@ void DIALOG_CHOOSE_COMPONENT::OnTreeMouseUp( wxMouseEvent& aMouseEvent )
aMouseEvent.Skip(); // Let upstream handle it.
}
// Test strategy to see if OnInterceptTreeEnter() works:
// - search for an item.
// - click into the tree once to set focus on tree; navigate. Press 'Enter'
// -> The dialog should close and the component be available to place.
void DIALOG_CHOOSE_COMPONENT::OnInterceptTreeEnter( wxKeyEvent& aEvent )
{
// We have to do some special handling for double-click on a tree-item because
// of some superfluous event delivery bug in wxWidgets (see OnDoubleClickTreeActivation()).
// In tree-activation, we assume we got a double-click and need to take special precaution
// that the mouse-up event is not delivered to the window one level up by going through
// a state-sequence OnDoubleClickTreeActivation() -> OnTreeMouseUp().
// Pressing 'Enter' within a tree will also call OnDoubleClickTreeActivation(),
// but since this is not due to the double-click and we have no way of knowing that it is
// not, we need to intercept the 'Enter' key before that to know that it is time to exit.
if( aEvent.GetKeyCode() == WXK_RETURN )
EndModal( wxID_OK ); // Dialog is done.
else
aEvent.Skip(); // Let tree handle that key for navigation.
}
void DIALOG_CHOOSE_COMPONENT::OnStartComponentBrowser( wxMouseEvent& aEvent )
{

View File

@ -27,27 +27,39 @@
#include <dialog_choose_component_base.h>
class COMPONENT_TREE_SEARCH_CONTAINER;
class LIB_ALIAS;
class LIB_COMPONENT;
class wxTreeItemId;
class DIALOG_CHOOSE_COMPONENT : public DIALOG_CHOOSE_COMPONENT_BASE
{
public:
/**
* Create dialog to choose component.
*
* @param aParent Parent window.
* @param aTitle Dialog title.
* @param aSearchContainer The tree selection search container. Needs to be pre-populated
* This dialog does not take over ownership of this object.
* @param aDeMorganConvert preferred deMorgan conversion (TODO: should happen in dialog)
*/
DIALOG_CHOOSE_COMPONENT( wxWindow* aParent, const wxString& aTitle,
COMPONENT_TREE_SEARCH_CONTAINER* aSearch_container,
COMPONENT_TREE_SEARCH_CONTAINER* aSearchContainer,
int aDeMorganConvert );
virtual ~DIALOG_CHOOSE_COMPONENT();
/** Function GetSelectedAliasName
/** Function GetSelectedAlias
* To be called after this dialog returns from ShowModal().
*
* @param aUnit if not NULL, the selected unit is filled in here.
* @return the alias that has been selected, or an empty string if there is none.
* @return the alias that has been selected, or NULL if there is none.
*/
wxString GetSelectedAliasName( int* aUnit ) const;
LIB_ALIAS* GetSelectedAlias( int* aUnit ) const;
/** Function IsExternalBrowserSelected
*
* @return true, iff the browser pressed the browsing button.
* @return true, iff the user pressed the thumbnail view of the component to
* launch the component browser.
*/
bool IsExternalBrowserSelected() const { return m_external_browser_requested; }
@ -57,7 +69,8 @@ protected:
virtual void OnInterceptSearchBoxKey( wxKeyEvent& aEvent );
virtual void OnTreeSelect( wxTreeEvent& aEvent );
virtual void OnDoubleClickTreeSelect( wxTreeEvent& aEvent );
virtual void OnDoubleClickTreeActivation( wxTreeEvent& aEvent );
virtual void OnInterceptTreeEnter( wxKeyEvent& aEvent );
virtual void OnTreeMouseUp( wxMouseEvent& aMouseEvent );
virtual void OnStartComponentBrowser( wxMouseEvent& aEvent );

Some files were not shown because too many files have changed in this diff Show More