diff --git a/CMakeLists.txt b/CMakeLists.txt index a680d70006..5351f68bf5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,13 +45,17 @@ option( KICAD_KEEPCASE # * No issues on Windows. # * needs webkitgtk-devel package installed on Linux, and wxWidgets rebuilt with this package. # * Seems also OK on OSX. -# However the default option is on and has effect only if BUILD_GITHUB_PLUGIN is ON -# This option could be removed soon, if no serious issue happens on Linux +# This option has effect only if BUILD_GITHUB_PLUGIN is ON +# +# This option is set to OFF because Kicad developers cannot be sure the use of Webkit does no open +# a security issue when runnig Kicad. +# the probability is low, but not zero. option( KICAD_USE_WEBKIT "Use system web kit to build a web viewer in footprint library wizard to easily select github libraries (default ON)." - ON + OFF ) + option( USE_WX_GRAPHICS_CONTEXT "Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" ) @@ -90,7 +94,6 @@ option( KICAD_SKIP_BOOST ) mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost. - # when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled: # PYTHON_EXECUTABLE can be defined when invoking cmake # ( use -DPYTHON_EXECUTABLE=/python.exe or python2 ) @@ -99,6 +102,18 @@ mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost. option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON ) +# When KICAD_USE_WEBKIT in on, the Kicad web viewer has access to the www. +# Kicad developers cannot be sure the use of Web viewer does no open a security issue when runnig Kicad. +# the probability is low, but not zero. +#so warn the user: +if( KICAD_USE_WEBKIT ) + message( STATUS "by setting KICAD_USE_WEBKIT ON, you are building a web viewer inside Kicad. +Kicad developers cannot be sure the Web access does no open a security issue, +when running a Web Viewer inside Kicad. The probability is low, but not zero. +You are warned" ) +endif() + + # This can be set to a custom name to brag about a particular branch in the "About" dialog: set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this build came." ) diff --git a/CMakeModules/config.h.cmake b/CMakeModules/config.h.cmake index d5aaf1843e..27c1117a16 100644 --- a/CMakeModules/config.h.cmake +++ b/CMakeModules/config.h.cmake @@ -61,6 +61,15 @@ /// The install prefix defined in CMAKE_INSTALL_PREFIX. #define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX@" +/// The install prefix used for KiCad's libraries. +/// These paths are only intended to be reasonable default values that work if +/// the user installs KiCad in the default path for a given platform. +#if defined( APPLE ) +#define KICAD_DATA_PATH "/Library/Application Support/kicad" +#else +#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@" +#endif + /// When defined, build the GITHUB_PLUGIN for pcbnew. #cmakedefine BUILD_GITHUB_PLUGIN diff --git a/common/class_plotter.cpp b/common/class_plotter.cpp index ffa4615fd5..12bbac2ed4 100644 --- a/common/class_plotter.cpp +++ b/common/class_plotter.cpp @@ -433,19 +433,16 @@ void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width, EDA_DRAW_MODE_T tracemode ) { - switch( tracemode ) + if( tracemode == FILLED ) { - case FILLED: - case LINE: - SetCurrentLineWidth( tracemode==FILLED ? width : -1 ); + SetCurrentLineWidth( width ); MoveTo( start ); FinishTo( end ); - break; - - case SKETCH: + } + else + { SetCurrentLineWidth( -1 ); segmentAsOval( start, end, width, tracemode ); - break; } } @@ -453,24 +450,15 @@ void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width, void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle, int radius, int width, EDA_DRAW_MODE_T tracemode ) { - switch( tracemode ) - { - case LINE: - SetCurrentLineWidth( -1 ); - Arc( centre, StAngle, EndAngle, radius, NO_FILL, -1 ); - break; - - case FILLED: + if( tracemode == FILLED ) Arc( centre, StAngle, EndAngle, radius, NO_FILL, width ); - break; - - case SKETCH: + else + { SetCurrentLineWidth( -1 ); Arc( centre, StAngle, EndAngle, radius - ( width - currentPenWidth ) / 2, NO_FILL, -1 ); Arc( centre, StAngle, EndAngle, radius + ( width - currentPenWidth ) / 2, NO_FILL, -1 ); - break; } } @@ -478,17 +466,10 @@ void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle, void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width, EDA_DRAW_MODE_T tracemode ) { - switch( tracemode ) - { - case LINE: - Rect( p1, p2, NO_FILL, -1 ); - break; - - case FILLED: + if( tracemode == FILLED ) Rect( p1, p2, NO_FILL, width ); - break; - - case SKETCH: + else + { SetCurrentLineWidth( -1 ); wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2, p1.y - (width - currentPenWidth) / 2 ); @@ -500,28 +481,19 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width, offsetp2.x -= (width - currentPenWidth); offsetp2.y -= (width - currentPenWidth); Rect( offsetp1, offsetp2, NO_FILL, -1 ); - break; } } void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, EDA_DRAW_MODE_T tracemode ) { - switch( tracemode ) - { - case LINE: - Circle( pos, diametre, NO_FILL, -1 ); - break; - - case FILLED: + if( tracemode == FILLED ) Circle( pos, diametre, NO_FILL, width ); - break; - - case SKETCH: + else + { SetCurrentLineWidth( -1 ); Circle( pos, diametre - width + currentPenWidth, NO_FILL, -1 ); Circle( pos, diametre + width - currentPenWidth, NO_FILL, -1 ); - break; } } diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index fbca11328f..e6e11cce9d 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -467,15 +467,7 @@ void DXF_PLOTTER::SetDash( bool dashed ) void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int aWidth, EDA_DRAW_MODE_T aPlotMode ) { - if( aPlotMode == LINE ) // In line mode, just a line is OK - { - MoveTo( aStart ); - FinishTo( aEnd ); - } - else - { - segmentAsOval( aStart, aEnd, aWidth, aPlotMode ); - } + segmentAsOval( aStart, aEnd, aWidth, aPlotMode ); } /* Plot an arc in DXF format diff --git a/common/common_plotGERBER_functions.cpp b/common/common_plotGERBER_functions.cpp index 50d1802eb8..2646171faf 100644 --- a/common/common_plotGERBER_functions.cpp +++ b/common/common_plotGERBER_functions.cpp @@ -432,19 +432,16 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_ wxASSERT( outputFile ); wxSize size( diametre, diametre ); - switch( trace_mode ) + if( trace_mode == SKETCH ) { - case LINE: - case SKETCH: SetCurrentLineWidth( -1 ); Circle( pos, diametre - currentPenWidth, NO_FILL ); - break; - - case FILLED: + } + else + { DPOINT pos_dev = userToDeviceCoordinates( pos ); selectAperture( size, APERTURE::Circle ); emitDcode( pos_dev, 3 ); - break; } } @@ -519,23 +516,20 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, // Pass through case 0: case 1800: - switch( trace_mode ) + if( trace_mode == SKETCH ) { - case LINE: - case SKETCH: SetCurrentLineWidth( -1 ); Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2, pos.y - (size.y - currentPenWidth) / 2 ), wxPoint( pos.x + (size.x - currentPenWidth) / 2, pos.y + (size.y - currentPenWidth) / 2 ), NO_FILL ); - break; - - case FILLED: + } + else + { DPOINT pos_dev = userToDeviceCoordinates( pos ); selectAperture( size, APERTURE::Rect ); emitDcode( pos_dev, 3 ); - break; } break; diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index 1e040b03b1..553b45dd67 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -388,8 +388,8 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, wxPoint center; wxSize size; - // Suppress overlap if pen is too big or in line mode - if( (penDiameter >= width) || (tracemode == LINE) ) + // Suppress overlap if pen is too big + if( penDiameter >= width ) { MoveTo( start ); FinishTo( end ); @@ -491,15 +491,10 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, int delta = KiROUND( penDiameter - penOverlap ); int radius = diametre / 2; - if( trace_mode != LINE ) - { - radius = ( diametre - KiROUND( penDiameter ) ) / 2; - } + radius = ( diametre - KiROUND( penDiameter ) ) / 2; if( radius < 0 ) - { radius = 0; - } double rsize = userToDeviceSize( radius ); @@ -534,11 +529,8 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize, size.x = padsize.x / 2; size.y = padsize.y / 2; - if( trace_mode != LINE ) - { - size.x = (padsize.x - (int) penDiameter) / 2; - size.y = (padsize.y - (int) penDiameter) / 2; - } + size.x = (padsize.x - (int) penDiameter) / 2; + size.y = (padsize.y - (int) penDiameter) / 2; if( size.x < 0 ) size.x = 0; diff --git a/common/eda_text.cpp b/common/eda_text.cpp index c592306cc8..c615f67b26 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -346,9 +346,6 @@ void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC, { int width = m_Thickness; - if( aFillMode == LINE ) - width = 0; - if( aDrawMode != UNSPECIFIED_DRAWMODE ) GRSetDrawMode( aDC, aDrawMode ); diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index a708ecdd56..1f8b01ff2f 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -51,14 +51,16 @@ #include -#define KICAD_COMMON wxT( "kicad_common" ) +#define KICAD_COMMON wxT( "kicad_common" ) // some key strings used to store parameters in KICAD_COMMON -const wxChar PGM_BASE::workingDirKey[] = wxT( "WorkingDir" ); // public +const wxChar PGM_BASE::workingDirKey[] = wxT( "WorkingDir" ); // public -static const wxChar languageCfgKey[] = wxT( "LanguageID" ); -static const wxChar kicadFpLibPath[] = wxT( "KicadFootprintLibraryPath" ); +static const wxChar languageCfgKey[] = wxT( "LanguageID" ); +static const wxChar kicadFpLibPath[] = wxT( "KicadFootprintLibraryPath" ); +static const wxChar pathEnvVariables[] = wxT( "EnvironmentVariables" ); +static const wxChar traceEnvVars[] = wxT( "KIENVVARS" ); /** @@ -353,7 +355,8 @@ bool PGM_BASE::initPgm() wxInitAllImageHandlers(); - m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId(), GetKicadLockFilePath() ); + m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + + wxGetUserId(), GetKicadLockFilePath() ); if( m_pgm_checker->IsAnotherRunning() ) { @@ -361,6 +364,7 @@ bool PGM_BASE::initPgm() _( "%s is already running, Continue?" ), GetChars( pgm_name.GetName() ) ); + if( !IsOK( NULL, quiz ) ) return false; } @@ -399,6 +403,17 @@ bool PGM_BASE::initPgm() SetLanguagePath(); + // Useful local environment variable settings. + m_local_env_vars[ wxString( wxT( "KIGITHUB" ) ) ] = + wxString( wxT( "https://github.com/KiCad" ) ); + + wxFileName tmpFileName; + tmpFileName.AssignDir( wxString( wxT( KICAD_DATA_PATH ) ) ); + tmpFileName.AppendDir( wxT( "modules" ) ); + m_local_env_vars[ wxString( wxT( "KISYSMOD" ) ) ] = tmpFileName.GetPath(); + tmpFileName.AppendDir( wxT( "packages3d" ) ); + m_local_env_vars[ wxString( wxT( "KISYS3DMOD" ) ) ] = tmpFileName.GetPath(); + // OS specific instantiation of wxConfigBase derivative: m_common_settings = GetNewConfig( KICAD_COMMON ); @@ -425,6 +440,7 @@ bool PGM_BASE::setExecutablePath() // bundle directory, e.g., /Applications/kicad.app/ wxFileName fn( m_bin_dir ); + if( fn.GetName() == wxT( "kicad" ) ) { // kicad launcher, so just remove the Contents/MacOS part @@ -440,6 +456,7 @@ bool PGM_BASE::setExecutablePath() fn.RemoveLastDir(); fn.RemoveLastDir(); } + m_bin_dir = fn.GetPath() + wxT( "/" ); #else // Use unix notation for paths. I am not sure this is a good idea, @@ -479,6 +496,33 @@ void PGM_BASE::loadCommonSettings() } m_editor_name = m_common_settings->Read( wxT( "Editor" ) ); + + wxString entry, oldPath; + wxArrayString entries; + long index = 0L; + + oldPath = m_common_settings->GetPath(); + m_common_settings->SetPath( pathEnvVariables ); + + while( m_common_settings->GetNextEntry( entry, index ) ) + { + wxLogTrace( traceEnvVars, + wxT( "Enumerating over entry %s, %ld." ), GetChars( entry ), index ); + entries.Add( entry ); + } + + for( unsigned i = 0; i < entries.GetCount(); i++ ) + { + wxString val = m_common_settings->Read( entries[i], wxEmptyString ); + m_local_env_vars[ entries[i] ] = val; + } + + for( std::map::iterator it = m_local_env_vars.begin(); + it != m_local_env_vars.end(); + ++it ) + SetLocalEnvVariable( it->first, it->second ); + + m_common_settings->SetPath( oldPath ); } @@ -491,6 +535,20 @@ void PGM_BASE::saveCommonSettings() wxString cur_dir = wxGetCwd(); m_common_settings->Write( workingDirKey, cur_dir ); + + // Save the local environment variables. + m_common_settings->SetPath( pathEnvVariables ); + + for( std::map::iterator it = m_local_env_vars.begin(); + it != m_local_env_vars.end(); + ++it ) + { + wxLogTrace( traceEnvVars, wxT( "Saving environment varaiable config entry %s as %s" ), + GetChars( it->first ), GetChars( it->second ) ); + m_common_settings->Write( it->first, it->second ); + } + + m_common_settings->SetPath( wxT( ".." ) ); } } @@ -665,3 +723,21 @@ void PGM_BASE::AddMenuLanguageList( wxMenu* MasterMenu ) } } + +bool PGM_BASE::SetLocalEnvVariable( const wxString& aName, const wxString& aValue ) +{ + wxString env; + + // Check to see if the environment variable is already set. + if( wxGetEnv( aName, &env ) ) + { + wxLogTrace( traceEnvVars, wxT( "Environment variable %s already set to %s." ), + GetChars( aName ), GetChars( env ) ); + return env == aValue; + } + + wxLogTrace( traceEnvVars, wxT( "Setting local environment variable %s to %s." ), + GetChars( aName ), GetChars( aValue ) ); + + return wxSetEnv( aName, aValue ); +} diff --git a/common/searchhelpfilefullpath.cpp b/common/searchhelpfilefullpath.cpp index 79e48fd665..e340a2c08a 100644 --- a/common/searchhelpfilefullpath.cpp +++ b/common/searchhelpfilefullpath.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014 CERN - * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2014-2015 CERN + * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.TXT for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -31,7 +31,7 @@ * Function FindFileInSearchPaths * looks in "this" for \a aFilename, but first modifies every search * path by appending a list of path fragments from aSubdirs. That modification - * is not rentative. + * is not relative. */ wxString FindFileInSearchPaths( const SEARCH_STACK& aStack, const wxString& aFilename, const wxArrayString* aSubdirs ) @@ -73,7 +73,12 @@ wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aB // If there's a KICAD environment variable set, use that guy's path also ss.AddPaths( Pgm().GetKicadEnvVariable(), 0 ); -#if 1 // && defined(__linux__) +#if defined(__WXMAC__) + ss.AddPaths( GetOSXKicadMachineDataDir() ); + ss.AddPaths( Pgm().GetExecutablePath(), 0 ); +#endif + +#if ! defined(__WXMAC__) // && defined(__linux__) // Based on kicad-doc.bzr/CMakeLists.txt, line 20, the help files are // installed into "/share/doc/kicad/help" for linux. // This is ${KICAD_HELP} var in that CMakeLists.txt file. @@ -84,7 +89,7 @@ wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aB subdirs.Add( wxT( "help" ) ); #endif -#if 1 // && defined(__WINDOWS__) +#if ! defined(__WXMAC__) // && defined(__WINDOWS__) // Based on kicad-doc.bzr/CMakeLists.txt, line 35, the help files are // installed into "/doc/help" for Windows. // This is ${KICAD_HELP} var in that CMakeLists.txt file. @@ -93,6 +98,18 @@ wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aB altsubdirs.Add( wxT( "help" ) ); #endif +#if defined (__WXMAC__) + // OS X packages can have the help files in + // /Library/Application\ Support/kicad/help, + // and in Contents/SharedSupport/help inside the + // bundle. + // Below we account for an international subdirectory. + subdirs.Add( wxT( "help" ) ); + altsubdirs.Add( wxT( "Contents" ) ); + altsubdirs.Add( wxT( "SharedSupport" ) ); + altsubdirs.Add( wxT( "help" ) ); +#endif + /* Search for a help file. * we *must* find a help file. * so help is searched in directories in this order: @@ -110,7 +127,7 @@ wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aB locale_name_dirs.Add( i18n->GetCanonicalName() ); // canonical name like fr_FR // wxLocale::GetName() does not return always the short name locale_name_dirs.Add( i18n->GetName().BeforeLast( '_' ) ); // short canonical name like fr - locale_name_dirs.Add( wxT("en") ); // default (en) + locale_name_dirs.Add( wxT( "en" ) ); // default (en) #if defined(DEBUG) && 0 ss.Show( __func__ ); @@ -127,22 +144,22 @@ wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aB subdirs.Add( locale_name_dirs[ii] ); altsubdirs.Add( locale_name_dirs[ii] ); - fn = FindFileInSearchPaths( ss, aBaseName + wxT(".html"), &altsubdirs ); + fn = FindFileInSearchPaths( ss, aBaseName + wxT( ".html" ), &altsubdirs ); if( !fn.IsEmpty() ) break; - fn = FindFileInSearchPaths( ss, aBaseName + wxT(".pdf"), &altsubdirs ); + fn = FindFileInSearchPaths( ss, aBaseName + wxT( ".pdf" ), &altsubdirs ); if( !fn.IsEmpty() ) break; - fn = FindFileInSearchPaths( ss, aBaseName + wxT(".html"), &subdirs ); + fn = FindFileInSearchPaths( ss, aBaseName + wxT( ".html" ), &subdirs ); if( !fn.IsEmpty() ) break; - fn = FindFileInSearchPaths( ss, aBaseName + wxT(".pdf"), &subdirs ); + fn = FindFileInSearchPaths( ss, aBaseName + wxT( ".pdf" ), &subdirs ); if( !fn.IsEmpty() ) break; diff --git a/common/tool/context_menu.cpp b/common/tool/context_menu.cpp index 105e283d6b..86c41c301b 100644 --- a/common/tool/context_menu.cpp +++ b/common/tool/context_menu.cpp @@ -132,7 +132,7 @@ void CONTEXT_MENU::SetTitle( const wxString& aTitle ) else { InsertSeparator( 0 ); - Insert( 0, new wxMenuItem( this, -1, aTitle, wxEmptyString, wxITEM_NORMAL ) ); + Insert( 0, new wxMenuItem( this, wxID_NONE, aTitle, wxEmptyString, wxITEM_NORMAL ) ); m_titleSet = true; } } diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 49e8958fb2..07b1721ebe 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 2007-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 2007-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -58,6 +58,7 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) EVT_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize ) EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, @@ -251,13 +252,10 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ) wxString msgTextsFill[2] = { _( "Show texts in filled mode" ), _( "Show texts in sketch mode" ) }; - unsigned i = displ_opts->m_DisplayModText + 1; + unsigned i = displ_opts->m_DisplayModTextFill == SKETCH ? 0 : 1; - if ( i > 2 ) - i = 1; - - aEvent.Check( displ_opts->m_DisplayModText == 1 ); - m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i-1] ); + aEvent.Check( displ_opts->m_DisplayModTextFill == SKETCH ); + m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] ); } @@ -266,16 +264,13 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent ) { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); - wxString msgEdgesFill[3] = { _( "Show outlines in filled mode" ), + wxString msgEdgesFill[2] = { _( "Show outlines in filled mode" ), _( "Show outlines in sketch mode" ) }; - int i = displ_opts->m_DisplayModEdge + 1; + int i = displ_opts->m_DisplayModEdgeFill == SKETCH ? 0 : 1; - if ( i > 2 ) - i = 1; - - aEvent.Check( displ_opts->m_DisplayModEdge == 2 ); - m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i-1] ); + aEvent.Check( displ_opts->m_DisplayModEdgeFill == SKETCH ); + m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] ); } @@ -303,20 +298,12 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) switch( id ) { case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - displ_opts->m_DisplayModText++; - - if( displ_opts->m_DisplayModText > 2 ) - displ_opts->m_DisplayModText = 0; - + displ_opts->m_DisplayModTextFill = displ_opts->m_DisplayModTextFill == FILLED ? SKETCH : FILLED; m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - displ_opts->m_DisplayModEdge++; - - if( displ_opts->m_DisplayModEdge > 2 ) - displ_opts->m_DisplayModEdge = 0; - + displ_opts->m_DisplayModEdgeFill = displ_opts->m_DisplayModEdgeFill == FILLED ? SKETCH : FILLED; m_canvas->Refresh(); break; diff --git a/cvpcb/dialogs/dialog_display_options.cpp b/cvpcb/dialogs/dialog_display_options.cpp index 381cf976c9..9911ebccc6 100644 --- a/cvpcb/dialogs/dialog_display_options.cpp +++ b/cvpcb/dialogs/dialog_display_options.cpp @@ -74,10 +74,10 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); - m_EdgesDisplayOption->SetSelection( displ_opts->m_DisplayModEdge ); - m_TextDisplayOption->SetSelection( displ_opts->m_DisplayModText ); - m_IsShowPadFill->SetValue( displ_opts->m_DisplayPadFill ); - m_IsShowPadNum->SetValue( displ_opts->m_DisplayPadNum ); + m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill ); + m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill ); + m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill ); + m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum ); m_IsZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() ); m_IsMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() ); m_IsMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() ); @@ -94,10 +94,10 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); - displ_opts->m_DisplayModEdge = m_EdgesDisplayOption->GetSelection(); - displ_opts->m_DisplayModText = m_TextDisplayOption->GetSelection(); - displ_opts->m_DisplayPadNum = m_IsShowPadNum->GetValue(); - displ_opts->m_DisplayPadFill = m_IsShowPadFill->GetValue(); + displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue(); + displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue(); + displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue(); + displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue(); m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_IsZoomNoCenter->GetValue() ); m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_IsMiddleButtonPan->GetValue() ); m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_IsMiddleButtonPanLimited->GetValue() ); diff --git a/cvpcb/dialogs/dialog_display_options_base.cpp b/cvpcb/dialogs/dialog_display_options_base.cpp index 8c37a2bee0..5b06c1058e 100644 --- a/cvpcb/dialogs/dialog_display_options_base.cpp +++ b/cvpcb/dialogs/dialog_display_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -19,38 +19,23 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - wxBoxSizer* bSizerLeft; - bSizerLeft = new wxBoxSizer( wxVERTICAL ); + wxStaticBoxSizer* sbSizerDrawMode; + sbSizerDrawMode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Draw options") ), wxVERTICAL ); - wxString m_EdgesDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_EdgesDisplayOptionNChoices = sizeof( m_EdgesDisplayOptionChoices ) / sizeof( wxString ); - m_EdgesDisplayOption = new wxRadioBox( this, ID_EDGE_SELECT, _("Edges"), wxDefaultPosition, wxDefaultSize, m_EdgesDisplayOptionNChoices, m_EdgesDisplayOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_EdgesDisplayOption->SetSelection( 0 ); - bSizerLeft->Add( m_EdgesDisplayOption, 1, wxALL|wxEXPAND, 5 ); + m_EdgesDisplayOption = new wxCheckBox( this, wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_EdgesDisplayOption, 0, wxALL, 5 ); - wxString m_TextDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_TextDisplayOptionNChoices = sizeof( m_TextDisplayOptionChoices ) / sizeof( wxString ); - m_TextDisplayOption = new wxRadioBox( this, ID_TEXT_SELECT, _("Text"), wxDefaultPosition, wxDefaultSize, m_TextDisplayOptionNChoices, m_TextDisplayOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_TextDisplayOption->SetSelection( 0 ); - bSizerLeft->Add( m_TextDisplayOption, 1, wxALL|wxEXPAND, 5 ); + m_TextDisplayOption = new wxCheckBox( this, wxID_ANY, _("Texts sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_TextDisplayOption, 0, wxALL, 5 ); + + m_ShowPadSketch = new wxCheckBox( this, ID_PADFILL_OPT, _("Pad sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_ShowPadSketch, 0, wxEXPAND|wxALL, 5 ); + + m_ShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_ShowPadNum, 0, wxALL|wxEXPAND, 5 ); - bUpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizerRight; - bSizerRight = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizerPads; - sbSizerPads = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pads") ), wxVERTICAL ); - - m_IsShowPadFill = new wxCheckBox( this, ID_PADFILL_OPT, _("Fill &pad"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerPads->Add( m_IsShowPadFill, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - - m_IsShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerPads->Add( m_IsShowPadNum, 0, wxALL|wxEXPAND, 5 ); - - - bSizerRight->Add( sbSizerPads, 1, wxEXPAND|wxALL, 5 ); + bUpperSizer->Add( sbSizerDrawMode, 1, wxEXPAND|wxALL, 5 ); wxStaticBoxSizer* sbSizerViewOpt; sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); @@ -58,19 +43,16 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( m_IsZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Do not center and warp cusor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); m_IsZoomNoCenter->SetToolTip( _("Keep the cursor at its current location when zooming") ); - sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxEXPAND|wxALL, 5 ); m_IsMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxEXPAND|wxALL, 5 ); m_IsMiddleButtonPanLimited = new wxCheckBox( this, wxID_ANY, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerViewOpt->Add( m_IsMiddleButtonPanLimited, 0, wxALL|wxEXPAND, 5 ); - bSizerRight->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 ); - - - bUpperSizer->Add( bSizerRight, 2, wxEXPAND, 5 ); + bUpperSizer->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 ); bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); @@ -92,7 +74,6 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( this->SetSizer( bSizerMain ); this->Layout(); - bSizerMain->Fit( this ); // Connect Events m_IsMiddleButtonPan->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this ); diff --git a/cvpcb/dialogs/dialog_display_options_base.fbp b/cvpcb/dialogs/dialog_display_options_base.fbp index 5247c0a142..3e08bd0da7 100644 --- a/cvpcb/dialogs/dialog_display_options_base.fbp +++ b/cvpcb/dialogs/dialog_display_options_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 0 0 @@ -42,7 +44,7 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE - -1,-1 + 425,206 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Display Options @@ -102,18 +104,21 @@ none 5 - wxEXPAND + wxEXPAND|wxALL 1 - + + wxID_ANY + Draw options - bSizerLeft + sbSizerDrawMode wxVERTICAL none + 5 - wxALL|wxEXPAND - 1 - + wxALL + 0 + 1 1 1 @@ -127,7 +132,7 @@ 1 0 - "Line" "Filled" "Sketch" + 0 1 1 @@ -141,9 +146,8 @@ 0 0 - ID_EDGE_SELECT - Edges - 1 + wxID_ANY + Graphic items sketch mode 0 @@ -159,10 +163,9 @@ 1 Resizable - 0 1 - wxRA_SPECIFY_COLS + 0 @@ -174,6 +177,7 @@ + @@ -190,7 +194,6 @@ - @@ -201,9 +204,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 0 + 1 1 1 @@ -217,7 +220,7 @@ 1 0 - "Line" "Filled" "Sketch" + 0 1 1 @@ -231,9 +234,8 @@ 0 0 - ID_TEXT_SELECT - Text - 1 + wxID_ANY + Texts sketch mode 0 @@ -249,10 +251,9 @@ 1 Resizable - 0 1 - wxRA_SPECIFY_COLS + 0 @@ -264,6 +265,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_PADFILL_OPT + Pad sketch mode + + 0 + + + 0 + + 1 + m_ShowPadSketch + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pad &number + + 0 + + + 0 + + 1 + m_ShowPadNum + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + @@ -280,7 +458,6 @@ - @@ -293,479 +470,278 @@ 5 - wxEXPAND - 2 - + wxALL|wxEXPAND + 1 + + wxID_ANY + Pan and Zoom - bSizerRight + sbSizerViewOpt wxVERTICAL none + 5 wxEXPAND|wxALL - 1 - + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 wxID_ANY - Pads + Do not center and warp cusor on zoom + + 0 + + + 0 - sbSizerPads - wxVERTICAL - none + 1 + m_IsZoomNoCenter + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Keep the cursor at its current location when zooming + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use middle mouse button to pan + + 0 + + + 0 + + 1 + m_IsMiddleButtonPan + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnMiddleBtnPanEnbl + + + + + + + + + + + + + + + + + + + + + - - 5 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_PADFILL_OPT - Fill &pad - - 0 - - - 0 - - 1 - m_IsShowPadFill - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show pad &number - - 0 - - - 0 - - 1 - m_IsShowPadNum - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxALL|wxEXPAND - 1 - + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 wxID_ANY - Pan and Zoom + Limit panning to scroll size + + 0 + + + 0 - sbSizerViewOpt - wxVERTICAL - none + 1 + m_IsMiddleButtonPanLimited + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + - - 5 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Do not center and warp cusor on zoom - - 0 - - - 0 - - 1 - m_IsZoomNoCenter - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Keep the cursor at its current location when zooming - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Use middle mouse button to pan - - 0 - - - 0 - - 1 - m_IsMiddleButtonPan - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnMiddleBtnPanEnbl - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Limit panning to scroll size - - 0 - - - 0 - - 1 - m_IsMiddleButtonPanLimited - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvpcb/dialogs/dialog_display_options_base.h b/cvpcb/dialogs/dialog_display_options_base.h index cfcf9da349..febdd1f8ef 100644 --- a/cvpcb/dialogs/dialog_display_options_base.h +++ b/cvpcb/dialogs/dialog_display_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -15,13 +15,12 @@ class DIALOG_SHIM; #include "dialog_shim.h" #include -#include +#include #include #include #include #include #include -#include #include #include #include @@ -29,9 +28,7 @@ class DIALOG_SHIM; /////////////////////////////////////////////////////////////////////////// -#define ID_EDGE_SELECT 1000 -#define ID_TEXT_SELECT 1001 -#define ID_PADFILL_OPT 1002 +#define ID_PADFILL_OPT 1000 /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE @@ -41,10 +38,10 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM private: protected: - wxRadioBox* m_EdgesDisplayOption; - wxRadioBox* m_TextDisplayOption; - wxCheckBox* m_IsShowPadFill; - wxCheckBox* m_IsShowPadNum; + wxCheckBox* m_EdgesDisplayOption; + wxCheckBox* m_TextDisplayOption; + wxCheckBox* m_ShowPadSketch; + wxCheckBox* m_ShowPadNum; wxCheckBox* m_IsZoomNoCenter; wxCheckBox* m_IsMiddleButtonPan; wxCheckBox* m_IsMiddleButtonPanLimited; @@ -63,7 +60,7 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM public: - DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 425,206 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(); }; diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index e834516693..bb3f9148c8 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -61,6 +61,9 @@ int LIB_PART::m_subpartIdSeparator = 0; int LIB_PART::m_subpartFirstId = 'A'; +const wxChar traceSchLibMem[] = wxT( "KISCHLIBMEM" ); // public + + LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ): EDA_ITEM( LIB_ALIAS_T ), shared( aRootPart ) @@ -85,10 +88,10 @@ LIB_ALIAS::~LIB_ALIAS() { wxASSERT_MSG( shared, wxT( "~LIB_ALIAS() without a LIB_PART" ) ); -#if defined(DEBUG) && 1 - printf( "%s: destroying alias:'%s' of part:'%s' alias count:%d.\n", - __func__, TO_UTF8( name ), TO_UTF8( shared->GetName() ), int( shared->m_aliases.size() ) ); -#endif + wxLogTrace( traceSchLibMem, + wxT( "%s: destroying alias:'%s' of part:'%s'." ), + GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( name ), + GetChars( shared->GetName() ) ); if( shared ) shared->RemoveAlias( this ); @@ -241,9 +244,10 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) : LIB_PART::~LIB_PART() { - wxLogDebug( wxT( "%s: destroying part '%s' with alias list count of %d\n" ), + wxLogTrace( traceSchLibMem, + wxT( "%s: destroying part '%s' with alias list count of %u." ), GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( GetName() ), - int( m_aliases.size() ) ); + m_aliases.size() ); // If the part is being deleted directly rather than through the library, // delete all of the aliases. @@ -481,7 +485,7 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD { wxASSERT( aItem != NULL ); - // none of the MANDATOR_FIELDS may be removed in RAM, but they may be + // none of the MANDATORY_FIELDS may be removed in RAM, but they may be // omitted when saving to disk. if( aItem->Type() == LIB_FIELD_T ) { @@ -1692,10 +1696,13 @@ LIB_ALIAS* LIB_PART::RemoveAlias( LIB_ALIAS* aAlias ) { bool rename = aAlias->IsRoot(); - DBG( printf( "%s: part:'%s' alias:'%s'\n", __func__, - TO_UTF8( m_name ), - TO_UTF8( aAlias->GetName() ) - );) + wxLogTrace( traceSchLibMem, + wxT( "%s: part:'%s', alias:'%s', alias count %u, reference count %d." ), + GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), + GetChars( m_name ), + GetChars( aAlias->GetName() ), + m_aliases.size(), + m_me.use_count() ); it = m_aliases.erase( it ); diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 21374863df..7c6d086bbf 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2008-2015 Wayne Stambaugh + * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,6 +34,7 @@ #include #include #include +#include class LINE_READER; class OUTPUTFORMATTER; @@ -69,6 +70,10 @@ enum LibrEntryOptions }; +/// WXTRACE value to enable schematic library memory deletion debug output. +extern const wxChar traceSchLibMem[]; + + /** * Part library alias object definition. * @@ -153,7 +158,7 @@ public: /** * Function SaveDocs - * rrite the entry document information to \a aFormatter in "*.dcm" format. + * write the entry document information to \a aFormatter in "*.dcm" format. * * @param aFormatter The #OUTPUTFORMATTER to write the alias documents to. * @return True if success writing else false. diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 66d57bade5..93f9a91ce0 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2008-2015 Wayne Stambaugh + * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -73,6 +73,22 @@ PART_LIB::PART_LIB( int aType, const wxString& aFileName ) : PART_LIB::~PART_LIB() { + // When the library is destroyed, all of the alias objects on the heap should be deleted. + for( LIB_ALIAS_MAP::iterator it = m_amap.begin(); it != m_amap.end(); ++it ) + { + wxLogTrace( traceSchLibMem, wxT( "Removing alias %s from library %s." ), + GetChars( it->second->GetName() ), GetChars( GetLogicalName() ) ); + LIB_PART* part = it->second->GetPart(); + LIB_ALIAS* alias = it->second; + delete alias; + + // When the last alias of a part is destroyed, the part is no longer required and it + // too is destroyed. + if( part && part->GetAliasCount() == 0 ) + delete part; + } + + m_amap.clear(); } diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index de6b092356..2b85ddf8be 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -107,6 +107,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg() { m_ButtonDeleteAllFootprintFilter->Enable( false ); m_ButtonDeleteOneFootprintFilter->Enable( false ); + m_buttonEditOneFootprintFilter->Enable( false ); } m_NoteBook->SetSelection( m_lastOpenedPage ); @@ -486,6 +487,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& m_FootprintFilterListBox->Clear(); m_ButtonDeleteAllFootprintFilter->Enable( false ); m_ButtonDeleteOneFootprintFilter->Enable( false ); + m_buttonEditOneFootprintFilter->Enable( false ); } } @@ -526,6 +528,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& event m_FootprintFilterListBox->Append( Line ); m_ButtonDeleteAllFootprintFilter->Enable( true ); m_ButtonDeleteOneFootprintFilter->Enable( true ); + m_buttonEditOneFootprintFilter->Enable( true ); } @@ -540,5 +543,28 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& { m_ButtonDeleteAllFootprintFilter->Enable( false ); m_ButtonDeleteOneFootprintFilter->Enable( false ); + m_buttonEditOneFootprintFilter->Enable( false ); } } + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::EditOneFootprintFilter( wxCommandEvent& event ) +{ + int idx = m_FootprintFilterListBox->GetSelection(); + + if( idx < 0 ) + return; + + wxString filter = m_FootprintFilterListBox->GetStringSelection(); + + wxTextEntryDialog dlg( this, wxEmptyString, _( "Edit footprint filter" ), filter ); + + if( dlg.ShowModal() != wxID_OK ) + return; // Aborted by user + + filter = dlg.GetValue(); + + if( filter.IsEmpty() ) + return; // do not accept blank filter. + + m_FootprintFilterListBox->SetString( idx, filter ); +} diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.h b/eeschema/dialogs/dialog_edit_component_in_lib.h index c343cf1cc2..b0672abd67 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.h +++ b/eeschema/dialogs/dialog_edit_component_in_lib.h @@ -63,7 +63,7 @@ private: void DeleteAllFootprintFilter(wxCommandEvent& event); void DeleteOneFootprintFilter(wxCommandEvent& event); void AddFootprintFilter(wxCommandEvent& event); - + void EditOneFootprintFilter( wxCommandEvent& event ); }; #endif diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp index 8aa344869f..57f59d6d75 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -225,6 +225,9 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx m_buttonAddFpF = new wxButton( m_PanelFootprintFilter, ID_ADD_FOOTPRINT_FILTER, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); bFpFilterRightBoxSizer->Add( m_buttonAddFpF, 0, wxALL|wxEXPAND, 5 ); + m_buttonEditOneFootprintFilter = new wxButton( m_PanelFootprintFilter, wxID_ANY, _("Edit"), wxDefaultPosition, wxDefaultSize, 0 ); + bFpFilterRightBoxSizer->Add( m_buttonEditOneFootprintFilter, 0, wxALL|wxEXPAND, 5 ); + m_ButtonDeleteOneFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ONE_FOOTPRINT_FILTER, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); bFpFilterRightBoxSizer->Add( m_ButtonDeleteOneFootprintFilter, 0, wxALL|wxEXPAND, 5 ); @@ -266,6 +269,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx m_ButtonDeleteOneAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this ); m_ButtonDeleteAllAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this ); m_buttonAddFpF->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this ); + m_buttonEditOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditOneFootprintFilter ), NULL, this ); m_ButtonDeleteOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this ); m_ButtonDeleteAllFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this ); m_stdSizerButtonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this ); @@ -281,6 +285,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE() m_ButtonDeleteOneAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this ); m_ButtonDeleteAllAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this ); m_buttonAddFpF->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this ); + m_buttonEditOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditOneFootprintFilter ), NULL, this ); m_ButtonDeleteOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this ); m_ButtonDeleteAllFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this ); m_stdSizerButtonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this ); diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp index f112d8a2c8..925397157a 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -899,6 +899,7 @@ + @@ -1080,6 +1081,7 @@ + @@ -3047,6 +3049,94 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Edit + + 0 + + + 0 + + 1 + m_buttonEditOneFootprintFilter + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + EditOneFootprintFilter + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL|wxEXPAND diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.h b/eeschema/dialogs/dialog_edit_component_in_lib_base.h index 0624bf8520..2dc78d7912 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.h +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -88,6 +88,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM wxStaticText* m_staticTextFootprints; wxListBox* m_FootprintFilterListBox; wxButton* m_buttonAddFpF; + wxButton* m_buttonEditOneFootprintFilter; wxButton* m_ButtonDeleteOneFootprintFilter; wxButton* m_ButtonDeleteAllFootprintFilter; wxStdDialogButtonSizer* m_stdSizerButton; @@ -101,6 +102,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM virtual void DeleteAliasOfPart( wxCommandEvent& event ) { event.Skip(); } virtual void DeleteAllAliasOfPart( wxCommandEvent& event ) { event.Skip(); } virtual void AddFootprintFilter( wxCommandEvent& event ) { event.Skip(); } + virtual void EditOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); } virtual void DeleteOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); } virtual void DeleteAllFootprintFilter( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/include/eda_text.h b/include/eda_text.h index 97a8f77738..cd14c46307 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -52,11 +52,10 @@ enum EDA_TEXT_VJUSTIFY_T { }; -/* Options to show solid segments (segments, texts...) */ +/* Options to draw items with thickness ( segments, arcs, circles, texts...) */ enum EDA_DRAW_MODE_T { - LINE = 0, // segments are drawn as lines - FILLED, // normal mode: segments have thickness - SKETCH // sketch mode: segments have thickness, but are not filled + FILLED = true, // normal mode: solid segments + SKETCH = false // sketch mode: draw segments outlines only }; @@ -199,12 +198,12 @@ public: * @param aOffset = draw offset (usually (0,0)) * @param aColor = text color * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. - * @param aDisplay_mode = LINE, FILLED or SKETCH + * @param aDisplay_mode = FILLED or SKETCH * @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). */ void Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, EDA_COLOR_T aColor, - GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = LINE, + GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = FILLED, EDA_COLOR_T aAnchor_color = EDA_COLOR_T(UNSPECIFIED_COLOR) ); /** @@ -318,7 +317,7 @@ private: * @param aOffset = draw offset (usually (0,0)) * @param aColor = text color * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. - * @param aFillMode = LINE, FILLED or SKETCH + * @param aFillMode = FILLED or SKETCH * @param aText = the single line of text to draw. * @param aPos = the position of this line ). */ diff --git a/include/pcbstruct.h b/include/pcbstruct.h index d55e6f802b..4920709c3a 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -75,8 +75,8 @@ public: bool m_DisplayViaFill; bool m_DisplayPadNum; // show pads numbers bool m_DisplayPadIsol; - int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch) - int m_DisplayModText; // How to display module texts (line/ filled / sketch) + bool m_DisplayModEdgeFill; // How to display module drawings ( sketch/ filled ) + bool m_DisplayModTextFill; // How to display module texts ( sketch/ filled ) bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled. /// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T. @@ -94,7 +94,7 @@ public: * 3 show netnames on tracks and pads */ - int m_DisplayDrawItems; + bool m_DisplayDrawItemsFill; // How to display graphic items on board ( sketch/ filled ) bool m_ContrastModeDisplay; int m_MaxLinksShowed; // in track creation: number of hairwires shown bool m_Show_Module_Ratsnest; // When moving a footprint: allows displaying a ratsnest diff --git a/include/pgm_base.h b/include/pgm_base.h index 8b151996de..be340e7406 100644 --- a/include/pgm_base.h +++ b/include/pgm_base.h @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2008-2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,6 +31,7 @@ #ifndef PGM_BASE_H_ #define PGM_BASE_H_ +#include #include #include #include @@ -109,7 +110,7 @@ public: /** * Function UseSystemPdfBrowser * returns true if the PDF browser is the default (system) PDF browser - * and false if the PDF browser is the prefered (selected) browser, else + * and false if the PDF browser is the preferred (selected) browser, else * returns false if there is no selected browser */ VTBL_ENTRY bool UseSystemPdfBrowser() const @@ -119,7 +120,7 @@ public: /** * Function ForceSystemPdfBrowser - * forces the use of system PDF browser, even if a preferend PDF browser is set. + * forces the use of system PDF browser, even if a preferred PDF browser is set. */ VTBL_ENTRY void ForceSystemPdfBrowser( bool aFlg ) { m_use_system_pdf_browser = aFlg; } @@ -168,6 +169,22 @@ public: */ VTBL_ENTRY void WritePdfBrowserInfos(); + /** + * Function SetLocalEnvVariable + * + * Sets the environment variable \a aName to \a aValue. + * + * This function first checks to see if the environment variable \a aName is already + * defined. If it is not defined, then the environment variable \a aName is set to + * a value. Otherwise, the environment variable is left unchanged. This allows the user + * to override environment variables for testing purposes. + * + * @param aName is a wxString containing the environment variable name. + * @param aValue is a wxString containing the environment variable value. + * @return true if the environment variable \a Name was set to \a aValue. + */ + VTBL_ENTRY bool SetLocalEnvVariable( const wxString& aName, const wxString& aValue ); + /** * Function App * returns a bare naked wxApp, which may come from wxPython, SINGLE_TOP, or kicad.exe. @@ -247,6 +264,10 @@ protected: wxString m_editor_name; wxSize m_help_size; + /// Local environment variable expansion settings such as KIGITHUB, KISYSMOD, and KISYS3DMOD. + /// library table. + std::map m_local_env_vars; + wxApp* m_wx_app; // The PGM_* classes can have difficulties at termination if they diff --git a/include/validators.h b/include/validators.h index 52eb377a5f..d5b3c47552 100644 --- a/include/validators.h +++ b/include/validators.h @@ -27,6 +27,9 @@ * @brief Custom text control validator definitions. */ +#ifndef VALIDATORS_H +#define VALIDATORS_H + #include /** @@ -56,3 +59,5 @@ class FILE_NAME_WITH_PATH_CHAR_VALIDATOR : public wxTextValidator public: FILE_NAME_WITH_PATH_CHAR_VALIDATOR( wxString* aValue = NULL ); }; + +#endif // #ifndef VALIDATORS_H diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 5b55acc974..909b7961ce 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -367,9 +367,6 @@ public: * to define a configuration setting that needs to be loaded at run time, * this is the place to define it. * - * @todo: Define the configuration variables as member variables instead of - * global variables or move them to the object class where they are - * used. * @return - Reference to the list of applications settings. */ PARAM_CFG_ARRAY& GetConfigurationSettings(); diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index c52463846b..6f076ae8a9 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -753,20 +753,14 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true ); aCfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true ); aCfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true ); - aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdge, ( long )FILLED ); + aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true ); aCfg->Read( m_FrameName + FastGrid1Entry, &itmp, ( long )0); m_FastGrid1 = itmp; aCfg->Read( m_FrameName + FastGrid2Entry, &itmp, ( long )0); m_FastGrid2 = itmp; - if( m_DisplayOptions.m_DisplayModEdge < LINE || m_DisplayOptions.m_DisplayModEdge > SKETCH ) - m_DisplayOptions.m_DisplayModEdge = FILLED; - - aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModText, ( long )FILLED ); - - if( m_DisplayOptions.m_DisplayModText < LINE || m_DisplayOptions.m_DisplayModText > SKETCH ) - m_DisplayOptions.m_DisplayModText = FILLED; + aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true ); } @@ -780,8 +774,8 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg ) aCfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill ); aCfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill ); aCfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum ); - aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayOptions.m_DisplayModEdge ); - aCfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayOptions.m_DisplayModText ); + aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill ); + aCfg->Write( m_FrameName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill ); aCfg->Write( m_FrameName + FastGrid1Entry, ( long )m_FastGrid1 ); aCfg->Write( m_FrameName + FastGrid2Entry, ( long )m_FastGrid2 ); } diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index af6f420f76..cda4b71afd 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -334,7 +334,6 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, const wxPoint& offset ) { - int typeaff, width; EDA_COLOR_T gcolor; BOARD* brd = GetBoard(); @@ -347,18 +346,11 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, GRSetDrawMode( DC, mode_color ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); - typeaff = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED; - width = m_Width; + bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED; + int width = m_Width; - if( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) - typeaff = LINE; - - switch( typeaff ) + if( filled ) { - case LINE: - width = 0; - - case FILLED: GRLine( panel->GetClipBox(), DC, m_crossBarO + offset, m_crossBarF + offset, width, gcolor ); GRLine( panel->GetClipBox(), DC, m_featureLineGO + offset, @@ -373,9 +365,9 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, m_arrowG1F + offset, width, gcolor ); GRLine( panel->GetClipBox(), DC, m_crossBarO + offset, m_arrowG2F + offset, width, gcolor ); - break; - - case SKETCH: + } + else + { GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset, m_crossBarF + offset, width, gcolor ); GRCSegm( panel->GetClipBox(), DC, m_featureLineGO + offset, @@ -390,7 +382,6 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, m_arrowG1F + offset, width, gcolor ); GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset, m_arrowG2F + offset, width, gcolor ); - break; } } diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index e19f2792ea..2ff4342e29 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -170,7 +170,6 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, { int ux0, uy0, dx, dy; int l_trace; - int mode; int radius; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; @@ -202,31 +201,24 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, dx = m_End.x + aOffset.x; dy = m_End.y + aOffset.y; - mode = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED; + bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED; if( m_Flags & FORCE_SKETCH ) - mode = SKETCH; - - if( DC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH ) - mode = LINE; + filled = SKETCH; switch( m_Shape ) { case S_CIRCLE: radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); - if( mode == LINE ) + if( filled ) { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, color ); - } - else if( mode == SKETCH ) - { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - l_trace, color ); - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + l_trace, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); } else { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - l_trace, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + l_trace, color ); } break; @@ -248,22 +240,19 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, EXCHG( StAngle, EndAngle ); } - if( mode == LINE ) + if( filled ) { - GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, + radius, m_Width, color ); } - else if( mode == SKETCH ) + else { GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius - l_trace, color ); GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius + l_trace, color ); } - else - { - GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, - radius, m_Width, color ); - } + break; case S_CURVE: @@ -271,43 +260,32 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, for( unsigned int i=1; i < m_BezierPoints.size(); i++ ) { - if( mode == LINE ) - { - GRLine( panel->GetClipBox(), DC, - m_BezierPoints[i].x, m_BezierPoints[i].y, - m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0, - color ); - } - else if( mode == SKETCH ) - { - GRCSegm( panel->GetClipBox(), DC, - m_BezierPoints[i].x, m_BezierPoints[i].y, - m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, - m_Width, color ); - } - else + if( filled ) { GRFillCSegm( panel->GetClipBox(), DC, m_BezierPoints[i].x, m_BezierPoints[i].y, m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, m_Width, color ); } + else + { + GRCSegm( panel->GetClipBox(), DC, + m_BezierPoints[i].x, m_BezierPoints[i].y, + m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, + m_Width, color ); + } } break; default: - if( mode == LINE ) + if( filled ) { - GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, 0, color ); - } - else if( mode == SKETCH ) - { - GRCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); + GRFillCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); } else { - GRFillCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); + GRCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); } break; diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 018ea36653..cb4aedc191 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -130,7 +130,6 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& offset ) { int ux0, uy0, dx, dy, radius, StAngle, EndAngle; - int typeaff; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; MODULE* module = (MODULE*) m_Parent; @@ -159,25 +158,15 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, dy = m_End.y - offset.y; GRSetDrawMode( DC, draw_mode ); - typeaff = displ_opts ? displ_opts->m_DisplayModEdge : FILLED; + bool filled = displ_opts ? displ_opts->m_DisplayModEdgeFill : FILLED; if( IsCopperLayer( m_Layer ) ) - { - typeaff = displ_opts ? displ_opts->m_DisplayPcbTrackFill : FILLED; - - if( !typeaff ) - typeaff = SKETCH; - } - - if( DC->LogicalToDeviceXRel( m_Width ) <= MIN_DRAW_WIDTH ) - typeaff = LINE; + filled = displ_opts ? displ_opts->m_DisplayPcbTrackFill : FILLED; switch( m_Shape ) { case S_SEGMENT: - if( typeaff == LINE ) - GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, 0, color ); - else if( typeaff == FILLED ) + if( filled ) GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); else // SKETCH Mode @@ -188,21 +177,14 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, case S_CIRCLE: radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); - if( typeaff == LINE ) + if( filled ) { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); } - else + else // SKETCH Mode { - if( typeaff == FILLED ) - { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); - } - else // SKETCH Mode - { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + (m_Width / 2), color ); - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - (m_Width / 2), color ); - } + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + (m_Width / 2), color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - (m_Width / 2), color ); } break; @@ -223,11 +205,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, EXCHG( StAngle, EndAngle ); } - if( typeaff == LINE ) - { - GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); - } - else if( typeaff == FILLED ) + if( filled ) { GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color ); } diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 8e63f5f275..6c1c2921a7 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -89,7 +89,6 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, { int radius, ox, oy, width; int dx1, dx2, dy1, dy2; - int typeaff; ox = m_Pos.x + offset.x; oy = m_Pos.y + offset.y; @@ -103,29 +102,20 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, GRSetDrawMode( DC, mode_color ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); - typeaff = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED; + bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED; width = m_Width; - if( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) - typeaff = LINE; - radius = m_Size / 3; + if( GetShape() ) // shape X radius = m_Size / 2; - switch( typeaff ) - { - case LINE: - width = 0; - - case FILLED: + if( filled ) GRCircle( panel->GetClipBox(), DC, ox, oy, radius, width, gcolor ); - break; - - case SKETCH: + else + { GRCircle( panel->GetClipBox(), DC, ox, oy, radius + (width / 2), gcolor ); GRCircle( panel->GetClipBox(), DC, ox, oy, radius - (width / 2), gcolor ); - break; } @@ -142,18 +132,15 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, dy2 = -dy1; } - switch( typeaff ) + if( filled ) { - case LINE: - case FILLED: GRLine( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor ); GRLine( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor ); - break; - - case SKETCH: + } + else + { GRCSegm( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor ); GRCSegm( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor ); - break; } } diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index bedc597e55..12c86fa565 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -93,7 +93,7 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, EDA_DRAW_MODE_T fillmode = FILLED; DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); - if( displ_opts && displ_opts->m_DisplayDrawItems == SKETCH ) + if( displ_opts && displ_opts->m_DisplayDrawItemsFill == SKETCH ) fillmode = SKETCH; EDA_COLOR_T anchor_color = UNSPECIFIED_COLOR; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 91fad64a4f..c698aba4b5 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -268,6 +268,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, * hiding. * If the whole module side is disabled this isn't even called */ LAYER_ID text_layer = GetLayer(); + if( (IsFrontLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE )) || (IsBackLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE )) ) return; @@ -289,10 +290,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, // Draw mode compensation for the width DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); int width = m_Thickness; - if( ( displ_opts && displ_opts->m_DisplayModText == LINE ) - || ( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) ) - width = 0; - else if( displ_opts && displ_opts->m_DisplayModText == SKETCH ) + + if( displ_opts && displ_opts->m_DisplayModTextFill == SKETCH ) width = -width; GRSetDrawMode( DC, draw_mode ); diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index a1430fc600..da1127dc61 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -202,16 +202,16 @@ int PCB_SCREEN::MilsToIuScalar() DISPLAY_OPTIONS::DISPLAY_OPTIONS() { - m_DisplayPadFill = FILLED; - m_DisplayViaFill = FILLED; + m_DisplayPadFill = FILLED; + m_DisplayViaFill = FILLED; m_DisplayPadNum = true; m_DisplayPadIsol = true; - m_DisplayModEdge = true; - m_DisplayModText = true; - m_DisplayPcbTrackFill = true; // false = sketch , true = filled + m_DisplayModEdgeFill = FILLED; + m_DisplayModTextFill = FILLED; + m_DisplayPcbTrackFill = FILLED; // false = sketch , true = filled m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS; - m_DisplayViaMode = VIA_HOLE_NOT_SHOW; + m_DisplayViaMode = VIA_HOLE_NOT_SHOW; m_DisplayPolarCood = false; /* false = display absolute coordinates, * true = display polar cordinates */ @@ -222,7 +222,7 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS() * 1 show netnames on pads * 2 show netnames on tracks * 3 show netnames on tracks and pads */ - m_DisplayDrawItems = true; + m_DisplayDrawItemsFill = FILLED; m_ContrastModeDisplay = false; m_MaxLinksShowed = 3; // in track creation: number of hairwires shown m_Show_Module_Ratsnest = true; // When moving a footprint: allows displaying a ratsnest diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index b07936d61e..25ff081b6c 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -294,6 +294,7 @@ const ZONE_CONTAINER* TRACKS_CLEANER::zoneForTrackEndpoint( const TRACK *aTrack, top_layer = aTrack->GetLayer(); bottom_layer = top_layer; } + return m_Brd->HitTestForAnyFilledArea( aTrack->GetEndPoint( aEndPoint ), top_layer, bottom_layer, aTrack->GetNetCode() ); } @@ -305,8 +306,8 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK *aTrack, ENDPOINT_T aEndPo bool flag_erase = false; TRACK* other = aTrack->GetTrack( m_Brd->m_Track, NULL, aEndPoint, true, false ); - if( (other == NULL) && - (zoneForTrackEndpoint( aTrack, aEndPoint ) == NULL) ) + + if( (other == NULL) && (zoneForTrackEndpoint( aTrack, aEndPoint ) == NULL) ) flag_erase = true; // Start endpoint is neither on pad, zone or other track else // segment, via or zone connected to this end { @@ -336,6 +337,7 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK *aTrack, ENDPOINT_T aEndPo aTrack->SetState( BUSY, false ); } } + return flag_erase; } diff --git a/pcbnew/dialogs/dialog_design_rules_base.cpp b/pcbnew/dialogs/dialog_design_rules_base.cpp index 67ed0a5180..a0a7f61816 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.cpp +++ b/pcbnew/dialogs/dialog_design_rules_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -54,8 +54,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // Rows - m_grid->AutoSizeRows(); - m_grid->EnableDragRowSize( true ); + m_grid->EnableDragRowSize( false ); m_grid->SetRowLabelSize( 120 ); m_grid->SetRowLabelValue( 0, _("Default") ); m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); @@ -65,6 +64,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID // Cell Defaults m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); m_grid->SetToolTip( _("Net Class parameters") ); + m_grid->SetMinSize( wxSize( -1,150 ) ); sbSizerUpper->Add( m_grid, 1, wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_design_rules_base.fbp b/pcbnew/dialogs/dialog_design_rules_base.fbp index e36c17226b..69b2143f6c 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.fbp +++ b/pcbnew/dialogs/dialog_design_rules_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -284,7 +284,7 @@ 0 - 1 + 0 @@ -311,7 +311,7 @@ 0 1 0 - 1 + 0 1 1 @@ -332,7 +332,7 @@ 0 - -1,-1 + -1,150 1 m_grid 1 diff --git a/pcbnew/dialogs/dialog_design_rules_base.h b/pcbnew/dialogs/dialog_design_rules_base.h index d553d4844d..d9565ba41b 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.h +++ b/pcbnew/dialogs/dialog_design_rules_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! diff --git a/pcbnew/dialogs/dialog_display_options.cpp b/pcbnew/dialogs/dialog_display_options.cpp index a452bc5747..283be865c9 100644 --- a/pcbnew/dialogs/dialog_display_options.cpp +++ b/pcbnew/dialogs/dialog_display_options.cpp @@ -5,8 +5,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -61,7 +61,7 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) : init(); - m_buttonOK->SetDefault(); + m_sdbSizerOK->SetDefault(); GetSizer()->SetSizeHints( this ); } @@ -70,10 +70,7 @@ void DIALOG_DISPLAY_OPTIONS::init() SetFocus(); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); - if ( displ_opts->m_DisplayPcbTrackFill ) - m_OptDisplayTracks->SetSelection( 1 ); - else - m_OptDisplayTracks->SetSelection( 0 ); + m_OptDisplayTracks->SetValue( displ_opts->m_DisplayPcbTrackFill == SKETCH ); switch ( displ_opts->m_ShowTrackClearanceMode ) { @@ -99,25 +96,18 @@ void DIALOG_DISPLAY_OPTIONS::init() break; } - if ( displ_opts->m_DisplayPadFill ) - m_OptDisplayPads->SetSelection( 1 ); - else - m_OptDisplayPads->SetSelection( 0 ); + m_OptDisplayPads->SetValue( displ_opts->m_DisplayPadFill == SKETCH ); + m_OptDisplayVias->SetValue( displ_opts->m_DisplayViaFill == SKETCH ); - if ( displ_opts->m_DisplayViaFill ) - m_OptDisplayVias->SetSelection( 1 ); - else - m_OptDisplayVias->SetSelection( 0 ); - - m_Show_Page_Limits->SetSelection( m_Parent->ShowPageLimits() ? 0 : 1 ); + m_Show_Page_Limits->SetValue( m_Parent->ShowPageLimits() ); m_OptDisplayViaHole->SetSelection( displ_opts->m_DisplayViaMode ); - m_OptDisplayModTexts->SetSelection( displ_opts->m_DisplayModText ); - m_OptDisplayModEdges->SetSelection( displ_opts->m_DisplayModEdge ); + m_OptDisplayModTexts->SetValue( displ_opts->m_DisplayModTextFill == SKETCH ); + m_OptDisplayModOutlines->SetValue( displ_opts->m_DisplayModEdgeFill == SKETCH ); m_OptDisplayPadClearence->SetValue( displ_opts->m_DisplayPadIsol ); m_OptDisplayPadNumber->SetValue( displ_opts->m_DisplayPadNum ); m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ) ); - m_OptDisplayDrawings->SetSelection( displ_opts->m_DisplayDrawItems ); + m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH ); m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode ); } @@ -134,12 +124,9 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event) { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); - if ( m_Show_Page_Limits->GetSelection() == 0 ) - m_Parent->SetShowPageLimits( true ); - else - m_Parent->SetShowPageLimits( false ); + m_Parent->SetShowPageLimits( m_Show_Page_Limits->GetValue() ); - displ_opts->m_DisplayPcbTrackFill = m_OptDisplayTracks->GetSelection() == 1; + displ_opts->m_DisplayPcbTrackFill = not m_OptDisplayTracks->GetValue(); displ_opts->m_DisplayViaMode = (VIA_DISPLAY_MODE_T) m_OptDisplayViaHole->GetSelection(); @@ -166,11 +153,11 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event) break; } - displ_opts->m_DisplayModText = m_OptDisplayModTexts->GetSelection(); - displ_opts->m_DisplayModEdge = m_OptDisplayModEdges->GetSelection(); + displ_opts->m_DisplayModTextFill = not m_OptDisplayModTexts->GetValue(); + displ_opts->m_DisplayModEdgeFill = not m_OptDisplayModOutlines->GetValue(); - displ_opts->m_DisplayPadFill = m_OptDisplayPads->GetSelection() == 1; - displ_opts->m_DisplayViaFill = m_OptDisplayVias->GetSelection() == 1; + displ_opts->m_DisplayPadFill = not m_OptDisplayPads->GetValue(); + displ_opts->m_DisplayViaFill = not m_OptDisplayVias->GetValue(); displ_opts->m_DisplayPadIsol = m_OptDisplayPadClearence->GetValue(); @@ -179,7 +166,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event) m_Parent->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE), m_OptDisplayPadNoConn->GetValue() ); - displ_opts->m_DisplayDrawItems = m_OptDisplayDrawings->GetSelection(); + displ_opts->m_DisplayDrawItemsFill = not m_OptDisplayDrawings->GetValue(); displ_opts->m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection(); // Apply changes to the GAL diff --git a/pcbnew/dialogs/dialog_display_options_base.cpp b/pcbnew/dialogs/dialog_display_options_base.cpp index bd26aff8f9..5e30109330 100644 --- a/pcbnew/dialogs/dialog_display_options_base.cpp +++ b/pcbnew/dialogs/dialog_display_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -14,24 +14,19 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxHORIZONTAL ); + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bupperSizer; + bupperSizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticBoxSizer* sLeftBoxSizer; sLeftBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks and vias:") ), wxVERTICAL ); - wxString m_OptDisplayTracksChoices[] = { _("Sketch"), _("Filled") }; - int m_OptDisplayTracksNChoices = sizeof( m_OptDisplayTracksChoices ) / sizeof( wxString ); - m_OptDisplayTracks = new wxRadioBox( this, wxID_DISPLAY_TRACK, _("Tracks:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayTracksNChoices, m_OptDisplayTracksChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayTracks->SetSelection( 1 ); - m_OptDisplayTracks->SetToolTip( _("Select how tracks are displayed") ); + m_OptDisplayTracks = new wxCheckBox( this, wxID_ANY, _("Tracks sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sLeftBoxSizer->Add( m_OptDisplayTracks, 0, wxALL, 5 ); - sLeftBoxSizer->Add( m_OptDisplayTracks, 0, wxALL|wxEXPAND, 5 ); - - wxString m_OptDisplayViasChoices[] = { _("Sketch"), _("Filled") }; - int m_OptDisplayViasNChoices = sizeof( m_OptDisplayViasChoices ) / sizeof( wxString ); - m_OptDisplayVias = new wxRadioBox( this, ID_VIAS_SHAPES, _("Via Shapes:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayViasNChoices, m_OptDisplayViasChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayVias->SetSelection( 1 ); - sLeftBoxSizer->Add( m_OptDisplayVias, 0, wxALL|wxEXPAND, 5 ); + m_OptDisplayVias = new wxCheckBox( this, wxID_ANY, _("Vias sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sLeftBoxSizer->Add( m_OptDisplayVias, 0, wxALL, 5 ); wxString m_OptDisplayViaHoleChoices[] = { _("Never"), _("Defined holes"), _("Always") }; int m_OptDisplayViaHoleNChoices = sizeof( m_OptDisplayViaHoleChoices ) / sizeof( wxString ); @@ -39,10 +34,10 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi m_OptDisplayViaHole->SetSelection( 1 ); m_OptDisplayViaHole->SetToolTip( _("Show (or not) via holes.\nIf Defined Holes is selected, only the non default size holes are shown") ); - sLeftBoxSizer->Add( m_OptDisplayViaHole, 0, wxALL|wxEXPAND, 5 ); + sLeftBoxSizer->Add( m_OptDisplayViaHole, 1, wxALL|wxEXPAND, 5 ); - bMainSizer->Add( sLeftBoxSizer, 0, wxEXPAND|wxALL, 5 ); + bupperSizer->Add( sLeftBoxSizer, 0, wxEXPAND|wxALL, 5 ); wxStaticBoxSizer* sbMiddleLeftSizer; sbMiddleLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Routing help:") ), wxVERTICAL ); @@ -53,7 +48,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi m_ShowNetNamesOption->SetSelection( 3 ); m_ShowNetNamesOption->SetToolTip( _("Show or not net names on pads and/or tracks") ); - sbMiddleLeftSizer->Add( m_ShowNetNamesOption, 0, wxALL, 5 ); + sbMiddleLeftSizer->Add( m_ShowNetNamesOption, 1, wxALL|wxEXPAND, 5 ); wxString m_OptDisplayTracksClearanceChoices[] = { _("Never"), _("New track"), _("New track with via area"), _("New and edited tracks with via area"), _("Always") }; int m_OptDisplayTracksClearanceNChoices = sizeof( m_OptDisplayTracksClearanceChoices ) / sizeof( wxString ); @@ -61,104 +56,87 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi m_OptDisplayTracksClearance->SetSelection( 3 ); m_OptDisplayTracksClearance->SetToolTip( _("Show( or not) tracks clearance area.\nIf New track is selected, track clearance area is shown only when creating the track.") ); - sbMiddleLeftSizer->Add( m_OptDisplayTracksClearance, 0, wxALL|wxEXPAND, 5 ); + sbMiddleLeftSizer->Add( m_OptDisplayTracksClearance, 1, wxALL|wxEXPAND, 5 ); - bMainSizer->Add( sbMiddleLeftSizer, 0, wxALL|wxEXPAND, 5 ); + bupperSizer->Add( sbMiddleLeftSizer, 0, wxALL|wxEXPAND, 5 ); - wxStaticBoxSizer* sMiddleRightSizer; - sMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprints:") ), wxHORIZONTAL ); + wxBoxSizer* b_rightSizer; + b_rightSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bLModuleSizer; - bLModuleSizer = new wxBoxSizer( wxVERTICAL ); + wxStaticBoxSizer* sfootprintSizer; + sfootprintSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprints:") ), wxVERTICAL ); - wxString m_OptDisplayModEdgesChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_OptDisplayModEdgesNChoices = sizeof( m_OptDisplayModEdgesChoices ) / sizeof( wxString ); - m_OptDisplayModEdges = new wxRadioBox( this, ID_EDGES_MODULES, _("Footprint Edges:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayModEdgesNChoices, m_OptDisplayModEdgesChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayModEdges->SetSelection( 1 ); - bLModuleSizer->Add( m_OptDisplayModEdges, 0, wxALL|wxEXPAND, 5 ); + m_OptDisplayModOutlines = new wxCheckBox( this, wxID_ANY, _("Outlines sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sfootprintSizer->Add( m_OptDisplayModOutlines, 0, wxALL, 5 ); - wxString m_OptDisplayModTextsChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_OptDisplayModTextsNChoices = sizeof( m_OptDisplayModTextsChoices ) / sizeof( wxString ); - m_OptDisplayModTexts = new wxRadioBox( this, ID_TEXT_MODULES, _("Texts:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayModTextsNChoices, m_OptDisplayModTextsChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayModTexts->SetSelection( 1 ); - bLModuleSizer->Add( m_OptDisplayModTexts, 0, wxALL|wxEXPAND, 5 ); + m_OptDisplayModTexts + = new wxCheckBox( this, wxID_ANY, _("Texts sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sfootprintSizer->Add( m_OptDisplayModTexts + , 0, wxALL, 5 ); - - sMiddleRightSizer->Add( bLModuleSizer, 0, 0, 5 ); - - wxStaticBoxSizer* bRModuleSizer; - bRModuleSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pad Options:") ), wxVERTICAL ); - - wxString m_OptDisplayPadsChoices[] = { _("Sketch"), _("Filled") }; - int m_OptDisplayPadsNChoices = sizeof( m_OptDisplayPadsChoices ) / sizeof( wxString ); - m_OptDisplayPads = new wxRadioBox( this, ID_PADS_SHAPES, _("Pad Shapes:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayPadsNChoices, m_OptDisplayPadsChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayPads->SetSelection( 1 ); - bRModuleSizer->Add( m_OptDisplayPads, 0, wxALL|wxEXPAND, 5 ); + m_OptDisplayPads = new wxCheckBox( this, wxID_ANY, _("Pads sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sfootprintSizer->Add( m_OptDisplayPads, 0, wxALL, 5 ); m_OptDisplayPadClearence = new wxCheckBox( this, wxID_ANY, _("Show pad clearance"), wxDefaultPosition, wxDefaultSize, 0 ); - bRModuleSizer->Add( m_OptDisplayPadClearence, 0, wxALL, 5 ); + sfootprintSizer->Add( m_OptDisplayPadClearence, 0, wxALL, 5 ); m_OptDisplayPadNumber = new wxCheckBox( this, wxID_ANY, _("Show pad number"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptDisplayPadNumber->SetValue(true); - bRModuleSizer->Add( m_OptDisplayPadNumber, 0, wxALL, 5 ); + sfootprintSizer->Add( m_OptDisplayPadNumber, 0, wxALL, 5 ); m_OptDisplayPadNoConn = new wxCheckBox( this, wxID_ANY, _("Show pad NoConnect"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptDisplayPadNoConn->SetValue(true); - bRModuleSizer->Add( m_OptDisplayPadNoConn, 0, wxALL, 5 ); + sfootprintSizer->Add( m_OptDisplayPadNoConn, 0, wxALL, 5 ); - sMiddleRightSizer->Add( bRModuleSizer, 0, 0, 5 ); + b_rightSizer->Add( sfootprintSizer, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* s_otherSizer; + s_otherSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Others:") ), wxVERTICAL ); + + m_OptDisplayDrawings = new wxCheckBox( this, wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + m_OptDisplayDrawings->SetValue(true); + s_otherSizer->Add( m_OptDisplayDrawings, 0, wxALL, 5 ); + + m_Show_Page_Limits = new wxCheckBox( this, wxID_ANY, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Show_Page_Limits->SetValue(true); + s_otherSizer->Add( m_Show_Page_Limits, 0, wxALL, 5 ); - bMainSizer->Add( sMiddleRightSizer, 0, wxEXPAND|wxALL, 5 ); - - wxBoxSizer* bRightSizer; - bRightSizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sRightUpperSizer; - sRightUpperSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Others:") ), wxVERTICAL ); - - wxString m_OptDisplayDrawingsChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_OptDisplayDrawingsNChoices = sizeof( m_OptDisplayDrawingsChoices ) / sizeof( wxString ); - m_OptDisplayDrawings = new wxRadioBox( this, wxID_ANY, _("Display other items:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayDrawingsNChoices, m_OptDisplayDrawingsChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayDrawings->SetSelection( 1 ); - sRightUpperSizer->Add( m_OptDisplayDrawings, 0, wxALL|wxEXPAND, 5 ); - - wxString m_Show_Page_LimitsChoices[] = { _("Yes"), _("No") }; - int m_Show_Page_LimitsNChoices = sizeof( m_Show_Page_LimitsChoices ) / sizeof( wxString ); - m_Show_Page_Limits = new wxRadioBox( this, wxID_ANY, _("Show page limits"), wxDefaultPosition, wxDefaultSize, m_Show_Page_LimitsNChoices, m_Show_Page_LimitsChoices, 1, wxRA_SPECIFY_COLS ); - m_Show_Page_Limits->SetSelection( 1 ); - sRightUpperSizer->Add( m_Show_Page_Limits, 0, wxALL|wxEXPAND, 5 ); + b_rightSizer->Add( s_otherSizer, 1, wxEXPAND|wxALL, 5 ); - bRightSizer->Add( sRightUpperSizer, 1, wxEXPAND, 5 ); + bupperSizer->Add( b_rightSizer, 0, 0, 5 ); - bRightSizer->Add( 10, 10, 0, 0, 5 ); + bMainSizer->Add( bupperSizer, 1, wxEXPAND, 5 ); - m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonCANCEL, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); - - bMainSizer->Add( bRightSizer, 0, wxEXPAND|wxALL, 5 ); + bMainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( bMainSizer ); this->Layout(); // Connect Events - m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); - m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); } DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE() { // Disconnect Events - m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); - m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_display_options_base.fbp b/pcbnew/dialogs/dialog_display_options_base.fbp index 0111ef1e2c..bfb48421cc 100644 --- a/pcbnew/dialogs/dialog_display_options_base.fbp +++ b/pcbnew/dialogs/dialog_display_options_base.fbp @@ -44,7 +44,7 @@ DIALOG_DISPLAY_OPTIONS_BASE - 880,320 + 562,361 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Display options @@ -91,706 +91,34 @@ bMainSizer - wxHORIZONTAL + wxVERTICAL none 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Tracks and vias: + wxEXPAND + 1 + - sLeftBoxSizer - wxVERTICAL - none - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Sketch" "Filled" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_DISPLAY_TRACK - Tracks: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayTracks - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - Select how tracks are displayed - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Sketch" "Filled" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_VIAS_SHAPES - Via Shapes: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayVias - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Never" "Defined holes" "Always" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_VIAS_HOLES - Show Via Holes: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayViaHole - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - Show (or not) via holes. If Defined Holes is selected, only the non default size holes are shown - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - wxID_ANY - Routing help: - - sbMiddleLeftSizer - wxVERTICAL - none - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Do not show" "On pads" "On tracks" "On pads and tracks" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show Net Names: - 1 - - 0 - - - 0 - - 1 - m_ShowNetNamesOption - 1 - - - protected - 1 - - Resizable - 3 - 1 - - wxRA_SPECIFY_COLS - - 0 - Show or not net names on pads and/or tracks - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Never" "New track" "New track with via area" "New and edited tracks with via area" "Always" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_SHOW_CLEARANCE - Show Tracks Clearance: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayTracksClearance - 1 - - - protected - 1 - - Resizable - 3 - 1 - - wxRA_SPECIFY_COLS - - 0 - Show( or not) tracks clearance area. If New track is selected, track clearance area is shown only when creating the track. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Footprints: - - sMiddleRightSizer + bupperSizer wxHORIZONTAL none - 5 - - 0 - - - bLModuleSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Line" "Filled" "Sketch" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_EDGES_MODULES - Footprint Edges: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayModEdges - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Line" "Filled" "Sketch" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_TEXT_MODULES - Texts: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayModTexts - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - + wxEXPAND|wxALL 0 wxID_ANY - Pad Options: + Tracks and vias: - bRModuleSizer + sLeftBoxSizer wxVERTICAL none 5 - wxALL|wxEXPAND + wxALL 0 - + 1 1 1 @@ -804,7 +132,7 @@ 1 0 - "Sketch" "Filled" + 0 1 1 @@ -818,9 +146,8 @@ 0 0 - ID_PADS_SHAPES - Pad Shapes: - 1 + wxID_ANY + Tracks sketch mode 0 @@ -828,7 +155,7 @@ 0 1 - m_OptDisplayPads + m_OptDisplayTracks 1 @@ -836,10 +163,9 @@ 1 Resizable - 1 1 - wxRA_SPECIFY_COLS + 0 @@ -851,6 +177,7 @@ + @@ -867,7 +194,6 @@ - @@ -909,7 +235,7 @@ 0 0 wxID_ANY - Show pad clearance + Vias sketch mode 0 @@ -917,7 +243,7 @@ 0 1 - m_OptDisplayPadClearence + m_OptDisplayVias 1 @@ -964,211 +290,10 @@ - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show pad number - - 0 - - - 0 - - 1 - m_OptDisplayPadNumber - 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 - Show pad NoConnect - - 0 - - - 0 - - 1 - m_OptDisplayPadNoConn - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - - bRightSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - wxID_ANY - Others: - - sRightUpperSizer - wxVERTICAL - none - 5 wxALL|wxEXPAND - 0 + 1 1 1 @@ -1183,7 +308,111 @@ 1 0 - "Line" "Filled" "Sketch" + "Never" "Defined holes" "Always" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_VIAS_HOLES + Show Via Holes: + 1 + + 0 + + + 0 + + 1 + m_OptDisplayViaHole + 1 + + + protected + 1 + + Resizable + 1 + 1 + + wxRA_SPECIFY_COLS + + 0 + Show (or not) via holes. If Defined Holes is selected, only the non default size holes are shown + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Routing help: + + sbMiddleLeftSizer + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Do not show" "On pads" "On tracks" "On pads and tracks" 1 1 @@ -1198,7 +427,7 @@ 0 0 wxID_ANY - Display other items: + Show Net Names: 1 0 @@ -1207,7 +436,7 @@ 0 1 - m_OptDisplayDrawings + m_ShowNetNamesOption 1 @@ -1215,13 +444,13 @@ 1 Resizable - 1 + 3 1 wxRA_SPECIFY_COLS 0 - + Show or not net names on pads and/or tracks wxFILTER_NONE wxDefaultValidator @@ -1258,7 +487,7 @@ 5 wxALL|wxEXPAND - 0 + 1 1 1 @@ -1273,7 +502,7 @@ 1 0 - "Yes" "No" + "Never" "New track" "New track with via area" "New and edited tracks with via area" "Always" 1 1 @@ -1287,8 +516,8 @@ 0 0 - wxID_ANY - Show page limits + ID_SHOW_CLEARANCE + Show Tracks Clearance: 1 0 @@ -1297,7 +526,7 @@ 0 1 - m_Show_Page_Limits + m_OptDisplayTracksClearance 1 @@ -1305,13 +534,13 @@ 1 Resizable - 1 + 3 1 wxRA_SPECIFY_COLS 0 - + Show( or not) tracks clearance area. If New track is selected, track clearance area is shown only when creating the track. wxFILTER_NONE wxDefaultValidator @@ -1351,190 +580,854 @@ 5 0 - - 10 - protected - 10 - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_OK - OK - - 0 - - - 0 + - 1 - m_buttonOK - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnOkClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Cancel - - 0 - - - 0 - - 1 - m_buttonCANCEL - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - + b_rightSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Footprints: + + sfootprintSizer + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Outlines sketch mode + + 0 + + + 0 + + 1 + m_OptDisplayModOutlines + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Texts sketch mode + + 0 + + + 0 + + 1 + m_OptDisplayModTexts + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pads sketch mode + + 0 + + + 0 + + 1 + m_OptDisplayPads + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pad clearance + + 0 + + + 0 + + 1 + m_OptDisplayPadClearence + 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 + Show pad number + + 0 + + + 0 + + 1 + m_OptDisplayPadNumber + 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 + Show pad NoConnect + + 0 + + + 0 + + 1 + m_OptDisplayPadNoConn + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Others: + + s_otherSizer + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Graphic items sketch mode + + 0 + + + 0 + + 1 + m_OptDisplayDrawings + 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 + Show page limits + + 0 + + + 0 + + 1 + m_Show_Page_Limits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + OnCancelClick + + + + OnOkClick + + + + diff --git a/pcbnew/dialogs/dialog_display_options_base.h b/pcbnew/dialogs/dialog_display_options_base.h index 9a99ca4bd3..817c2bd4ee 100644 --- a/pcbnew/dialogs/dialog_display_options_base.h +++ b/pcbnew/dialogs/dialog_display_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -15,14 +15,15 @@ class DIALOG_SHIM; #include "dialog_shim.h" #include -#include +#include #include #include #include #include +#include #include #include -#include +#include #include #include @@ -38,39 +39,37 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM protected: enum { - wxID_DISPLAY_TRACK = 1000, - ID_VIAS_SHAPES, - ID_VIAS_HOLES, - ID_SHOW_CLEARANCE, - ID_EDGES_MODULES, - ID_TEXT_MODULES, - ID_PADS_SHAPES + ID_VIAS_HOLES = 1000, + ID_SHOW_CLEARANCE }; - wxRadioBox* m_OptDisplayTracks; - wxRadioBox* m_OptDisplayVias; + wxCheckBox* m_OptDisplayTracks; + wxCheckBox* m_OptDisplayVias; wxRadioBox* m_OptDisplayViaHole; wxRadioBox* m_ShowNetNamesOption; wxRadioBox* m_OptDisplayTracksClearance; - wxRadioBox* m_OptDisplayModEdges; - wxRadioBox* m_OptDisplayModTexts; - wxRadioBox* m_OptDisplayPads; + wxCheckBox* m_OptDisplayModOutlines; + wxCheckBox* m_OptDisplayModTexts + ; + wxCheckBox* m_OptDisplayPads; wxCheckBox* m_OptDisplayPadClearence; wxCheckBox* m_OptDisplayPadNumber; wxCheckBox* m_OptDisplayPadNoConn; - wxRadioBox* m_OptDisplayDrawings; - wxRadioBox* m_Show_Page_Limits; - wxButton* m_buttonOK; - wxButton* m_buttonCANCEL; + wxCheckBox* m_OptDisplayDrawings; + wxCheckBox* m_Show_Page_Limits; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; // Virtual event handlers, overide them in your derived class - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 880,320 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 562,361 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_DISPLAY_OPTIONS_BASE(); }; diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index b91d3d1109..f7430f96fb 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -5,9 +5,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013 Jean-Pierre Charras - * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com + * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -43,10 +43,13 @@ #include #include +#include #include #include +size_t DIALOG_MODULE_BOARD_EDITOR::m_page = 0; // remember the last open page during session + DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, MODULE* aModule, @@ -65,14 +68,19 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent InitModeditProperties(); InitBoardProperties(); + m_NoteBook->SetSelection( m_page ); + m_sdbSizerStdButtonsOK->SetDefault(); GetSizer()->SetSizeHints( this ); Centre(); } + DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR() { + m_page = m_NoteBook->GetSelection(); + for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ ) delete m_Shapes3D_list[ii]; @@ -417,6 +425,25 @@ void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event ) } } +void DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName() +{ + int idx = m_3D_ShapeNameListBox->GetSelection(); + + if( idx < 0 ) + return; + + // Edit filename + wxString filename = m_3D_ShapeNameListBox->GetStringSelection(); + + wxTextEntryDialog dlg( this, wxEmptyString, wxEmptyString, filename ); + dlg.SetTextValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR( &filename ) ); + + if( dlg.ShowModal() != wxID_OK || filename.IsEmpty() ) + return; //Aborted by user + + m_3D_ShapeNameListBox->SetString( idx, filename ); +} + void DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile() { diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h index 6bf70e1b2f..1b27076dbc 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -38,6 +38,7 @@ private: S3DPOINT_VALUE_CTRL * m_3D_Scale; S3DPOINT_VALUE_CTRL * m_3D_Offset; S3DPOINT_VALUE_CTRL * m_3D_Rotation; + static size_t m_page; // remember the last open page during session public: @@ -51,17 +52,22 @@ private: void InitModeditProperties(); void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource ); void TransfertDisplayTo3DValues( int aIndexSelection ); + void Edit3DShapeFileName(); // virtual event functions void OnEditValue( wxCommandEvent& event ); void OnEditReference( wxCommandEvent& event ); void On3DShapeSelection( wxCommandEvent& event ); void On3DShapeNameSelected( wxCommandEvent& event ); - void Add3DShape( wxCommandEvent& event ) + void Edit3DShapeFilename( wxCommandEvent& event ) + { + Edit3DShapeFileName(); + } + void Remove3DShape( wxCommandEvent& event ); + void Add3DShape( wxCommandEvent& event ) { BrowseAndAdd3DShapeFile(); } - void Remove3DShape( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event ); void GotoModuleEditor( wxCommandEvent& event ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp index ecd0b04eff..d47946603b 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -356,14 +356,14 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare wxBoxSizer* bSizer3DButtons; bSizer3DButtons = new wxBoxSizer( wxVERTICAL ); - m_buttonBrowse = new wxButton( m_Panel3D, ID_BROWSE_3D_LIB, _("Browse Shapes"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonBrowse, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - m_buttonAdd = new wxButton( m_Panel3D, ID_ADD_3D_SHAPE, _("Add 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonAdd, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + bSizer3DButtons->Add( m_buttonAdd, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_buttonRemove = new wxButton( m_Panel3D, ID_REMOVE_3D_SHAPE, _("Remove 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonRemove, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + bSizer3DButtons->Add( m_buttonRemove, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_buttonEdit = new wxButton( m_Panel3D, wxID_ANY, _("Edit Filename"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer3DButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 ); bLowerSizer3D->Add( bSizer3DButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -399,9 +399,9 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this ); m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this ); m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); - m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Browse3DLib ), NULL, this ); m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Add3DShape ), NULL, this ); m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Remove3DShape ), NULL, this ); + m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Edit3DShapeFilename ), NULL, this ); m_sdbSizerStdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerStdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnOkClick ), NULL, this ); } @@ -415,9 +415,9 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::~DIALOG_MODULE_BOARD_EDITOR_BASE() m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this ); m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this ); m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); - m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Browse3DLib ), NULL, this ); m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Add3DShape ), NULL, this ); m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Remove3DShape ), NULL, this ); + m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Edit3DShapeFilename ), NULL, this ); m_sdbSizerStdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerStdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnOkClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp index 8413a47ab2..80a6083222 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp @@ -4764,11 +4764,11 @@ - + 5 wxEXPAND 0 - + bLowerSizer3D wxHORIZONTAL @@ -5069,106 +5069,18 @@ - + 5 wxALIGN_CENTER_VERTICAL 0 - + bSizer3DButtons wxVERTICAL none 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_BROWSE_3D_LIB - Browse Shapes - - 0 - - - 0 - - 1 - m_buttonBrowse - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - Browse3DLib - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -5256,7 +5168,7 @@ 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -5342,6 +5254,94 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Edit Filename + + 0 + + + 0 + + 1 + m_buttonEdit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + Edit3DShapeFilename + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.h b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.h index 335a04ed32..366782bb9a 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.h +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -42,9 +42,8 @@ class DIALOG_SHIM; #define ID_LISTBOX_ORIENT_SELECT 1001 #define ID_MODULE_PROPERTIES_EXCHANGE 1002 #define ID_GOTO_MODULE_EDITOR 1003 -#define ID_BROWSE_3D_LIB 1004 -#define ID_ADD_3D_SHAPE 1005 -#define ID_REMOVE_3D_SHAPE 1006 +#define ID_ADD_3D_SHAPE 1004 +#define ID_REMOVE_3D_SHAPE 1005 /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_MODULE_BOARD_EDITOR_BASE @@ -114,9 +113,9 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM wxStaticText* m_staticTextShapeOffset; wxBoxSizer* m_bSizerShapeRotation; wxStaticText* m_staticTextShapeRotation; - wxButton* m_buttonBrowse; wxButton* m_buttonAdd; wxButton* m_buttonRemove; + wxButton* m_buttonEdit; wxStdDialogButtonSizer* m_sdbSizerStdButtons; wxButton* m_sdbSizerStdButtonsOK; wxButton* m_sdbSizerStdButtonsCancel; @@ -128,9 +127,9 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM virtual void ExchangeModule( wxCommandEvent& event ) { event.Skip(); } virtual void GotoModuleEditor( wxCommandEvent& event ) { event.Skip(); } virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); } - virtual void Browse3DLib( wxCommandEvent& event ) { event.Skip(); } virtual void Add3DShape( wxCommandEvent& event ) { event.Skip(); } virtual void Remove3DShape( wxCommandEvent& event ) { event.Skip(); } + virtual void Edit3DShapeFilename( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index d196eb23ba..e2186c5f0f 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -7,10 +7,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2008-2014 Wayne Stambaugh - * Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com + * Copyright (C) 2008-2015 Wayne Stambaugh + * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -51,6 +51,8 @@ #include #include +size_t DIALOG_MODULE_MODULE_EDITOR::m_page = 0; // remember the last open page during session + DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, MODULE* aModule ) : @@ -66,6 +68,9 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* m_FootprintNameCtrl->SetValidator( FILE_NAME_CHAR_VALIDATOR() ); initModeditProperties(); + + m_NoteBook->SetSelection( m_page ); + m_sdbSizerStdButtonsOK->SetDefault(); GetSizer()->SetSizeHints( this ); Centre(); @@ -74,6 +79,8 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR() { + m_page = m_NoteBook->GetSelection(); + for( unsigned ii = 0; ii < m_shapes3D_list.size(); ii++ ) delete m_shapes3D_list[ii]; @@ -287,6 +294,26 @@ void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event) } +void DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName() +{ + int idx = m_3D_ShapeNameListBox->GetSelection(); + + if( idx < 0 ) + return; + + // Edit filename + wxString filename = m_3D_ShapeNameListBox->GetStringSelection(); + + wxTextEntryDialog dlg( this, wxEmptyString, wxEmptyString, filename ); + dlg.SetTextValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR( &filename ) ); + + if( dlg.ShowModal() != wxID_OK || filename.IsEmpty() ) + return; //Aborted by user + + m_3D_ShapeNameListBox->SetString( idx, filename ); +} + + void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile() { PROJECT& prj = Prj(); diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.h b/pcbnew/dialogs/dialog_edit_module_for_Modedit.h index 2d6aebdbd3..06fac763b2 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.h +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,6 +42,7 @@ private: S3DPOINT_VALUE_CTRL * m_3D_Scale; S3DPOINT_VALUE_CTRL * m_3D_Offset; S3DPOINT_VALUE_CTRL * m_3D_Rotation; + static size_t m_page; // remember the last open page during session public: @@ -54,6 +55,7 @@ private: void initModeditProperties(); void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource ); void TransfertDisplayTo3DValues( int aIndexSelection ); + void Edit3DShapeFileName(); // virtual event functions void OnEditValue( wxCommandEvent& event ); @@ -65,6 +67,10 @@ private: BrowseAndAdd3DShapeFile(); } void Remove3DShape( wxCommandEvent& event ); + void Edit3DShapeFilename( wxCommandEvent& event ) + { + Edit3DShapeFileName(); + } void OnCancelClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event ); }; diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.cpp index 6e404ab13c..2256d65a6a 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -291,10 +291,13 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa bSizer3DButtons = new wxBoxSizer( wxVERTICAL ); m_buttonBrowse = new wxButton( m_Panel3D, ID_BROWSE_3D_LIB, _("Add 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonBrowse, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + bSizer3DButtons->Add( m_buttonBrowse, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_buttonRemove = new wxButton( m_Panel3D, ID_REMOVE_3D_SHAPE, _("Remove 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonRemove, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + bSizer3DButtons->Add( m_buttonRemove, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_buttonEdit = new wxButton( m_Panel3D, wxID_ANY, _("Edit Filename"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer3DButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 ); bLowerSizer3D->Add( bSizer3DButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -329,6 +332,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Add3DShape ), NULL, this ); m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Remove3DShape ), NULL, this ); + m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Edit3DShapeFilename ), NULL, this ); m_sdbSizerStdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerStdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnOkClick ), NULL, this ); } @@ -341,6 +345,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::~DIALOG_MODULE_MODULE_EDITOR_BASE() m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Add3DShape ), NULL, this ); m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Remove3DShape ), NULL, this ); + m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Edit3DShapeFilename ), NULL, this ); m_sdbSizerStdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerStdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnOkClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.fbp b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.fbp index 11bfde271e..2722bffc4f 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.fbp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.fbp @@ -3801,7 +3801,7 @@ 5 wxALL|wxEXPAND 0 - + bLowerSizer3D wxHORIZONTAL @@ -4113,7 +4113,7 @@ none 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -4201,7 +4201,7 @@ 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -4287,6 +4287,94 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Edit Filename + + 0 + + + 0 + + 1 + m_buttonEdit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + Edit3DShapeFilename + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.h b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.h index f617580944..e4057ea805 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.h +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -101,6 +101,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM wxStaticText* m_staticTextShapeRotation; wxButton* m_buttonBrowse; wxButton* m_buttonRemove; + wxButton* m_buttonEdit; wxStdDialogButtonSizer* m_sdbSizerStdButtons; wxButton* m_sdbSizerStdButtonsOK; wxButton* m_sdbSizerStdButtonsCancel; @@ -111,6 +112,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); } virtual void Add3DShape( wxCommandEvent& event ) { event.Skip(); } virtual void Remove3DShape( wxCommandEvent& event ) { event.Skip(); } + virtual void Edit3DShapeFilename( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index fff88b87af..edb27594c1 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010 Jean-Pierre Charras - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -49,34 +49,36 @@ #include #include +#include -class DIALOG_GRAPHIC_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE +class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE { private: - PCB_EDIT_FRAME* m_parent; - wxDC* m_DC; - DRAWSEGMENT* m_Item; - BOARD_DESIGN_SETTINGS m_brdSettings; + PCB_EDIT_FRAME* m_parent; + wxDC* m_DC; + DRAWSEGMENT* m_item; + BOARD_DESIGN_SETTINGS m_brdSettings; public: - DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent, DRAWSEGMENT * aItem, wxDC * aDC); + DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent, DRAWSEGMENT* aItem, wxDC* aDC ); ~DIALOG_GRAPHIC_ITEM_PROPERTIES() {}; private: - void initDlg( ); + void initDlg(); void OnOkClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } void OnLayerChoice( wxCommandEvent& event ); + bool itemValuesOK(); }; DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent, - DRAWSEGMENT * aItem, wxDC * aDC ): + DRAWSEGMENT* aItem, wxDC* aDC ): DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent ) { m_parent = aParent; m_DC = aDC; - m_Item = aItem; + m_item = aItem; m_brdSettings = m_parent->GetDesignSettings(); initDlg(); Layout(); @@ -87,11 +89,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* void PCB_EDIT_FRAME::InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC ) { - if ( aItem == NULL ) - { - DisplayError( this, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) ); - return; - } + wxCHECK_RET( aItem != NULL, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) ); m_canvas->SetIgnoreMouseEvents( true ); DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem, aDC ); @@ -101,12 +99,12 @@ void PCB_EDIT_FRAME::InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxD } -void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) +void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg() { m_StandardButtonsSizerOK->SetDefault(); // Set unit symbol - wxStaticText * texts_unit[] = + wxStaticText* texts_unit[] = { m_StartPointXUnit, m_StartPointYUnit, @@ -128,9 +126,10 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) wxString msg; // Change texts according to the segment shape: - switch ( m_Item->GetShape() ) + switch( m_item->GetShape() ) { case S_CIRCLE: + SetTitle( _( "Circle Properties" ) ); m_StartPointXLabel->SetLabel( _( "Center X" ) ); m_StartPointYLabel->SetLabel( _( "Center Y" ) ); m_EndPointXLabel->SetLabel( _( "Point X" ) ); @@ -141,16 +140,21 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) break; case S_ARC: + SetTitle( _( "Arc Properties" ) ); m_StartPointXLabel->SetLabel( _( "Center X" ) ); m_StartPointYLabel->SetLabel( _( "Center Y" ) ); m_EndPointXLabel->SetLabel( _( "Start Point X" ) ); m_EndPointYLabel->SetLabel( _( "Start Point Y" ) ); // Here the angle is a double, but the UI is still working with integers. - msg << int( m_Item->GetAngle() ); + msg << int( m_item->GetAngle() ); m_Angle_Ctrl->SetValue( msg ); break; + case S_SEGMENT: + SetTitle( _( "Line Segment Properties" ) ); + + // Fall through. default: m_Angle_Text->Show( false ); m_Angle_Ctrl->Show( false ); @@ -158,22 +162,22 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) break; } - PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->GetStart().x ); + PutValueInLocalUnits( *m_Center_StartXCtrl, m_item->GetStart().x ); - PutValueInLocalUnits( *m_Center_StartYCtrl, m_Item->GetStart().y ); + PutValueInLocalUnits( *m_Center_StartYCtrl, m_item->GetStart().y ); - PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_Item->GetEnd().x ); + PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_item->GetEnd().x ); - PutValueInLocalUnits( *m_EndY_Ctrl, m_Item->GetEnd().y ); + PutValueInLocalUnits( *m_EndY_Ctrl, m_item->GetEnd().y ); - PutValueInLocalUnits( *m_ThicknessCtrl, m_Item->GetWidth() ); + PutValueInLocalUnits( *m_ThicknessCtrl, m_item->GetWidth() ); int thickness; - if( m_Item->GetLayer() == Edge_Cuts ) - thickness = m_brdSettings.m_EdgeSegmentWidth; + if( m_item->GetLayer() == Edge_Cuts ) + thickness = m_brdSettings.m_EdgeSegmentWidth; else - thickness = m_brdSettings.m_DrawSegmentWidth; + thickness = m_brdSettings.m_DrawSegmentWidth; PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness ); @@ -183,10 +187,10 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) m_LayerSelectionCtrl->SetBoardFrame( m_parent ); m_LayerSelectionCtrl->Resync(); - if( m_LayerSelectionCtrl->SetLayerSelection( m_Item->GetLayer() ) < 0 ) + if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 ) { - wxMessageBox( _( "This item has an illegal layer id.\n" - "Now, forced on the drawings layer. Please, fix it" ) ); + wxMessageBox( _( "This item was on an unknown layer.\n" + "It has been moved to the drawings layer. Please fix it." ) ); m_LayerSelectionCtrl->SetLayerSelection( Dwgs_User ); } } @@ -197,9 +201,9 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event ) int thickness; if( m_LayerSelectionCtrl->GetLayerSelection() == Edge_Cuts ) - thickness = m_brdSettings.m_EdgeSegmentWidth; + thickness = m_brdSettings.m_EdgeSegmentWidth; else - thickness = m_brdSettings.m_DrawSegmentWidth; + thickness = m_brdSettings.m_DrawSegmentWidth; PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness ); } @@ -207,54 +211,126 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event ) void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) { - m_parent->SaveCopyInUndoList( m_Item, UR_CHANGED ); + if( !itemValuesOK() ) + return; + + m_parent->SaveCopyInUndoList( m_item, UR_CHANGED ); wxString msg; if( m_DC ) - m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR ); + m_item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR ); msg = m_Center_StartXCtrl->GetValue(); - m_Item->SetStartX( ValueFromString( g_UserUnit, msg ) ); + m_item->SetStartX( ValueFromString( g_UserUnit, msg ) ); msg = m_Center_StartYCtrl->GetValue(); - m_Item->SetStartY( ValueFromString( g_UserUnit, msg ) ); + m_item->SetStartY( ValueFromString( g_UserUnit, msg ) ); msg = m_EndX_Radius_Ctrl->GetValue(); - m_Item->SetEndX( ValueFromString( g_UserUnit, msg ) ); + m_item->SetEndX( ValueFromString( g_UserUnit, msg ) ); msg = m_EndY_Ctrl->GetValue(); - m_Item->SetEndY( ValueFromString( g_UserUnit, msg ) ); + m_item->SetEndY( ValueFromString( g_UserUnit, msg ) ); msg = m_ThicknessCtrl->GetValue(); - m_Item->SetWidth( ValueFromString( g_UserUnit, msg ) ); + m_item->SetWidth( ValueFromString( g_UserUnit, msg ) ); msg = m_DefaultThicknessCtrl->GetValue(); int thickness = ValueFromString( g_UserUnit, msg ); - m_Item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ); + m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ); - if( m_Item->GetLayer() == Edge_Cuts ) - m_brdSettings.m_EdgeSegmentWidth = thickness; + if( m_item->GetLayer() == Edge_Cuts ) + m_brdSettings.m_EdgeSegmentWidth = thickness; else - m_brdSettings.m_DrawSegmentWidth = thickness; + m_brdSettings.m_DrawSegmentWidth = thickness; - if( m_Item->GetShape() == S_ARC ) + if( m_item->GetShape() == S_ARC ) { double angle; m_Angle_Ctrl->GetValue().ToDouble( &angle ); - NORMALIZE_ANGLE_360(angle); - m_Item->SetAngle( angle ); + NORMALIZE_ANGLE_360( angle ); + m_item->SetAngle( angle ); } m_parent->OnModify(); if( m_DC ) - m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_OR ); + m_item->Draw( m_parent->GetCanvas(), m_DC, GR_OR ); - m_parent->SetMsgPanel( m_Item ); + m_parent->SetMsgPanel( m_item ); m_parent->SetDesignSettings( m_brdSettings ); Close( true ); } + + +bool DIALOG_GRAPHIC_ITEM_PROPERTIES::itemValuesOK() +{ + wxArrayString error_msgs; + + // Load the start and end points -- all types use these in the checks. + int startx = ValueFromString( g_UserUnit, m_Center_StartXCtrl->GetValue() ); + int starty = ValueFromString( g_UserUnit, m_Center_StartYCtrl->GetValue() ); + int endx = ValueFromString( g_UserUnit, m_EndX_Radius_Ctrl->GetValue() ); + int endy = ValueFromString( g_UserUnit, m_EndY_Ctrl->GetValue() ); + + // Type specific checks. + switch( m_item->GetShape() ) + { + case S_ARC: + // Check angle of arc. + double angle; + m_Angle_Ctrl->GetValue().ToDouble( &angle ); + NORMALIZE_ANGLE_360( angle ); + + if( angle == 0 ) + { + error_msgs.Add( _( "The arc angle must be greater than zero." ) ); + } + + // Fall through. + case S_CIRCLE: + + // Check radius. + if( (startx == endx) && (starty == endy) ) + { + error_msgs.Add( _( "The radius must be greater than zero." ) ); + } + + break; + + default: + + // Check start and end are not the same. + if( (startx == endx) && (starty == endy) ) + { + error_msgs.Add( _( "The start and end points cannot be the same." ) ); + } + + break; + } + + // Check the item thickness. + int thickness = ValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue() ); + + if( thickness <= 0 ) + error_msgs.Add( _( "The item thickness must be greater than zero." ) ); + + // And the default thickness. + thickness = ValueFromString( g_UserUnit, m_DefaultThicknessCtrl->GetValue() ); + + if( thickness <= 0 ) + error_msgs.Add( _( "The default thickness must be greater than zero." ) ); + + if( error_msgs.GetCount() ) + { + HTML_MESSAGE_BOX dlg( this, _( "Error list" ) ); + dlg.ListSet( error_msgs ); + dlg.ShowModal(); + } + + return error_msgs.GetCount() == 0; +} diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp index 58492f857d..92c8d7caa4 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -23,7 +23,7 @@ */ /** - @file dialog_graphic_item_properties_for_Modedit.cpp + * @file dialog_graphic_item_properties_for_Modedit.cpp */ /* Edit parameters values of graphic items in a footprint body: @@ -49,25 +49,27 @@ #include #include +#include -class DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES: public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE +class DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE { private: - FOOTPRINT_EDIT_FRAME* m_parent; - EDGE_MODULE* m_item; + FOOTPRINT_EDIT_FRAME* m_parent; + EDGE_MODULE* m_item; BOARD_DESIGN_SETTINGS m_brdSettings; - MODULE * m_module; + MODULE* m_module; public: DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( FOOTPRINT_EDIT_FRAME* aParent, - EDGE_MODULE * aItem); + EDGE_MODULE* aItem ); ~DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES() {}; private: - void initDlg( ); + void initDlg(); void OnOkClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } void OnLayerChoice( wxCommandEvent& event ); + bool itemValuesOK(); }; DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( @@ -85,14 +87,15 @@ DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( Centre(); } + /* * Dialog to edit a graphic item of a footprint body. */ -void FOOTPRINT_EDIT_FRAME::InstallFootprintBodyItemPropertiesDlg(EDGE_MODULE * aItem) +void FOOTPRINT_EDIT_FRAME::InstallFootprintBodyItemPropertiesDlg( EDGE_MODULE* aItem ) { - if ( aItem == NULL ) + if( aItem == NULL ) { - wxMessageBox( wxT("InstallGraphicItemPropertiesDialog() error: NULL item")); + wxMessageBox( wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) ); return; } @@ -112,7 +115,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg() m_StandardButtonsSizerOK->SetDefault(); // Set unit symbol - wxStaticText * texts_unit[] = + wxStaticText* texts_unit[] = { m_StartPointXUnit, m_StartPointYUnit, @@ -134,34 +137,40 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg() wxString msg; // Change texts according to the segment shape: - switch ( m_item->GetShape() ) + switch( m_item->GetShape() ) { case S_CIRCLE: - m_StartPointXLabel->SetLabel(_("Center X")); - m_StartPointYLabel->SetLabel(_("Center Y")); - m_EndPointXLabel->SetLabel(_("Point X")); - m_EndPointYLabel->SetLabel(_("Point Y")); - m_Angle_Text->Show(false); - m_Angle_Ctrl->Show(false); - m_AngleUnit->Show(false); + SetTitle( _( "Circle Properties" ) ); + m_StartPointXLabel->SetLabel( _( "Center X" ) ); + m_StartPointYLabel->SetLabel( _( "Center Y" ) ); + m_EndPointXLabel->SetLabel( _( "Point X" ) ); + m_EndPointYLabel->SetLabel( _( "Point Y" ) ); + m_Angle_Text->Show( false ); + m_Angle_Ctrl->Show( false ); + m_AngleUnit->Show( false ); break; case S_ARC: - m_StartPointXLabel->SetLabel(_("Center X")); - m_StartPointYLabel->SetLabel(_("Center Y")); - m_EndPointXLabel->SetLabel(_("Start Point X")); - m_EndPointYLabel->SetLabel(_("Start Point Y")); + SetTitle( _( "Arc Properties" ) ); + m_StartPointXLabel->SetLabel( _( "Center X" ) ); + m_StartPointYLabel->SetLabel( _( "Center Y" ) ); + m_EndPointXLabel->SetLabel( _( "Start Point X" ) ); + m_EndPointYLabel->SetLabel( _( "Start Point Y" ) ); // Here the angle is a double, but the UI is still working // with integers msg << int( m_item->GetAngle() ); - m_Angle_Ctrl->SetValue(msg); + m_Angle_Ctrl->SetValue( msg ); break; + case S_SEGMENT: + SetTitle( _( "Line Segment Properties" ) ); + + // Fall through. default: - m_Angle_Text->Show(false); - m_Angle_Ctrl->Show(false); - m_AngleUnit->Show(false); + m_Angle_Text->Show( false ); + m_Angle_Ctrl->Show( false ); + m_AngleUnit->Show( false ); break; } @@ -185,8 +194,8 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg() if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 ) { - wxMessageBox( _( "This item has an illegal layer id.\n" - "Now, forced on the front silk screen layer. Please, fix it" ) ); + wxMessageBox( _( "This item was on an unknown layer.\n" + "It has been moved to the front silk screen layer. Please fix it." ) ); m_LayerSelectionCtrl->SetLayerSelection( F_SilkS ); } } @@ -198,12 +207,16 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& even { } + /*******************************************************************/ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) /*******************************************************************/ /* Copy values in text control to the item parameters -*/ + */ { + if( !itemValuesOK() ) + return; + LAYER_NUM layer = m_LayerSelectionCtrl->GetLayerSelection(); if( IsCopperLayer( layer ) ) @@ -250,7 +263,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) { double angle; m_Angle_Ctrl->GetValue().ToDouble( &angle ); - NORMALIZE_ANGLE_360(angle); + NORMALIZE_ANGLE_360( angle ); m_item->SetAngle( angle ); } @@ -259,3 +272,68 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) Close( true ); } + + +bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::itemValuesOK() +{ + wxArrayString error_msgs; + + // Load the start and end points -- all types use these in the checks. + int startx = ValueFromString( g_UserUnit, m_Center_StartXCtrl->GetValue() ); + int starty = ValueFromString( g_UserUnit, m_Center_StartYCtrl->GetValue() ); + int endx = ValueFromString( g_UserUnit, m_EndX_Radius_Ctrl->GetValue() ); + int endy = ValueFromString( g_UserUnit, m_EndY_Ctrl->GetValue() ); + + // Type specific checks. + switch( m_item->GetShape() ) + { + case S_ARC: + // Check angle of arc. + double angle; + m_Angle_Ctrl->GetValue().ToDouble( &angle ); + NORMALIZE_ANGLE_360( angle ); + + if( angle == 0 ) + { + error_msgs.Add( _( "The arc angle must be greater than zero." ) ); + } + + // Fall through. + case S_CIRCLE: + + // Check radius. + if( (startx == endx) && (starty == endy) ) + error_msgs.Add( _( "The radius must be greater than zero." ) ); + + break; + + default: + + // Check start and end are not the same. + if( (startx == endx) && (starty == endy) ) + error_msgs.Add( _( "The start and end points cannot be the same." ) ); + + break; + } + + // Check the item thickness. + int thickness = ValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue() ); + + if( thickness <= 0 ) + error_msgs.Add( _( "The item thickness must be greater than zero." ) ); + + // And the default thickness. + thickness = ValueFromString( g_UserUnit, m_DefaultThicknessCtrl->GetValue() ); + + if( thickness <= 0 ) + error_msgs.Add( _( "The default thickness must be greater than zero." ) ); + + if( error_msgs.GetCount() ) + { + HTML_MESSAGE_BOX dlg( this, _( "Error list" ) ); + dlg.ListSet( error_msgs ); + dlg.ShowModal(); + } + + return error_msgs.GetCount() == 0; +} diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 690ef34b9b..2ade29e32b 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -193,7 +193,7 @@ void DIALOG_PLOT::Init_Dialog() m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() ); // Plot mode - m_plotModeOpt->SetSelection( m_plotOpts.GetMode() ); + setPlotModeChoiceSelection( m_plotOpts.GetPlotMode() ); // Plot mirror option m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() ); @@ -335,7 +335,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) } -PlotFormat DIALOG_PLOT::GetPlotFormat() +PlotFormat DIALOG_PLOT::getPlotFormat() { // plot format id's are ordered like displayed in m_plotFormatOpt static const PlotFormat plotFmt[] = @@ -356,13 +356,13 @@ PlotFormat DIALOG_PLOT::GetPlotFormat() // and clear also some optional values void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) { - switch( GetPlotFormat() ) + switch( getPlotFormat() ) { case PLOT_FORMAT_PDF: case PLOT_FORMAT_SVG: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( false ); - m_plotModeOpt->SetSelection( 1 ); + setPlotModeChoiceSelection( FILLED ); m_plotMirrorOpt->Enable( true ); m_useAuxOriginCheckBox->Enable( false ); m_useAuxOriginCheckBox->SetValue( false ); @@ -422,7 +422,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_drillShapeOpt->Enable( false ); m_drillShapeOpt->SetSelection( 0 ); m_plotModeOpt->Enable( false ); - m_plotModeOpt->SetSelection( 1 ); + setPlotModeChoiceSelection( FILLED ); m_plotMirrorOpt->Enable( false ); m_plotMirrorOpt->SetValue( false ); m_useAuxOriginCheckBox->Enable( true ); @@ -576,7 +576,7 @@ void DIALOG_PLOT::applyPlotSettings() tempOptions.SetDrillMarksType( static_cast ( m_drillShapeOpt->GetSelection() ) ); tempOptions.SetMirror( m_plotMirrorOpt->GetValue() ); - tempOptions.SetMode( static_cast( m_plotModeOpt->GetSelection() ) ); + tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED ); tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() ); // Update settings from text fields. Rewrite values back to the fields, @@ -669,7 +669,7 @@ void DIALOG_PLOT::applyPlotSettings() ConfigBaseWriteDouble( m_config, CONFIG_PS_FINEWIDTH_ADJ, (double)m_PSWidthAdjust / IU_PER_MM ); - tempOptions.SetFormat( GetPlotFormat() ); + tempOptions.SetFormat( getPlotFormat() ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberAttributes( m_useGerberAttributes->GetValue() ); diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h index b041ba7a55..47f4692ace 100644 --- a/pcbnew/dialogs/dialog_plot.h +++ b/pcbnew/dialogs/dialog_plot.h @@ -57,6 +57,7 @@ private: PCB_PLOT_PARAMS m_plotOpts; + // Event called functions void Init_Dialog(); void Plot( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event ); @@ -66,7 +67,14 @@ private: void OnPopUpLayers( wxCommandEvent& event ); void SetPlotFormat( wxCommandEvent& event ); void OnSetScaleOpt( wxCommandEvent& event ); - void applyPlotSettings(); void CreateDrillFile( wxCommandEvent& event ); - PlotFormat GetPlotFormat(); + + // orther functions + void applyPlotSettings(); + PlotFormat getPlotFormat(); + + void setPlotModeChoiceSelection( EDA_DRAW_MODE_T aPlotMode ) + { + m_plotModeOpt->SetSelection( aPlotMode == SKETCH ? 1 : 0 ); + } }; diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index 3c4838ebe7..a5134b39c7 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -159,7 +159,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_staticText13->Wrap( -1 ); bSizer14->Add( m_staticText13, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - wxString m_plotModeOptChoices[] = { _("Line"), _("Filled"), _("Sketch") }; + wxString m_plotModeOptChoices[] = { _("Filled"), _("Sketch") }; int m_plotModeOptNChoices = sizeof( m_plotModeOptChoices ) / sizeof( wxString ); m_plotModeOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotModeOptNChoices, m_plotModeOptChoices, 0 ); m_plotModeOpt->SetSelection( 0 ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index f4cebc7ed9..5363d9cd7f 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -26,7 +26,7 @@ UI 1 0 - + 0 wxAUI_MGR_DEFAULT @@ -2064,7 +2064,7 @@ 1 0 - "Line" "Filled" "Sketch" + "Filled" "Sketch" 1 1 diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h index d81971d2dc..13c4972a29 100644 --- a/pcbnew/dialogs/dialog_plot_base.h +++ b/pcbnew/dialogs/dialog_plot_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! diff --git a/pcbnew/dialogs/dialog_pns_settings.cpp b/pcbnew/dialogs/dialog_pns_settings.cpp index 0368294ab1..a243f40c9c 100644 --- a/pcbnew/dialogs/dialog_pns_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_settings.cpp @@ -41,6 +41,9 @@ DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTING m_effort->SetValue( m_settings.OptimizerEffort() ); m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() ); m_violateDrc->SetValue( m_settings.CanViolateDRC() ); + + GetSizer()->Fit( this ); + GetSizer()->SetSizeHints( this ); } diff --git a/pcbnew/dialogs/dialog_pns_settings_base.cpp b/pcbnew/dialogs/dialog_pns_settings_base.cpp index 7fc9eff220..d1a0a2f201 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.cpp +++ b/pcbnew/dialogs/dialog_pns_settings_base.cpp @@ -11,7 +11,7 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 280,480 ), wxDefaultSize ); + this->SetSizeHints( wxSize( 350,-1 ), wxDefaultSize ); wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); @@ -48,6 +48,9 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID bOptions->Add( m_suggestEnding, 0, wxALL, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bOptions->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + wxBoxSizer* bEffort; bEffort = new wxBoxSizer( wxHORIZONTAL ); diff --git a/pcbnew/dialogs/dialog_pns_settings_base.fbp b/pcbnew/dialogs/dialog_pns_settings_base.fbp index b15698ba15..5eb3f90215 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.fbp +++ b/pcbnew/dialogs/dialog_pns_settings_base.fbp @@ -41,10 +41,10 @@ 0 wxID_ANY - 280,480 + 350,-1 DIALOG_PNS_SETTINGS_BASE - 286,480 + 358,393 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Interactive Router settings @@ -183,11 +183,11 @@ - + 5 wxEXPAND|wxALL 1 - + wxID_ANY Options @@ -811,6 +811,87 @@ + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxEXPAND @@ -913,11 +994,11 @@ 0 - + 5 wxEXPAND 1 - + bSlider wxVERTICAL @@ -1030,11 +1111,11 @@ - + 5 wxEXPAND 1 - + bSliderLabels wxHORIZONTAL diff --git a/pcbnew/dialogs/dialog_pns_settings_base.h b/pcbnew/dialogs/dialog_pns_settings_base.h index d85930dd44..9e9bbad0ba 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.h +++ b/pcbnew/dialogs/dialog_pns_settings_base.h @@ -21,6 +21,7 @@ class DIALOG_SHIM; #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ class DIALOG_PNS_SETTINGS_BASE : public DIALOG_SHIM wxCheckBox* m_smoothDragged; wxCheckBox* m_violateDrc; wxCheckBox* m_suggestEnding; + wxStaticLine* m_staticline1; wxStaticText* m_effortLabel; wxSlider* m_effort; wxStaticText* m_lowLabel; @@ -63,7 +65,7 @@ class DIALOG_PNS_SETTINGS_BASE : public DIALOG_SHIM public: - DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Interactive Router settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 286,480 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Interactive Router settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 358,393 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_PNS_SETTINGS_BASE(); }; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index cc0db92b17..4e79cb43db 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr - * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -110,6 +110,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_DELETE_ZONE: case ID_POPUP_PCB_MOVE_ZONE_CORNER: case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT: + case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT: case ID_POPUP_PCB_MOVE_ZONE_OUTLINES: case ID_POPUP_PCB_ADD_ZONE_CORNER: case ID_POPUP_PCB_DELETE_TRACKSEG: @@ -609,6 +610,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: case ID_POPUP_PCB_PLACE_ZONE_CORNER: + case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT: { m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index e5375b75e7..0dcd2f32cf 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -114,7 +114,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) { EDA_ITEM* PtStruct; DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); - int tmp = displ_opts->m_DisplayDrawItems; + bool tmp = displ_opts->m_DisplayDrawItemsFill; if( Segment == NULL ) return; @@ -122,7 +122,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) if( Segment->IsNew() ) // Trace in progress. { // Delete current segment. - displ_opts->m_DisplayDrawItems = SKETCH; + displ_opts->m_DisplayDrawItemsFill = SKETCH; Segment->Draw( m_canvas, DC, GR_XOR ); PtStruct = Segment->Back(); Segment ->DeleteStructure(); @@ -130,7 +130,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) if( PtStruct && (PtStruct->Type() == PCB_LINE_T ) ) Segment = (DRAWSEGMENT*) PtStruct; - displ_opts->m_DisplayDrawItems = tmp; + displ_opts->m_DisplayDrawItemsFill = tmp; SetCurItem( NULL ); } else if( Segment->GetFlags() == 0 ) @@ -335,14 +335,15 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) */ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem(); - int tmp = displ_opts->m_DisplayDrawItems; if( Segment == NULL ) return; - displ_opts->m_DisplayDrawItems = SKETCH; + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); + bool tmp = displ_opts->m_DisplayDrawItemsFill; + + displ_opts->m_DisplayDrawItemsFill = SKETCH; if( aErase ) Segment->Draw( aPanel, aDC, GR_XOR ); @@ -362,5 +363,5 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi } Segment->Draw( aPanel, aDC, GR_XOR ); - displ_opts->m_DisplayDrawItems = tmp; + displ_opts->m_DisplayDrawItemsFill = tmp; } diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index 5a2c6ad5fb..0ce4575905 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -428,7 +428,7 @@ bool EXCELLON_WRITER::PlotDrillMarks( PLOTTER* aPlotter ) wxSize oblong_size; oblong_size = m_holeListBuffer[ii].m_Hole_Size; aPlotter->FlashPadOval( pos, oblong_size, - m_holeListBuffer[ii].m_Hole_Orient, LINE ); + m_holeListBuffer[ii].m_Hole_Orient, SKETCH ); } } diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index f4e776afcc..25bdcf3926 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -60,12 +60,12 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) break; case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - displ_opts->m_DisplayModText = state ? SKETCH : FILLED; + displ_opts->m_DisplayModTextFill = state ? SKETCH : FILLED; m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - displ_opts->m_DisplayModEdge = state ? SKETCH : FILLED; + displ_opts->m_DisplayModEdgeFill = state ? SKETCH : FILLED; m_canvas->Refresh( ); break; @@ -95,12 +95,12 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings() &displ_opts->m_DisplayPolarCood, false ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ), &displ_opts->m_DisplayPadFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorGraphicLinesDisplayMode" ), - &displ_opts->m_DisplayModEdge, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ), - &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ), - &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ), + &displ_opts->m_DisplayModEdgeFill, FILLED ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ), + &displ_opts->m_DisplayModTextFill, FILLED ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ), + &displ_opts->m_DisplayModTextFill, FILLED ) ); m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ), &settings.m_RefDefaultText, wxT( "REF**" ) ) ); diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index a214f33af8..55e18b4666 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -111,9 +111,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar ) - // Options Toolbar - EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) - EVT_TOOL( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) + // Options Toolbar (ID_TB_OPTIONS_SHOW_PADS_SKETCH id is managed in PCB_BASE_FRAME) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) @@ -181,8 +179,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) // Option toolbar: - EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, - FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, @@ -581,20 +577,12 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ) switch( id ) { - case ID_TB_OPTIONS_SHOW_PADS_SKETCH: - state = !displ_opts->m_DisplayPadFill; - break; - - case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: - state = !displ_opts->m_DisplayViaFill; - break; - case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - state = displ_opts->m_DisplayModText == SKETCH; + state = displ_opts->m_DisplayModTextFill == SKETCH; break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - state = displ_opts->m_DisplayModEdge == SKETCH; + state = displ_opts->m_DisplayModEdgeFill == SKETCH; break; case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 1e04a8b6c5..ae8d638144 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -2,7 +2,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -89,7 +89,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() : m_lineWidth = g_DrawDefaultLineThickness; m_plotFrameRef = false; m_plotViaOnMaskLayer = false; - m_mode = FILLED; + m_plotMode = FILLED; m_useAuxOrigin = false; m_HPGLPenNum = 1; m_HPGLPenSpeed = 20; // this param is always in cm/s @@ -167,7 +167,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_viasonmask ), m_plotViaOnMaskLayer ? trueStr : falseStr ); aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_mode ), - m_mode ); + GetPlotMode() == SKETCH ? 2 : 1 ); // Value 0 (LINE mode) no more used aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_useauxorigin ), m_useAuxOrigin ? trueStr : falseStr ); aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ), @@ -237,7 +237,7 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const return false; if( m_plotViaOnMaskLayer != aPcbPlotParams.m_plotViaOnMaskLayer ) return false; - if( m_mode != aPcbPlotParams.m_mode ) + if( m_plotMode != aPcbPlotParams.m_plotMode ) return false; if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin ) return false; @@ -430,7 +430,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) break; case T_mode: - aPcbPlotParams->m_mode = static_cast( parseInt( 0, 2 ) ); + aPcbPlotParams->SetPlotMode( parseInt( 0, 2 ) > 1 ? SKETCH : FILLED ); break; case T_useauxorigin: diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index 47eb89bbb4..308f2404c2 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -3,7 +3,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -49,9 +49,10 @@ private: // (mainly used to disable NPTH pads plotting on copper layers) bool m_skipNPTH_Pads; - /** LINE, FILLED or SKETCH selects how to plot filled objects. - * FILLED is not available with all drivers */ - EDA_DRAW_MODE_T m_mode; + /** FILLED or SKETCH selects how to plot filled objects. + * FILLED or SKETCH not available with all drivers: some have fixed mode + */ + EDA_DRAW_MODE_T m_plotMode; /// Plot format type (chooses the driver to be used) PlotFormat m_format; @@ -178,8 +179,8 @@ public: void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; } PlotTextMode GetTextMode() const { return m_textMode; } - void SetMode( EDA_DRAW_MODE_T aVal ) { m_mode = aVal; } - EDA_DRAW_MODE_T GetMode() const { return m_mode; } + void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; } + EDA_DRAW_MODE_T GetPlotMode() const { return m_plotMode; } void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; } DrillMarksType GetDrillMarksType() const { return m_drillMarks; } diff --git a/pcbnew/pcb_plot_params_parser.h b/pcbnew/pcb_plot_params_parser.h index 221bc92570..cc3137ea98 100644 --- a/pcbnew/pcb_plot_params_parser.h +++ b/pcbnew/pcb_plot_params_parser.h @@ -24,7 +24,6 @@ */ #include -//#include class PCB_PLOT_PARAMS; class LINE_READER; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 95fbb6e635..1adf75aba5 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. @@ -96,8 +96,8 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) { LAYER_ID cur_layer = GetActiveLayer(); - // If after showing the dialog the user removed the active layer, - // then use a sensible alternative layer to set as the active layer. + // If after showing the dialog the user has removed the active layer, + // then select a new active layer (front copper layer). if( !GetBoard()->GetEnabledLayers()[ cur_layer ] ) cur_layer = F_Cu; @@ -354,12 +354,12 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() &displ_opts->m_DisplayPadIsol, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), &displ_opts->m_DisplayPadNum, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffC" ), - &displ_opts->m_DisplayModEdge, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffT" ), - &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbAffT" ), - &displ_opts->m_DisplayDrawItems, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ), + &displ_opts->m_DisplayModEdgeFill, FILLED ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ), + &displ_opts->m_DisplayModTextFill, FILLED ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ), + &displ_opts->m_DisplayDrawItemsFill, FILLED ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), &displ_opts->m_DisplayZonesMode, 0, 0, 2 ) ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 6d1f397aba..c796ee844e 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -103,7 +103,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, if( layersmask_plotpads[F_SilkS] ) color = ColorFromInt( color | aBoard->GetLayerColor( F_SilkS ) ); - itemplotter.PlotPad( pad, color, LINE ); + itemplotter.PlotPad( pad, color, SKETCH ); } } } @@ -137,7 +137,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, continue; aPlotter->ThickSegment( seg->GetStart(), seg->GetEnd(), seg->GetWidth(), - itemplotter.GetMode() ); + itemplotter.GetPlotMode() ); } } @@ -285,7 +285,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, itemplotter.SetLayerSet( aLayerMask ); - EDA_DRAW_MODE_T plotMode = aPlotOpt.GetMode(); + EDA_DRAW_MODE_T plotMode = aPlotOpt.GetPlotMode(); // Plot edge layer and graphic items itemplotter.PlotBoardGraphicItems(); diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 7dd42a2f06..887ff9c089 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -222,9 +222,6 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, EDA_COLOR_T aColo thickness = pt_texte->GetThickness(); - if( GetMode() == LINE ) - thickness = -1; - if( pt_texte->IsMirrored() ) NEGATE( size.x ); // Text is mirrored @@ -249,7 +246,7 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) DRAWSEGMENT draw; - draw.SetWidth( (GetMode() == LINE) ? -1 : aDim->GetWidth() ); + draw.SetWidth( aDim->GetWidth() ); draw.SetLayer( aDim->GetLayer() ); EDA_COLOR_T color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() ); @@ -302,7 +299,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire ) DRAWSEGMENT draw; draw.SetShape( S_CIRCLE ); - draw.SetWidth( ( GetMode() == LINE ) ? -1 : aMire->GetWidth() ); + draw.SetWidth( aMire->GetWidth() ); draw.SetLayer( aMire->GetLayer() ); draw.SetStart( aMire->GetPosition() ); radius = aMire->GetSize() / 3; @@ -382,12 +379,12 @@ void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge ) switch( type_trace ) { case S_SEGMENT: - m_plotter->ThickSegment( pos, end, thickness, GetMode() ); + m_plotter->ThickSegment( pos, end, thickness, GetPlotMode() ); break; case S_CIRCLE: radius = KiROUND( GetLineLength( end, pos ) ); - m_plotter->ThickCircle( pos, radius * 2, thickness, GetMode() ); + m_plotter->ThickCircle( pos, radius * 2, thickness, GetPlotMode() ); break; case S_ARC: @@ -396,7 +393,7 @@ void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge ) double startAngle = ArcTangente( end.y - pos.y, end.x - pos.x ); double endAngle = startAngle + aEdge->GetAngle(); - m_plotter->ThickArc( pos, -endAngle, -startAngle, radius, thickness, GetMode() ); + m_plotter->ThickArc( pos, -endAngle, -startAngle, radius, thickness, GetPlotMode() ); } break; @@ -455,7 +452,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) size = pt_texte->GetSize(); pos = pt_texte->GetTextPosition(); orient = pt_texte->GetOrientation(); - thickness = ( GetMode() == LINE ) ? -1 : pt_texte->GetThickness(); + thickness = pt_texte->GetThickness(); if( pt_texte->IsMirrored() ) size.x = -size.x; @@ -528,7 +525,7 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) } // Plot the current filled area and its outline - if( GetMode() == FILLED ) + if( GetPlotMode() == FILLED ) { // Plot the filled area polygon. // The area can be filled by segments or uses solid polygons @@ -544,7 +541,7 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) wxPoint end = aZone->FillSegments()[iseg].m_End; m_plotter->ThickSegment( start, end, aZone->GetMinThickness(), - GetMode() ); + GetPlotMode() ); } // Plot the area outline only @@ -558,9 +555,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) { for( unsigned jj = 1; jjThickSegment( cornerList[jj -1], cornerList[jj], - ( GetMode() == LINE ) ? -1 : aZone->GetMinThickness(), - GetMode() ); + GetPlotMode() ); } m_plotter->SetCurrentLineWidth( -1 ); @@ -576,17 +572,12 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) */ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) { - int thickness; - int radius = 0; - double StAngle = 0, EndAngle = 0; - if( !m_layerMask[aSeg->GetLayer()] ) return; - if( GetMode() == LINE ) - thickness = GetLineWidth(); - else - thickness = aSeg->GetWidth(); + int radius = 0; + double StAngle = 0, EndAngle = 0; + int thickness = aSeg->GetWidth(); m_plotter->SetColor( getColor( aSeg->GetLayer() ) ); @@ -599,14 +590,14 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) { case S_CIRCLE: radius = KiROUND( GetLineLength( end, start ) ); - m_plotter->ThickCircle( start, radius * 2, thickness, GetMode() ); + m_plotter->ThickCircle( start, radius * 2, thickness, GetPlotMode() ); break; case S_ARC: radius = KiROUND( GetLineLength( end, start ) ); StAngle = ArcTangente( end.y - start.y, end.x - start.x ); EndAngle = StAngle + aSeg->GetAngle(); - m_plotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, GetMode() ); + m_plotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, GetPlotMode() ); break; case S_CURVE: @@ -616,12 +607,12 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) for( unsigned i = 1; i < bezierPoints.size(); i++ ) m_plotter->ThickSegment( bezierPoints[i - 1], bezierPoints[i], - thickness, GetMode() ); + thickness, GetPlotMode() ); } break; default: - m_plotter->ThickSegment( start, end, thickness, GetMode() ); + m_plotter->ThickSegment( start, end, thickness, GetPlotMode() ); } } @@ -646,10 +637,10 @@ void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, { aDrillSize.y -= getFineWidthAdj(); aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 ); - m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetMode() ); + m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetPlotMode() ); } else - m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetMode() ); + m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetPlotMode() ); } @@ -671,7 +662,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks() you could start a layer with negative polarity to scrape the film. - In DXF they go into the 'WHITE' layer. This could be useful. */ - if( GetMode() == FILLED ) + if( GetPlotMode() == FILLED ) m_plotter->SetColor( WHITE ); for( TRACK *pts = m_board->m_Track; pts != NULL; pts = pts->Next() ) @@ -698,6 +689,6 @@ void BRDITEMS_PLOTTER::PlotDrillMarks() } } - if( GetMode() == FILLED ) + if( GetPlotMode() == FILLED ) m_plotter->SetColor( GetColor() ); } diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index b6e9c705ca..72024e2467 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -71,11 +71,11 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, bool nctmp = GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE); GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false); displ_opts->m_DisplayPadIsol = false; - displ_opts->m_DisplayModEdge = FILLED; - displ_opts->m_DisplayModText = FILLED; + displ_opts->m_DisplayModEdgeFill = FILLED; + displ_opts->m_DisplayModTextFill = FILLED; displ_opts->m_DisplayPcbTrackFill = true; displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; - displ_opts->m_DisplayDrawItems = FILLED; + displ_opts->m_DisplayDrawItemsFill = FILLED; displ_opts->m_DisplayZonesMode = 0; displ_opts->m_DisplayNetNamesMode = 0; @@ -191,11 +191,11 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, false ); displ_opts->m_DisplayPadIsol = false; - displ_opts->m_DisplayModEdge = FILLED; - displ_opts->m_DisplayModText = FILLED; + displ_opts->m_DisplayModEdgeFill = FILLED; + displ_opts->m_DisplayModTextFill = FILLED; displ_opts->m_DisplayPcbTrackFill = true; displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; - displ_opts->m_DisplayDrawItems = FILLED; + displ_opts->m_DisplayDrawItemsFill = FILLED; displ_opts->m_DisplayZonesMode = 0; displ_opts->m_DisplayNetNamesMode = 0; diff --git a/qa/test.py b/qa/test.py index 88ce7bd841..3ebb93740f 100644 --- a/qa/test.py +++ b/qa/test.py @@ -12,7 +12,7 @@ if __name__ == '__main__': results = unittest.TextTestRunner(verbosity=100).run(testsuite) # Return an error code if any of the testsuite tests fail - if len(results.errors) > 0: + if not results.wasSuccessful(): sys.exit(1) diff --git a/qa/testcases/test_002_board_class.py b/qa/testcases/test_002_board_class.py index 98f82abc29..64dff3a6a9 100644 --- a/qa/testcases/test_002_board_class.py +++ b/qa/testcases/test_002_board_class.py @@ -51,8 +51,9 @@ class TestBoardClass(unittest.TestCase): bounding_box = pcb.ComputeBoundingBox() height, width = ToMM(bounding_box.GetSize()) - self.assertAlmostEqual(width, (30-10) + 0.5, 2) - self.assertAlmostEqual(height, (20-10) + 0.5, 2) + clearance = ToMM(track.GetClearance()*2) + self.assertAlmostEqual(width, (30-10) + 0.5 + clearance, 2) + self.assertAlmostEqual(height, (20-10) + 0.5 + clearance, 2) def test_pcb_get_pad(self): pcb = BOARD()