7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-18 20:59:17 +00:00

see CHANGELOG.txt

This commit is contained in:
Dick Hollenbeck 2012-02-05 23:44:19 -06:00
parent 716d21d88a
commit 6c04e60587
37 changed files with 899 additions and 754 deletions

View File

@ -4,6 +4,32 @@ KiCad ChangeLog 2012
Please add newer entries at the top, list the date and your name with
email address.
2012-Feb-5 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
* Changed classs ZONE_SETTING to class ZONE_SETTINGS, better English.
* Changed ZONE_SETTINGS::Import() to operator << ( ZONE_CONTAINER )
* move globals into BOARD:
bool g_Zone_45_Only, is now in BOARD::m_zoneSettings.m_Zone_45_Only
ZONE_SETTINGS g_Zone_Default_Setting is now in BOARD::m_zoneSettings
* Added BOARD::{Get,Set}ZoneSettings().
* Added PCB_BASE_FRAME::{Get,Set}ZoneSettings().
* Save/load BOARD::m_zoneSettings.m_Zone_45_Only to/from BOARD file.
* Removed PCB_EDIT_FRAME::InstallDialogNonCopperZonesEditor() in favor of
::InvokeNonCopperZonesEditor() declared in zones.h
* Added ::InvokeCopperZonesEditor() declared in zones.h
* Removed dialog_copper_zones.h since DIALOG class is now declared in *.cpp.
* Renamed to enum ZONE_EDIT_T in zones.h
* SetVisibleAlls() is not called as it was in two previous cases for several
reasons. BOARD_DESIGN_SETTINGS constructor controls what is visible initially.
and in the near future so will the *.brd file. I believe the user should
have visibility setting rentention accross editing sessions of zones,
fields, etc.
* BOARD_DESIGN_SETTINGS constructor initializes hidden text as not visible.
* Added PCB_EDIT_FRAME::SyncRenderStates() and PCB_LAYER_WIDGET::syncRenderStates()
so the checkboxes can be set after loading a BOARD file containing previous
visibility settings.
2012-Feb-2 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew

View File

@ -106,7 +106,7 @@ set(PCB_COMMON_SRCS
../pcbnew/class_text_mod.cpp
../pcbnew/class_track.cpp
../pcbnew/class_zone.cpp
../pcbnew/class_zone_setting.cpp
../pcbnew/class_zone_settings.cpp
../pcbnew/classpcb.cpp
../pcbnew/collectors.cpp
../pcbnew/sel_layer.cpp

View File

@ -35,7 +35,7 @@
#include <plot_common.h>
#include <class_pad.h>
#include <class_zone_setting.h>
#include <class_zone_settings.h>
#include <class_board_design_settings.h>
@ -100,9 +100,6 @@ int g_PadCUColor = GREEN;
int g_PadCMPColor = RED;
// Current design settings:
class BOARD_DESIGN_SETTINGS g_DesignSettings;
/**
* Used in track creation, a list of track segments currently being created,
* with the newest track at the end of the list, sorted by new-ness. e.g. use
@ -111,9 +108,4 @@ class BOARD_DESIGN_SETTINGS g_DesignSettings;
*/
DLIST<TRACK> g_CurrentTrackList;
bool g_Zone_45_Only = false;
// Default setting used when creating a new zone
ZONE_SETTING g_Zone_Default_Setting;
D_PAD g_Pad_Master( (MODULE*) NULL );

View File

@ -10,13 +10,6 @@
// Class for handle current printed board design settings
class BOARD_DESIGN_SETTINGS
{
protected:
int m_CopperLayerCount; ///< Number of copper layers for this design
int m_EnabledLayers; ///< Bit-mask for layer enabling
int m_VisibleLayers; ///< Bit-mask for layer visibility
int m_VisibleElements; ///< Bit-mask for element category visibility
public:
bool m_MicroViasAllowed; ///< true to allow micro vias
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
@ -57,9 +50,10 @@ public:
/**
* Function SetVisibleAlls
* Set the bit-mask of all visible elements categories, including layers
* Set the bit-mask of all visible elements categories,
* including enabled layers
*/
void SetVisibleAlls( );
void SetVisibleAlls();
/**
* Function SetVisibleLayers
@ -177,6 +171,13 @@ public:
* @param aNewLayerCount = The new number of enabled copper layers
*/
void SetCopperLayerCount( int aNewLayerCount );
private:
int m_CopperLayerCount; ///< Number of copper layers for this design
int m_EnabledLayers; ///< Bit-mask for layer enabling
int m_VisibleLayers; ///< Bit-mask for layer visibility
int m_VisibleElements; ///< Bit-mask for element category visibility
};

View File

@ -39,6 +39,7 @@
#include <richio.h>
#include <class_pcb_screen.h>
#ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000
#endif
@ -56,6 +57,7 @@ class EDA_3D_FRAME;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
class BOARD_DESIGN_SETTINGS;
class ZONE_SETTINGS;
/**
* class PCB_BASE_FRAME
@ -130,6 +132,9 @@ public:
virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
virtual void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
const ZONE_SETTINGS& GetZoneSettings() const;
void SetZoneSettings( const ZONE_SETTINGS& aSettings );
/**
* Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous

View File

@ -36,7 +36,7 @@
#include <class_layer_box_selector.h>
#include <class_macros_record.h>
#include <class_undoredo_container.h>
#include <zones.h>
#ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000
@ -119,7 +119,7 @@ protected:
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
if( doLayerWidgetUpdate )
syncLayerWidget();
syncLayerWidgetLayer();
}
/**
@ -132,7 +132,7 @@ protected:
}
/**
* Function syncLayerWidget
* Function syncLayerWidgetLayer
* updates the currently "selected" layer within the PCB_LAYER_WIDGET.
* The currently active layer is defined by the return value of getActiveLayer().
* <p>
@ -140,7 +140,15 @@ protected:
* here and we do not want to do that.
* </p>
*/
void syncLayerWidget();
void syncLayerWidgetLayer();
/**
* Function syncRenderStates
* updates the "Render" checkboxes in the layer widget according
* to current toggle values determined by IsElementVisible(), and is helpful
* immediately after loading a BOARD which may have state information in it.
*/
void syncRenderStates();
virtual void unitsChangeRefresh();
@ -702,7 +710,7 @@ public:
void OnConfigurePcbOptions( wxCommandEvent& aEvent );
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
bool InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone );
void InstallDialogLayerSetup();
void GenModulesPosition( wxCommandEvent& event );

View File

@ -194,6 +194,20 @@ void PCB_BASE_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings )
}
const ZONE_SETTINGS& PCB_BASE_FRAME::GetZoneSettings() const
{
wxASSERT( m_Pcb );
return m_Pcb->GetZoneSettings();
}
void PCB_BASE_FRAME::SetZoneSettings( const ZONE_SETTINGS& aSettings )
{
wxASSERT( m_Pcb );
m_Pcb->SetZoneSettings( aSettings );
}
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{
wxASSERT( m_Pcb );

View File

@ -10,7 +10,6 @@
#include <common.h>
#include <pcbcommon.h>
#include <wxBasePcbFrame.h>
#include <build_version.h> // BOARD_FILE_VERSION
#include <pcbnew.h>
#include <colors_selection.h>
@ -52,16 +51,16 @@ BOARD::BOARD() :
m_Layer[layer].m_Type = LT_SIGNAL;
}
// Initial parameters for the default NETCLASS come from the global
// preferences within g_DesignSettings via the NETCLASS() constructor.
// Should user eventually load a board from a disk file, then these
// defaults will get overwritten during load.
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
m_ViaSizeSelector = 0;
m_TrackWidthSelector = 0;
/* Dick 5-Feb-2012: this seems unnecessary. I don't believe the comment in
near line 70 of class_netclass.cpp. I stepped through with debugger.
// Initialize default values in default netclass.
m_NetClasses.GetDefault()->SetParams();
*/
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
}
@ -530,14 +529,14 @@ void BOARD::SetVisibleElements( int aMask )
}
}
// these are not tidy, since there are PCB_VISIBLEs that are not stored in the bitmap.
void BOARD::SetVisibleAlls( )
void BOARD::SetVisibleAlls()
{
SetVisibleLayers( FULL_LAYERS );
/* Call SetElementVisibility for each item,
* to ensure specific calculations that can be needed by some items
*/
// Call SetElementVisibility for each item,
// to ensure specific calculations that can be needed by some items
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
SetElementVisibility( ii, true );
}
@ -557,14 +556,16 @@ bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const
void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
{
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
switch( aPCB_VISIBLE )
{
case RATSNEST_VISIBLE:
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet
// because we have a tool to show hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection
if( IsElementVisible(RATSNEST_VISIBLE) )
if( IsElementVisible( RATSNEST_VISIBLE ) )
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
@ -574,12 +575,10 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
}
break;
default:
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
;
}
}

View File

@ -16,6 +16,8 @@
#include <class_board_design_settings.h>
#include <common.h> // PAGE_INFO
#include <class_title_block.h>
#include <class_zone_settings.h>
class PCB_BASE_FRAME;
class PCB_EDIT_FRAME;
@ -174,6 +176,7 @@ private:
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
BOARD_DESIGN_SETTINGS m_designSettings;
ZONE_SETTINGS m_zoneSettings;
COLORS_DESIGN_SETTINGS* m_colorsSettings;
PAGE_INFO m_paper;
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
@ -549,8 +552,11 @@ public:
TITLE_BLOCK& GetTitleBlock() { return m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
const ZONE_SETTINGS& GetZoneSettings() const { return m_zoneSettings; }
void SetZoneSettings( const ZONE_SETTINGS& aSettings ) { m_zoneSettings = aSettings; }
/**
* Function SetBoardSettings
* Function SetColorSettings
* @return the current COLORS_DESIGN_SETTINGS in use
*/
COLORS_DESIGN_SETTINGS* GetColorsSettings() const { return m_colorsSettings; }

View File

@ -17,7 +17,11 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
{
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
SetVisibleAlls(); // All layers and all elements visible at first.
SetVisibleLayers( FULL_LAYERS );
// set all but hidden text as visible.
m_VisibleElements = 0xFFFFFFFF & ~( 1 << MOD_TEXT_INVISIBLE );
SetCopperLayerCount( 2 ); // Default design is a double sided board
@ -62,11 +66,6 @@ int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
}
/**
* Function SetVisibleAlls
* Set the bit-mask of all visible elements categories,
* including enabled layers
*/
void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{
SetVisibleLayers( FULL_LAYERS );

View File

@ -39,9 +39,9 @@
const wxString NETCLASS::Default = wxT("Default");
// Initial values for netclass initialization
int NETCLASS::DEFAULT_CLEARANCE = 100; // track to track and track to pads clearance
int NETCLASS::DEFAULT_VIA_DRILL = 250; // default via drill
int NETCLASS::DEFAULT_UVIA_DRILL = 50; // micro via drill
int NETCLASS::DEFAULT_CLEARANCE = 100; // track to track and track to pads clearance
int NETCLASS::DEFAULT_VIA_DRILL = 250; // default via drill
int NETCLASS::DEFAULT_UVIA_DRILL = 50; // micro via drill
NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) :
@ -66,13 +66,20 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
SetuViaDrill( defaults->GetuViaDrill() );
}
else
{ // Note:
{
/* Dick 5-Feb-2012: I do not believe this comment to be true with current code.
It is certainly not a constructor race.
// Note:
// We use m_Parent->GetDesignSettings() to get some default values
// But when this function is called when instantiating a BOARD class,
// by the NETCLASSES constructor that calls NETCLASS constructor,
// the BOARD constructor (see BOARD::BOARD) is not yet run,
// and BOARD::m_designSettings contains not yet initialized values.
// So inside the BOARD constructor itself, you SHOULD recall SetParams
*/
const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings();
SetTrackWidth( g.m_TrackMinWidth );

View File

@ -86,7 +86,7 @@ public:
* @param aParent = the parent board
* @param aName = the name of this new netclass
* @param initialParameters is a NETCLASS to copy parameters from, or if
* NULL tells me to copy from g_DesignSettings.
* NULL tells me to copy default settings from BOARD::m_designSettings.
*/
NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters = NULL );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@ -46,12 +46,32 @@
#include <pcbnew_id.h>
/**
* Class PCB_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the PCB_EDIT_FRAME's data and so we can add a popup
* menu which is specific to Pcbnew's needs.
*/
// this is a read only template that is copied and modified before adding to LAYER_WIDGET
const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip
RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ),
RR( _( "Bl/Buried Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show blind or buried vias" ) ),
RR( _( "Micro Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show micro vias") ),
RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ),
RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ),
RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ),
RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Grid" ), GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, -1, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "Modules Front" ), MOD_FR_VISIBLE, -1, _( "Show footprints that are on board's front") ),
RR( _( "Modules Back" ), MOD_BK_VISIBLE, -1, _( "Show footprints that are on board's back") ),
RR( _( "Values" ), MOD_VALUES_VISIBLE, -1, _( "Show footprint's values") ),
RR( _( "References" ), MOD_REFERENCES_VISIBLE, -1, _( "Show footprint's references") ),
};
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize ) :
@ -61,7 +81,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwn
ReFillRender();
// Update default tabs labels for GerbView
SetLayersManagerTabsText( );
SetLayersManagerTabsText();
//-----<Popup menu>-------------------------------------------------
// handle the popup menu over the layer window.
@ -100,17 +120,16 @@ void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
// menu text is capitalized:
// http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS,
_("Show All Copper Layers") ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, _( "Show All Copper Layers" ) ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS,
_( "Hide All Copper Layers" ) ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, _( "Hide All Copper Layers" ) ) );
PopupMenu( &menu );
passOnFocus();
}
void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{
int rowCount;
@ -160,68 +179,48 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
}
}
/**
* Function SetLayersManagerTabsText
* Update the layer manager tabs labels
* Useful when changing Language or to set labels to a non default value
*/
void PCB_LAYER_WIDGET::SetLayersManagerTabsText( )
void PCB_LAYER_WIDGET::SetLayersManagerTabsText()
{
m_notebook->SetPageText(0, _("Layer") );
m_notebook->SetPageText(1, _("Render") );
m_notebook->SetPageText( 0, _( "Layer" ) );
m_notebook->SetPageText( 1, _( "Render" ) );
}
/**
* Function ReFillRender
* Rebuild Render for instance after the config is read
*/
void PCB_LAYER_WIDGET::ReFillRender()
{
BOARD* board = myframe->GetBoard();
ClearRenderRows();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
// not a static variable, change the color & state after copying from code to renderRows
// on the stack.
LAYER_WIDGET::ROW renderRows[16] = {
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip checked
RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ),
RR( _( "Bl/Buried Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show blind or buried vias" ) ),
RR( _( "Micro Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show micro vias") ),
RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ),
RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ),
RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ),
RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Grid" ), GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, -1, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "Modules Front" ), MOD_FR_VISIBLE, -1, _( "Show footprints that are on board's front") ),
RR( _( "Modules Back" ), MOD_BK_VISIBLE, -1, _( "Show footprints that are on board's back") ),
RR( _( "Values" ), MOD_VALUES_VISIBLE, -1, _( "Show footprint's values") ),
RR( _( "References" ), MOD_REFERENCES_VISIBLE, -1, _( "Show footprint's references") ),
};
for( unsigned row=0; row<DIM(renderRows); ++row )
// Add "Render" tab rows to LAYER_WIDGET, after setting color and checkbox state.
for( unsigned row=0; row<DIM(s_render_rows); ++row )
{
if( renderRows[row].color != -1 ) // does this row show a color?
LAYER_WIDGET::ROW renderRow = s_render_rows[row];
if( renderRow.color != -1 ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows[row].color = board->GetVisibleElementColor( renderRows[row].id );
renderRow.color = board->GetVisibleElementColor( renderRow.id );
}
renderRows[row].state = board->IsElementVisible( renderRows[row].id );
}
renderRow.state = board->IsElementVisible( renderRow.id );
AppendRenderRows( renderRows, DIM(renderRows) );
AppendRenderRow( renderRow );
}
}
void PCB_LAYER_WIDGET::SyncRenderStates()
{
BOARD* board = myframe->GetBoard();
for( unsigned row=0; row<DIM(s_render_rows); ++row )
{
// this does not fire an event
SetRenderState( s_render_rows[row].id, board->IsElementVisible( s_render_rows[row].id ) );
}
}
void PCB_LAYER_WIDGET::ReFill()
{
BOARD* brd = myframe->GetBoard();
@ -304,6 +303,7 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor )
myframe->GetCanvas()->Refresh();
}
bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
@ -316,6 +316,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
return true;
}
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
@ -369,5 +370,3 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
}
//-----</LAYER_WIDGET callbacks>------------------------------------------

View File

@ -28,8 +28,8 @@
/* class_pcb_layer_widget.h : header for the layers manager */
/************************************************************/
#ifndef _CLASS_PCB_LAYER_WIDGET_H_
#define _CLASS_PCB_LAYER_WIDGET_H_
#ifndef CLASS_PCB_LAYER_WIDGET_H_
#define CLASS_PCB_LAYER_WIDGET_H_
/**
* Class PCB_LAYER_WIDGET
@ -39,6 +39,53 @@
*/
class PCB_LAYER_WIDGET : public LAYER_WIDGET
{
public:
/**
* Constructor
* @param aParent is the parent window
* @param aFocusOwner is the window that should be sent the focus after
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
*/
PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
void ReFill();
/**
* Function ReFillRender
* rebuilds Render for instance after the config is read
*/
void ReFillRender();
/**
* Function SyncRenderStates
* updates the checkboxes (checked or not) to be consistent with the current state
* of the visibility of the visible rendering elements.
*/
void SyncRenderStates();
/**
* Function SetLayersManagerTabsText
* Update the layer manager tabs labels
* Useful when changing Language or to set labels to a non default value
*/
void SetLayersManagerTabsText();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, int aColor );
void OnRenderEnable( int aId, bool isEnabled );
//-----</implement LAYER_WIDGET abstract callback functions>----------
protected:
static const LAYER_WIDGET::ROW s_render_rows[];
PCB_EDIT_FRAME* myframe;
// popup menu ids.
@ -56,40 +103,6 @@ class PCB_LAYER_WIDGET : public LAYER_WIDGET
/// this is for the popup menu, the right click handler has to be installed
/// on every child control within the layer panel.
void installRightLayerClickHandler();
public:
/**
* Constructor
* @param aParent is the parent window
* @param aFocusOwner is the window that should be sent the focus after
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
*/
PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
void ReFill();
/**
* Function ReFillRender
* Rebuild Render for instance after the config is read
*/
void ReFillRender();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, int aColor );
void OnRenderEnable( int aId, bool isEnabled );
/**
* Function SetLayersManagerTabsText
* Update the layer manager tabs labels
* Useful when changing Language or to set labels to a non default value
*/
void SetLayersManagerTabsText( );
//-----</implement LAYER_WIDGET abstract callback functions>----------
};
#endif // _CLASS_PCB_LAYER_WIDGET_H_
#endif // CLASS_PCB_LAYER_WIDGET_H_

View File

@ -48,8 +48,8 @@
#include <zones.h>
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
BOARD_CONNECTED_ITEM( parent, PCB_ZONE_AREA_T )
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
BOARD_CONNECTED_ITEM( aBoard, PCB_ZONE_AREA_T )
{
SetNet( -1 ); // Net number for fast comparisons
m_CornerSelection = -1;
@ -57,12 +57,12 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
m_FillMode = 0; // How to fill areas: 0 = use filled polygons, != 0 fill with segments
m_priority = 0;
smoothedPoly = NULL;
cornerSmoothingType = ZONE_SETTING::SMOOTHING_NONE;
cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE;
cornerRadius = 0;
utility = 0; // flags used in polygon calculations
utility2 = 0; // flags used in polygon calculations
m_Poly = new CPolyLine(); // Outlines
g_Zone_Default_Setting.ExportSetting( *this );
aBoard->GetZoneSettings().ExportSetting( *this );
}

View File

@ -37,7 +37,7 @@
#include <class_board_connected_item.h>
#include <layers_id_colors_and_visibility.h>
#include <PolyLine.h>
#include <class_zone_setting.h>
#include <class_zone_settings.h>
class EDA_RECT;

View File

@ -1,93 +0,0 @@
/**
* @file class_zone_setting.h
* @brief Class ZONE_SETTING used to handle zones parameters in dialogs.
*/
#ifndef ZONE_SETTING_H
#define ZONE_SETTING_H
class ZONE_CONTAINER;
#define MAX_ZONE_CORNER_RADIUS 4000
/**
* Class ZONE_SETTING
* handles zones parameters.
*/
class ZONE_SETTING
{
public:
enum {
SMOOTHING_NONE,
SMOOTHING_CHAMFER,
SMOOTHING_FILLET,
SMOOTHING_LAST
};
// Mode for filling zone : 1 use segments, 0 use polygons
int m_FillMode;
int m_ZonePriority; // Priority (0 ... N) of the zone
int m_ZoneClearance; // Clearance value
int m_ZoneMinThickness; // Min thickness value in filled areas
int m_NetcodeSelection; // Net code selection for the current zone
int m_CurrentZone_Layer; // Layer used to create the current zone
// Option to show the zone area (outlines only, short hatches or full hatches
int m_Zone_HatchingStyle;
// Option to select number of segments to approximate a circle 16 or 32 segments.
int m_ArcToSegmentsCount;
long m_ThermalReliefGap; // thickness of the gap in thermal reliefs
long m_ThermalReliefCopperBridge; // thickness of the copper bridge in thermal reliefs
int m_Zone_Pad_Options; // How pads are covered by copper in zone
private:
int cornerSmoothingType; // Corner smoothing type
unsigned int cornerRadius; // Corner chamfer distance / fillet radius
public:
ZONE_SETTING( void );
/**
* Function ImportSetting
* copy settings from a given zone
* @param aSource: the given zone
*/
void ImportSetting( const ZONE_CONTAINER& aSource );
/**
* Function ExportSetting
* copy settings to a given zone
* @param aTarget: the given zone
* @param aFullExport: if false: some parameters are NOT exported
* because they must not be exported when export settings from a zone to others zones
* Currently:
* m_NetcodeSelection
*/
void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true);
void SetCornerSmoothingType( int aType) { cornerSmoothingType = aType; };
int GetCornerSmoothingType() const { return cornerSmoothingType; };
void SetCornerRadius( int aRadius )
{
if( aRadius > MAX_ZONE_CORNER_RADIUS )
cornerRadius = MAX_ZONE_CORNER_RADIUS;
else if( aRadius < 0 )
cornerRadius = 0;
else
cornerRadius = aRadius;
};
unsigned int GetCornerRadius() const { return cornerRadius; };
};
#endif // ifndef ZONE_SETTING_H

View File

@ -1,5 +1,5 @@
/******************************************************/
/* class ZONE_SETTING used to handle zones parameters */
/* class ZONE_SETTINGS used to handle zones parameters */
/******************************************************/
#ifndef WX_PRECOMP
@ -22,34 +22,33 @@
#include <class_zone.h>
ZONE_SETTING::ZONE_SETTING( void )
ZONE_SETTINGS::ZONE_SETTINGS()
{
m_ZonePriority = 0;
m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons
m_ZoneClearance = 200; // Clearance value
m_ZoneMinThickness = 100; // Min thickness value in filled areas
m_NetcodeSelection = 0; // Net code selection for the current zone
m_CurrentZone_Layer = 0; // Layer used to create the current zone
m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches
m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; /* Option to select number of segments to approximate a circle
* ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
* or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments */
m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons
m_ZoneClearance = 200; // Clearance value
m_ZoneMinThickness = 100; // Min thickness value in filled areas
m_NetcodeSelection = 0; // Net code selection for the current zone
m_CurrentZone_Layer = 0; // Layer used to create the current zone
m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches
m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle
// ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
// or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments
m_ThermalReliefGap = 200; // tickness of the gap in thermal reliefs
m_ThermalReliefCopperBridge = 200; // tickness of the copper bridge in thermal reliefs
m_Zone_Pad_Options = THERMAL_PAD; // How pads are covered by copper in zone
m_Zone_Pad_Options = THERMAL_PAD; // How pads are covered by copper in zone
m_Zone_45_Only = false;
cornerSmoothingType = SMOOTHING_NONE;
cornerRadius = 0;
}
/**
* Function ImportSetting
* copy settings from a given zone
* @param aSource: the given zone
*/
void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource )
ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
{
m_ZonePriority = aSource.GetPriority();
m_FillMode = aSource.m_FillMode;
@ -64,19 +63,12 @@ void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource )
m_Zone_Pad_Options = aSource.m_PadOption;
cornerSmoothingType = aSource.GetCornerSmoothingType();
cornerRadius = aSource.GetCornerRadius();
return *this;
}
/**
* Function ExportSetting
* copy settings to a given zone
* @param aTarget: the given zone
* @param aFullExport: if false: some parameters are NOT exported
* because they must not be exported when export settings from a zone to others zones
* Currently:
* m_NetcodeSelection
*/
void ZONE_SETTING::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport )
void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) const
{
aTarget.m_FillMode = m_FillMode;
aTarget.m_ZoneClearance = m_ZoneClearance;
@ -88,6 +80,7 @@ void ZONE_SETTING::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport )
aTarget.m_PadOption = m_Zone_Pad_Options;
aTarget.SetCornerSmoothingType( cornerSmoothingType );
aTarget.SetCornerRadius( cornerRadius );
if( aFullExport )
{
aTarget.SetPriority( m_ZonePriority );

View File

@ -0,0 +1,96 @@
/**
* @file class_zone_settings.h
* @brief Class ZONE_SETTINGS used to handle zones parameters in dialogs.
*/
#ifndef ZONE_SETTINGS_H_
#define ZONE_SETTINGS_H_
class ZONE_CONTAINER;
#define MAX_ZONE_CORNER_RADIUS 4000
/**
* Class ZONE_SETTINGS
* handles zones parameters.
*/
class ZONE_SETTINGS
{
public:
enum {
SMOOTHING_NONE,
SMOOTHING_CHAMFER,
SMOOTHING_FILLET,
SMOOTHING_LAST
};
/// Mode for filling zone : 1 use segments, 0 use polygons
int m_FillMode;
int m_ZonePriority; ///< Priority (0 ... N) of the zone
int m_ZoneClearance; ///< Clearance value
int m_ZoneMinThickness; ///< Min thickness value in filled areas
int m_NetcodeSelection; ///< Net code selection for the current zone
int m_CurrentZone_Layer; ///< Layer used to create the current zone
/// Option to show the zone area (outlines only, short hatches or full hatches
int m_Zone_HatchingStyle;
/// Option to select number of segments to approximate a circle 16 or 32 segments.
int m_ArcToSegmentsCount;
long m_ThermalReliefGap; ///< thickness of the gap in thermal reliefs
long m_ThermalReliefCopperBridge; ///< thickness of the copper bridge in thermal reliefs
int m_Zone_Pad_Options; ///< How pads are covered by copper in zone
bool m_Zone_45_Only;
private:
int cornerSmoothingType; ///< Corner smoothing type
unsigned int cornerRadius; ///< Corner chamfer distance / fillet radius
public:
ZONE_SETTINGS();
/**
* operator << ( const ZONE_CONTAINER& )
* was Function ImportSetting
* copies settings from a given zone into this object.
* @param aSource: the given zone
*/
ZONE_SETTINGS& operator << ( const ZONE_CONTAINER& aSource );
/**
* Function ExportSetting
* copy settings to a given zone
* @param aTarget: the given zone
* @param aFullExport: if false: some parameters are NOT exported
* because they must not be exported when export settings from a zone to others zones
* Currently:
* m_NetcodeSelection
*/
void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true ) const;
void SetCornerSmoothingType( int aType) { cornerSmoothingType = aType; };
int GetCornerSmoothingType() const { return cornerSmoothingType; };
void SetCornerRadius( int aRadius )
{
if( aRadius > MAX_ZONE_CORNER_RADIUS )
cornerRadius = MAX_ZONE_CORNER_RADIUS;
else if( aRadius < 0 )
cornerRadius = 0;
else
cornerRadius = aRadius;
};
unsigned int GetCornerRadius() const { return cornerRadius; };
};
#endif // ZONE_SETTINGS_H_

View File

@ -16,13 +16,93 @@
#include <trigo.h>
#include <zones.h>
#include <dialog_copper_zones.h>
#include <class_zone_setting.h>
#include <class_zone_settings.h>
#include <class_board.h>
#include <dialog_copper_zones_base.h>
#define LAYER_BITMAP_SIZE_X 20
#define LAYER_BITMAP_SIZE_Y 10
/**
* Class DIALOG_COPPER_ZONE
* is the derived class from dialog_copper_zone_frame created by wxFormBuilder
*/
class DIALOG_COPPER_ZONE : public DIALOG_COPPER_ZONE_BASE
{
public:
DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings );
private:
PCB_BASE_FRAME* m_Parent;
wxConfig* m_Config; ///< Current config
ZONE_EDIT_T m_OnExitCode; ///< exit code: ZONE_ABORT if no change,
///< ZONE_OK if new values accepted
///< ZONE_EXPORT_VALUES if values are exported to others zones
ZONE_SETTINGS m_settings;
ZONE_SETTINGS* m_ptr;
bool m_NetSortingByPadCount; ///< false = alphabetic sort.
///< true = pad count sort.
long m_NetFiltering;
std::vector<int> m_LayerId; ///< Handle the real layer number from layer
///< name position in m_LayerSelectionCtrl
static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*").
///< static to keep this pattern for an entire pcbnew session
wxListView* m_LayerSelectionCtrl;
static wxPoint prevPosition; ///< Dialog position & size
static wxSize prevSize;
/**
* Function initDialog
* fills in the dialog controls using the current settings.
*/
void initDialog();
void OnButtonOkClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
void OnSize( wxSizeEvent& event );
void OnCornerSmoothingModeChoice( wxCommandEvent& event );
/**
* Function AcceptOptions
* @param aPromptForErrors is true to prompt user on incorrect params.
* @param aUseExportableSetupOnly is true to use exportable parametres only (used to export this setup to other zones).
* @return bool - false if incorrect options, true if ok.
*/
bool AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly = false );
void OnNetSortingOptionSelected( wxCommandEvent& event );
void ExportSetupToOtherCopperZones( wxCommandEvent& event );
void OnPadsInZoneClick( wxCommandEvent& event );
void OnRunFiltersButtonClick( wxCommandEvent& event );
void buildAvailableListOfNets();
/**
* Function initListNetsParams
* initializes m_NetSortingByPadCount and m_NetFiltering values
* according to m_NetDisplayOption selection.
*/
void initListNetsParams();
/**
* Function makeLayerBitmap
* creates the colored rectangle bitmaps used in the layer selection widget.
* @param aColor is the color to fill the rectangle with.
*/
wxBitmap makeLayerBitmap( int aColor );
};
#define LAYER_BITMAP_SIZE_X 20
#define LAYER_BITMAP_SIZE_Y 10
// Initialize static member variables
wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) );
@ -30,16 +110,31 @@ wxPoint DIALOG_COPPER_ZONE::prevPosition( -1, -1 );
wxSize DIALOG_COPPER_ZONE::prevSize;
DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_EDIT_FRAME* parent, ZONE_SETTING* zone_setting ) :
DIALOG_COPPER_ZONE_BASE( parent )
ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
{
m_Parent = parent;
DIALOG_COPPER_ZONE dlg( aCaller, aSettings );
ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() );
// D(printf( "%s: result:%d\n", __FUNCTION__, result );)
return result;
}
DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) :
DIALOG_COPPER_ZONE_BASE( aParent )
{
m_Parent = aParent;
m_Config = wxGetApp().GetSettings();
m_Zone_Setting = zone_setting;
m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
m_ptr = aSettings;
m_settings = *aSettings;
m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
m_OnExitCode = ZONE_ABORT;
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
m_LayerSelectionCtrl = new wxListView( this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
@ -76,24 +171,24 @@ void DIALOG_COPPER_ZONE::initDialog()
wxString msg;
if( g_Zone_45_Only )
if( m_settings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
m_FillModeCtrl->SetSelection( m_Zone_Setting->m_FillMode ? 1 : 0 );
m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 );
AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneClearance,
m_settings.m_ZoneClearance,
m_Parent->GetInternalUnits() );
m_ZoneClearanceCtrl->SetValue( msg );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneMinThickness,
m_settings.m_ZoneMinThickness,
m_Parent->GetInternalUnits() );
m_ZoneMinThicknessCtrl->SetValue( msg );
switch( m_Zone_Setting->m_Zone_Pad_Options )
switch( m_settings.m_Zone_Pad_Options )
{
case PAD_NOT_IN_ZONE: // Pads are not covered
m_PadInZoneOpt->SetSelection( 2 );
@ -108,7 +203,7 @@ void DIALOG_COPPER_ZONE::initDialog()
break;
}
if( m_Zone_Setting->m_Zone_Pad_Options != THERMAL_PAD )
if( m_settings.m_Zone_Pad_Options != THERMAL_PAD )
{
m_AntipadSizeValue->Enable( false );
m_CopperWidthValue->Enable( false );
@ -119,24 +214,24 @@ void DIALOG_COPPER_ZONE::initDialog()
m_CopperWidthValue->Enable( true );
}
m_PriorityLevelCtrl->SetValue( m_Zone_Setting->m_ZonePriority );
m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority );
AddUnitSymbol( *m_AntipadSizeText, g_UserUnit );
AddUnitSymbol( *m_CopperBridgeWidthText, g_UserUnit );
PutValueInLocalUnits( *m_AntipadSizeValue,
m_Zone_Setting->m_ThermalReliefGap,
m_settings.m_ThermalReliefGap,
PCB_INTERNAL_UNIT );
PutValueInLocalUnits( *m_CopperWidthValue,
m_Zone_Setting->m_ThermalReliefCopperBridge,
m_settings.m_ThermalReliefCopperBridge,
PCB_INTERNAL_UNIT );
m_cornerSmoothingChoice->SetSelection( m_Zone_Setting->GetCornerSmoothingType() );
m_cornerSmoothingChoice->SetSelection( m_settings.GetCornerSmoothingType() );
PutValueInLocalUnits( *m_cornerSmoothingCtrl,
m_Zone_Setting->GetCornerRadius(),
m_settings.GetCornerRadius(),
PCB_INTERNAL_UNIT );
switch( m_Zone_Setting->m_Zone_HatchingStyle )
switch( m_settings.m_Zone_HatchingStyle )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
@ -152,7 +247,7 @@ void DIALOG_COPPER_ZONE::initDialog()
}
m_ArcApproximationOpt->SetSelection(
m_Zone_Setting->m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 );
m_settings.m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 );
// Build copper layer list and append to layer widget
int layerCount = board->GetCopperLayerCount();
@ -175,7 +270,7 @@ void DIALOG_COPPER_ZONE::initDialog()
imageList->Add( makeLayerBitmap( layerColor ) );
itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii );
if( m_Zone_Setting->m_CurrentZone_Layer == layerNumber )
if( m_settings.m_CurrentZone_Layer == layerNumber )
m_LayerSelectionCtrl->Select( itemIndex );
}
@ -206,11 +301,27 @@ void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event )
Close( true );
}
void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
{
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
prevPosition = GetPosition();
prevSize = GetSize();
if( AcceptOptions( true ) )
{
EndModal( ZONE_OK );
}
}
void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
{
prevPosition = GetPosition();
prevSize = GetSize();
if( m_OnExitCode != ZONE_ABORT )
*m_ptr = m_settings;
EndModal( m_OnExitCode );
}
@ -225,126 +336,101 @@ void DIALOG_COPPER_ZONE::OnSize( wxSizeEvent& event )
}
void DIALOG_COPPER_ZONE::OnCornerSmoothingModeChoice( wxCommandEvent& event )
{
int selection = m_cornerSmoothingChoice->GetSelection();
switch( selection )
{
case ZONE_SETTING::SMOOTHING_NONE:
m_cornerSmoothingTitle->Enable( false );
m_cornerSmoothingCtrl->Enable( false );
break;
case ZONE_SETTING::SMOOTHING_CHAMFER:
m_cornerSmoothingTitle->Enable( true );
m_cornerSmoothingCtrl->Enable( true );
m_cornerSmoothingTitle->SetLabel( _( "Chamfer distance" ) );
AddUnitSymbol( *m_cornerSmoothingTitle, g_UserUnit );
break;
case ZONE_SETTING::SMOOTHING_FILLET:
m_cornerSmoothingTitle->Enable( true );
m_cornerSmoothingCtrl->Enable( true );
m_cornerSmoothingTitle->SetLabel( _( "Fillet radius" ) );
AddUnitSymbol( *m_cornerSmoothingTitle, g_UserUnit );
break;
}
}
bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly )
{
switch( m_PadInZoneOpt->GetSelection() )
{
case 2:
m_Zone_Setting->m_Zone_Pad_Options = PAD_NOT_IN_ZONE; // Pads are not covered
// Pads are not covered
m_settings.m_Zone_Pad_Options = PAD_NOT_IN_ZONE;
break;
case 1:
m_Zone_Setting->m_Zone_Pad_Options = THERMAL_PAD; // Use thermal relief for pads
// Use thermal relief for pads
m_settings.m_Zone_Pad_Options = THERMAL_PAD;
break;
case 0:
m_Zone_Setting->m_Zone_Pad_Options = PAD_IN_ZONE; // pads are covered by copper
// pads are covered by copper
m_settings.m_Zone_Pad_Options = PAD_IN_ZONE;
break;
}
switch( m_OutlineAppearanceCtrl->GetSelection() )
{
case 0:
m_Zone_Setting->m_Zone_HatchingStyle = CPolyLine::NO_HATCH;
m_settings.m_Zone_HatchingStyle = CPolyLine::NO_HATCH;
break;
case 1:
m_Zone_Setting->m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE;
m_settings.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE;
break;
case 2:
m_Zone_Setting->m_Zone_HatchingStyle = CPolyLine::DIAGONAL_FULL;
m_settings.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_FULL;
break;
}
m_Zone_Setting->m_ArcToSegmentsCount = m_ArcApproximationOpt->GetSelection() == 1 ?
m_settings.m_ArcToSegmentsCount = m_ArcApproximationOpt->GetSelection() == 1 ?
ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF :
ARC_APPROX_SEGMENTS_COUNT_LOW_DEF;
if( m_Config )
{
m_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) m_Zone_Setting->m_Zone_HatchingStyle );
wxString Filter = m_DoNotShowNetNameFilter->GetValue();
m_Config->Write( ZONE_NET_FILTER_STRING_KEY, Filter );
(long) m_settings.m_Zone_HatchingStyle );
wxString filter = m_DoNotShowNetNameFilter->GetValue();
m_Config->Write( ZONE_NET_FILTER_STRING_KEY, filter );
}
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
m_Zone_Setting->m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1;
m_settings.m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1;
wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
m_Zone_Setting->m_ZoneClearance =
m_settings.m_ZoneClearance =
ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() );
// Test if this is a reasonnable value for this parameter
// A too large value can hang Pcbnew
#define CLEARANCE_MAX_VALUE 5000 // in 1/10000 inch
if( m_Zone_Setting->m_ZoneClearance > CLEARANCE_MAX_VALUE )
if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE )
{
DisplayError( this, _( "Clearance must be smaller than 0.5\" / 12.7 mm." ) );
return false;
}
txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness =
m_settings.m_ZoneMinThickness =
ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() );
if( m_Zone_Setting->m_ZoneMinThickness < 10 )
if( m_settings.m_ZoneMinThickness < 10 )
{
DisplayError( this,
_( "Minimum width must be larger than 0.001\" / 0.0254 mm." ) );
return false;
}
m_Zone_Setting->SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
txtvalue = m_cornerSmoothingCtrl->GetValue();
m_Zone_Setting->SetCornerRadius( ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() ) );
m_settings.SetCornerRadius( ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() ) );
m_Zone_Setting->m_ZonePriority = m_PriorityLevelCtrl->GetValue();
m_settings.m_ZonePriority = m_PriorityLevelCtrl->GetValue();
if( m_OrientEdgesOpt->GetSelection() == 0 )
g_Zone_45_Only = false;
m_settings.m_Zone_45_Only = false;
else
g_Zone_45_Only = true;
m_settings.m_Zone_45_Only = true;
m_Zone_Setting->m_ThermalReliefGap = ReturnValueFromTextCtrl( *m_AntipadSizeValue,
PCB_INTERNAL_UNIT );
m_Zone_Setting->m_ThermalReliefCopperBridge = ReturnValueFromTextCtrl(
m_settings.m_ThermalReliefGap = ReturnValueFromTextCtrl( *m_AntipadSizeValue, PCB_INTERNAL_UNIT );
m_settings.m_ThermalReliefCopperBridge = ReturnValueFromTextCtrl(
*m_CopperWidthValue,
PCB_INTERNAL_UNIT );
m_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
(long) m_Zone_Setting->m_ThermalReliefGap );
m_Config->Write(
ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
(long) m_Zone_Setting->m_ThermalReliefCopperBridge );
m_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, (long) m_settings.m_ThermalReliefGap );
if( m_Zone_Setting->m_ThermalReliefCopperBridge <= m_Zone_Setting->m_ZoneMinThickness )
m_Config->Write( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, (long) m_settings.m_ThermalReliefCopperBridge );
if( m_settings.m_ThermalReliefCopperBridge <= m_settings.m_ZoneMinThickness )
{
DisplayError( this,
_( "Thermal relief spoke width is larger than the minimum width." ) );
@ -364,7 +450,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
return false;
}
m_Zone_Setting->m_CurrentZone_Layer = m_LayerId[ii];
m_settings.m_CurrentZone_Layer = m_LayerId[ii];
// Get the net name selection for this zone
ii = m_ListNetNameSelection->GetSelection();
@ -385,19 +471,44 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
wxString net_name = m_ListNetNameSelection->GetString( ii );
g_Zone_Default_Setting.m_NetcodeSelection = 0;
m_settings.m_NetcodeSelection = 0;
// Search net_code for this net, if a net was selected
if( m_ListNetNameSelection->GetSelection() > 0 )
{
NETINFO_ITEM* net = m_Parent->GetBoard()->FindNet( net_name );
if( net )
g_Zone_Default_Setting.m_NetcodeSelection = net->GetNet();
m_settings.m_NetcodeSelection = net->GetNet();
}
return true;
}
void DIALOG_COPPER_ZONE::OnCornerSmoothingModeChoice( wxCommandEvent& event )
{
int selection = m_cornerSmoothingChoice->GetSelection();
switch( selection )
{
case ZONE_SETTINGS::SMOOTHING_NONE:
m_cornerSmoothingTitle->Enable( false );
m_cornerSmoothingCtrl->Enable( false );
break;
case ZONE_SETTINGS::SMOOTHING_CHAMFER:
m_cornerSmoothingTitle->Enable( true );
m_cornerSmoothingCtrl->Enable( true );
m_cornerSmoothingTitle->SetLabel( _( "Chamfer distance" ) );
AddUnitSymbol( *m_cornerSmoothingTitle, g_UserUnit );
break;
case ZONE_SETTINGS::SMOOTHING_FILLET:
m_cornerSmoothingTitle->Enable( true );
m_cornerSmoothingCtrl->Enable( true );
m_cornerSmoothingTitle->SetLabel( _( "Fillet radius" ) );
AddUnitSymbol( *m_cornerSmoothingTitle, g_UserUnit );
break;
}
}
void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event )
{
@ -414,17 +525,6 @@ void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event )
}
void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event )
{
m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
prevPosition = GetPosition();
prevSize = GetSize();
if( AcceptOptions( true ) )
EndModal( ZONE_OK );
}
void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
{
prevPosition = GetPosition();
@ -438,7 +538,7 @@ void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = pcb->GetArea( ii );
m_Zone_Setting->ExportSetting( *zone, false ); // false = partiel export
m_settings.ExportSetting( *zone, false ); // false = partial export
m_Parent->OnModify();
}
@ -534,7 +634,7 @@ void DIALOG_COPPER_ZONE::buildAvailableListOfNets()
// Ensure currently selected net for the zone is visible, regardless of filters
int selectedNetListNdx = -1;
int net_select = m_Zone_Setting->m_NetcodeSelection;
int net_select = m_settings.m_NetcodeSelection;
if( net_select > 0 )
{

View File

@ -1,88 +0,0 @@
/* dialog_copper_zones.h */
#ifndef DIALOG_COPPER_ZONES_
#define DIALOG_COPPER_ZONES_
#include <wx/wx.h>
#include <wx/listctrl.h>
#include <dialog_copper_zones_base.h>
/**
* Class DIALOG_COPPER_ZONE
* is the derivated class from dialog_copper_zone_frame created by wxFormBuilder
*/
class DIALOG_COPPER_ZONE : public DIALOG_COPPER_ZONE_BASE
{
private:
PCB_EDIT_FRAME* m_Parent;
wxConfig* m_Config; ///< Current config
int m_OnExitCode; ///< exit code: ZONE_ABORT if no change,
///< ZONE_OK if new values accepted
///< ZONE_EXPORT_VALUES if values are exported to others zones
ZONE_SETTING* m_Zone_Setting;
bool m_NetSortingByPadCount; ///< false = alphabetic sort.
///< true = pad count sort.
long m_NetFiltering;
std::vector<int> m_LayerId; ///< Handle the real layer number from layer
///< name position in m_LayerSelectionCtrl
static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*").
///< static to keep this pattern for an entire pcbnew session
wxListView* m_LayerSelectionCtrl;
static wxPoint prevPosition; ///< Dialog position & size
static wxSize prevSize;
public:
DIALOG_COPPER_ZONE( PCB_EDIT_FRAME* parent, ZONE_SETTING* zone_setting );
private:
/**
* Function initDialog
* fills in the dialog controls using the current settings.
*/
void initDialog();
void OnButtonOkClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
void OnSize( wxSizeEvent& event );
void OnCornerSmoothingModeChoice( wxCommandEvent& event );
/**
* Function AcceptOptions
* @param aPromptForErrors is true to prompt user on incorrect params.
* @param aUseExportableSetupOnly is true to use exportable parametres only (used to export this setup to other zones).
* @return bool - false if incorrect options, true if ok.
*/
bool AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly = false );
void OnNetSortingOptionSelected( wxCommandEvent& event );
void ExportSetupToOtherCopperZones( wxCommandEvent& event );
void OnPadsInZoneClick( wxCommandEvent& event );
void OnRunFiltersButtonClick( wxCommandEvent& event );
void buildAvailableListOfNets();
/**
* Function initListNetsParams
* initializes m_NetSortingByPadCount and m_NetFiltering values
* according to m_NetDisplayOption selection.
*/
void initListNetsParams();
/**
* Function makeLayerBitmap
* creates the colored rectangle bitmaps used in the layer selection widget.
* @param aColor is the color to fill the rectangle with.
*/
wxBitmap makeLayerBitmap( int aColor );
};
#endif // DIALOG_COPPER_ZONES_

View File

@ -191,7 +191,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
if( !testNetClasses() )
{
// testing the netclasses is a special case because if the netclasses
// do not pass the g_DesignSettings checks, then every member of a net
// do not pass the BOARD_DESIGN_SETTINGS checks, then every member of a net
// class (a NET) will cause its items such as tracks, vias, and pads
// to also fail. So quit after *all* netclass errors have been reported.
if( aMessages )

View File

@ -23,7 +23,7 @@
* Basic routine used by other routines when editing tracks or vias
* @param aTrackItem = the track segment or via to modify
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use g_DesignSettings value
* @param aUseNetclassValue = true to use NetClass value, false to use BOARD::m_designSettings value
* @return true if done, false if no not change (because DRC error)
*/
bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
@ -71,7 +71,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
aTrackItem->m_Width = new_width;
/* make a DRC test because the new size is bigger than the old size */
// make a DRC test because the new size is bigger than the old size
if( initial_width < new_width )
{
int diagdrc = OK_DRC;
@ -218,16 +218,16 @@ bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNe
if( aNetcode <= 0 )
return false;
/* Examine segments */
// Examine segments
PICKED_ITEMS_LIST itemsListPicker;
bool change = false;
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
{
if( aNetcode != pt_segm->GetNet() ) /* not in net */
if( aNetcode != pt_segm->GetNet() ) // not in net
continue;
/* we have found a item member of the net */
// we have found a item member of the net
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, aUseNetclassValue ) )
change = true;
}
@ -245,7 +245,7 @@ bool PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack,
{
TRACK* pt_segm;
/* read and edit tracks and vias if required */
// read and edit tracks and vias if required
PICKED_ITEMS_LIST itemsListPicker;
bool change = false;

View File

@ -217,7 +217,7 @@ the changes?" ) ) )
FILTER_READER reader( fileReader );
/* Read header and TEST if it is a PCB file format */
// Read header and TEST if it is a PCB file format
reader.ReadLine();
if( strncmp( reader.Line(), "PCBNEW-BOARD", 12 ) != 0 )
@ -324,7 +324,7 @@ this file again." ) );
GetScreen()->ClrModify();
/* If append option: change the initial board name to <oldname>-append.brd */
// If append option: change the initial board name to <oldname>-append.brd
if( aAppend )
{
wxString new_filename = GetScreen()->GetFileName().BeforeLast( '.' );
@ -343,26 +343,35 @@ this file again." ) );
UpdateTitle();
UpdateFileHistory( GetScreen()->GetFileName() );
/* Rebuild the new pad list (for drc and ratsnet control ...) */
// Rebuild the new pad list (for drc and ratsnet control ...)
GetBoard()->m_Status_Pcb = 0;
// Dick 5-Feb-2012: I do not agree with this. The layer widget will show what
// is visible or not, and I want the board to look like it did when I saved
// it, immediately after loading.
#if 0
/* Reset the items visibility flag when loading a new config
* Because it could creates SERIOUS mistakes for the user,
* Because it could creates SERIOUS mistakes for the user,
* if board items are not visible after loading a board...
* Grid and ratsnest can be left to their previous state
*/
bool showGrid = IsElementVisible( GRID_VISIBLE );
bool showRats = IsElementVisible( RATSNEST_VISIBLE );
SetVisibleAlls();
SetElementVisibility( GRID_VISIBLE, showGrid );
SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif
// Update info shown by the horizontal toolbars
GetBoard()->SetCurrentNetClass( NETCLASS::Default );
ReFillLayerWidget();
ReCreateLayerBox( NULL );
syncLayerWidget();
syncLayerWidgetLayer();
syncRenderStates();
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
@ -436,7 +445,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
if( aCreateBackupFile )
{
/* Get the backup file name */
// Get the backup file name
backupFileName = pcbFileName;
backupFileName.SetExt( pcbBackupFileExtension );
@ -524,7 +533,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
#endif
/* Display the file names: */
// Display the file names:
m_messagePanel->EraseMsgBox();
if( saveok )

View File

@ -333,6 +333,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
char* data;
NETCLASS* netclass_default = GetBoard()->m_NetClasses.GetDefault();
ZONE_SETTINGS zoneInfo = GetBoard()->GetZoneSettings();
while( aReader->ReadLine() )
{
@ -380,6 +381,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
// projects.
GetBoard()->m_NetClasses.GetDefault()->SetParams();
GetBoard()->SetZoneSettings( zoneInfo );
return 0;
}
@ -459,7 +462,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "ZoneClearence" ) == 0 )
{
g_Zone_Default_Setting.m_ZoneClearance = atoi( data );
zoneInfo.m_ZoneClearance = atoi( data );
continue;
}
@ -697,7 +700,7 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() );
fprintf( aFile, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
fprintf( aFile, "ZoneClearence %d\n", aBoard->GetZoneSettings().m_ZoneClearance );
fprintf( aFile, "TrackMinWidth %d\n", aBoard->GetDesignSettings().m_TrackMinWidth );
fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetDesignSettings().m_DrawSegmentWidth );

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