Commit 678a7634 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: better display of tracks/vias/grid in toolbar. All: modify the zoom...

Pcbnew: better display of tracks/vias/grid in toolbar. All: modify the zoom value shown in toolbar or status bar (roughly now zoom 1.0 is near the 1:1 scale, on a 22 inches Monitor). Fix also many other minor and very minor issues
parents f5059ec4 ad74a9a1
......@@ -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 )
{
......
......@@ -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 )
{
......
......@@ -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 );
GRID_TYPE& grid = screen->GetGrid( i );
gridMenu->Append( grid.m_Id, gridsList[i], wxEmptyString, true );
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 );
if( (int)i == icurr )
gridMenu->Check( grid.m_Id, true );
}
}
......
......@@ -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
......
......@@ -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.
......
......@@ -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 );
......
......@@ -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,7 +662,6 @@ void PCB_BASE_FRAME::UpdateStatusBar()
wxString formatter;
switch( g_UserUnit )
{
#if defined( USE_PCBNEW_NANOMETRE )
case INCHES:
formatter = wxT( "Ro %.6f Th %.1f" );
break;
......@@ -665,15 +669,6 @@ void PCB_BASE_FRAME::UpdateStatusBar()
case MILLIMETRES:
formatter = wxT( "Ro %.6f Th %.1f" );
break;
#else
case INCHES:
formatter = wxT( "Ro %.4f Th %.1f" );
break;
case MILLIMETRES:
formatter = wxT( "Ro %.3f Th %.1f" );
break;
#endif
case UNSCALED_UNITS:
formatter = wxT( "Ro %f Th %f" );
......@@ -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 );
m_gridSelectBox->Append( gridsList[i], (void*) &grid.m_Id );
}
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->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 );
......
......@@ -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 );
}
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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( " *" );
......
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