Commit d0aeb879 authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5357

parents ac26035f c9a1b239
[core]
excludesfile .bzrignore
......@@ -165,6 +165,51 @@ bool BASE_SCREEN::SetPreviousZoom()
return false;
}
/* Build the list of human readable grid list.
* The list shows the grid size both in mils or mm.
* aMmFirst = true to have mm first and mils after
* false to have mils first and mm after
*/
int BASE_SCREEN::BuildGridsChoiceList( wxArrayString& aGridsList, bool aMmFirst) const
{
wxString msg;
wxRealPoint curr_grid_size = GetGridSize();
int idx = -1;
int idx_usergrid = -1;
for( size_t i = 0; i < GetGridCount(); i++ )
{
const GRID_TYPE& grid = m_grids[i];
double gridValueMils = To_User_Unit( INCHES, grid.m_Size.x ) * 1000;
double gridValue_mm = To_User_Unit( MILLIMETRES, grid.m_Size.x );
if( grid.m_Id == ID_POPUP_GRID_USER )
{
msg = _( "User Grid" );
idx_usergrid = i;
}
else
{
if( aMmFirst )
msg.Printf( _( "Grid: %.4f mm (%.2f mils)" ),
gridValue_mm, gridValueMils );
else
msg.Printf( _( "Grid: %.2f mils (%.4f mm)" ),
gridValueMils, gridValue_mm );
}
aGridsList.Add( msg );
if( curr_grid_size == grid.m_Size )
idx = i;
}
if( idx < 0 )
idx = idx_usergrid;
return idx;
}
void BASE_SCREEN::SetGridList( GRIDS& gridlist )
{
......
/*
* 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) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* 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
......@@ -271,9 +271,9 @@ double RoundTo0( double x, double precision )
int remainder = ix % 10; // remainder is in precision mm
if ( remainder <= 2 )
if( remainder <= 2 )
ix -= remainder; // truncate to the near number
else if (remainder >= 8 )
else if( remainder >= 8 )
ix += 10 - remainder; // round to near number
if ( x < 0 )
......@@ -305,6 +305,46 @@ wxConfigBase* GetNewConfig( const wxString& aProgName )
return cfg;
}
wxString GetKicadLockFilePath()
{
wxFileName lockpath;
lockpath.AssignDir( wxGetHomeDir() ); // Default wx behavior
#if defined( __WXMAC__ )
// In OSX use the standard per user cache directory
lockpath.AppendDir( wxT( "Library" ) );
lockpath.AppendDir( wxT( "Caches" ) );
lockpath.AppendDir( wxT( "kicad" ) );
#elif defined( __UNIX__ )
wxString envstr;
// Try first the standard XDG_RUNTIME_DIR, falling back to XDG_CACHE_HOME
if( wxGetEnv( wxT( "XDG_RUNTIME_DIR" ), &envstr ) && !envstr.IsEmpty() )
{
lockpath.AssignDir( envstr );
}
else if( wxGetEnv( wxT( "XDG_CACHE_HOME" ), &envstr ) && !envstr.IsEmpty() )
{
lockpath.AssignDir( envstr );
}
else
{
// If all fails, just use ~/.cache
lockpath.AppendDir( wxT( ".cache" ) );
}
lockpath.AppendDir( wxT( "kicad" ) );
#endif
#if defined( __WXMAC__ ) || defined( __UNIX__ )
if( !lockpath.DirExists() )
{
// Lockfiles should be only readable by the user
lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL );
}
#endif
return lockpath.GetPath();
}
wxString GetKicadConfigPath()
{
......
......@@ -128,6 +128,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_snapToGrid = true;
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
m_movingCursorWithKeyboard = false;
m_zoomLevelCoeff = 1.0;
m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE);
......@@ -613,16 +614,7 @@ bool EDA_DRAW_FRAME::HandleBlockEnd( wxDC* DC )
void EDA_DRAW_FRAME::UpdateStatusBar()
{
wxString Line;
BASE_SCREEN* screen = GetScreen();
if( !screen )
return;
// Display Zoom level: zoom = zoom_coeff/ZoomScalar
Line.Printf( wxT( "Z %g" ), screen->GetZoom() );
SetStatusText( Line, 1 );
SetStatusText( GetZoomLevelIndicator(), 1 );
// Absolute and relative cursor positions are handled by overloading this function and
// handling the internal to user units conversion at the appropriate level.
......@@ -631,6 +623,22 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
DisplayUnitsMsg();
}
const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
{
BASE_SCREEN* screen = GetScreen();
wxString Line;
if( screen )
{
// returns a human readable value which can be displayed as zoom
// level indicator in dialogs.
double level = m_zoomLevelCoeff / (double)screen->GetZoom();
Line.Printf( wxT( "Z %.2f" ), level );
}
return Line;
}
void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
{
......
......@@ -101,7 +101,7 @@ void FOOTPRINT_INFO::load()
std::auto_ptr<MODULE> m( fptable->FootprintLoad( m_nickname, m_fpname ) );
m_pad_count = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
m_pad_count = m->GetPadCount( DO_NOT_INCLUDE_NPTH );
m_keywords = m->GetKeywords();
m_doc = m->GetDescription();
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2014-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.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
......@@ -24,6 +24,7 @@
#include <wx/filename.h>
#include <wx/snglinst.h>
#include <common.h>
wxSingleInstanceChecker* LockFile( const wxString& aFileName )
......@@ -41,7 +42,8 @@ wxSingleInstanceChecker* LockFile( const wxString& aFileName )
// We can have filenames coming from Windows, so also convert Windows separator
lockFileName.Replace( wxT( "\\" ), wxT( "_" ) );
wxSingleInstanceChecker* p = new wxSingleInstanceChecker( lockFileName );
wxSingleInstanceChecker* p = new wxSingleInstanceChecker( lockFileName,
GetKicadLockFilePath() );
if( p->IsAnotherRunning() )
{
......
/*
* 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 <stambaughw@verizon.net>
* 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 <stambaughw@verizon.net>
* 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
......@@ -353,7 +353,7 @@ bool PGM_BASE::initPgm()
wxInitAllImageHandlers();
m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId() );
m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId(), GetKicadLockFilePath() );
if( m_pgm_checker->IsAnotherRunning() )
{
......
......@@ -251,7 +251,7 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
// Populate zoom submenu.
for( int i = 0; i < maxZoomIds; i++ )
{
msg.Printf( wxT( "%g" ), screen->m_ZoomList[i] );
msg.Printf( wxT( "%.2f" ), m_zoomLevelCoeff / screen->m_ZoomList[i] );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
wxEmptyString, wxITEM_CHECK );
......@@ -266,43 +266,16 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
AddMenuItem( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
_( "Grid Select" ), KiBitmap( grid_select_xpm ) );
GRID_TYPE tmp;
wxRealPoint grid = screen->GetGridSize();
wxArrayString gridsList;
int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
for( size_t i = 0; i < screen->GetGridCount(); i++ )
for( unsigned i = 0; i < gridsList.GetCount(); i++ )
{
tmp = screen->GetGrid( i );
double gridValueInch = To_User_Unit( INCHES, tmp.m_Size.x );
double gridValue_mm = To_User_Unit( MILLIMETRES, tmp.m_Size.x );
if( tmp.m_Id == ID_POPUP_GRID_USER )
{
msg = _( "User Grid" );
}
else
{
switch( g_UserUnit )
{
case INCHES:
msg.Printf( wxT( "%.1f mils, (%.4f mm)" ),
gridValueInch * 1000, gridValue_mm );
break;
case MILLIMETRES:
msg.Printf( wxT( "%.4f mm, (%.1f mils)" ),
gridValue_mm, gridValueInch * 1000 );
break;
case UNSCALED_UNITS:
msg = wxT( "???" );
break;
}
}
gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );
if( grid == tmp.m_Size )
gridMenu->Check( tmp.m_Id, true );
GRID_TYPE& grid = screen->GetGrid( i );
gridMenu->Append( grid.m_Id, gridsList[i], wxEmptyString, true );
if( (int)i == icurr )
gridMenu->Check( grid.m_Id, true );
}
}
......
......@@ -442,17 +442,6 @@ bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, i
return false;
m_NetlistFileName = aFileSet[0];
ReadNetListAndLinkFiles();
UpdateTitle();
// Resize the components list box. This is needed in case the
// contents have shrunk compared to the previous netlist.
m_compListBox->UpdateWidth();
// OSX need it since some objects are "rebuild" just make aware AUI
// Fixes #1258081
m_auimgr.Update();
if( Kiface().IsSingle() )
{
......@@ -470,6 +459,18 @@ bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, i
Prj().SetProjectFullName( pro.GetFullPath() );
}
ReadNetListAndLinkFiles();
UpdateTitle();
// Resize the components list box. This is needed in case the
// contents have shrunk compared to the previous netlist.
m_compListBox->UpdateWidth();
// OSX need it since some objects are "rebuild" just make aware AUI
// Fixes #1258081
m_auimgr.Update();
return true;
}
......
Cmp-Mod V01 Created by Cvpcb (2014-12-31 BZR 5344)-product date = 01/01/2015 18:25:40
Cmp-Mod V01 Created by Cvpcb (2014-12-31 BZR 5344)-product date = 01/01/2015 20:57:19
BeginCmp
TimeStamp = /4549F4BE;
......@@ -102,7 +102,7 @@ BeginCmp
TimeStamp = /48B4F266;
Reference = U1;
ValeurCmp = ECC83;
IdModule = Valves:VALVE-ECC-83-1;
IdModule = Valves:VALVE-ECC-83-2;
EndCmp
EndListe
This diff is collapsed.
(export (version D)
(design
(source F:/kicad-launchpad/testing/demos/ecc83/ecc83-pp_v2.sch)
(date "01/01/2015 18:25:50")
(date "01/01/2015 20:57:24")
(tool "Eeschema (2014-12-31 BZR 5344)-product"))
(components
(comp (ref U1)
(value ECC83)
(footprint Valves:VALVE-ECC-83-1)
(footprint Valves:VALVE-ECC-83-2)
(libsource (lib valves) (part ECC83))
(sheetpath (names /) (tstamps /))
(tstamp 48B4F266))
......@@ -95,18 +95,6 @@
(sheetpath (names /) (tstamps /))
(tstamp 54A58391)))
(libparts
(libpart (lib device) (part C)
(description "Condensateur non polarise")
(footprints
(fp SM*)
(fp C?)
(fp C1-1))
(fields
(field (name Reference) C)
(field (name Value) C))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib device) (part R)
(description Resistance)
(footprints
......@@ -138,6 +126,18 @@
(pin (num 7) (name G) (type input))
(pin (num 8) (name K) (type BiDi))
(pin (num 9) (name F2) (type power_in))))
(libpart (lib device) (part C)
(description "Condensateur non polarise")
(footprints
(fp SM*)
(fp C?)
(fp C1-1))
(fields
(field (name Reference) C)
(field (name Value) C))
(pins
(pin (num 1) (name ~) (type passive))
(pin (num 2) (name ~) (type passive))))
(libpart (lib conn) (part CONN_1)
(description "1 pin")
(fields
......
......@@ -5,25 +5,6 @@ LIBS:valves
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers
LIBS:microchip
LIBS:analog_switches
LIBS:motorola
LIBS:intel
LIBS:audio
LIBS:interface
LIBS:digital-audio
LIBS:philips
LIBS:display
LIBS:cypress
LIBS:siliconi
LIBS:contrib
LIBS:ecc83-pp_v2-cache
EELAYER 25 0
EELAYER END
......@@ -105,7 +86,7 @@ U 3 1 48B4F266
P 2000 6100
F 0 "U1" H 2130 6410 50 0000 C CNN
F 1 "ECC83" H 2350 5800 50 0000 C CNN
F 2 "Valves:VALVE-ECC-83-1" H 2450 5650 50 0000 C CNN
F 2 "Valves:VALVE-ECC-83-2" V 1750 6100 30 0000 C CNN
F 3 "" H 2000 6100 60 0001 C CNN
3 2000 6100
1 0 0 -1
......@@ -116,7 +97,7 @@ U 2 1 48B4F263
P 4950 4450
F 0 "U1" H 5080 4760 50 0000 C CNN
F 1 "ECC83" H 5150 4100 50 0000 C CNN
F 2 "Valves:VALVE-ECC-83-1" H 5150 4000 50 0000 C CNN
F 2 "Valves:VALVE-ECC-83-2" H 5150 4000 30 0000 C CNN
F 3 "" H 4950 4450 60 0001 C CNN
2 4950 4450
1 0 0 -1
......@@ -127,7 +108,7 @@ U 1 1 48B4F256
P 5750 4450
F 0 "U1" H 5880 4760 50 0000 C CNN
F 1 "ECC83" H 5500 4150 50 0000 C CNN
F 2 "Valves:VALVE-ECC-83-1" H 5750 3950 50 0000 C CNN
F 2 "Valves:VALVE-ECC-83-2" H 5750 3950 30 0000 C CNN
F 3 "" H 5750 4450 60 0001 C CNN
1 5750 4450
-1 0 0 -1
......@@ -193,7 +174,7 @@ U 1 1 456A8ACC
P 2000 7100
F 0 "P4" V 1950 7100 40 0000 C CNN
F 1 "CONN_2" V 2050 7100 40 0000 C CNN
F 2 "pin_array:pin_array_1x02" V 2150 7100 60 0000 C CNN
F 2 "pin_array:pin_array_1x02" V 2150 7100 30 0000 C CNN
F 3 "" H 2000 7100 60 0001 C CNN
1 2000 7100
0 1 1 0
......@@ -204,7 +185,7 @@ U 1 1 4549F4BE
P 6700 4050
F 0 "C1" H 6750 4150 50 0000 L CNN
F 1 "10uF" H 6450 4150 50 0000 L CNN
F 2 "discret:C2V10" H 6700 4050 60 0000 C CNN
F 2 "discret:C2V10" H 6700 3950 30 0000 C CNN
F 3 "" H 6700 4050 60 0001 C CNN
1 6700 4050
1 0 0 -1
......@@ -237,7 +218,7 @@ U 1 1 4549F4A5
P 7300 3950
F 0 "P3" V 7250 3950 40 0000 C CNN
F 1 "POWER" V 7350 3950 40 0000 C CNN
F 2 "pin_array:pin_array_1x02" H 7300 4150 60 0000 C CNN
F 2 "pin_array:pin_array_1x02" V 7450 3950 30 0000 C CNN
F 3 "" H 7300 3950 60 0001 C CNN
1 7300 3950
1 0 0 -1
......@@ -248,7 +229,7 @@ U 1 1 4549F46C
P 7300 4900
F 0 "P2" V 7250 4900 40 0000 C CNN
F 1 "OUT" V 7350 4900 40 0000 C CNN
F 2 "pin_array:pin_array_1x02" H 7300 5100 60 0000 C CNN
F 2 "pin_array:pin_array_1x02" V 7450 4900 30 0000 C CNN
F 3 "" H 7300 4900 60 0001 C CNN
1 7300 4900
1 0 0 -1
......@@ -259,7 +240,7 @@ U 1 1 4549F464
P 3800 4900
F 0 "P1" V 3750 4900 40 0000 C CNN
F 1 "IN" V 3850 4900 40 0000 C CNN
F 2 "pin_array:pin_array_1x02" H 3750 4700 60 0000 C CNN
F 2 "pin_array:pin_array_1x02" V 3950 4900 30 0000 C CNN
F 3 "" H 3800 4900 60 0001 C CNN
1 3800 4900
-1 0 0 1
......@@ -270,7 +251,7 @@ U 1 1 4549F3BE
P 6500 4800
F 0 "C2" H 6550 4900 50 0000 L CNN
F 1 "680nF" H 6550 4700 50 0000 L CNN
F 2 "discret:CP8" H 6400 4900 60 0000 C CNN
F 2 "discret:CP8" V 6350 4800 30 0000 C CNN
F 3 "" H 6500 4800 60 0001 C CNN
1 6500 4800
0 1 1 0
......@@ -314,7 +295,7 @@ U 1 1 4549F38A
P 6300 4250
F 0 "R1" V 6380 4250 50 0000 C CNN
F 1 "1.5K" V 6300 4250 50 0000 C CNN
F 2 "discret:R3" H 6400 4150 60 0000 C CNN
F 2 "discret:R3" V 6450 4250 30 0000 C CNN
F 3 "" H 6300 4250 60 0001 C CNN
1 6300 4250
1 0 0 -1
......
......@@ -419,8 +419,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( preferencesMenu,
ID_CONFIG_READ,
_( "&Read Preferences" ),
_( "Read application preferences" ),
_( "Load Prefe&rences" ),
_( "Load application preferences" ),
KiBitmap( read_setup_xpm ) );
// Menu Tools:
......@@ -446,8 +446,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// ERC
AddMenuItem( toolsMenu,
ID_GET_ERC,
_( "Electric Rules &Checker" ),
_( "Perform electrical rule check" ),
_( "Electrical Rules &Checker" ),
_( "Perform electrical rules check" ),
KiBitmap( erc_xpm ) );
AddMenuItem( toolsMenu,
......
......@@ -35,6 +35,10 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition,
aSize, aStyle, aFrameName )
{
m_zoomLevelCoeff = 11.0; // Adjusted to roughly displays zoom level = 1
// when the screen shows a 1:1 image
// obviously depends on the monitor,
// but this is an acceptable value
}
......@@ -64,6 +68,10 @@ SCH_SCREEN* SCH_BASE_FRAME::GetScreen() const
return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen();
}
const wxString SCH_BASE_FRAME::GetZoomLevelIndicator() const
{
return EDA_DRAW_FRAME::GetZoomLevelIndicator();
}
void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
......
......@@ -57,21 +57,13 @@
#define EESCHEMA_FILE_STAMP "EESchema"
/* Default Eeschema zoom values. Limited to 17 values to keep a decent size
/* Default zoom values. Limited to these values to keep a decent size
* to menus
*/
/* Please, note: wxMSW before version 2.9 seems have
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
* edit file <wxWidgets>/src/msw/dc.cpp
* search for line static const int VIEWPORT_EXTENT = 1000;
* and replace by static const int VIEWPORT_EXTENT = 10000;
* see http://trac.wxwidgets.org/ticket/9554
* This is a workaround that is not a full fix, but remaining artifacts are acceptable
*/
static double SchematicZoomList[] =
{
0.5, 0.7, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0,
12.0, 16.0, 23.0, 32.0, 48.0, 64.0, 80.0, 128.0
0.5, 0.7, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0, 11.0,
13.0, 16.0, 20.0, 26.0, 32.0, 48.0, 64.0, 80.0, 128.0
};
#define MM_TO_SCH_UNITS 1000.0 / 25.4 //schematic internal unites are mils
......
......@@ -146,7 +146,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
HELP_ANNOTATE );
m_mainToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiBitmap( erc_xpm ),
_( "Perform electrical rule check" ) );
_( "Perform electrical rules check" ) );
m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ),
_( "Generate netlist" ) );
......
......@@ -46,6 +46,7 @@
static const double gbrZoomList[] =
{
ZOOM_FACTOR( 0.5 ),
ZOOM_FACTOR( 0.75 ),
ZOOM_FACTOR( 1.0 ),
ZOOM_FACTOR( 1.5 ),
ZOOM_FACTOR( 2.0 ),
......@@ -58,7 +59,8 @@ static const double gbrZoomList[] =
ZOOM_FACTOR( 35.0 ),
ZOOM_FACTOR( 50.0 ),
ZOOM_FACTOR( 80.0 ),
ZOOM_FACTOR( 120.0 ),
ZOOM_FACTOR( 110.0 ),
ZOOM_FACTOR( 150.0 ),
ZOOM_FACTOR( 200.0 ),
ZOOM_FACTOR( 350.0 ),
ZOOM_FACTOR( 500.0 ),
......
......@@ -70,6 +70,11 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
{
m_colorsSettings = &g_ColorsSettings;
m_gerberLayout = NULL;
m_zoomLevelCoeff = ZOOM_FACTOR( 110 ); // Adjusted to roughly displays zoom level = 1
// when the screen shows a 1:1 image
// obviously depends on the monitor,
// but this is an acceptable value
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
......@@ -863,12 +868,12 @@ void GERBVIEW_FRAME::UpdateStatusBar()
{
case INCHES:
absformatter = wxT( "X %.6f Y %.6f" );
locformatter = wxT( "dx %.6f dy %.6f d %.6f" );
locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
break;
case MILLIMETRES:
absformatter = wxT( "X %.5f Y %.5f" );
locformatter = wxT( "dx %.5f dy %.5f d %.5f" );
locformatter = wxT( "dx %.5f dy %.5f dist %.3f" );
break;
case UNSCALED_UNITS:
......@@ -894,3 +899,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
}
}
const wxString GERBVIEW_FRAME::GetZoomLevelIndicator() const
{
return EDA_DRAW_FRAME::GetZoomLevelIndicator();
}
......@@ -235,6 +235,14 @@ public:
double BestZoom();
void UpdateStatusBar();
/**
* Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom
* level indicator in dialogs.
* Virtual from the base class
*/
const wxString GetZoomLevelIndicator() const;
/**
* Function ReportMessage
* Add a message (a string) in message list
......
......@@ -452,6 +452,18 @@ public:
return m_grids;
}
/**
* Function BuildGridsChoiceList().
* Build the human readable list of grid list, for menus or combo boxes
* the list shows the grid size both in mils or mm.
* @param aGridsList = a wxArrayString to populate
* @param aMmFirst = true to have mm first and mils after
* false to have mils first and mm after
* @return the index of the curr grid in list, if found or -1
*/
int BuildGridsChoiceList( wxArrayString& aGridsList, bool aMmFirst) const;
/**
* Function GetClass
* returns the class name.
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* 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
......@@ -278,7 +278,7 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = NULL );
* wxExecute())
*/
int ProcessExecute( const wxString& aCommandLine, int aFlags = wxEXEC_ASYNC,
wxProcess *callback = NULL );
wxProcess *callback = NULL );
/*******************/
......@@ -433,6 +433,12 @@ const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPa
*/
wxConfigBase* GetNewConfig( const wxString& aProgName );
/**
* Function GetKicadLockFilePath
* @return A wxString containing the path for lockfiles in Kicad
*/
wxString GetKicadLockFilePath();
/**
* Function GetKicadConfigPath
* @return A wxString containing the config path for Kicad
......
......@@ -65,6 +65,9 @@ protected:
EDA_COLOR_T m_gridColor; // Grid color
EDA_COLOR_T m_drawBgColor; ///< the background color of the draw canvas
///< BLACK for Pcbnew, BLACK or WHITE for eeschema
double m_zoomLevelCoeff; ///< a suitable value to convert the internal zoom scaling factor
// to a zoom level value which rougly gives 1.0 when the board/schematic
// is at scale = 1
/// The area to draw on.
EDA_DRAW_PANEL* m_canvas;
......@@ -329,6 +332,17 @@ public:
*/
virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
/**
* Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom
* level indicator in dialogs.
* this can be a percentage or other indicator.
* it is virtual because it could be different for pcbnew, gerbview or eeschema
* (different internal units and different purposes)
* note also adjust m_zoomLevelCoeff is the way to adjust the displayed value
*/
virtual const wxString GetZoomLevelIndicator() const;
void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event );
......
......@@ -80,7 +80,7 @@ enum EDA_DRAW_MODE_T {
class EDA_TEXT
{
protected:
wxString m_Text; ///< The 'base' text, maybe later processed for display
wxString m_Text; ///< The 'base' text, maybe later processed for display
int m_Thickness; ///< pen size used to draw this text
double m_Orient; ///< Orient in 0.1 degrees
wxPoint m_Pos; ///< XY position of anchor text.
......@@ -200,12 +200,12 @@ public:
* @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplay_mode = LINE, FILLED or SKETCH
* @param aAnchor_color = anchor color ( UNSPECIFIED = do not draw anchor ).
* @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,
EDA_COLOR_T aAnchor_color = UNSPECIFIED_COLOR );
EDA_COLOR_T aAnchor_color = EDA_COLOR_T(UNSPECIFIED_COLOR) );
/**
* Convert the text shape to a list of segment
......
......@@ -54,6 +54,14 @@ public:
SCH_SCREEN* GetScreen() const; // overload EDA_DRAW_FRAME
/**
* Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom
* level indicator in dialogs.
* Virtual from the base class
*/
const wxString GetZoomLevelIndicator() const;
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
......
......@@ -201,6 +201,14 @@ public:
*/
virtual double BestZoom();
/**
* Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom
* level indicator in dialogs.
* Virtual from the base class
*/
const wxString GetZoomLevelIndicator() const;
virtual void Show3D_Frame( wxCommandEvent& event );
// Read/write functions:
......
......@@ -52,8 +52,10 @@ static const double pl_editorZoomList[] =
ZOOM_FACTOR( 50.0 ),
ZOOM_FACTOR( 80.0 ),
ZOOM_FACTOR( 120.0 ),
ZOOM_FACTOR( 200.0 ),
ZOOM_FACTOR( 350.0 ),
ZOOM_FACTOR( 160.0 ),
ZOOM_FACTOR( 230.0 ),
ZOOM_FACTOR( 290.0 ),
ZOOM_FACTOR( 380.0 ),
ZOOM_FACTOR( 500.0 ),
ZOOM_FACTOR( 750.0 ),
ZOOM_FACTOR( 1000.0 ),
......
......@@ -27,7 +27,6 @@
*/
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <build_version.h>
......@@ -58,6 +57,10 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME )
{
m_FrameName = PL_EDITOR_FRAME_NAME;
m_zoomLevelCoeff = 290.0; // Adjusted to roughly displays zoom level = 1
// when the screen shows a 1:1 image
// obviously depends on the monitor,
// but this is an acceptable value
m_showAxis = false; // true to show X and Y axis on screen
m_showGridAxis = true;
......@@ -404,6 +407,9 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
if( !screen )
return;
// Display Zoom level:
EDA_DRAW_FRAME::UpdateStatusBar();
// coodinate origin can be the paper Top Left corner,
// or each of 4 page corners
// We know the origin, and the orientation of axis
......@@ -491,10 +497,6 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos );
SetStatusText( line, 3 );
// Display Zoom level: zoom = zoom_coeff/ZoomScalar
line.Printf( wxT( "Z %.1f" ), screen->GetZoom() );
SetStatusText( line, 1 );
// Display corner reference for coord origin
line.Printf( _("coord origin: %s"),
m_originSelectBox->GetString( m_originSelectChoice ). GetData() );
......@@ -773,3 +775,9 @@ void PL_EDITOR_FRAME::OnNewPageLayout()
Zoom_Automatique( true );
m_canvas->Refresh();
}
const wxString PL_EDITOR_FRAME::GetZoomLevelIndicator() const
{
return EDA_DRAW_FRAME::GetZoomLevelIndicator();
}
......@@ -108,6 +108,14 @@ public:
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
/**
* Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom
* level indicator in dialogs.
* Virtual from the base class
*/
const wxString GetZoomLevelIndicator() const;
PL_EDITOR_SCREEN* GetScreen() const // overload EDA_DRAW_FRAME
{
return (PL_EDITOR_SCREEN*) EDA_DRAW_FRAME::GetScreen();
......
......@@ -116,6 +116,11 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_FastGrid2 = 0;
m_auxiliaryToolBar = NULL;
m_zoomLevelCoeff = 110.0 * IU_PER_DECIMILS; // Adjusted to roughly displays zoom level = 1
// when the screen shows a 1:1 image
// obviously depends on the monitor,
// but this is an acceptable value
}
......@@ -630,8 +635,6 @@ void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
*/
void PCB_BASE_FRAME::UpdateStatusBar()
{
EDA_DRAW_FRAME::UpdateStatusBar();
PCB_SCREEN* screen = GetScreen();
if( !screen )
......@@ -644,6 +647,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
wxString line;
wxString locformatter;
EDA_DRAW_FRAME::UpdateStatusBar();
if( DisplayOpt.DisplayPolarCood ) // display polar coordinates
{
double theta, ro;
......@@ -657,26 +662,16 @@ void PCB_BASE_FRAME::UpdateStatusBar()
wxString formatter;
switch( g_UserUnit )
{
#if defined( USE_PCBNEW_NANOMETRE )
case INCHES:
formatter = wxT( "Ro %.6f Th %.1f" );
break;
case MILLIMETRES:
formatter = wxT( "Ro %.6f Th %.1f" );
break;
#else
case INCHES:
formatter = wxT( "Ro %.4f Th %.1f" );
formatter = wxT( "Ro %.6f Th %.1f" );
break;
case MILLIMETRES:
formatter = wxT( "Ro %.3f Th %.1f" );
formatter = wxT( "Ro %.6f Th %.1f" );
break;
#endif
case UNSCALED_UNITS:
formatter = wxT( "Ro %f Th %f" );
formatter = wxT( "Ro %f Th %f" );
break;
}
......@@ -696,17 +691,17 @@ void PCB_BASE_FRAME::UpdateStatusBar()
{
case INCHES:
absformatter = wxT( "X %.6f Y %.6f" );
locformatter = wxT( "dx %.6f dy %.6f d %.6f" );
locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
break;
case MILLIMETRES:
absformatter = wxT( "X %.6f Y %.6f" );
locformatter = wxT( "dx %.6f dy %.6f d %.6f" );
locformatter = wxT( "dx %.6f dy %.6f dist %.3f" );
break;
case UNSCALED_UNITS:
absformatter = wxT( "X %f Y %f" );
locformatter = wxT( "dx %f dy %f d %f" );
locformatter = wxT( "dx %f dy %f dist %f" );
break;
}
......@@ -800,6 +795,12 @@ void PCB_BASE_FRAME::OnModify()
}
const wxString PCB_BASE_FRAME::GetZoomLevelIndicator() const
{
return EDA_DRAW_FRAME::GetZoomLevelIndicator();
}
void PCB_BASE_FRAME::updateGridSelectBox()
{
UpdateStatusBar();
......@@ -810,42 +811,16 @@ void PCB_BASE_FRAME::updateGridSelectBox()
// Update grid values with the current units setting.
m_gridSelectBox->Clear();
wxString msg;
wxString format = _( "Grid:");
switch( g_UserUnit )
{
case INCHES: // the grid size is displayed in mils
case MILLIMETRES:
format += wxT( " %.6f" );
break;
case UNSCALED_UNITS:
format += wxT( " %f" );
break;
}
wxArrayString gridsList;
int icurr = GetScreen()->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
{
GRID_TYPE& grid = GetScreen()->GetGrid( i );
double value = To_User_Unit( g_UserUnit, grid.m_Size.x );
if( g_UserUnit == INCHES )
value *= 1000;
if( grid.m_Id != ID_POPUP_GRID_USER )
{
msg.Printf( format.GetData(), value );
StripTrailingZeros( msg );
}
else
msg = _( "User Grid" );
m_gridSelectBox->Append( msg, (void*) &grid.m_Id );
if( ( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) == GetScreen()->GetGrid( i ).m_Id )
m_gridSelectBox->SetSelection( i );
m_gridSelectBox->Append( gridsList[i], (void*) &grid.m_Id );
}
m_gridSelectBox->SetSelection( icurr );
}
void PCB_BASE_FRAME::updateZoomSelectBox()
......@@ -856,19 +831,15 @@ void PCB_BASE_FRAME::updateZoomSelectBox()
wxString msg;
m_zoomSelectBox->Clear();
m_zoomSelectBox->Append( _( "Auto" ) );
m_zoomSelectBox->Append( _( "Zoom Auto" ) );
m_zoomSelectBox->SetSelection( 0 );
for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); ++i )
{
msg = _( "Zoom " );
wxString value = wxString::Format( wxT( "%g" ),
// @todo could do scaling here and show a "percentage"
GetScreen()->m_ZoomList[i]
);
double level = m_zoomLevelCoeff / (double)GetScreen()->m_ZoomList[i];
wxString value = wxString::Format( wxT( "%.2f" ), level );
msg += value;
m_zoomSelectBox->Append( msg );
......
......@@ -52,6 +52,12 @@ class BOARD;
class MSG_PANEL_ITEM;
enum INCLUDE_NPTH_T
{
DO_NOT_INCLUDE_NPTH = false,
INCLUDE_NPTH = true
};
/**
* Enum MODULE_ATTR_T
* is the set of attributes allowed within a MODULE, using MODULE::SetAttributes()
......@@ -425,12 +431,6 @@ public:
*/
D_PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
enum INCLUDE_NPTH_T
{
DO_NOT_INCLUDE_NPTH = false,
INCLUDE_NPTH = true
};
/**
* GetPadCount
* returns the number of pads.
......@@ -439,7 +439,7 @@ public:
* non-plated through holes when false.
* @return the number of pads according to \a aIncludeNPTH.
*/
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH ) const;
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T( INCLUDE_NPTH ) ) const;
double GetArea() const { return m_Surface; }
......
......@@ -62,6 +62,8 @@
Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic
functions )
*/
#define DEFAULT_ZOOM ZOOM_FACTOR( 120 )
static const double pcbZoomList[] =
{
ZOOM_FACTOR( 0.1 ),
......@@ -73,17 +75,18 @@ static const double pcbZoomList[] =
ZOOM_FACTOR( 2.0 ),
ZOOM_FACTOR( 3.0 ),
ZOOM_FACTOR( 4.5 ),
ZOOM_FACTOR( 7.0 ),
ZOOM_FACTOR( 10.0 ),
ZOOM_FACTOR( 6.0 ),
ZOOM_FACTOR( 8.0 ),
ZOOM_FACTOR( 11.0 ),
ZOOM_FACTOR( 15.0 ),
ZOOM_FACTOR( 22.0 ),
ZOOM_FACTOR( 35.0 ),
ZOOM_FACTOR( 50.0 ),
ZOOM_FACTOR( 80.0 ),
ZOOM_FACTOR( 120.0 ),
ZOOM_FACTOR( 110.0 ),
ZOOM_FACTOR( 150.0 ),
ZOOM_FACTOR( 200.0 ),
ZOOM_FACTOR( 300.0 ),
/*
The largest distance that wx can support is INT_MAX, since it represents
distance often in a wxCoord or wxSize. As a scalar, a distance is always
......@@ -179,7 +182,7 @@ PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) :
m_Route_Layer_TOP = F_Cu; // default layers pair for vias (bottom to top)
m_Route_Layer_BOTTOM = B_Cu;
SetZoom( ZOOM_FACTOR( 120 ) ); // a default value for zoom
SetZoom( DEFAULT_ZOOM ); // a default value for zoom
InitDataPoints( aPageSizeIU );
}
......
......@@ -714,7 +714,7 @@ void WIZARD_FPLIB_TABLE::selectLibsGithub() // select a set of library on Git
wxArrayString urls;
// Run the web viewer and open the default URL: the default path
// or our github library depos
// or our github library repos
wxString defaultURL = m_currLibDescr->m_DefaultPath;
if( defaultURL.IsEmpty() )
......
......@@ -22,7 +22,7 @@ WIZARD_FPLIB_TABLE_BASE::WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID i
wxBoxSizer* bSizerPage1;
bSizerPage1 = new wxBoxSizer( wxVERTICAL );
wxString m_rbFpLibFormatChoices[] = { _("KiCad (*.Pretty folder containing .kicad_mod files)"), _("GitHub (.Pretty lib stored on GitHub depos)"), _("Legacy ( old *.mod lib file)"), _("Eagle V6 xml library file"), _("Geda footprint folder (folder containing *.fp files)") };
wxString m_rbFpLibFormatChoices[] = { _("KiCad (*.Pretty folder containing .kicad_mod files)"), _("GitHub (.Pretty lib stored on GitHub repos)"), _("Legacy ( old *.mod lib file)"), _("Eagle V6 xml library file"), _("Geda footprint folder (folder containing *.fp files)") };
int m_rbFpLibFormatNChoices = sizeof( m_rbFpLibFormatChoices ) / sizeof( wxString );
m_rbFpLibFormat = new wxRadioBox( m_wizPage1, wxID_ANY, _("Library Format:"), wxDefaultPosition, wxDefaultSize, m_rbFpLibFormatNChoices, m_rbFpLibFormatChoices, 1, wxRA_SPECIFY_COLS );
m_rbFpLibFormat->SetSelection( 0 );
......
......@@ -153,7 +153,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;KiCad (*.Pretty folder containing .kicad_mod files)&quot; &quot;GitHub (.Pretty lib stored on GitHub depos)&quot; &quot;Legacy ( old *.mod lib file)&quot; &quot;Eagle V6 xml library file&quot; &quot;Geda footprint folder (folder containing *.fp files)&quot;</property>
<property name="choices">&quot;KiCad (*.Pretty folder containing .kicad_mod files)&quot; &quot;GitHub (.Pretty lib stored on GitHub repos)&quot; &quot;Legacy ( old *.mod lib file)&quot; &quot;Eagle V6 xml library file&quot; &quot;Geda footprint folder (folder containing *.fp files)&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......
......@@ -548,7 +548,7 @@ bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName, bool aUseThou )
idfBoard.SetLibraryVersion( 0 );
std::ostringstream ostr;
ostr << "Created by KiCad " << TO_UTF8( GetBuildVersion() );
ostr << "KiCad " << TO_UTF8( GetBuildVersion() );
idfBoard.SetIDFSource( ostr.str() );
try
......
......@@ -52,7 +52,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
GetScreen()->ClearUndoRedoList();
GetScreen()->ClrModify();
// Items visibility flags will be set becuse a new board will be created.
// Items visibility flags will be set because a new board will be created.
// Grid and ratsnest can be left to their previous state
bool showGrid = IsElementVisible( GRID_VISIBLE );
bool showRats = IsElementVisible( RATSNEST_VISIBLE );
......@@ -68,11 +68,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
// clear filename, to avoid overwriting an old file
GetBoard()->SetFileName( wxEmptyString );
// preserve grid size accross call to InitDataPoints()
// wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen()->InitDataPoints( GetPageSizeIU() );
// GetScreen()->SetGrid( gridsize );
GetBoard()->ResetHighLight();
......@@ -82,9 +78,10 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
// Default copper layers count set to 2: double layer board
GetBoard()->SetCopperLayerCount( 2 );
// Update display
// Update display (some options depend on the board setup)
GetBoard()->SetVisibleLayers( LSET().set() );
ReCreateLayerBox();
ReCreateAuxiliaryToolbar();
ReFillLayerWidget();
Zoom_Automatique( false );
......@@ -116,10 +113,7 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
SetCurItem( NULL );
// preserve grid size accross call to InitDataPoints()
// wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen()->InitDataPoints( GetPageSizeIU() );
// GetScreen()->SetGrid( gridsize );
Zoom_Automatique( false );
......
......@@ -510,8 +510,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( save_setup_xpm ) );
AddMenuItem( configmenu, ID_CONFIG_READ,
_( "&Read Preferences" ),
_( "Read application preferences" ),
_( "Load Prefe&rences" ),
_( "Load application preferences" ),
KiBitmap( read_setup_xpm ) );
//----- Tools menu ----------------------------------------------------------
......
......@@ -731,8 +731,7 @@ void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event )
if( returncode == wxID_OK ) // New rules, or others changes.
{
ReCreateLayerBox();
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
ReCreateAuxiliaryToolbar();
OnModify();
}
}
......@@ -876,8 +875,7 @@ void PCB_EDIT_FRAME::unitsChangeRefresh()
{
PCB_BASE_FRAME::unitsChangeRefresh(); // Update the grid size select box.
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
ReCreateAuxiliaryToolbar();
}
......@@ -1064,8 +1062,7 @@ bool PCB_EDIT_FRAME::SetCurrentNetClass( const wxString& aNetClassName )
if( change )
{
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
ReCreateAuxiliaryToolbar();
}
return change;
......
......@@ -31,7 +31,7 @@
%extend BOARD
{
%pythoncode
{
%{
def GetModules(self): return self.m_Modules
def GetDrawings(self): return self.m_Drawings
def GetTracks(self): return self.m_Track
......@@ -48,7 +48,7 @@
def Add(self,item):
item.thisown=0
self.AddNative(item)
}
%}
}
......
......@@ -31,7 +31,7 @@
%extend MODULE
{
%pythoncode
{
%{
#def SaveToLibrary(self,filename):
# return SaveModuleToLibrary(filename,self)
......@@ -51,7 +51,7 @@
elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]:
item.thisown = 0
self.GraphicalItems().PushBack(item)
}
%}
}
......
......@@ -296,11 +296,11 @@ class HelpfulFootprintWizardPlugin(pcbnew.FootprintWizardPlugin,
fpid = pcbnew.FPID(self.module.GetValue()) # the name in library
self.module.SetFPID(fpid)
self.BuildThisFootprint() # implementer's build function
self.SetModule3DModel() # add a 3d module if specified
thick = self.GetTextThickness()
self.module.Reference().SetThickness(thick)
self.module.Value().SetThickness(thick)
self.BuildThisFootprint() # implementer's build function
......@@ -51,8 +51,7 @@ void PCB_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_OK )
{
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
ReCreateAuxiliaryToolbar();
}
break;
......
......@@ -46,13 +46,6 @@
#include <wx/wupdlock.h>
#ifdef __UNIX__
#define LISTBOX_WIDTH 150
#else
#define LISTBOX_WIDTH 130
#endif
#define SEL_LAYER_HELP _( \
"Show active layer selections\nand select layer pair for route and place via" )
......@@ -551,7 +544,20 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
wxWindowUpdateLocker dummy( this );
if( m_auxiliaryToolBar )
{
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
// combobox sizes can have changed: apply new best sizes
wxAuiToolBarItem* item = m_auxiliaryToolBar->FindTool( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH );
item->SetMinSize( m_SelTrackWidthBox->GetBestSize() );
item = m_auxiliaryToolBar->FindTool( ID_AUX_TOOLBAR_PCB_VIA_SIZE );
item->SetMinSize( m_SelViaSizeBox->GetBestSize() );
m_auxiliaryToolBar->Realize();
m_auimgr.Update();
return;
}
m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
......@@ -562,19 +568,19 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_SelTrackWidthBox = new wxComboBox( m_auxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
updateTraceWidthSelectBox();
m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_auxiliaryToolBar->AddSeparator();
// m_auxiliaryToolBar->AddSeparator();
// Creates box to display and choose vias diameters:
m_SelViaSizeBox = new wxComboBox( m_auxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( (LISTBOX_WIDTH*12)/10, -1 ),
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
updateViaSizeSelectBox();
m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_auxiliaryToolBar->AddSeparator();
......@@ -591,9 +597,9 @@ an existing track use its width\notherwise, use current width setting" ),
m_gridSelectBox = new wxComboBox( m_auxiliaryToolBar,
ID_ON_GRID_SELECT,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
updateGridSelectBox();
m_auxiliaryToolBar->AddControl( m_gridSelectBox );
// Add the box to display and select the current Zoom
......@@ -601,19 +607,14 @@ an existing track use its width\notherwise, use current width setting" ),
m_zoomSelectBox = new wxComboBox( m_auxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
updateZoomSelectBox();
updateGridSelectBox();
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
// after adding the buttons to the toolbar, must call Realize()
m_auxiliaryToolBar->Realize();
m_auxiliaryToolBar->AddSeparator();
// m_auxiliaryToolBar->AddSeparator();
}
......@@ -623,13 +624,25 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox()
return;
wxString msg;
bool mmFirst = g_UserUnit != INCHES;
m_SelTrackWidthBox->Clear();
for( unsigned ii = 0; ii < GetDesignSettings().m_TrackWidthList.size(); ii++ )
{
msg = _( "Track " ) + CoordinateToString( GetDesignSettings().m_TrackWidthList[ii], true );
int size = GetDesignSettings().m_TrackWidthList[ii];
double valueMils = To_User_Unit( INCHES, size ) * 1000;
double value_mm = To_User_Unit( MILLIMETRES, size );
if( mmFirst )
msg.Printf( _( "Track: %.3f mm (%.2f mils)" ),
value_mm, valueMils );
else
msg.Printf( _( "Track: %.2f mils (%.3f mm)" ),
valueMils, value_mm );
// Mark the netclass track width value (the first in list)
if( ii == 0 )
msg << wxT( " *" );
......@@ -651,16 +664,42 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
wxString msg;
m_SelViaSizeBox->Clear();
bool mmFirst = g_UserUnit != INCHES;
for( unsigned ii = 0; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
{
msg = _( "Via " );
msg << CoordinateToString( GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter, true );
int diam = GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter;
double valueMils = To_User_Unit( INCHES, diam ) * 1000;
double value_mm = To_User_Unit( MILLIMETRES, diam );
if( mmFirst )
msg.Printf( _( "Via: %.2f mm (%.1f mils)" ),
value_mm, valueMils );
else
msg.Printf( _( "Via: %.1f mils (%.2f mm)" ),
valueMils, value_mm );
if( GetDesignSettings().m_ViasDimensionsList[ii].m_Drill )
msg << wxT("/ ")
<< CoordinateToString( GetDesignSettings().m_ViasDimensionsList[ii].m_Drill, true );
int hole = GetDesignSettings().m_ViasDimensionsList[ii].m_Drill;
if( hole )
{
msg << wxT("/ ");
wxString hole_str;
double valueMils = To_User_Unit( INCHES, hole ) * 1000;
double value_mm = To_User_Unit( MILLIMETRES, hole );
if( mmFirst )
hole_str.Printf( _( "%.2f mm (%.1f mils)" ),
value_mm, valueMils );
else
hole_str.Printf( _( "%.1f mils (%.2f mm)" ),
valueMils, value_mm );
msg += hole_str;
}
// Mark the netclass via size value (the first in list)
if( ii == 0 )
msg << wxT( " *" );
......
......@@ -37,9 +37,12 @@ if (len(lines)<4000):
txt = ""
for l in lines:
if l.startswith("if version_info >= (2,6,0):"):
if l.startswith("if version_info >= (2,6,0):"): # ok with swig version <= 3.0.2
l = l.replace("version_info >= (2,6,0)","False")
doneOk = True
elif l.startswith("if version_info >= (2, 6, 0):"): # needed with swig version 3.0.3
l = l.replace("version_info >= (2, 6, 0)","False")
doneOk = True
elif l.startswith("if False:"): # it was already patched?
doneOk = True
txt = txt + l
......
......@@ -27,7 +27,7 @@
%extend DLIST
{
%pythoncode
{
%{
class DLISTIter:
def __init__(self,aList):
self.last = aList # last item is the start of list
......@@ -63,5 +63,5 @@
def __iter__(self):
return self.DLISTIter(self)
}
%}
}
......@@ -136,7 +136,7 @@
const char* Cast_to_CChar() { return (self->c_str()); }
%pythoncode
{
%{
# Get the char buffer of the UTF8 string
def GetChars(self):
......@@ -147,6 +147,6 @@
def __str__(self):
return self.GetChars()
}
%}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment