diff --git a/3d-viewer/3d_canvas.h b/3d-viewer/3d_canvas.h index 4d1c929eca..cb931c991f 100644 --- a/3d-viewer/3d_canvas.h +++ b/3d-viewer/3d_canvas.h @@ -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(); /** diff --git a/3d-viewer/3d_class.cpp b/3d-viewer/3d_class.cpp index 7edb6bd996..79ea755b2f 100644 --- a/3d-viewer/3d_class.cpp +++ b/3d-viewer/3d_class.cpp @@ -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; } diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index d721f0a8b4..909d15a4aa 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -50,7 +50,6 @@ #include <3d_draw_basic_functions.h> // Imported function: -extern void Set_Object_Data( std::vector& 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(); } diff --git a/3d-viewer/3d_read_mesh.cpp b/3d-viewer/3d_read_mesh.cpp index 1863b339b2..d093dbecf9 100644 --- a/3d-viewer/3d_read_mesh.cpp +++ b/3d-viewer/3d_read_mesh.cpp @@ -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; -} diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h index d53327f7e9..56a083f8c9 100644 --- a/3d-viewer/3d_struct.h +++ b/3d-viewer/3d_struct.h @@ -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 diff --git a/3d-viewer/info3d_visu.cpp b/3d-viewer/info3d_visu.cpp index 0dc0f04848..3e0afc43c1 100644 --- a/3d-viewer/info3d_visu.cpp +++ b/3d-viewer/info3d_visu.cpp @@ -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; } diff --git a/3d-viewer/info3d_visu.h b/3d-viewer/info3d_visu.h index de9d755eed..00acbbd226 100644 --- a/3d-viewer/info3d_visu.h +++ b/3d-viewer/info3d_visu.h @@ -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; } diff --git a/3d-viewer/vrmlmodelparser.cpp b/3d-viewer/vrmlmodelparser.cpp index fa90c6ada8..fa6367793b 100644 --- a/3d-viewer/vrmlmodelparser.cpp +++ b/3d-viewer/vrmlmodelparser.cpp @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f0d4b109a..4a923759cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/Documentation/compiling/COMPILING.txt b/Documentation/compiling/COMPILING.txt index 8457885384..dbdcca25d5 100644 --- a/Documentation/compiling/COMPILING.txt +++ b/Documentation/compiling/COMPILING.txt @@ -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. diff --git a/Documentation/compiling/build-config.txt b/Documentation/compiling/build-config.txt index b9575e8bf2..5d162f133f 100644 --- a/Documentation/compiling/build-config.txt +++ b/Documentation/compiling/build-config.txt @@ -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: /.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. diff --git a/INSTALL.txt b/INSTALL.txt index 7e1b6e33a1..0a21ae500b 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -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= may current one of "Debug" and "Release". diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index bbd6cd967f..7462e6afe4 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -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; iiAppend( wxGetTranslation( pageFmts[ii] ) ); diff --git a/common/dialogs/dialog_page_settings_base.cpp b/common/dialogs/dialog_page_settings_base.cpp index e11dff30ca..d38544a21e 100644 --- a/common/dialogs/dialog_page_settings_base.cpp +++ b/common/dialogs/dialog_page_settings_base.cpp @@ -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 ); diff --git a/common/dialogs/dialog_page_settings_base.fbp b/common/dialogs/dialog_page_settings_base.fbp index 7cbdda3d75..220b6d3fef 100644 --- a/common/dialogs/dialog_page_settings_base.fbp +++ b/common/dialogs/dialog_page_settings_base.fbp @@ -390,7 +390,7 @@ 0 0 - ID_CHICE_PAGE_SIZE + wxID_ANY 0 diff --git a/common/dialogs/dialog_page_settings_base.h b/common/dialogs/dialog_page_settings_base.h index f4bcc42ab8..2fba886d27 100644 --- a/common/dialogs/dialog_page_settings_base.h +++ b/common/dialogs/dialog_page_settings_base.h @@ -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 diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 3df80ec6d1..fd208eb0cb 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -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() ) diff --git a/cvpcb/common_help_msg.h b/cvpcb/common_help_msg.h index 5796719eac..3f09617d6c 100644 --- a/cvpcb/common_help_msg.h +++ b/cvpcb/common_help_msg.h @@ -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 diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index a5ad9fe60e..36fb9c123a 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -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; diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index f20fcd33d9..acd761b19b 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -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" ), diff --git a/cvpcb/tool_cvpcb.cpp b/cvpcb/tool_cvpcb.cpp index 700e344c0e..47b6d78b49 100644 --- a/cvpcb/tool_cvpcb.cpp +++ b/cvpcb/tool_cvpcb.cpp @@ -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 ) diff --git a/eeschema/component_tree_search_container.cpp b/eeschema/component_tree_search_container.cpp index 015397349d..28ef57d162 100644 --- a/eeschema/component_tree_search_container.cpp +++ b/eeschema/component_tree_search_container.cpp @@ -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 ) diff --git a/eeschema/component_tree_search_container.h b/eeschema/component_tree_search_container.h index 88bd52474f..19d2a54df6 100644 --- a/eeschema/component_tree_search_container.h +++ b/eeschema/component_tree_search_container.h @@ -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 ); diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp index 1039acf1f6..7356137b32 100644 --- a/eeschema/dialogs/dialog_choose_component.cpp +++ b/eeschema/dialogs/dialog_choose_component.cpp @@ -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 ) { diff --git a/eeschema/dialogs/dialog_choose_component.h b/eeschema/dialogs/dialog_choose_component.h index b2e3a0903f..b8839ccc63 100644 --- a/eeschema/dialogs/dialog_choose_component.h +++ b/eeschema/dialogs/dialog_choose_component.h @@ -27,27 +27,39 @@ #include 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 ); diff --git a/eeschema/dialogs/dialog_choose_component_base.cpp b/eeschema/dialogs/dialog_choose_component_base.cpp index af6b6546f2..2d84ff23cd 100644 --- a/eeschema/dialogs/dialog_choose_component_base.cpp +++ b/eeschema/dialogs/dialog_choose_component_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Feb 22 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -75,8 +75,9 @@ DIALOG_CHOOSE_COMPONENT_BASE::DIALOG_CHOOSE_COMPONENT_BASE( wxWindow* parent, wx m_searchBox->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnInterceptSearchBoxKey ), NULL, this ); m_searchBox->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxChange ), NULL, this ); m_searchBox->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxEnter ), NULL, this ); + m_libraryComponentTree->Connect( wxEVT_KEY_UP, wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnInterceptTreeEnter ), NULL, this ); m_libraryComponentTree->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnTreeMouseUp ), NULL, this ); - m_libraryComponentTree->Connect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnDoubleClickTreeSelect ), NULL, this ); + m_libraryComponentTree->Connect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnDoubleClickTreeActivation ), NULL, this ); m_libraryComponentTree->Connect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnTreeSelect ), NULL, this ); m_componentView->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnStartComponentBrowser ), NULL, this ); m_componentView->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnHandlePreviewRepaint ), NULL, this ); @@ -88,8 +89,9 @@ DIALOG_CHOOSE_COMPONENT_BASE::~DIALOG_CHOOSE_COMPONENT_BASE() m_searchBox->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnInterceptSearchBoxKey ), NULL, this ); m_searchBox->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxChange ), NULL, this ); m_searchBox->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnSearchBoxEnter ), NULL, this ); + m_libraryComponentTree->Disconnect( wxEVT_KEY_UP, wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnInterceptTreeEnter ), NULL, this ); m_libraryComponentTree->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnTreeMouseUp ), NULL, this ); - m_libraryComponentTree->Disconnect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnDoubleClickTreeSelect ), NULL, this ); + m_libraryComponentTree->Disconnect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnDoubleClickTreeActivation ), NULL, this ); m_libraryComponentTree->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnTreeSelect ), NULL, this ); m_componentView->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnStartComponentBrowser ), NULL, this ); m_componentView->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_CHOOSE_COMPONENT_BASE::OnHandlePreviewRepaint ), NULL, this ); diff --git a/eeschema/dialogs/dialog_choose_component_base.fbp b/eeschema/dialogs/dialog_choose_component_base.fbp index ee169c8e0c..77cf06af9e 100644 --- a/eeschema/dialogs/dialog_choose_component_base.fbp +++ b/eeschema/dialogs/dialog_choose_component_base.fbp @@ -338,7 +338,7 @@ - + OnInterceptTreeEnter @@ -363,7 +363,7 @@ - OnDoubleClickTreeSelect + OnDoubleClickTreeActivation diff --git a/eeschema/dialogs/dialog_choose_component_base.h b/eeschema/dialogs/dialog_choose_component_base.h index ad588da058..881b5a5ea3 100644 --- a/eeschema/dialogs/dialog_choose_component_base.h +++ b/eeschema/dialogs/dialog_choose_component_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Feb 22 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -50,8 +50,9 @@ class DIALOG_CHOOSE_COMPONENT_BASE : public DIALOG_SHIM virtual void OnInterceptSearchBoxKey( wxKeyEvent& event ) { event.Skip(); } virtual void OnSearchBoxChange( wxCommandEvent& event ) { event.Skip(); } virtual void OnSearchBoxEnter( wxCommandEvent& event ) { event.Skip(); } + virtual void OnInterceptTreeEnter( wxKeyEvent& event ) { event.Skip(); } virtual void OnTreeMouseUp( wxMouseEvent& event ) { event.Skip(); } - virtual void OnDoubleClickTreeSelect( wxTreeEvent& event ) { event.Skip(); } + virtual void OnDoubleClickTreeActivation( wxTreeEvent& event ) { event.Skip(); } virtual void OnTreeSelect( wxTreeEvent& event ) { event.Skip(); } virtual void OnStartComponentBrowser( wxMouseEvent& event ) { event.Skip(); } virtual void OnHandlePreviewRepaint( wxPaintEvent& event ) { event.Skip(); } diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index e8031d3b86..200b29bcd3 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -52,8 +52,8 @@ #include -// TODO(hzeller): would be good if we could give a pre-selected component. -wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void ) +wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( LIB_ALIAS* aPreselectedAlias, + int* aUnit, int* aConvert ) { wxSemaphore semaphore( 0, 1 ); wxString cmpname; @@ -64,7 +64,21 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void ) viewlibFrame->Destroy(); viewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore, - KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT ); + KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT ); + if ( aPreselectedAlias ) + { + viewlibFrame->SetSelectedLibrary( aPreselectedAlias->GetLibraryName() ); + viewlibFrame->SetSelectedComponent( aPreselectedAlias->GetName() ); + } + + if( aUnit && *aUnit > 0 ) + viewlibFrame->SetUnit( *aUnit ); + + if( aConvert && *aConvert > 0 ) + viewlibFrame->SetConvert( *aConvert ); + + viewlibFrame->Refresh(); + // Show the library viewer frame until it is closed // Wait for viewer closing event: while( semaphore.TryWait() == wxSEMA_BUSY ) @@ -74,6 +88,13 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void ) } cmpname = viewlibFrame->GetSelectedComponent(); + + if( aUnit ) + *aUnit = viewlibFrame->GetUnit(); + + if( aConvert ) + *aConvert = viewlibFrame->GetConvert(); + viewlibFrame->Destroy(); return cmpname; @@ -114,7 +135,13 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname, { // This is good for a transition for experineced users: giving them a History. Ideally, // we actually make this part even faster to access with a popup on ALT-a or something. - search_container.AddAliasList( _("-- History --"), aHistoryList, NULL ); + // the history is under a node named "-- History --" + // However, because it is translatable, and we need to have a node name starting by "-- " + // because we (later) sort all node names alphabetically and this node should be the first, + // we build it with only with "History" string translatable + wxString nodename; + nodename << wxT("-- ") << _("History") << wxT(" --"); + search_container.AddAliasList( nodename, aHistoryList, NULL ); search_container.SetPreselectNode( aHistoryList[0], aHistoryLastUnit ); } @@ -125,18 +152,13 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname, if( dlg.ShowModal() == wxID_CANCEL ) return wxEmptyString; - wxString cmpName = dlg.GetSelectedAliasName( aUnit ); + wxString cmpName; + LIB_ALIAS* const alias = dlg.GetSelectedAlias( aUnit ); + if ( alias ) + cmpName = alias->GetName(); - if( dlg.IsExternalBrowserSelected() ) - { - cmpName = SelectComponentFromLibBrowser(); // Would be good if we could pre-select. - - if( aUnit ) - *aUnit = LIB_VIEW_FRAME::GetUnit(); - - if( aConvert ) - *aConvert = LIB_VIEW_FRAME::GetConvert(); - } + if( dlg.IsExternalBrowserSelected() ) // User requested big component browser. + cmpName = SelectComponentFromLibBrowser( alias, aUnit, aConvert); if ( !cmpName.empty() ) { diff --git a/eeschema/help_common_strings.h b/eeschema/help_common_strings.h index c3290c6faf..0f4a8b50a4 100644 --- a/eeschema/help_common_strings.h +++ b/eeschema/help_common_strings.h @@ -47,7 +47,7 @@ "Place hierarchical pin imported from the corresponding hierarchical label" ) #define HELP_PLACE_SHEETPIN _( "Place hierarchical pin in sheet" ) #define HELP_PLACE_GRAPHICLINES _( "Place graphic lines or polygons" ) -#define HELP_PLACE_GRAPHICTEXTS _( "Place graphic text/comment" ) +#define HELP_PLACE_GRAPHICTEXTS _( "Place text" ) #define HELP_ANNOTATE _( "Annotate schematic components" ) #define HELP_RUN_LIB_EDITOR _( "Library Editor - Create/edit components" ) diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 8b7b5a1794..b608513916 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -221,6 +221,13 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, LoadSettings(); + // Ensure m_LastGridSizeId is an offset inside the allowed schematic range + if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 ) + m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; + + if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 ) + m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000; + SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 412d8b27d0..61f8e22256 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -71,10 +71,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() KiBitmap( new_xpm ) ); // Open - text = AddHotkeyName( _( "&Open Schematic Sheet" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH ); + text = AddHotkeyName( _( "&Open Schematic Project" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH ); AddMenuItem( fileMenu, ID_LOAD_PROJECT, text, - _( "Open an existing schematic sheet" ), + _( "Open an existing schematic hierarchy" ), KiBitmap( open_document_xpm ) ); // Open Recent submenu @@ -399,8 +399,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Library AddMenuItem( preferencesMenu, ID_CONFIG_REQ, - _( "Set &Library Path" ), - _( "Set library preferences" ), + _( "Set Active &Libraries" ), + _( "Set active library list and library paths" ), KiBitmap( library_xpm ) ); // Colors @@ -497,7 +497,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() //Run CvPcb AddMenuItem( toolsMenu, ID_TO_CVPCB, - _( "A&ssign Component Footprints" ), + _( "A&ssign Component Footprint" ), _( "Run CvPcb" ), KiBitmap( cvpcb_xpm ) ); diff --git a/eeschema/operations_on_items_lists.cpp b/eeschema/operations_on_items_lists.cpp index 2b417e0020..e897d8d735 100644 --- a/eeschema/operations_on_items_lists.cpp +++ b/eeschema/operations_on_items_lists.cpp @@ -59,11 +59,6 @@ void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& rotationPoint ) } -void DeleteItemsInList( EDA_DRAW_PANEL* panel, PICKED_ITEMS_LIST& aItemsList ); -void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, - const wxPoint aMoveVector ); - - void MirrorY( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint ) { for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ ) diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index d83c892591..3575075845 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -764,14 +764,14 @@ void SCH_COMPONENT::SetOrientation( int aOrientation ) m_transform.x2 = m_transform.y1 = 0; break; - case CMP_ROTATE_CLOCKWISE: // Rotate + (incremental rotation) + case CMP_ROTATE_COUNTERCLOCKWISE: // Rotate + (incremental rotation) temp.x1 = temp.y2 = 0; temp.y1 = 1; temp.x2 = -1; transform = true; break; - case CMP_ROTATE_COUNTERCLOCKWISE: // Rotate - (incremental rotation) + case CMP_ROTATE_CLOCKWISE: // Rotate - (incremental rotation) temp.x1 = temp.y2 = 0; temp.y1 = -1; temp.x2 = 1; @@ -1534,8 +1534,7 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition ) RotatePoint( &m_Pos, aPosition, 900 ); - //SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE ); - SetOrientation( CMP_ROTATE_CLOCKWISE ); + SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE ); for( int ii = 0; ii < GetFieldCount(); ii++ ) { diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 15e021fab1..808c3044c5 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -215,6 +215,13 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle, /* Get config */ LoadSettings(); + // Ensure m_LastGridSizeId is an offset inside the allowed schematic range + if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 ) + m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; + + if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 ) + m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000; + SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); if( m_canvas ) diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index a1414c08d8..2bbed5bd48 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -195,7 +195,7 @@ void SCH_EDIT_FRAME::ReCreateVToolbar() m_drawToolBar->AddTool( ID_HIERARCHY_PUSH_POP_BUTT, wxEmptyString, KiBitmap( hierarchy_cursor_xpm ), - _( "Ascend or descend hierarchy" ), wxITEM_CHECK ); + _( "Ascend/descend hierarchy" ), wxITEM_CHECK ); m_drawToolBar->AddTool( ID_SCH_PLACE_COMPONENT, wxEmptyString, KiBitmap( add_component_xpm ), HELP_PLACE_COMPONENTS, wxITEM_CHECK ); @@ -251,7 +251,7 @@ void SCH_EDIT_FRAME::ReCreateVToolbar() HELP_PLACE_GRAPHICTEXTS, wxITEM_CHECK ); m_drawToolBar->AddTool( ID_ADD_IMAGE_BUTT, wxEmptyString, KiBitmap( image_xpm ), - _("Add a bitmap image"), wxITEM_CHECK ); + _("Add bitmap image"), wxITEM_CHECK ); m_drawToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString, KiBitmap( delete_xpm ), @@ -282,11 +282,11 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, KiBitmap( unit_inch_xpm ), - _( "Units in inches" ), wxITEM_CHECK ); + _( "Set unit to inch" ), wxITEM_CHECK ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, KiBitmap( unit_mm_xpm ), - _( "Units in millimeters" ), wxITEM_CHECK ); + _( "Set unit to mm" ), wxITEM_CHECK ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, KiBitmap( cursor_shape_xpm ), diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index c1b421e76e..b6a3b296a6 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -402,16 +402,24 @@ void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event ) if( ii < 0 ) return; - wxString name = m_libList->GetString( ii ); + SetSelectedLibrary( m_libList->GetString( ii ) ); +} - if( m_libraryName == name ) + +void LIB_VIEW_FRAME::SetSelectedLibrary( const wxString& aLibraryName ) +{ + if( m_libraryName == aLibraryName ) return; - m_libraryName = name; + m_libraryName = aLibraryName; ReCreateListCmp(); m_canvas->Refresh(); DisplayLibInfos(); ReCreateHToolbar(); + // Ensure the corresponding line in m_libList is selected + // (which is not necessary the case if SetSelectedLibrary is called + // by an other caller than ClickOnLibList. + m_libList->SetStringSelection( m_libraryName, true ); } @@ -422,11 +430,19 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event ) if( ii < 0 ) return; - wxString name = m_cmpList->GetString( ii ); + SetSelectedComponent( m_cmpList->GetString( ii ) ); +} - if( m_entryName.CmpNoCase( name ) != 0 ) + +void LIB_VIEW_FRAME::SetSelectedComponent( const wxString& aComponentName ) +{ + if( m_entryName.CmpNoCase( aComponentName ) != 0 ) { - m_entryName = name; + m_entryName = aComponentName; + // Ensure the corresponding line in m_cmpList is selected + // (which is not necessary the case if SetSelectedComponent is called + // by an other caller than ClickOnCmpList. + m_cmpList->SetStringSelection( aComponentName, true ); DisplayLibInfos(); m_unit = 1; m_convert = 1; @@ -436,6 +452,7 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event ) } } + void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event ) { if( m_semaphore ) @@ -480,10 +497,10 @@ void LIB_VIEW_FRAME::LoadSettings( ) cfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 100 ); // Set parameters to a reasonable value. - if ( m_libListWidth > m_FrameSize.x/2 ) + if( m_libListWidth > m_FrameSize.x/2 ) m_libListWidth = m_FrameSize.x/2; - if ( m_cmpListWidth > m_FrameSize.x/2 ) + if( m_cmpListWidth > m_FrameSize.x/2 ) m_cmpListWidth = m_FrameSize.x/2; } diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h index 7449dbfd1a..f5b4a05f85 100644 --- a/eeschema/viewlib_frame.h +++ b/eeschema/viewlib_frame.h @@ -47,29 +47,6 @@ class CMP_LIBRARY; */ class LIB_VIEW_FRAME : public SCH_BASE_FRAME { -private: - wxComboBox* m_selpartBox; - - // List of libraries (for selection ) - wxListBox* m_libList; // The list of libs - int m_libListWidth; // Last width of the window - - // List of components in the selected library - wxListBox* m_cmpList; // The list of components - int m_cmpListWidth; // Last width of the window - - // Flags - wxSemaphore* m_semaphore; // != NULL if the frame must emulate a modal dialog - wxString m_configPath; // subpath for configuration - -protected: - static wxString m_libraryName; - static wxString m_entryName; - static wxString m_exportToEeschemaCmpName; // When the viewer is used to select a component - // in schematic, the selected component is here - static int m_unit; - static int m_convert; - public: LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary = NULL, wxSemaphore* aSemaphore = NULL, @@ -134,11 +111,26 @@ public: */ void SaveSettings(); - wxString& GetEntryName( void ) const { return m_entryName; } - wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; } + /** + * Set the selected library in the library window. + * + * @param aLibName name of the library to be selected. + */ + void SetSelectedLibrary( const wxString& aLibName ); - static int GetUnit( void ) { return m_unit; } - static int GetConvert( void ) { return m_convert; } + /** + * Set the selected component. + * + * @param the alias name of the component to be selected. + */ + void SetSelectedComponent( const wxString& aComponentName ); + const wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; } + + void SetUnit( int aUnit ) { m_unit = aUnit; } + int GetUnit( void ) { return m_unit; } + + void SetConvert( int aConvert ) { m_convert = aConvert; } + int GetConvert( void ) { return m_convert; } private: /** @@ -160,6 +152,33 @@ private: bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void DClickOnCmpList( wxCommandEvent& event ); + wxComboBox* m_selpartBox; + + // List of libraries (for selection ) + wxListBox* m_libList; // The list of libs + int m_libListWidth; // Last width of the window + + // List of components in the selected library + wxListBox* m_cmpList; // The list of components + int m_cmpListWidth; // Last width of the window + + // Flags + wxSemaphore* m_semaphore; // != NULL if the frame must emulate a modal dialog + wxString m_configPath; // subpath for configuration + + // TODO(hzeller): looks like these members were chosen to be static to survive different + // instances of this browser and communicate it to the next instance. This looks like an + // ugly hack, and should be solved differently. + static wxString m_libraryName; + + // TODO(hzeller): figure out what the difference between these is and the motivation to + // have this distinction. Shouldn't these essentially be the same ? + static wxString m_entryName; + static wxString m_exportToEeschemaCmpName; // When the viewer is used to select a component + // in schematic, the selected component is here + static int m_unit; + static int m_convert; + DECLARE_EVENT_TABLE() }; diff --git a/include/sch_base_frame.h b/include/sch_base_frame.h index c2c7e8b011..b598df3944 100644 --- a/include/sch_base_frame.h +++ b/include/sch_base_frame.h @@ -31,7 +31,7 @@ class PAGE_INFO; class TITLE_BLOCK; class LIB_VIEW_FRAME; class LIB_EDIT_FRAME; - +class LIB_ALIAS; /** * Class SCH_BASE_FRAME @@ -80,9 +80,15 @@ protected: * Calls the library viewer to select component to import into schematic. * if the library viewer is currently running, it is closed and reopened * in modal mode. + * @param aPreslectedAlias Preselected component alias. NULL if none. + * @param aUnit Pointer to Unit-number. Input is the pre-selected unit, output + * is the finally selected unit by the user. Can be NULL. + * @param aConvert Pointer to deMorgan conversion. Input is what is pre-selected, + * output is the finally selected deMorgan type by the user. * @return the component name */ - wxString SelectComponentFromLibBrowser( void ); + wxString SelectComponentFromLibBrowser( LIB_ALIAS* aPreselectedAlias, + int* aUnit, int* aConvert ); /** * Function SelectComponentFromLib diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 1b5bc4b299..219c411523 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -279,6 +279,7 @@ public: void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent ); void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent ); + void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent ); /** * Function RecordMacros. diff --git a/kicad/commandframe.cpp b/kicad/commandframe.cpp index c49e90ed84..ca53048b0c 100644 --- a/kicad/commandframe.cpp +++ b/kicad/commandframe.cpp @@ -78,7 +78,7 @@ void LAUNCHER_PANEL::CreateCommandToolbar( void ) btn = AddBitmapButton( ID_TO_BITMAP_CONVERTER, KiBitmap( icon_bitmap2component_xpm ) ); btn->SetToolTip( _( "Bitmap2Component - Convert bitmap images to Eeschema\n" - "or Pcbnew elements." ) ); + "or Pcbnew elements" ) ); btn = AddBitmapButton( ID_TO_PCB_CALCULATOR, KiBitmap( icon_pcbcalculator_xpm ) ); btn->SetToolTip( _( "Pcb calculator - Calculator for components, track width, etc." ) ); diff --git a/packaging/windows/nsis/install.nsi b/packaging/windows/nsis/install.nsi index 99bdf010b4..f94e534625 100644 --- a/packaging/windows/nsis/install.nsi +++ b/packaging/windows/nsis/install.nsi @@ -17,27 +17,31 @@ ; General Product Description Definitions !define PRODUCT_NAME "KiCad" -!define PRODUCT_VERSION "2013.03.13" -!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" -!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" +!define PRODUCT_VERSION "2014.03.05" +!define ALT_DOWNLOAD_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" +!define LIBRARIES_WEB_SITE "https://github.com/KiCad/" +!define KICAD_MAIN_SITE "www.kicad-pcb.org/" !define COMPANY_NAME "" !define TRADE_MARKS "" !define COPYRIGHT "Kicad Developers Team" !define COMMENTS "" !define HELP_WEB_SITE "http://groups.yahoo.com/group/kicad-users/" -!define DEVEL_WEB_SITE "https://launchpad.net/~kicad-developers/" +!define DEVEL_WEB_SITE "https://launchpad.net/kicad/" !define WINGS3D_WEB_SITE "http://www.wings3d.com" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define UNINST_ROOT "HKLM" + ;Comment out the following SetCompressor command while testing this script -SetCompressor /final /solid lzma +;SetCompressor /final /solid lzma + CRCCheck force XPStyle on Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "${PRODUCT_NAME}_stable-${PRODUCT_VERSION}-BZR4000_Win_full_version.exe" -InstallDir "$PROGRAMFILES\KiCad" +OutFile "${PRODUCT_NAME}_stable-${PRODUCT_VERSION}-BZR4xxx_Win_full_version.exe" +;InstallDir "$PROGRAMFILES\KiCad" +InstallDir "C:\KiCad" ShowInstDetails hide ShowUnInstDetails hide @@ -72,21 +76,25 @@ ShowUnInstDetails hide !insertmacro MUI_UNPAGE_INSTFILES ; Language files -; - To add another language; add an insert macro line here and inlcude a language file as below +; - To add another language; add an insert macro line here and include a language file as below ; - This must be after all page macros have been inserted !insertmacro MUI_LANGUAGE "English" ;first language is the default language !insertmacro MUI_LANGUAGE "French" +!insertmacro MUI_LANGUAGE "Italian" !insertmacro MUI_LANGUAGE "Polish" +!insertmacro MUI_LANGUAGE "Portuguese" !insertmacro MUI_LANGUAGE "Dutch" !insertmacro MUI_LANGUAGE "Russian" !insertmacro MUI_LANGUAGE "Japanese" !include "English.nsh" !include "French.nsh" -!include "Polish.nsh" !include "Dutch.nsh" -!include "Russian.nsh" +!include "Italian.nsh" !include "Japanese.nsh" +!include "Polish.nsh" +!include "Portuguese.nsh" +!include "Russian.nsh" ; MUI end ------ @@ -150,20 +158,22 @@ SectionEnd Section -CreateShortcuts SetOutPath $INSTDIR - WriteIniStr "$INSTDIR\HomePage.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" - WriteIniStr "$INSTDIR\SourceForge.url" "InternetShortcut" "URL" "${SOURCEFORGE_WEB_SITE}" - WriteIniStr "$INSTDIR\UserGroup.url" "InternetShortcut" "URL" "${HELP_WEB_SITE}" - WriteIniStr "$INSTDIR\DevelGroup.url" "InternetShortcut" "URL" "${DEVEL_WEB_SITE}" - WriteIniStr "$INSTDIR\Wings3D.url" "InternetShortcut" "URL" "${WINGS3D_WEB_SITE}" + WriteIniStr "$INSTDIR\HomePage.url" "InternetShortcut" "URL" "${KICAD_MAIN_SITE}" + WriteIniStr "$INSTDIR\AltDownloadSite.url" "InternetShortcut" "URL" "${ALT_DOWNLOAD_WEB_SITE}" + WriteIniStr "$INSTDIR\UserGroup.url" "InternetShortcut" "URL" "${HELP_WEB_SITE}" + WriteIniStr "$INSTDIR\DevelGroup.url" "InternetShortcut" "URL" "${DEVEL_WEB_SITE}" + WriteIniStr "$INSTDIR\LibrariesGroup.url" "InternetShortcut" "URL" "${LIBRARIES_WEB_SITE}" + WriteIniStr "$INSTDIR\Wings3D.url" "InternetShortcut" "URL" "${WINGS3D_WEB_SITE}" SetShellVarContext all CreateDirectory "$SMPROGRAMS\KiCad" CreateShortCut "$SMPROGRAMS\KiCad\Home Page.lnk" "$INSTDIR\HomePage.url" - CreateShortCut "$SMPROGRAMS\KiCad\Kicad SourceForge.lnk" "$INSTDIR\SourceForge.url" + CreateShortCut "$SMPROGRAMS\KiCad\Kicad Alternate Download.lnk" "$INSTDIR\AltDownloadSite.url" + CreateShortCut "$SMPROGRAMS\KiCad\Kicad Libraries.lnk" "$INSTDIR\LibrariesGroup.url" + CreateShortCut "$SMPROGRAMS\KiCad\Wings3D.lnk" "$INSTDIR\Wings3D.url" CreateShortCut "$SMPROGRAMS\KiCad\User Group.lnk" "$INSTDIR\UserGroup.url" CreateShortCut "$SMPROGRAMS\KiCad\Devel Group.lnk" "$INSTDIR\DevelGroup.url" CreateShortCut "$SMPROGRAMS\KiCad\Uninstall.lnk" "$INSTDIR\uninstaller.exe" CreateShortCut "$SMPROGRAMS\KiCad\KiCad.lnk" "$INSTDIR\bin\kicad.exe" - CreateShortCut "$SMPROGRAMS\KiCad\Wings3D.lnk" "$INSTDIR\Wings3D.url" CreateShortCut "$DESKTOP\KiCad.lnk" "$INSTDIR\bin\kicad.exe" SectionEnd @@ -172,13 +182,13 @@ Section -CreateAddRemoveEntry WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "Publisher" "${COMPANY_NAME}" WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstaller.exe" - WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" + WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${KICAD_MAIN_SITE}" WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\kicad.exe" WriteRegDWORD ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "NoModify" "1" WriteRegDWORD ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "NoRepair" "1" WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "Comments" "${COMMENTS}" WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "HelpLink" "${HELP_WEB_SITE}" - WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}" + WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${KICAD_MAIN_SITE}" WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR" WriteUninstaller "$INSTDIR\uninstaller.exe" @@ -213,6 +223,9 @@ Section Uninstall ;remove start menu shortcuts and web page links SetShellVarContext all Delete "$SMPROGRAMS\KiCad\Home Page.lnk" + Delete "$SMPROGRAMS\KiCad\Kicad Libraries.lnk" + Delete "$SMPROGRAMS\KiCad\Kicad Alternate Download.lnk" + Delete "$SMPROGRAMS\KiCad\Devel Group.lnk" Delete "$SMPROGRAMS\KiCad\User Group.lnk" Delete "$SMPROGRAMS\KiCad\Uninstall.lnk" Delete "$SMPROGRAMS\KiCad\KiCad.lnk" @@ -221,6 +234,9 @@ Section Uninstall Delete "$INSTDIR\Wings3D.url" Delete "$INSTDIR\HomePage.url" Delete "$INSTDIR\UserGroup.url" + Delete "$INSTDIR\AltDownloadSite.url" + Delete "$INSTDIR\DevelGroup.url" + Delete "$INSTDIR\LibrariesGroup.url" RMDir "$SMPROGRAMS\KiCad" ;remove all program files now diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index af090ae805..f470ada643 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -4,6 +4,10 @@ set( MAKE_LINK_MAPS false ) add_definitions( -DPCBNEW ) add_subdirectory(router) +# psnrouter depends on make_lexer outputs in common (bug # 1285878 ) +add_dependencies( pnsrouter pcbcommon ) + + if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting ) find_package( SWIG REQUIRED ) @@ -617,6 +621,13 @@ if( KICAD_SCRIPTING ) # fix bundle after copying wxpython, fixing and copying add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting ) + + if ( KICAD_SCRIPTING_MODULES ) + #they do more or less the same job, avoid race between them + #Cmake copy goes in error otherwise + add_dependencies( pcbnew_copy_wxpython_scripting pcbnew_copy_wxpython_module ) + endif() + endif() endif() diff --git a/pcbnew/autorouter/spread_footprints.cpp b/pcbnew/autorouter/spread_footprints.cpp index ee9ea8a6cb..42b0ea47c7 100644 --- a/pcbnew/autorouter/spread_footprints.cpp +++ b/pcbnew/autorouter/spread_footprints.cpp @@ -184,23 +184,23 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly ) // Build candidate list // calculate also the area needed by these footprints - MODULE* Module = GetBoard()->m_Modules; + MODULE* module = GetBoard()->m_Modules; std::vector moduleList; - for( ; Module != NULL; Module = Module->Next() ) + for( ; module != NULL; module = module->Next() ) { - Module->CalculateBoundingBox(); + module->CalculateBoundingBox(); if( outsideBrdFilter ) { - if( bbox.Contains( Module->GetPosition() ) ) + if( bbox.Contains( module->GetPosition() ) ) continue; } - if( Module->IsLocked() ) + if( module->IsLocked() ) continue; - moduleList.push_back(Module); + moduleList.push_back(module); } if( moduleList.size() == 0 ) // Nothing to do @@ -216,18 +216,17 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly ) for( unsigned ii = 0; ii < moduleList.size(); ii++ ) { - Module = moduleList[ii]; + module = moduleList[ii]; // Undo: add copy of module to undo list - picker.SetItem( Module ); - picker.SetLink( Module->Clone() ); + picker.SetItem( module ); + picker.SetLink( module->Clone() ); undoList.PushItem( picker ); } // Extract and place footprints by sheet std::vector moduleListBySheet; std::vector placementSheetAreas; - wxString curr_sheetPath ; double subsurface; double placementsurface = 0.0; @@ -253,22 +252,23 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly ) for( int pass = 0; pass < 2; pass++ ) { int subareaIdx = 0; - curr_sheetPath = moduleList[0]->GetPath().BeforeLast( '/' ); moduleListBySheet.clear(); subsurface = 0.0; for( unsigned ii = 0; ii < moduleList.size(); ii++ ) { - Module = moduleList[ii]; - bool iscurrPath = curr_sheetPath == moduleList[ii]->GetPath().BeforeLast( '/' ); + module = moduleList[ii]; + bool islastItem = false; - if( iscurrPath ) - { - moduleListBySheet.push_back( Module ); - subsurface += Module->GetArea(); - } + if( ii == moduleList.size() - 1 || + ( moduleList[ii]->GetPath().BeforeLast( '/' ) != + moduleList[ii+1]->GetPath().BeforeLast( '/' ) ) ) + islastItem = true; - if( !iscurrPath || (ii == moduleList.size()-1) ) + moduleListBySheet.push_back( module ); + subsurface += module->GetArea(); + + if( islastItem ) { // end of the footprint sublist relative to the same sheet path // calculate placement of the current sublist @@ -306,14 +306,9 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly ) sub_area.GetHeight(); } - curr_sheetPath = moduleList[ii]->GetPath().BeforeLast( '/' ); + // Prepare buffers for next sheet subsurface = 0.0; moduleListBySheet.clear(); - - // Enter first module of next sheet - moduleListBySheet.push_back( Module ); - subsurface += Module->GetArea(); - subareaIdx++; } } @@ -350,7 +345,14 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly ) } +// Sort function, used to group footprints by sheet. +// Footprints are sorted by their sheet path. +// (the full sheet path restricted to the time stamp of the sheet itself, +// without the time stamp of the footprint ). static bool sortModulesbySheetPath( MODULE* ref, MODULE* compare ) { - return compare->GetPath().Cmp( ref->GetPath() ) < 0; + if( ref->GetPath().Length() == compare->GetPath().Length() ) + return ref->GetPath().BeforeLast( '/' ).Cmp( compare->GetPath().BeforeLast( '/' ) ) < 0; + + return ref->GetPath().Length() < compare->GetPath().Length(); } diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 68059370d1..4cf371eedb 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -23,6 +23,21 @@ #include #include +// These variables are parameters used in addTextSegmToPoly. +// But addTextSegmToPoly is a call-back function, +// so we cannot send them as arguments. +int s_textWidth; +int s_textCircle2SegmentCount; +CPOLYGONS_LIST* s_cornerBuffer; + +// This is a call back function, used by DrawGraphicText to draw the 3D text shape: +static void addTextSegmToPoly( int x0, int y0, int xf, int yf ) +{ + TransformRoundedEndsSegmentToPolygon( *s_cornerBuffer, + wxPoint( x0, y0), wxPoint( xf, yf ), + s_textCircle2SegmentCount, s_textWidth ); +} + /* generate pads shapes on layer aLayer as polygons, * and adds these polygons to aCornerBuffer * aCornerBuffer = the buffer to store polygons @@ -91,12 +106,16 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( int aCircleToSegmentsCount, double aCorrectionFactor ) { + std::vector texts; // List of TEXTE_MODULE to convert EDGE_MODULE* outline; + for( EDA_ITEM* item = GraphicalItems(); item != NULL; item = item->Next() ) { switch( item->Type() ) { case PCB_MODULE_TEXT_T: + if( ((TEXTE_MODULE*)item)->GetLayer() == aLayer ) + texts.push_back( (TEXTE_MODULE *) item ); break; case PCB_MODULE_EDGE_T: @@ -153,6 +172,33 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( break; } } + + // Convert texts sur modules + if( Reference().GetLayer() == aLayer && Reference().IsVisible() ) + texts.push_back( &Reference() ); + + if( Value().GetLayer() == aLayer && Value().IsVisible() ) + texts.push_back( &Value() ); + + s_cornerBuffer = &aCornerBuffer; + s_textCircle2SegmentCount = aCircleToSegmentsCount; + + for( unsigned ii = 0; ii < texts.size(); ii++ ) + { + TEXTE_MODULE *textmod = texts[ii]; + s_textWidth = textmod->GetThickness() + ( 2 * aInflateValue ); + wxSize size = textmod->GetSize(); + + if( textmod->IsMirrored() ) + NEGATE( size.x ); + + DrawGraphicText( NULL, NULL, textmod->GetTextPosition(), BLACK, + textmod->GetText(), textmod->GetDrawRotation(), size, + textmod->GetHorizJustify(), textmod->GetVertJustify(), + textmod->GetThickness(), textmod->IsItalic(), + true, addTextSegmToPoly ); + } + } /* Function TransformSolidAreasShapesToPolygonSet @@ -257,20 +303,6 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon( * clearance when the circle is approximated by segment bigger or equal * to the real clearance value (usually near from 1.0) */ -// These variables are parameters used in addTextSegmToPoly. -// But addTextSegmToPoly is a call-back function, -// so we cannot send them as arguments. -int s_textWidth; -int s_textCircle2SegmentCount; -CPOLYGONS_LIST* s_cornerBuffer; - -// This is a call back function, used by DrawGraphicText to draw the 3D text shape: -static void addTextSegmToPoly( int x0, int y0, int xf, int yf ) -{ - TransformRoundedEndsSegmentToPolygon( *s_cornerBuffer, - wxPoint( x0, y0), wxPoint( xf, yf ), - s_textCircle2SegmentCount, s_textWidth ); -} void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( CPOLYGONS_LIST& aCornerBuffer, @@ -309,7 +341,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( } else { - DrawGraphicText( NULL, NULL, GetTextPosition(), (EDA_COLOR_T) color, + DrawGraphicText( NULL, NULL, GetTextPosition(), color, GetText(), GetOrientation(), size, GetHorizJustify(), GetVertJustify(), GetThickness(), IsItalic(), diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index c46e1f8e37..ee54fd6e82 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -47,6 +47,7 @@ #define PrecisionKey wxT( "DrilltPrecisionOpt" ) #define MirrorKey wxT( "DrillMirrorYOpt" ) #define MinimalHeaderKey wxT( "DrillMinHeader" ) +#define MergePTHNPTHKey wxT( "DrillMergePTHNPTH" ) #define UnitDrillInchKey wxT( "DrillUnit" ) #define DrillOriginIsAuxAxisKey wxT( "DrillAuxAxis" ) #define DrillMapFileTypeKey wxT( "DrillMapFileType" ) @@ -68,7 +69,6 @@ void PCB_EDIT_FRAME::InstallDrillFrame( wxCommandEvent& event ) } - DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* parent ) : DIALOG_GENDRILL_BASE( parent ) { @@ -88,6 +88,7 @@ int DIALOG_GENDRILL::m_UnitDrillIsInch = true; int DIALOG_GENDRILL::m_ZerosFormat = EXCELLON_WRITER::DECIMAL_FORMAT; bool DIALOG_GENDRILL::m_MinimalHeader = false; bool DIALOG_GENDRILL::m_Mirror = false; +bool DIALOG_GENDRILL::m_Merge_PTH_NPTH = false; bool DIALOG_GENDRILL::m_DrillOriginIsAuxAxis = false; int DIALOG_GENDRILL::m_mapFileType = 1; @@ -102,6 +103,7 @@ void DIALOG_GENDRILL::initDialog() { m_config->Read( ZerosFormatKey, &m_ZerosFormat ); m_config->Read( MirrorKey, &m_Mirror ); + m_config->Read( MergePTHNPTHKey, &m_Merge_PTH_NPTH ); m_config->Read( MinimalHeaderKey, &m_MinimalHeader ); m_config->Read( UnitDrillInchKey, &m_UnitDrillIsInch ); m_config->Read( DrillOriginIsAuxAxisKey, &m_DrillOriginIsAuxAxis ); @@ -124,6 +126,7 @@ void DIALOG_GENDRILL::InitDisplayParams() m_Choice_Drill_Offset->SetSelection( 1 ); m_Check_Mirror->SetValue( m_Mirror ); + m_Check_Merge_PTH_NPTH->SetValue( m_Merge_PTH_NPTH ); m_Choice_Drill_Map->SetSelection( m_mapFileType ); m_ViaDrillValue->SetLabel( _( "Use Netclasses values" ) ); m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) ); @@ -213,6 +216,7 @@ void DIALOG_GENDRILL::UpdateConfig() m_config->Write( ZerosFormatKey, m_ZerosFormat ); m_config->Write( MirrorKey, m_Mirror ); m_config->Write( MinimalHeaderKey, m_MinimalHeader ); + m_config->Write( MergePTHNPTHKey, m_Merge_PTH_NPTH ); m_config->Write( UnitDrillInchKey, m_UnitDrillIsInch ); m_config->Write( DrillOriginIsAuxAxisKey, m_DrillOriginIsAuxAxis ); m_config->Write( DrillMapFileTypeKey, m_mapFileType ); @@ -229,6 +233,7 @@ void DIALOG_GENDRILL::OnGenMapFile( wxCommandEvent& event ) GenDrillAndMapFiles( false, true); } + void DIALOG_GENDRILL::OnGenDrillFile( wxCommandEvent& event ) { GenDrillAndMapFiles(true, false); @@ -264,6 +269,7 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions() m_staticTextPrecision->Enable( true ); } + void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { // Build the absolute path of current output plot directory @@ -292,14 +298,14 @@ void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName() ).GetPath(); if( !dirName.MakeRelativeTo( boardFilePath ) ) - wxMessageBox( _( - "Cannot make path relative (target volume different from board file volume)!" ), + wxMessageBox( _( "Cannot make path relative. The target volume is different from board file volume!" ), _( "Plot Output Directory" ), wxOK | wxICON_ERROR ); } m_outputDirectoryName->SetValue( dirName.GetFullPath() ); } + void DIALOG_GENDRILL::SetParams() { wxString msg; @@ -315,6 +321,7 @@ void DIALOG_GENDRILL::SetParams() m_UnitDrillIsInch = (m_Choice_Unit->GetSelection() == 0) ? false : true; m_MinimalHeader = m_Check_Minimal->IsChecked(); m_Mirror = m_Check_Mirror->IsChecked(); + m_Merge_PTH_NPTH = m_Check_Merge_PTH_NPTH->IsChecked(); m_ZerosFormat = m_Choice_Zeros_Format->GetSelection(); m_DrillOriginIsAuxAxis = m_Choice_Drill_Offset->GetSelection(); @@ -331,16 +338,7 @@ void DIALOG_GENDRILL::SetParams() m_board->SetPlotOptions( m_plotOpts ); } -/** - * Function GenDrillAndMapFiles - * Calls the functions to create EXCELLON drill files and/or drill map files - * >When all holes are through holes, only one excellon file is created. - * >When there are some partial holes (some blind or buried vias), - * one excellon file is created, for all plated through holes, - * and one file per layer pair, which have one or more holes, excluding - * through holes, already in the first file. - * one file for all Not Plated through holes - */ + void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) { wxString layer_extend; /* added to the Board FileName to @@ -369,14 +367,14 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::zeros_fmt) m_ZerosFormat, m_Precision.m_lhs, m_Precision.m_rhs ); - excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset ); + excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH ); wxFileName fn; for( ; ; ) { - excellonWriter.BuildHolesList( layer1, layer2, - gen_through_holes ? false : true, gen_NPTH_holes ); + excellonWriter.BuildHolesList( layer1, layer2, gen_through_holes ? false : true, + gen_NPTH_holes, m_Merge_PTH_NPTH ); if( excellonWriter.GetHolesCount() > 0 ) // has holes? { @@ -393,6 +391,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) layer_extend << wxT( "-back" ); else layer_extend << wxT( "-inner" ) << layer1; + if( layer2 == LAYER_N_FRONT ) layer_extend << wxT( "-front" ); else @@ -401,6 +400,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) fn.SetName( fn.GetName() + layer_extend ); wxString defaultPath = m_plotOpts.GetOutputDirectory(); + if( defaultPath.IsEmpty() ) defaultPath = ::wxGetCwd(); @@ -466,6 +466,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) gen_NPTH_holes = true; continue; } + layer1++; layer2++; // use next layer pair @@ -482,11 +483,6 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap) } -/* - * Create a plain text report file giving a list of drill values and drill count - * for through holes, oblong holes, and for buried vias, - * drill values and drill count per layer pair - */ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event ) { UpdateConfig(); // set params and Save drill options @@ -497,6 +493,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event ) fn.SetExt( ReportFileExtension ); wxString defaultPath = m_plotOpts.GetOutputDirectory(); + if( defaultPath.IsEmpty() ) defaultPath = ::wxGetCwd(); @@ -512,7 +509,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event ) excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::zeros_fmt) m_ZerosFormat, m_Precision.m_lhs, m_Precision.m_rhs ); - excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset ); + excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH ); bool success = excellonWriter.GenDrillReportFile( dlg.GetPath() ); @@ -572,7 +569,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFullFileNameWithoutExt, break; default: - wxLogMessage( wxT( "DIALOG_GENDRILL::GenDrillMap() error, fmt % unkown" ), format ); + wxLogMessage( wxT( "DIALOG_GENDRILL::GenDrillMap() error, fmt % unknown" ), format ); return; } @@ -581,15 +578,14 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFullFileNameWithoutExt, fullFilename << wxT(".") << ext; bool success = aExcellonWriter.GenDrillMapFile( fullFilename, - m_parent->GetPageSettings(), - format ); + m_parent->GetPageSettings(), + format ); wxString msg; if( ! success ) { - msg.Printf( _( "** Unable to create %s **\n" ), - GetChars( fullFilename ) ); + msg.Printf( _( "** Unable to create %s **\n" ), GetChars( fullFilename ) ); m_messagesBox->AppendText( msg ); return; } @@ -598,5 +594,4 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFullFileNameWithoutExt, msg.Printf( _( "Plot: %s OK\n" ), GetChars( fullFilename ) ); m_messagesBox->AppendText( msg ); } - } diff --git a/pcbnew/dialogs/dialog_gendrill.h b/pcbnew/dialogs/dialog_gendrill.h index b7c2717886..c9b32cfed0 100644 --- a/pcbnew/dialogs/dialog_gendrill.h +++ b/pcbnew/dialogs/dialog_gendrill.h @@ -41,6 +41,7 @@ public: static int m_ZerosFormat; static bool m_MinimalHeader; static bool m_Mirror; + static bool m_Merge_PTH_NPTH; static bool m_DrillOriginIsAuxAxis; /* Axis selection (main / auxiliary) * for drill origin coordinates */ DRILL_PRECISION m_Precision; // Selected precision for drill files @@ -69,15 +70,34 @@ private: // event functions void OnSelDrillUnitsSelected( wxCommandEvent& event ); void OnSelZerosFmtSelected( wxCommandEvent& event ); - void OnGenDrillFile( wxCommandEvent& event ); - void OnGenMapFile( wxCommandEvent& event ); - void OnGenReportFile( wxCommandEvent& event ); + void OnGenDrillFile( wxCommandEvent& event ); + void OnGenMapFile( wxCommandEvent& event ); + + /* + * Create a plain text report file giving a list of drill values and drill count + * for through holes, oblong holes, and for buried vias, + * drill values and drill count per layer pair + */ + void OnGenReportFile( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ); // Specific functions: void SetParams( void ); - void GenDrillAndMapFiles(bool aGenDrill, bool aGenMap); + + /** + * Function GenDrillAndMapFiles + * Calls the functions to create EXCELLON drill files and/or drill map files + * >When all holes are through holes, only one excellon file is created. + * >When there are some partial holes (some blind or buried vias), + * one excellon file is created, for all plated through holes, + * and one file per layer pair, which have one or more holes, excluding + * through holes, already in the first file. + * one file for all Not Plated through holes + */ + void GenDrillAndMapFiles( bool aGenDrill, bool aGenMap ); + void GenDrillMap( const wxString aFileName, EXCELLON_WRITER& aExcellonWriter, PlotFormat format ); diff --git a/pcbnew/dialogs/dialog_gendrill_base.cpp b/pcbnew/dialogs/dialog_gendrill_base.cpp index 0210d9fb84..126fce0196 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.cpp +++ b/pcbnew/dialogs/dialog_gendrill_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Feb 26 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -88,6 +88,9 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con m_Check_Minimal = new wxCheckBox( this, wxID_ANY, _("Minimal header"), wxDefaultPosition, wxDefaultSize, 0 ); sbOptSizer->Add( m_Check_Minimal, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + m_Check_Merge_PTH_NPTH = new wxCheckBox( this, wxID_ANY, _("Merge PTH and NPTH holes into one file"), wxDefaultPosition, wxDefaultSize, 0 ); + sbOptSizer->Add( m_Check_Merge_PTH_NPTH, 0, wxALL, 5 ); + bMiddleBoxSizer->Add( sbOptSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); diff --git a/pcbnew/dialogs/dialog_gendrill_base.fbp b/pcbnew/dialogs/dialog_gendrill_base.fbp index 940053bf24..467f67066f 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.fbp +++ b/pcbnew/dialogs/dialog_gendrill_base.fbp @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 0 0 @@ -879,6 +881,94 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Merge PTH and NPTH holes into one file + + 0 + + + 0 + + 1 + m_Check_Merge_PTH_NPTH + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_gendrill_base.h b/pcbnew/dialogs/dialog_gendrill_base.h index 63aa22dfbb..fc61ef59de 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.h +++ b/pcbnew/dialogs/dialog_gendrill_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Feb 26 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -48,6 +48,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM wxRadioBox* m_Choice_Drill_Map; wxCheckBox* m_Check_Mirror; wxCheckBox* m_Check_Minimal; + wxCheckBox* m_Check_Merge_PTH_NPTH; wxRadioBox* m_Choice_Drill_Offset; wxStaticBoxSizer* m_DefaultViasDrillSizer; wxStaticText* m_ViaDrillValue; diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index c01e433f3e..cf2e5b607f 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -237,6 +237,10 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) m_show_microwave_tools = state; m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); m_auimgr.Update(); + + GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, + m_show_microwave_tools ? + _( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" )); break; case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR: diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index cce6a7b4b5..69eec16422 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -27,9 +27,11 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent ) m_TrackFilterLocked->Enable( m_DelTracks->GetValue() ); m_TrackFilterNormal->Enable( m_DelTracks->GetValue() ); m_TrackFilterVias->Enable( m_DelTracks->GetValue() ); + m_ModuleFilterLocked->Enable( m_DelModules->GetValue() ); + m_ModuleFilterNormal->Enable( m_DelModules->GetValue() ); SetFocus(); - GetSizer()->SetSizeHints(this); + GetSizer()->SetSizeHints( this ); Centre(); } @@ -42,12 +44,14 @@ void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos ) dlg.ShowModal(); } + void DIALOG_GLOBAL_DELETION::SetCurrentLayer( LAYER_NUM aLayer ) { m_currentLayer = aLayer; m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( aLayer ) ); } + void DIALOG_GLOBAL_DELETION::OnCheckDeleteTracks( wxCommandEvent& event ) { m_TrackFilterAR->Enable( m_DelTracks->GetValue() ); @@ -56,6 +60,14 @@ void DIALOG_GLOBAL_DELETION::OnCheckDeleteTracks( wxCommandEvent& event ) m_TrackFilterVias->Enable( m_DelTracks->GetValue() ); } + +void DIALOG_GLOBAL_DELETION::OnCheckDeleteModules( wxCommandEvent& event ) +{ + m_ModuleFilterLocked->Enable( m_DelModules->GetValue() ); + m_ModuleFilterNormal->Enable( m_DelModules->GetValue() ); +} + + void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) { bool gen_rastnest = false; @@ -68,72 +80,102 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) } else { - if( !IsOK( this, _( "OK to delete selected items ?" ) ) ) + + if( !IsOK( this, _( "Are you sure you want to delete the selected items?" ) ) ) return; - BOARD * pcb = m_Parent->GetBoard(); + BOARD* pcb = m_Parent->GetBoard(); PICKED_ITEMS_LIST pickersList; ITEM_PICKER itemPicker( NULL, UR_DELETED ); BOARD_ITEM* item, * nextitem; - if( m_DelZones->GetValue() ) - { - gen_rastnest = true; - - /* SEG_ZONE items used in Zone filling selection are now deprecated : - * and are deleted but not put in undo buffer if exist - */ - pcb->m_Zone.DeleteAll(); - - while( pcb->GetAreaCount() ) - { - item = pcb->GetArea( 0 ); - itemPicker.SetItem( item ); - pickersList.PushItem( itemPicker ); - pcb->Remove( item ); - } - } - - LAYER_MSK masque_layer = NO_LAYERS; LAYER_MSK layers_filter = ALL_LAYERS; + if( m_rbLayersOption->GetSelection() != 0 ) // Use current layer only layers_filter = GetLayerMask( m_currentLayer ); - - if( m_DelDrawings->GetValue() ) - masque_layer = (~EDGE_LAYER) & ALL_NO_CU_LAYERS; - - if( m_DelBoardEdges->GetValue() ) - masque_layer |= EDGE_LAYER; - - layers_filter &= layers_filter; - - for( item = pcb->m_Drawings; item != NULL; item = nextitem ) + if( m_DelZones->GetValue() ) { - nextitem = item->Next(); - bool removeme = GetLayerMask( item->GetLayer() ) & masque_layer; + int area_index = 0; + item = pcb->GetArea( area_index ); - if( ( item->Type() == PCB_TEXT_T ) && m_DelTexts->GetValue() ) - removeme = true; - - if( removeme ) + while( item != NULL ) { - itemPicker.SetItem( item ); - pickersList.PushItem( itemPicker ); - item->UnLink(); + + if( GetLayerMask( item->GetLayer() ) & layers_filter ) + { + itemPicker.SetItem( item ); + pickersList.PushItem( itemPicker ); + pcb->Remove( item ); + gen_rastnest = true; + } + else + { + area_index++; + } + + item = pcb->GetArea( area_index ); + } + } + + if( m_DelDrawings->GetValue() || m_DelBoardEdges->GetValue() ) + { + LAYER_MSK masque_layer = NO_LAYERS; + + if( m_DelDrawings->GetValue() ) + masque_layer = (~EDGE_LAYER) & ALL_NO_CU_LAYERS; + + if( m_DelBoardEdges->GetValue() ) + masque_layer |= EDGE_LAYER; + + masque_layer &= layers_filter; + + for( item = pcb->m_Drawings; item != NULL; item = nextitem ) + { + nextitem = item->Next(); + + if( ( item->Type() == PCB_LINE_T ) && ( GetLayerMask( item->GetLayer() ) & masque_layer) ) + { + itemPicker.SetItem( item ); + pickersList.PushItem( itemPicker ); + item->UnLink(); + } + } + } + + if( m_DelTexts->GetValue() ) + { + LAYER_MSK del_text_layers = ALL_LAYERS & layers_filter; + + for( item = pcb->m_Drawings; item != NULL; item = nextitem ) + { + nextitem = item->Next(); + + if( ( item->Type() == PCB_TEXT_T ) && ( GetLayerMask( item->GetLayer() ) & del_text_layers ) ) + { + itemPicker.SetItem( item ); + pickersList.PushItem( itemPicker ); + item->UnLink(); + } } } if( m_DelModules->GetValue() ) { - gen_rastnest = true; for( item = pcb->m_Modules; item; item = nextitem ) { nextitem = item->Next(); - itemPicker.SetItem( item ); - pickersList.PushItem( itemPicker ); - item->UnLink(); + + if( ( GetLayerMask( item->GetLayer() ) & layers_filter ) && + ( ( m_ModuleFilterNormal->GetValue() && !item->IsLocked() ) || + ( m_ModuleFilterLocked->GetValue() && item->IsLocked() ) ) ) + { + itemPicker.SetItem( item ); + pickersList.PushItem( itemPicker ); + item->UnLink(); + gen_rastnest = true; + } } } @@ -148,6 +190,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) track_mask_filter |= TRACK_AR; TRACK * nexttrack; + for( TRACK *track = pcb->m_Track; track != NULL; track = nexttrack ) { nexttrack = track->Next(); @@ -180,6 +223,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) if( gen_rastnest ) m_Parent->Compile_Ratsnest( NULL, true ); + } m_Parent->GetCanvas()->Refresh(); @@ -187,4 +231,3 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) EndModal( 1 ); } - diff --git a/pcbnew/dialogs/dialog_global_deletion.h b/pcbnew/dialogs/dialog_global_deletion.h index 1983409708..4742a9ea04 100644 --- a/pcbnew/dialogs/dialog_global_deletion.h +++ b/pcbnew/dialogs/dialog_global_deletion.h @@ -30,6 +30,7 @@ private: void AcceptPcbDelete(); void OnCheckDeleteTracks( wxCommandEvent& event ); + void OnCheckDeleteModules( wxCommandEvent& event ); }; #endif // _DIALOG_GLOBAL_DELETION_H_ diff --git a/pcbnew/dialogs/dialog_global_deletion_base.cpp b/pcbnew/dialogs/dialog_global_deletion_base.cpp index 29317e86d0..b56bae82e5 100644 --- a/pcbnew/dialogs/dialog_global_deletion_base.cpp +++ b/pcbnew/dialogs/dialog_global_deletion_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Feb 26 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -52,25 +52,32 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi wxBoxSizer* bSizerRight; bSizerRight = new wxBoxSizer( wxVERTICAL ); - sbTrackFilter = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Track Filter") ), wxVERTICAL ); + sbFilter = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Filter Settings") ), wxVERTICAL ); m_TrackFilterAR = new wxCheckBox( this, wxID_ANY, _("Automatically routed tracks"), wxDefaultPosition, wxDefaultSize, 0 ); m_TrackFilterAR->SetValue(true); - sbTrackFilter->Add( m_TrackFilterAR, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + sbFilter->Add( m_TrackFilterAR, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_TrackFilterLocked = new wxCheckBox( this, wxID_ANY, _("Locked tracks"), wxDefaultPosition, wxDefaultSize, 0 ); - sbTrackFilter->Add( m_TrackFilterLocked, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + sbFilter->Add( m_TrackFilterLocked, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_TrackFilterNormal = new wxCheckBox( this, wxID_ANY, _("Normal tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TrackFilterNormal = new wxCheckBox( this, wxID_ANY, _("Unlocked tracks"), wxDefaultPosition, wxDefaultSize, 0 ); m_TrackFilterNormal->SetValue(true); - sbTrackFilter->Add( m_TrackFilterNormal, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + sbFilter->Add( m_TrackFilterNormal, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_TrackFilterVias = new wxCheckBox( this, wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 ); m_TrackFilterVias->SetValue(true); - sbTrackFilter->Add( m_TrackFilterVias, 0, wxALL, 5 ); + sbFilter->Add( m_TrackFilterVias, 0, wxALL, 5 ); + + m_ModuleFilterLocked = new wxCheckBox( this, wxID_ANY, _("Locked footprints"), wxDefaultPosition, wxDefaultSize, 0 ); + sbFilter->Add( m_ModuleFilterLocked, 0, wxALL, 5 ); + + m_ModuleFilterNormal = new wxCheckBox( this, wxID_ANY, _("Unlocked footprints"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ModuleFilterNormal->SetValue(true); + sbFilter->Add( m_ModuleFilterNormal, 0, wxALL, 5 ); - bSizerRight->Add( sbTrackFilter, 0, wxALL|wxEXPAND, 5 ); + bSizerRight->Add( sbFilter, 0, wxALL|wxEXPAND, 5 ); wxString m_rbLayersOptionChoices[] = { _("All layers"), _("Current layer only") }; int m_rbLayersOptionNChoices = sizeof( m_rbLayersOptionChoices ) / sizeof( wxString ); @@ -112,6 +119,7 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi this->Centre( wxBOTH ); // Connect Events + m_DelModules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCheckDeleteModules ), NULL, this ); m_DelTracks->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCheckDeleteTracks ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCancelClick ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnOkClick ), NULL, this ); @@ -120,6 +128,7 @@ DIALOG_GLOBAL_DELETION_BASE::DIALOG_GLOBAL_DELETION_BASE( wxWindow* parent, wxWi DIALOG_GLOBAL_DELETION_BASE::~DIALOG_GLOBAL_DELETION_BASE() { // Disconnect Events + m_DelModules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCheckDeleteModules ), NULL, this ); m_DelTracks->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCheckDeleteTracks ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnCancelClick ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_DELETION_BASE::OnOkClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_global_deletion_base.fbp b/pcbnew/dialogs/dialog_global_deletion_base.fbp index f4a139f955..1053aa1bf2 100644 --- a/pcbnew/dialogs/dialog_global_deletion_base.fbp +++ b/pcbnew/dialogs/dialog_global_deletion_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 0 0 @@ -527,7 +529,7 @@ - + OnCheckDeleteModules @@ -833,9 +835,9 @@ 0 wxID_ANY - Track Filter + Filter Settings - sbTrackFilter + sbFilter wxVERTICAL protected @@ -1048,7 +1050,7 @@ 0 0 wxID_ANY - Normal tracks + Unlocked tracks 0 @@ -1191,6 +1193,182 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Locked footprints + + 0 + + + 0 + + 1 + m_ModuleFilterLocked + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Unlocked footprints + + 0 + + + 0 + + 1 + m_ModuleFilterNormal + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_global_deletion_base.h b/pcbnew/dialogs/dialog_global_deletion_base.h index dca068674f..d9d8042b78 100644 --- a/pcbnew/dialogs/dialog_global_deletion_base.h +++ b/pcbnew/dialogs/dialog_global_deletion_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Feb 26 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -48,11 +48,13 @@ class DIALOG_GLOBAL_DELETION_BASE : public DIALOG_SHIM wxCheckBox* m_DelTracks; wxCheckBox* m_DelMarkers; wxCheckBox* m_DelAlls; - wxStaticBoxSizer* sbTrackFilter; + wxStaticBoxSizer* sbFilter; wxCheckBox* m_TrackFilterAR; wxCheckBox* m_TrackFilterLocked; wxCheckBox* m_TrackFilterNormal; wxCheckBox* m_TrackFilterVias; + wxCheckBox* m_ModuleFilterLocked; + wxCheckBox* m_ModuleFilterNormal; wxRadioBox* m_rbLayersOption; wxStaticText* m_staticText1; wxTextCtrl* m_textCtrlCurrLayer; @@ -62,6 +64,7 @@ class DIALOG_GLOBAL_DELETION_BASE : public DIALOG_SHIM wxButton* m_sdbSizer1Cancel; // Virtual event handlers, overide them in your derived class + virtual void OnCheckDeleteModules( wxCommandEvent& event ) { event.Skip(); } virtual void OnCheckDeleteTracks( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_layers_setup.cpp b/pcbnew/dialogs/dialog_layers_setup.cpp index aded0cf5df..fc26fe399e 100644 --- a/pcbnew/dialogs/dialog_layers_setup.cpp +++ b/pcbnew/dialogs/dialog_layers_setup.cpp @@ -294,6 +294,7 @@ DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( PCB_EDIT_FRAME* parent ) : m_TitlePanel->SetMinSize( wxSize( -1, m_AdhesFrontName->GetSize().y+10 ) ); Layout(); + Fit(); Center(); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 73cbbd446b..42f75d220c 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -681,13 +681,14 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() { if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y ) { - msg = _( "Error: pad is not on a copper layer and has a hole" ); + // Note: he message is shown in an HTML window + msg = _( "Error: the pad is not on a copper layer and has a hole" ); if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED ) { - msg += wxT("\n"); - msg += _( "For NPTH pad, set pad drill value to pad size value,\n" - "if you do not want this pad plotted in gerber files" + msg += wxT("

"); + msg += _( "For NPTH pad, set pad size value to pad drill value," + " if you do not want this pad plotted in gerber files" ); } diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index c73e4e19d1..2c4f9b8c7c 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -360,7 +360,7 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName ) for( ; ; ) { BuildHolesList( layer1, layer2, - gen_through_holes ? false : true, gen_NPTH_holes ); + gen_through_holes ? false : true, gen_NPTH_holes, false); totalHoleCount = 0; diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index 7ad2293b95..91b486c4ad 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp @@ -442,11 +442,13 @@ static bool CmpHoleDiameterValue( const HOLE_INFO& a, const HOLE_INFO& b ) * param aGenerateNPTH_list : * true to create NPTH only list (with no plated holes) * false to created plated holes list (with no NPTH ) + * param aMergePTHNPTH : if true, merge PTH and NPTH holes into one file by treating all holes as PTH */ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, int aLastLayer, bool aExcludeThroughHoles, - bool aGenerateNPTH_list ) + bool aGenerateNPTH_list, + bool aMergePTHNPTH ) { HOLE_INFO new_hole; int hole_value; @@ -460,6 +462,11 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, EXCHG( aFirstLayer, aLastLayer ); } + if ( aGenerateNPTH_list && aMergePTHNPTH ) + { + return; + } + /* build hole list for vias */ if( ! aGenerateNPTH_list ) // vias are always plated ! @@ -507,7 +514,7 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, // Read and analyse pads for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) { - if( ! aGenerateNPTH_list && pad->GetAttribute() == PAD_HOLE_NOT_PLATED ) + if( ! aGenerateNPTH_list && pad->GetAttribute() == PAD_HOLE_NOT_PLATED && ! aMergePTHNPTH ) continue; if( aGenerateNPTH_list && pad->GetAttribute() != PAD_HOLE_NOT_PLATED ) diff --git a/pcbnew/exporters/gendrill_Excellon_writer.h b/pcbnew/exporters/gendrill_Excellon_writer.h index 2a059fade4..e62501e80a 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.h +++ b/pcbnew/exporters/gendrill_Excellon_writer.h @@ -135,6 +135,7 @@ private: // (i.e inches or mm) bool m_mirror; wxPoint m_offset; // Drill offset ooordinates + bool m_mergePTHNPTH; std::vector m_holeListBuffer; // Buffer containing holes std::vector m_toolListBuffer; // Buffer containing tools @@ -146,6 +147,7 @@ public: EXCELLON_WRITER( BOARD* aPcb, wxPoint aOffset ) m_conversionUnits = 0.0001; m_unitsDecimal = false; m_mirror = false; + m_mergePTHNPTH = false; m_minimalHeader = false; } @@ -177,11 +179,12 @@ public: EXCELLON_WRITER( BOARD* aPcb, wxPoint aOffset ) * @param aMinimalHeader = true to use a minimal header (no comments, no info) * @param aOffset = drill coordinates offset */ - void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset ) + void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset, bool aMergePTHNPTH ) { m_mirror = aMirror; m_offset = aOffset; m_minimalHeader = aMinimalHeader; + m_mergePTHNPTH = aMergePTHNPTH; } /** @@ -199,7 +202,8 @@ public: EXCELLON_WRITER( BOARD* aPcb, wxPoint aOffset ) */ void BuildHolesList( int aFirstLayer, int aLastLayer, bool aExcludeThroughHoles, - bool aGenerateNPTH_list ); + bool aGenerateNPTH_list, + bool aMergePTHNPTH ); int GetHolesCount() const { return m_holeListBuffer.size(); } diff --git a/pcbnew/help_common_strings.h b/pcbnew/help_common_strings.h index e628f9771a..cbc1d6b378 100644 --- a/pcbnew/help_common_strings.h +++ b/pcbnew/help_common_strings.h @@ -22,3 +22,5 @@ #define HELP_ZOOM_REDRAW _( "Redraw the screen of the board" ) #define HELP_SHOW_HIDE_LAYERMANAGER _( "Show/hide the layers manager toolbar" ) + +#define HELP_SHOW_HIDE_MICROWAVE_TOOLS _( "Show/hide the toolbar for microwave tools\nThis is a experimental feature (under development)" ) diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index df68cee10a..12854c7ea5 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -62,7 +62,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() wxMenu* fileMenu = new wxMenu; // Active library selection - AddMenuItem( fileMenu, ID_MODEDIT_SELECT_CURRENT_LIB, _("Current Library"), + AddMenuItem( fileMenu, ID_MODEDIT_SELECT_CURRENT_LIB, _("Set Active Library"), _( "Select active library" ), KiBitmap( open_library_xpm ) ); fileMenu->AppendSeparator(); @@ -77,32 +77,32 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // from File AddMenuItem( openSubmenu, ID_MODEDIT_IMPORT_PART, - _( "&Import Module from File" ), - _( "Import a footprint from an existing file" ), + _( "&Import Module From File" ), + _( "Import footprint from an existing file" ), KiBitmap( import_module_xpm ) ); // from Library AddMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE, - _( "Load Module from Current Li&brary" ), - _( "Open a footprint module from a Library" ), + _( "Load Module From Current Li&brary" ), + _( "Open a footprint module from library" ), KiBitmap( module_xpm ) ); // from current Board AddMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE_FROM_BOARD, - _( "Load Module from &Current Board" ), - _( "Load a footprint module from the current loaded board" ), + _( "Load Module From &Current Board" ), + _( "Load a footprint module from the current board" ), KiBitmap( load_module_board_xpm ) ); /* Append openSubmenu to fileMenu */ AddMenuItem( fileMenu, openSubmenu, -1, _( "&Load Module" ), - _( "Load a footprint module" ), + _( "Load footprint module" ), KiBitmap( open_document_xpm ) ); fileMenu->AppendSeparator(); // Save the currently loaded legacy library as an s-expression library. AddMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBRARY_AS, - _( "Save Current Library as ..." ), + _( "Save Current Library As..." ), _( "Save entire current library under a new name." ), wxNullBitmap ); @@ -116,21 +116,21 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Save module in new lib AddMenuItem( fileMenu, ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, - _( "S&ave Module into a New Library" ), + _( "S&ave Module in New Library" ), _( "Create a new library and save current module into it" ), KiBitmap( new_library_xpm ) ); // Export module AddMenuItem( fileMenu, ID_MODEDIT_EXPORT_PART, _( "&Export Module" ), - _( "Save the current loaded module to a file" ), + _( "Save current loaded module into file" ), KiBitmap( export_module_xpm ) ); fileMenu->AppendSeparator(); // Print AddMenuItem( fileMenu, wxID_PRINT, _( "&Print" ), - _( "Print the current module" ), + _( "Print current module" ), KiBitmap( plot_xpm ) ); // Separator @@ -139,7 +139,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Close editor AddMenuItem( fileMenu, wxID_EXIT, _( "Cl&ose" ), - _( "Close the footprint editor" ), + _( "Close footprint editor" ), KiBitmap( exit_xpm ) ); // Menu Edit: @@ -148,18 +148,18 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Undo text = AddHotkeyName( _( "&Undo" ), g_Module_Editor_Hokeys_Descr, HK_UNDO ); AddMenuItem( editMenu, wxID_UNDO, - text, _( "Undo last edit" ), + text, _( "Undo last action" ), KiBitmap( undo_xpm ) ); // Redo text = AddHotkeyName( _( "&Redo" ), g_Module_Editor_Hokeys_Descr, HK_REDO ); AddMenuItem( editMenu, wxID_REDO, - text, _( "Redo the last undo action" ), + text, _( "Redo last action" ), KiBitmap( redo_xpm ) ); // Delete items AddMenuItem( editMenu, ID_MODEDIT_DELETE_TOOL, - _( "&Delete" ), _( "Delete objects with the eraser" ), + _( "&Delete" ), _( "Delete objects with eraser" ), KiBitmap( delete_xpm ) ); // Separator @@ -167,7 +167,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Properties AddMenuItem( editMenu, ID_MODEDIT_EDIT_MODULE_PROPERTIES, - _( "&Properties" ), + _( "Edit &Properties" ), _( "Edit module properties" ), KiBitmap( module_options_xpm ) ); @@ -176,13 +176,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Sizes and Widths AddMenuItem( dimensions_Submenu, ID_PCB_DRAWINGS_WIDTHS_SETUP, - _( "&Sizes and Widths" ), + _( "&Size and Width" ), _( "Adjust width for texts and drawings" ), KiBitmap( options_text_xpm ) ); // Pad settings AddMenuItem( dimensions_Submenu, ID_MODEDIT_PAD_SETTINGS, - _( "&Pad Settings" ), _( "Edit the settings for new pads" ), + _( "&Pad Setting" ), _( "Edit settings for new pads" ), KiBitmap( pad_dimensions_xpm ) ); // User grid size @@ -195,25 +195,25 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Zoom In AddMenuItem( viewMenu, ID_ZOOM_IN, - _( "Zoom &In" ), _( "Zoom in on the module" ), + _( "Zoom &In" ), _( "Zoom in" ), KiBitmap( zoom_in_xpm ) ); // Zoom Out AddMenuItem( viewMenu, ID_ZOOM_OUT, - _( "Zoom &Out" ), _( "Zoom out on the module" ), + _( "Zoom &Out" ), _( "Zoom out" ), KiBitmap( zoom_out_xpm ) ); // Fit on Screen AddMenuItem( viewMenu, ID_ZOOM_PAGE, _( "&Fit on Screen" ), - _( "Zoom and fit the module in the window" ), + _( "Zoom to fit the module in the window" ), KiBitmap( zoom_fit_in_page_xpm ) ); viewMenu->AppendSeparator(); // Redraw AddMenuItem( viewMenu, ID_ZOOM_REDRAW, - _( "&Redraw" ), _( "Redraw the window's viewport" ), + _( "&Redraw" ), _( "Redraw window's viewport" ), KiBitmap( zoom_redraw_xpm ) ); // 3D view @@ -258,7 +258,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Anchor AddMenuItem( placeMenu, ID_MODEDIT_ANCHOR_TOOL, _( "A&nchor" ), - _( "Place the footprint module reference anchor" ), + _( "Place footprint module reference anchor" ), KiBitmap( anchor_xpm ) ); // Menu Help: @@ -269,8 +269,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Contents AddMenuItem( helpMenu, wxID_HELP, - _( "&Contents" ), - _( "Open the Pcbnew handbook" ), + _( "P&cbnew Manual" ), + _( "Open the Pcbnew manual" ), KiBitmap( online_help_xpm ) ); AddMenuItem( helpMenu, wxID_INDEX, diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 01a424de51..df83d337c9 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -477,6 +477,13 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() HELP_SHOW_HIDE_LAYERMANAGER, KiBitmap( layers_manager_xpm ) ); + AddMenuItem( configmenu, ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, + m_show_microwave_tools ? + _( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" ), + HELP_SHOW_HIDE_MICROWAVE_TOOLS, + KiBitmap( mw_toolbar_xpm ) ); + + // General #ifdef __WXMAC__ configmenu->Append(wxID_PREFERENCES); diff --git a/pcbnew/pad_edition_functions.cpp b/pcbnew/pad_edition_functions.cpp index 50fae272bf..57907ad142 100644 --- a/pcbnew/pad_edition_functions.cpp +++ b/pcbnew/pad_edition_functions.cpp @@ -121,6 +121,8 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() ); aPad->GetParent()->SetLastEditTime(); + + OnModify(); } /** Compute the 'next' pad number for autoincrement @@ -132,8 +134,8 @@ static wxString GetNextPadName( wxString aPadName ) int ponder = 1; // Trim and extract the trailing numeric part - while( aPadName.Len() - && aPadName.Last() >= '0' + while( aPadName.Len() + && aPadName.Last() >= '0' && aPadName.Last() <= '9' ) { num += ( aPadName.Last() - '0' ) * ponder; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 64abab4807..25fa22eaa4 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -139,6 +139,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, PCB_EDIT_FRAME::Process_Config ) + EVT_MENU( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( wxID_PREFERENCES, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_PCB_LAYERS_SETUP, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_PCB_MASK_CLEARANCE, PCB_EDIT_FRAME::Process_Config ) @@ -290,6 +291,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) PCB_EDIT_FRAME::OnUpdateVerticalToolbar ) EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle ) + EVT_UPDATE_UI_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD, + PCB_EDIT_FRAME::OnUpdateMuWaveToolbar ) END_EVENT_TABLE() diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 50ab5bbc59..46315ab1da 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -77,6 +77,17 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) _("Hide &Layers Manager" ) : _("Show &Layers Manager" )); break; + case ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR: + m_show_microwave_tools = ! m_show_microwave_tools; + m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); + m_auimgr.Update(); + + GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, + m_show_microwave_tools ? + _( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" )); + break; + + case ID_PCB_LAYERS_SETUP: InstallDialogLayerSetup(); break; diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 3dad96290a..608bac920a 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -280,6 +280,7 @@ enum pcbnew_ids ID_PCB_LIB_TABLE_EDIT, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, + ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, ID_TB_OPTIONS_SHOW_ZONES, diff --git a/pcbnew/ratsnest_data.cpp b/pcbnew/ratsnest_data.cpp index 234326c132..6b9d2b043a 100644 --- a/pcbnew/ratsnest_data.cpp +++ b/pcbnew/ratsnest_data.cpp @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -953,26 +952,40 @@ void RN_DATA::ProcessBoard() { m_nets.clear(); m_nets.resize( m_board->GetNetCount() ); + int netCode; // Iterate over all items that may need to be connected for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) { for( D_PAD* pad = module->Pads().GetFirst(); pad; pad = pad->Next() ) - m_nets[pad->GetNetCode()].AddItem( pad ); + { + netCode = pad->GetNetCode(); + + if( netCode > 0 ) + m_nets[netCode].AddItem( pad ); + } } for( TRACK* track = m_board->m_Track; track; track = track->Next() ) { - if( track->Type() == PCB_VIA_T ) - m_nets[track->GetNetCode()].AddItem( static_cast( track ) ); - else if( track->Type() == PCB_TRACE_T ) - m_nets[track->GetNetCode()].AddItem( track ); + netCode = track->GetNetCode(); + + if( netCode > 0 ) + { + if( track->Type() == PCB_VIA_T ) + m_nets[netCode].AddItem( static_cast( track ) ); + else if( track->Type() == PCB_TRACE_T ) + m_nets[netCode].AddItem( track ); + } } for( int i = 0; i < m_board->GetAreaCount(); ++i ) { ZONE_CONTAINER* zone = m_board->GetArea( i ); - m_nets[zone->GetNetCode()].AddItem( zone ); + netCode = zone->GetNetCode(); + + if( netCode > 0 ) + m_nets[netCode].AddItem( zone ); } } diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index e0f4647a2e..6038bf41ff 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -398,7 +398,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, wxEmptyString, KiBitmap( mw_toolbar_xpm ), - _( "Show/hide the toolbar for microwaves tools\n This is a experimental feature (under development)" ), + HELP_SHOW_HIDE_MICROWAVE_TOOLS, wxITEM_CHECK ); @@ -500,25 +500,30 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar() // Set up toolbar m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, KiBitmap( mw_add_line_xpm ), - _( "Create line of specified length for microwave applications" ) ); + _( "Create line of specified length for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString, KiBitmap( mw_add_gap_xpm ), - _( "Create gap of specified length for microwave applications" ) ); + _( "Create gap of specified length for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->AddSeparator(); m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString, KiBitmap( mw_add_stub_xpm ), - _( "Create stub of specified length for microwave applications" ) ); + _( "Create stub of specified length for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString, KiBitmap( mw_add_stub_arc_xpm ), - _( "Create stub (arc) of specified length for microwave applications" ) ); + _( "Create stub (arc) of specified length for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString, KiBitmap( mw_add_shape_xpm ), - _( "Create a polynomial shape for microwave applications" ) ); + _( "Create a polynomial shape for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->Realize(); } diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 23d850d2b1..6e8ceaac2c 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -204,6 +204,12 @@ void PCB_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ) aEvent.Check( GetToolId() == aEvent.GetId() ); } +void PCB_EDIT_FRAME::OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent ) +{ + if( aEvent.GetEventObject() == m_microWaveToolBar ) + aEvent.Check( GetToolId() == aEvent.GetId() ); +} + void PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent ) {