This commit is contained in:
Dick Hollenbeck 2012-02-06 01:14:51 -06:00
commit e7b3ed2e88
39 changed files with 918 additions and 767 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

@ -2,21 +2,14 @@
/* class_board_design_settings.h : handle board options */
/**********************************************************/
#ifndef _BOARD_DESIGN_SETTING_H
#define _BOARD_DESIGN_SETTING_H
#ifndef BOARD_DESIGN_SETTINGS_H_
#define BOARD_DESIGN_SETTINGS_H_
#include <pcbstruct.h> // NB_COLORS
// 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,9 +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
};
#endif
// _BOARD_DESIGN_SETTING_H
#endif // BOARD_DESIGN_SETTINGS_H_

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,18 @@ 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
near line 70 of class_netclass.cpp. I stepped through with debugger.
Perhaps something else is at work, it is not a constructor race.
// Initialize default values in default netclass.
*/
m_NetClasses.GetDefault()->SetParams();
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
}
@ -530,14 +531,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 +558,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 +577,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 = -1 & ~( 1 << MOD_TEXT_INVISIBLE );
SetCopperLayerCount( 2 ); // Default design is a double sided board
@ -62,15 +66,10 @@ 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 );
m_VisibleElements = 0xFFFFFFFF;
m_VisibleElements = -1;
}

View File

@ -66,13 +66,21 @@ 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. Normally items are initialized
within a class according to the order of their appearance.
// 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 );
}
renderRows[row].state = board->IsElementVisible( renderRows[row].id );
renderRow.color = board->GetVisibleElementColor( renderRow.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,7 +22,7 @@
#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
@ -31,25 +31,24 @@ ZONE_SETTING::ZONE_SETTING( void )
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_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_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,9 +16,89 @@
#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>
/**
* 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
@ -30,12 +110,27 @@ 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_ptr = aSettings;
m_settings = *aSettings;
m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort
m_OnExitCode = ZONE_ABORT;
@ -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,29 @@ 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 ) )
{
*m_ptr = m_settings;
EndModal( ZONE_OK );
}
}
// called on system close button
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 +338,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 +452,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 +473,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 +527,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 +540,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 +636,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

@ -576,6 +576,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
m_EnabledLayers = getUILayerMask();
m_Pcb->SetEnabledLayers( m_EnabledLayers );
/* Ensure enabled layers are also visible
* This is mainly to avoid mistakes if some enabled
* layers are not visible when exiting this dialog

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,9 +343,13 @@ 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 it would be nice for 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,
* if board items are not visible after loading a board...
@ -353,16 +357,21 @@ this file again." ) );
*/
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

@ -212,14 +212,14 @@ int PCB_BASE_FRAME::ReadGeneralDescrPcb( LINE_READER* aReader )
if( stricmp( data, "EnabledLayers" ) == 0 )
{
int EnabledLayers = 0;
int enabledLayers = 0;
data = strtok( NULL, delims );
sscanf( data, "%X", &EnabledLayers );
sscanf( data, "%X", &enabledLayers );
// Setup layer visibility
GetBoard()->SetEnabledLayers( EnabledLayers );
GetBoard()->SetEnabledLayers( enabledLayers );
GetBoard()->SetVisibleLayers( enabledLayers );
continue;
}
@ -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 );

View File

@ -14,14 +14,6 @@
#include <macros.h>
#include <pcbcommon.h>
#ifdef PCBNEW
/**
* @todo Fix having to recompile the same file with a different defintion. This is
* what C++ derivation was designed to solve.
*/
//#include "zones.h"
#endif
#include <zones.h>
#ifdef CVPCB
@ -1825,7 +1817,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
if( ret < 2 )
return false;
if( tempSmoothingType >= ZONE_SETTING::SMOOTHING_LAST)
if( tempSmoothingType >= ZONE_SETTINGS::SMOOTHING_LAST )
return false;
if( tempSmoothingType < 0 )

View File

@ -358,6 +358,7 @@ void KICAD_PLUGIN::loadGENERAL()
// Setup layer visibility
m_board->SetEnabledLayers( enabledLayers );
m_board->SetVisibleLayers( enabledLayers );
}
else if( TESTLINE( "Ly" ) ) // Old format for Layer count
@ -558,6 +559,7 @@ void KICAD_PLUGIN::loadSETUP()
{
NETCLASS* netclass_default = m_board->m_NetClasses.GetDefault();
BOARD_DESIGN_SETTINGS bds = m_board->GetDesignSettings();
ZONE_SETTINGS zs = m_board->GetZoneSettings();
while( READLINE() )
{
@ -638,7 +640,13 @@ void KICAD_PLUGIN::loadSETUP()
else if( TESTLINE( "ZoneClearence" ) )
{
BIU tmp = biuParse( line + SZ( "ZoneClearence" ) );
g_Zone_Default_Setting.m_ZoneClearance = tmp;
zs.m_ZoneClearance = tmp;
}
else if( TESTLINE( "Zone_45_Only" ) )
{
bool tmp = (bool) intParse( line + SZ( "Zone_45_Only" ) );
zs.m_Zone_45_Only = tmp;
}
else if( TESTLINE( "DrawSegmWidth" ) )
@ -793,6 +801,7 @@ void KICAD_PLUGIN::loadSETUP()
else if( TESTLINE( "$EndSETUP" ) )
{
m_board->SetDesignSettings( bds );
m_board->SetZoneSettings( zs );
// Until such time as the *.brd file does not have the
// global parameters:
@ -2109,7 +2118,7 @@ void KICAD_PLUGIN::loadZONE_CONTAINER()
int smoothing = intParse( line + SZ( "ZSmoothing" ), &data );
BIU cornerRadius = biuParse( data );
if( smoothing >= ZONE_SETTING::SMOOTHING_LAST || smoothing < 0 )
if( smoothing >= ZONE_SETTINGS::SMOOTHING_LAST || smoothing < 0 )
{
m_error.Printf( wxT( "Bad ZSmoothing for CZONE_CONTAINER '%s'" ), zc->GetNetName().GetData() );
THROW_IO_ERROR( m_error );
@ -2804,9 +2813,9 @@ void KICAD_PLUGIN::saveSETUP() const
fprintf( m_fp, "TrackClearence %s\n", fmtBIU( netclass_default->GetClearance() ).c_str() );
/* @todo no globals in a plugin.
fprintf( m_fp, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance );
*/
// ZONE_SETTINGS
fprintf( m_fp, "ZoneClearence %s\n", fmtBIU( m_board->GetZoneSettings().m_ZoneClearance ).c_str() );
fprintf( m_fp, "Zone_45_Only %d\n", m_board->GetZoneSettings().m_Zone_45_Only );
fprintf( m_fp, "TrackMinWidth %s\n", fmtBIU( bds.m_TrackMinWidth ).c_str() );

View File

@ -49,8 +49,7 @@
/**
* Class LAYER_WIDGET
* is abstract and is derived from a wxFormBuilder maintained class called
* LAYER_PANEL_BASE. It is used to manage a list of layers, with the notion of
* is abstract and is used to manage a list of layers, with the notion of
* a "current" layer, and layer specific visibility control. You must derive from
* it to use it so you can implement the abstract functions which recieve the
* events. Each layer is given its own color, and that color can be changed

View File

@ -47,7 +47,7 @@
#include <module_editor_frame.h>
static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the footprint editor
static PCB_SCREEN* s_screenModule; // the PCB_SCREEN used by the footprint editor
wxString FOOTPRINT_EDIT_FRAME::m_CurrentLib = wxEmptyString;
@ -157,16 +157,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
SetBoard( s_Pcb );
if( s_screenModule == NULL )
if( !s_screenModule )
s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() );
SetScreen( s_screenModule );
/* not sure why this was here, formerly s_ModuleEditorDesignSetting, since
we get default BOARD_DESIGN_SETTINGS in BOARD's constructor.
GetBoard()->SetDesignSettings( BOARD_DESIGN_SETTINGS() );
*/
GetScreen()->SetCurItem( NULL );
LoadSettings();

View File

@ -403,8 +403,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
ReFillLayerWidget(); // this is near end because contents establish size
m_Layers->ReFillRender(); // Update colors in Render after the config is read
syncLayerWidget();
syncLayerWidgetLayer();
m_auimgr.Update();
}
@ -639,12 +642,18 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void )
}
void PCB_EDIT_FRAME::syncLayerWidget( )
void PCB_EDIT_FRAME::syncLayerWidgetLayer()
{
m_Layers->SelectLayer( getActiveLayer() );
}
void PCB_EDIT_FRAME::syncRenderStates()
{
m_Layers->SyncRenderStates();
}
void PCB_EDIT_FRAME::unitsChangeRefresh()
{
PCB_BASE_FRAME::unitsChangeRefresh(); // Update the grid size select box.
@ -667,9 +676,9 @@ void PCB_EDIT_FRAME::SetElementVisibility( int aElement, bool aNewState )
}
void PCB_EDIT_FRAME::SetVisibleAlls( )
void PCB_EDIT_FRAME::SetVisibleAlls()
{
GetBoard()->SetVisibleAlls( );
GetBoard()->SetVisibleAlls();
for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ )
m_Layers->SetRenderState( ii, true );

View File

@ -177,15 +177,25 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
// User library path takes precedent over default library search paths.
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
// Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate
// what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings
// have no control over what is visible (see PCB_EDIT_FRAME::GetProjectFileParameters())
// this is recklessly turning on things the user may not want to see.
#if 0
/* Reset the items visibility flag when loading a new configuration because it could
* create SERIOUS mistakes for the user f board items are not visible after loading
* create 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
return true;
}

View File

@ -152,6 +152,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
FILE* FichCmp, * NewFile;
char line[1024];
wxString msg;
char* quiet_gcc_4_4_3;
if( old_name == new_name )
return 0;
@ -189,7 +190,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
return 1;
}
fgets( line, sizeof(line), FichCmp );
quiet_gcc_4_4_3 = fgets( line, sizeof(line), FichCmp );
fprintf( NewFile, "Cmp-Mod V01 Created by PcbNew date = %s\n", TO_UTF8( DateAndTime() ) );
@ -587,6 +588,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
MODULE* Module = GetBoard()->m_Modules;
wxString msg;
wxString wildcard;
char* quiet_gcc_4_4_3;
if( Module == NULL )
{
@ -617,7 +619,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
return;
}
fgets( line, sizeof(line), FichCmp );
quiet_gcc_4_4_3 = fgets( line, sizeof(line), FichCmp );
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
for( ; Module != NULL; Module = Module->Next() )

View File

@ -55,10 +55,10 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
switch( cornerSmoothingType )
{
case ZONE_SETTING::SMOOTHING_CHAMFER:
case ZONE_SETTINGS::SMOOTHING_CHAMFER:
smoothedPoly = m_Poly->Chamfer( cornerRadius );
break;
case ZONE_SETTING::SMOOTHING_FILLET:
case ZONE_SETTINGS::SMOOTHING_FILLET:
smoothedPoly = m_Poly->Fillet( cornerRadius, m_ArcToSegmentsCount );
break;
default:

View File

@ -2,12 +2,8 @@
/* constants used in zone dialogs and functions */
/************************************************/
#ifndef ZONES_H
#define ZONES_H
#include <class_zone_setting.h>
#ifndef ZONES_H_
#define ZONES_H_
// keys used to store net sort option in config file :
#define ZONE_NET_OUTLINES_HATCH_OPTION_KEY wxT( "Zone_Ouline_Hatch_Opt" )
@ -16,28 +12,46 @@
#define ZONE_THERMAL_RELIEF_GAP_STRING_KEY wxT( "Zone_TH_Gap" )
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY wxT( "Zone_TH_Copper_Width" )
// Exit codes for dialog edit zones
enum zone_cmd {
ZONE_ABORT, // if no change
ZONE_OK, // if new values accepted
ZONE_EXPORT_VALUES // if values are exported to others zones
/// Exit codes for zone editing dialogs
enum ZONE_EDIT_T {
ZONE_ABORT, ///< if no change
ZONE_OK, ///< if new values were accepted
ZONE_EXPORT_VALUES ///< if values were exported to others zones
};
enum { // How pads are covered by copper in zone
PAD_NOT_IN_ZONE, // Pads are not covered
THERMAL_PAD, // Use thermal relief for pads
PAD_IN_ZONE // pads are covered by copper
/// How pads are covered by copper in zone
enum {
PAD_NOT_IN_ZONE, ///< Pads are not covered
THERMAL_PAD, ///< Use thermal relief for pads
PAD_IN_ZONE ///< pads are covered by copper
};
class ZONE_CONTAINER;
class ZONE_SETTINGS;
class PCB_BASE_FRAME;
/************************************************/
/* variables used in zone dialogs and functions */
/************************************************/
/**
* Function InvokeNonCopperZonesEditor
* invokes up a modal dialog window for non-copper zone editing.
*
* @param aCaller is the PCB_BASE_FRAME calling parent window for the modal dialog,
* and it gives access to the BOARD through PCB_BASE_FRAME::GetBoard().
* @param aZone is the ZONE_CONTAINER to edit.
* @param aSettings points to the ZONE_SETTINGS to edit.
* @return ZONE_EDIT_T - tells if user aborted, changed only one zone, or all of them.
*/
ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings );
extern bool g_Zone_45_Only;
/**
* Function InvokeCopperZonesEditor
* invokes up a modal dialog window for copper zone editing.
*
* @param aCaller is the PCB_BASE_FRAME calling parent window for the modal dialog,
* and it gives access to the BOARD through PCB_BASE_FRAME::GetBoard().
* @param aZone is the ZONE_CONTAINER to edit.
* @return ZONE_EDIT_T - tells if user aborted, changed only one zone, or all of them.
*/
ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings );
// Default setting used when creating a new zone
extern ZONE_SETTING g_Zone_Default_Setting;
#endif // ifndef ZONES_H
#endif // ZONES_H_

View File

@ -57,7 +57,7 @@ static void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel
const wxPoint& aPosition,
bool aErase );
/* Local variables */
// Local variables
static wxPoint s_CornerInitialPosition; // Used to abort a move corner command
static bool s_CornerIsNew; // Used to abort a move corner command (if it is a new corner, it must be deleted)
static bool s_AddCutoutToCurrentZone; // if true, the next outline will be added to s_CurrentZone
@ -66,39 +66,41 @@ static wxPoint s_CursorLastPosition; // in move zone outline, las
static PICKED_ITEMS_LIST s_PickedList; // a picked list to save zones for undo/redo command
static PICKED_ITEMS_LIST _AuxiliaryList; // a picked list to store zones that are deleted or added when combined
#include <dialog_copper_zones.h>
void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container )
void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* aZone )
{
if ( zone_container == NULL )
if( !aZone )
return;
s_AddCutoutToCurrentZone = false;
s_CurrentZone = zone_container;
s_CurrentZone = aZone;
/* set zones setup to the current zone */
g_Zone_Default_Setting.ImportSetting( *zone_container );
// set zone settings to the current zone
ZONE_SETTINGS zoneInfo = GetZoneSettings();
zoneInfo << *aZone;
SetZoneSettings( zoneInfo );
// Use the general event handle to set others params (like toolbar) */
// Use the general event handler to set others params (like toolbar)
wxCommandEvent evt;
evt.SetId( ID_PCB_ZONES_BUTT );
OnSelectTool( evt );
}
void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container )
void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* aZone )
{
if ( zone_container == NULL )
if( !aZone )
return;
s_AddCutoutToCurrentZone = true;
s_CurrentZone = zone_container;
s_CurrentZone = aZone;
/* set zones setup to the current zone */
g_Zone_Default_Setting.ImportSetting( *zone_container );
// set zones setup to the current zone
ZONE_SETTINGS zoneInfo = GetZoneSettings();
zoneInfo << *aZone;
SetZoneSettings( zoneInfo );
// Use the general event handle to set others params (like toolbar) */
// Use the general event handle to set others params (like toolbar)
wxCommandEvent evt;
evt.SetId( ID_PCB_ZONES_BUTT );
OnSelectTool( evt );
@ -109,10 +111,10 @@ int PCB_EDIT_FRAME::Delete_LastCreatedCorner( wxDC* DC )
{
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
if( zone == NULL )
if( !zone )
return 0;
if( zone->GetNumCorners() == 0 )
if( !zone->GetNumCorners() )
return 0;
zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR );
@ -159,18 +161,21 @@ static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
}
void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container,
void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone,
int corner_id, bool IsNewCorner )
{
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
if( aZone->IsOnCopperLayer() ) // Show the Net
{
if( GetBoard()->IsHighLightNetON() && DC )
{
HighLight( DC ); // Remove old highlight selection
}
g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet();
GetBoard()->SetHighLightNet( zone_container->GetNet() );
ZONE_SETTINGS zoneInfo = GetZoneSettings();
zoneInfo.m_NetcodeSelection = aZone->GetNet();
SetZoneSettings( zoneInfo );
GetBoard()->SetHighLightNet( aZone->GetNet() );
if( DC )
HighLight( DC );
@ -179,25 +184,25 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont
// Prepare copy of old zones, for undo/redo.
// if the corner is new, remove it from list, save and insert it in list
int cx = zone_container->m_Poly->GetX( corner_id );
int cy = zone_container->m_Poly->GetY( corner_id );
int cx = aZone->m_Poly->GetX( corner_id );
int cy = aZone->m_Poly->GetY( corner_id );
if ( IsNewCorner )
zone_container->m_Poly->DeleteCorner( corner_id );
aZone->m_Poly->DeleteCorner( corner_id );
_AuxiliaryList.ClearListAndDeleteItems();
s_PickedList.ClearListAndDeleteItems();
SaveCopyOfZones( s_PickedList, GetBoard(), zone_container->GetNet(),
zone_container->GetLayer() );
SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNet(),
aZone->GetLayer() );
if ( IsNewCorner )
zone_container->m_Poly->InsertCorner(corner_id-1, cx, cy );
aZone->m_Poly->InsertCorner(corner_id-1, cx, cy );
zone_container->SetFlags( IN_EDIT );
aZone->SetFlags( IN_EDIT );
m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
s_CornerInitialPosition = zone_container->GetCornerPosition( corner_id );
s_CornerInitialPosition = aZone->GetCornerPosition( corner_id );
s_CornerIsNew = IsNewCorner;
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
@ -205,11 +210,11 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont
void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
ZONE_CONTAINER* zone_container,
ZONE_CONTAINER* aZone,
int corner_id )
{
zone_container->SetFlags( IS_DRAGGED );
zone_container->m_CornerSelection = corner_id;
aZone->SetFlags( IS_DRAGGED );
aZone->m_CornerSelection = corner_id;
m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->GetCrossHairPosition();
@ -218,32 +223,35 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
s_PickedList.ClearListAndDeleteItems();
_AuxiliaryList.ClearListAndDeleteItems();
SaveCopyOfZones( s_PickedList, GetBoard(), zone_container->GetNet(),
zone_container->GetLayer() );
SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNet(),
aZone->GetLayer() );
}
void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container )
void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* aZone )
{
/* Show the Net */
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
// Show the Net
if( aZone->IsOnCopperLayer() ) // Show the Net
{
if( GetBoard()->IsHighLightNetON() )
{
HighLight( DC ); // Remove old highlight selection
}
g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet();
GetBoard()->SetHighLightNet( zone_container->GetNet() );
ZONE_SETTINGS zoneInfo = GetZoneSettings();
zoneInfo.m_NetcodeSelection = aZone->GetNet();
SetZoneSettings( zoneInfo );
GetBoard()->SetHighLightNet( aZone->GetNet() );
HighLight( DC );
}
s_PickedList.ClearListAndDeleteItems();
_AuxiliaryList.ClearListAndDeleteItems();
SaveCopyOfZones( s_PickedList, GetBoard(), zone_container->GetNet(),
zone_container->GetLayer() );
SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNet(),
aZone->GetLayer() );
zone_container->SetFlags( IS_MOVED );
aZone->SetFlags( IS_MOVED );
m_canvas->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->GetCrossHairPosition();
@ -253,13 +261,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co
}
void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container )
void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* aZone )
{
zone_container->ClearFlags();
aZone->ClearFlags();
m_canvas->SetMouseCapture( NULL, NULL );
if( DC )
zone_container->Draw( m_canvas, DC, GR_OR );
aZone->Draw( m_canvas, DC, GR_OR );
OnModify();
s_AddCutoutToCurrentZone = false;
@ -267,22 +275,22 @@ void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER*
SetCurItem( NULL ); // This outline can be deleted when merging outlines
/* Combine zones if possible */
// Combine zones if possible
wxBusyCursor dummy;
GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone_container, true, s_Verbose );
GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose );
m_canvas->Refresh();
int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists
int ii = GetBoard()->GetAreaIndex( aZone ); // test if aZone exists
if( ii < 0 )
zone_container = NULL; // was removed by combining zones
aZone = NULL; // was removed by combining zones
UpdateCopyOfZonesList( s_PickedList, _AuxiliaryList, GetBoard() );
SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true );
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( aZone, true );
if( error_count )
{
@ -291,25 +299,25 @@ void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER*
}
void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container )
void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone )
{
OnModify();
if( zone_container->m_Poly->GetNumCorners() <= 3 )
if( aZone->m_Poly->GetNumCorners() <= 3 )
{
m_canvas->RefreshDrawingRect( zone_container->GetBoundingBox() );
m_canvas->RefreshDrawingRect( aZone->GetBoundingBox() );
if( DC )
{ // Remove the full zone because this is no more an area
zone_container->UnFill();
zone_container->DrawFilledArea( m_canvas, DC, GR_XOR );
aZone->UnFill();
aZone->DrawFilledArea( m_canvas, DC, GR_XOR );
}
GetBoard()->Delete( zone_container );
GetBoard()->Delete( aZone );
return;
}
int layer = zone_container->GetLayer();
int layer = aZone->GetLayer();
if( DC )
{
@ -319,12 +327,12 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
_AuxiliaryList.ClearListAndDeleteItems();
s_PickedList. ClearListAndDeleteItems();
SaveCopyOfZones( s_PickedList, GetBoard(), zone_container->GetNet(),
zone_container->GetLayer() );
zone_container->m_Poly->DeleteCorner( zone_container->m_CornerSelection );
SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNet(),
aZone->GetLayer() );
aZone->m_Poly->DeleteCorner( aZone->m_CornerSelection );
// modify zones outlines according to the new zone_container shape
GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone_container, true, s_Verbose );
// modify zones outlines according to the new aZone shape
GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose );
if( DC )
{
@ -336,12 +344,12 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists
int ii = GetBoard()->GetAreaIndex( aZone ); // test if aZone exists
if( ii < 0 )
zone_container = NULL; // zone_container does not exist anymore, after combining zones
aZone = NULL; // aZone does not exist anymore, after combining zones
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true );
int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( aZone, true );
if( error_count )
{
@ -357,30 +365,30 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_containe
void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) pcbframe->GetCurItem();
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( zone_container->IsMoving() )
if( zone->IsMoving() )
{
wxPoint offset;
offset = s_CornerInitialPosition - s_CursorLastPosition;
zone_container->Move( offset );
zone->Move( offset );
}
else if( zone_container->IsDragging() )
else if( zone->IsDragging() )
{
wxPoint offset;
offset = s_CornerInitialPosition - s_CursorLastPosition;
zone_container->MoveEdge( offset );
zone->MoveEdge( offset );
}
else
{
if( s_CornerIsNew )
{
zone_container->m_Poly->DeleteCorner( zone_container->m_CornerSelection );
zone->m_Poly->DeleteCorner( zone->m_CornerSelection );
}
else
{
wxPoint pos = s_CornerInitialPosition;
zone_container->m_Poly->MoveCorner( zone_container->m_CornerSelection, pos.x, pos.y );
zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y );
}
}
@ -390,21 +398,20 @@ void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
Panel->Refresh();
pcbframe->SetCurItem( NULL );
zone_container->ClearFlags();
zone->ClearFlags();
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
}
/* Redraws the zone outline when moving a corner according to the cursor position
*/
/// Redraws the zone outline when moving a corner according to the cursor position
void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent();
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( aErase ) /* Undraw edge in old position*/
if( aErase ) // Undraw edge in old position
{
zone->Draw( aPanel, aDC, GR_XOR );
}
@ -437,9 +444,10 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC*
int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{
ZONE_SETTINGS zoneInfo = GetZoneSettings();
// verify if s_CurrentZone exists (could be deleted since last selection) :
int ii;
for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
{
if( s_CurrentZone == GetBoard()->GetArea( ii ) )
@ -453,16 +461,17 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
}
// If no zone contour in progress, a new zone is being created:
if( GetBoard()->m_CurrentZoneContour == NULL )
if( !GetBoard()->m_CurrentZoneContour )
GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() );
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
if( zone->GetNumCorners() == 0 ) // Start a new contour: init zone params (net, layer ...)
{
if( s_CurrentZone == NULL ) // A new outline is created, from scratch
if( !s_CurrentZone ) // A new outline is created, from scratch
{
int diag;
ZONE_EDIT_T edited;
// Init zone params to reasonable values
zone->SetLayer( getActiveLayer() );
@ -470,59 +479,72 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
m_canvas->SetIgnoreMouseEvents( true );
if( zone->IsOnCopperLayer() )
{ // Put a zone on a copper layer
if ( GetBoard()->GetHighLightNetCode() > 0 )
{
g_Zone_Default_Setting.m_NetcodeSelection = GetBoard()->GetHighLightNetCode();
// Put a zone on a copper layer
if( GetBoard()->GetHighLightNetCode() > 0 )
{
zoneInfo.m_NetcodeSelection = GetBoard()->GetHighLightNetCode();
zone->SetNet( g_Zone_Default_Setting.m_NetcodeSelection );
zone->SetNet( zoneInfo.m_NetcodeSelection );
zone->SetNetNameFromNetCode( );
}
wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
&g_Zone_Default_Setting.m_ThermalReliefGap );
wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
&g_Zone_Default_Setting.m_ThermalReliefCopperBridge );
&zoneInfo.m_ThermalReliefGap );
g_Zone_Default_Setting.m_CurrentZone_Layer = zone->GetLayer();
DIALOG_COPPER_ZONE* frame = new DIALOG_COPPER_ZONE( this, &g_Zone_Default_Setting );
diag = frame->ShowModal();
frame->Destroy();
wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
&zoneInfo.m_ThermalReliefCopperBridge );
zoneInfo.m_CurrentZone_Layer = zone->GetLayer();
edited = InvokeCopperZonesEditor( this, &zoneInfo );
}
else // Put a zone on a non copper layer (technical layer)
{
diag = InstallDialogNonCopperZonesEditor( zone );
g_Zone_Default_Setting.m_NetcodeSelection = 0; // No net for non copper zones
zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones
edited = InvokeNonCopperZonesEditor( this, zone, &zoneInfo );
}
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
if( diag == ZONE_ABORT )
if( edited == ZONE_ABORT )
return 0;
// Switch active layer to the selected zone layer
setActiveLayer( g_Zone_Default_Setting.m_CurrentZone_Layer );
setActiveLayer( zoneInfo.m_CurrentZone_Layer );
SetZoneSettings( zoneInfo );
}
else // Start a new contour: init zone params (net and layer) from an existing
{ // zone (add cutout or similar zone)
g_Zone_Default_Setting.m_CurrentZone_Layer = s_CurrentZone->GetLayer();
else
{
// Start a new contour: init zone params (net and layer) from an existing
// zone (add cutout or similar zone)
zoneInfo.m_CurrentZone_Layer = s_CurrentZone->GetLayer();
setActiveLayer( s_CurrentZone->GetLayer() );
g_Zone_Default_Setting.ImportSetting( * s_CurrentZone);
zoneInfo << *s_CurrentZone;
SetZoneSettings( zoneInfo );
}
/* Show the Net for zones on copper layers */
if( g_Zone_Default_Setting.m_CurrentZone_Layer < FIRST_NO_COPPER_LAYER )
// Show the Net for zones on copper layers
if( zoneInfo.m_CurrentZone_Layer < FIRST_NO_COPPER_LAYER )
{
if( s_CurrentZone )
g_Zone_Default_Setting.m_NetcodeSelection = s_CurrentZone->GetNet();
{
zoneInfo.m_NetcodeSelection = s_CurrentZone->GetNet();
GetBoard()->SetZoneSettings( zoneInfo );
}
if( GetBoard()->IsHighLightNetON() )
{
HighLight( DC ); // Remove old highlight selection
}
GetBoard()->SetHighLightNet( g_Zone_Default_Setting.m_NetcodeSelection );
GetBoard()->SetHighLightNet( zoneInfo.m_NetcodeSelection );
HighLight( DC );
}
@ -535,11 +557,14 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{
zone->SetFlags( IS_NEW );
zone->SetTimeStamp( GetNewTimeStamp() );
g_Zone_Default_Setting.ExportSetting( *zone );
zone->m_Poly->Start( g_Zone_Default_Setting.m_CurrentZone_Layer,
zoneInfo.ExportSetting( *zone );
zone->m_Poly->Start( zoneInfo.m_CurrentZone_Layer,
GetScreen()->GetCrossHairPosition().x,
GetScreen()->GetCrossHairPosition().y,
zone->GetHatchStyle() );
zone->AppendCorner( GetScreen()->GetCrossHairPosition() );
if( Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() )
@ -563,11 +588,12 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{
ii = zone->GetNumCorners() - 1;
/* edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse */
// edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse
if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
{
if( !Drc_On || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) )
{ // Ok, we can add a new corner
{
// Ok, we can add a new corner
zone->AppendCorner( GetScreen()->GetCrossHairPosition() );
SetCurItem( zone ); // calls DisplayInfo().
}
@ -582,7 +608,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
{
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
if( zone == NULL )
if( !zone )
return true;
// Validate the current outline:
@ -624,12 +650,13 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
s_PickedList.ClearListAndDeleteItems();
SaveCopyOfZones(s_PickedList, GetBoard(), zone->GetNet(), zone->GetLayer() );
/* Put new zone in list */
if( s_CurrentZone == NULL )
// Put new zone in list
if( !s_CurrentZone )
{
zone->m_Poly->Close(); // Close the current corner list
GetBoard()->Add( zone );
GetBoard()->m_CurrentZoneContour = NULL;
// Add this zone in picked list, as new item
ITEM_PICKER picker( zone, UR_NEW );
s_PickedList.PushItem( picker );
@ -658,7 +685,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer );
GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_OR, layer );
int ii = GetBoard()->GetAreaIndex( zone ); // test if zone_container exists
int ii = GetBoard()->GetAreaIndex( zone ); // test if zone exists
if( ii < 0 )
zone = NULL; // was removed by combining zones
@ -688,21 +715,21 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
wxPoint c_pos = pcbframe->GetScreen()->GetCrossHairPosition();
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
if( zone == NULL )
if( !zone )
return;
int icorner = zone->GetNumCorners() - 1;
if ( icorner < 1 )
if( icorner < 1 )
return; // We must have 2 (or more) corners
if( aErase ) /* Undraw edge in old position*/
if( aErase ) // Undraw edge in old position
{
zone->DrawWhileCreateOutline( aPanel, aDC );
}
/* Redraw the current edge in its new position */
if( g_Zone_45_Only )
// Redraw the current edge in its new position
if( pcbframe->GetZoneSettings().m_Zone_45_Only )
{
// calculate the new position as allowed
wxPoint StartPoint = zone->GetCornerPosition( icorner - 1 );
@ -715,41 +742,45 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
}
void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container )
void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
{
int diag;
ZONE_EDIT_T edited;
ZONE_SETTINGS zoneInfo = GetZoneSettings();
m_canvas->SetIgnoreMouseEvents( true );
/* Save initial zones configuration, for undo/redo, before adding new zone
* note the net name and the layer can be changed, so we must save all zones
*/
// Save initial zones configuration, for undo/redo, before adding new zone
// note the net name and the layer can be changed, so we must save all zones
_AuxiliaryList.ClearListAndDeleteItems();
s_PickedList.ClearListAndDeleteItems();
SaveCopyOfZones(s_PickedList, GetBoard(), -1, -1 );
if( zone_container->GetLayer() < FIRST_NO_COPPER_LAYER )
{ // edit a zone on a copper layer
g_Zone_Default_Setting.ImportSetting(*zone_container);
DIALOG_COPPER_ZONE* frame = new DIALOG_COPPER_ZONE( this, &g_Zone_Default_Setting );
diag = frame->ShowModal();
frame->Destroy();
}
else // edit a zone on a non copper layer (technical layer)
if( aZone->GetLayer() < FIRST_NO_COPPER_LAYER )
{
diag = InstallDialogNonCopperZonesEditor( zone_container );
// edit a zone on a copper layer
zoneInfo << *aZone;
edited = InvokeCopperZonesEditor( this, &zoneInfo );
}
else
{
edited = InvokeNonCopperZonesEditor( this, aZone, &zoneInfo );
}
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
if( diag == ZONE_ABORT )
if( edited == ZONE_ABORT )
{
_AuxiliaryList.ClearListAndDeleteItems();
s_PickedList.ClearListAndDeleteItems();
return;
}
if( diag == ZONE_EXPORT_VALUES )
SetZoneSettings( zoneInfo );
if( edited == ZONE_EXPORT_VALUES )
{
UpdateCopyOfZonesList( s_PickedList, _AuxiliaryList, GetBoard() );
SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
@ -764,47 +795,49 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
edge_zone->Draw( m_canvas, DC, GR_XOR );
}
g_Zone_Default_Setting.ExportSetting( *zone_container);
NETINFO_ITEM* net = GetBoard()->FindNet( g_Zone_Default_Setting.m_NetcodeSelection );
zoneInfo.ExportSetting( *aZone );
NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection );
if( net ) // net == NULL should not occur
zone_container->m_Netname = net->GetNetname();
aZone->m_Netname = net->GetNetname();
// Combine zones if possible :
GetBoard()->AreaPolygonModified( &_AuxiliaryList, zone_container, true, s_Verbose );
// Combine zones if possible
GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose );
// Redraw the real new zone outlines:
// Redraw the real new zone outlines
GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, -1 );
UpdateCopyOfZonesList( s_PickedList, _AuxiliaryList, GetBoard() );
SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED);
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
s_PickedList.ClearItemsList(); // s_ItemsListPicker is no longer owner of picked items
OnModify();
}
void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container )
void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* aZone )
{
int ncont = zone_container->m_Poly->GetContour( zone_container->m_CornerSelection );
int ncont = aZone->m_Poly->GetContour( aZone->m_CornerSelection );
EDA_RECT dirty = zone_container->GetBoundingBox();
EDA_RECT dirty = aZone->GetBoundingBox();
// For compatibility with old boards: remove old SEGZONE fill segments
Delete_OldZone_Fill( NULL, zone_container->GetTimeStamp() );
Delete_OldZone_Fill( NULL, aZone->GetTimeStamp() );
// Remove current filling:
zone_container->UnFill();
aZone->UnFill();
if( ncont == 0 ) // This is the main outline: remove all
{
SaveCopyInUndoList( zone_container, UR_DELETED );
GetBoard()->Remove( zone_container );
SaveCopyInUndoList( aZone, UR_DELETED );
GetBoard()->Remove( aZone );
}
else
{
zone_container->m_Poly->RemoveContour( ncont );
aZone->m_Poly->RemoveContour( ncont );
}
m_canvas->RefreshDrawingRect( dirty );

View File

@ -41,6 +41,8 @@
#include <pcbnew.h>
#include <zones.h>
#define FORMAT_STRING _( "Filling zone %d out of %d (net %s)..." )
/**
* Function Delete_OldZone_Fill (obsolete)
@ -70,7 +72,7 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
if( zone->GetTimeStamp() == TimeStamp )
{
modify = true;
/* remove item from linked list and free memory */
// remove item from linked list and free memory
zone->DeleteStructure();
}
}
@ -83,15 +85,6 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
}
/**
* Function Fill_Zone
* Calculate the zone filling for the outline zone_container
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists, the old filling is removed
* @param aZone = zone to fill
* @return error level (0 = no error)
*/
int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
{
wxString msg;
@ -99,7 +92,10 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
ClearMsgPanel();
// Shows the net
g_Zone_Default_Setting.m_NetcodeSelection = aZone->GetNet();
ZONE_SETTINGS zoneInfo = GetZoneSettings();
zoneInfo.m_NetcodeSelection = aZone->GetNet();
SetZoneSettings( zoneInfo );
msg = aZone->GetNetName();
if( msg.IsEmpty() )
@ -119,22 +115,12 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
}
/*
* Function Fill_All_Zones
* Fill all zones on the board
* The old fillings are removed
* aActiveWindow = the current active window, if a progress bar is shown
* = NULL to do not display a progress bar
* aVerbose = true to show error messages
* return error level (0 = no error)
*/
int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose )
{
int errorLevel = 0;
int areaCount = GetBoard()->GetAreaCount();
wxBusyCursor dummyCursor;
wxString msg;
#define FORMAT_STRING _( "Filling zone %d out of %d (net %s)..." )
wxProgressDialog * progressDialog = NULL;
// Create a message with a long net name, and build a wxProgressDialog

View File

@ -16,75 +16,78 @@
#include <dialog_non_copper_zones_properties_base.h>
/* Class DialogNonCopperZonesEditor
* Dialog editor for non copper zones properties
* Derived from DialogNonCopperZonesPropertiesBase, created by wxFormBuilder
/**
* Class DIALOG_NON_COPPER_ZONES_EDITOR
* is a dialog editor for non copper zones properties,
* derived from DialogNonCopperZonesPropertiesBase, which is maintained and
* created by wxFormBuilder
*/
class DialogNonCopperZonesEditor : public DialogNonCopperZonesPropertiesBase
class DIALOG_NON_COPPER_ZONES_EDITOR : public DialogNonCopperZonesPropertiesBase
{
private:
PCB_EDIT_FRAME* m_Parent;
ZONE_CONTAINER* m_Zone_Container;
ZONE_SETTING* m_Zone_Setting;
PCB_BASE_FRAME* m_Parent;
ZONE_CONTAINER* m_zone;
ZONE_SETTINGS* m_ptr;
ZONE_SETTINGS m_settings;
private:
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void Init();
public:
DialogNonCopperZonesEditor( PCB_EDIT_FRAME* parent,
ZONE_CONTAINER* zone_container,
ZONE_SETTING* zone_setting );
~DialogNonCopperZonesEditor();
DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings );
};
DialogNonCopperZonesEditor::DialogNonCopperZonesEditor( PCB_EDIT_FRAME* parent,
ZONE_CONTAINER* zone_container,
ZONE_SETTING* zone_setting ) :
DialogNonCopperZonesPropertiesBase( parent )
ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent,
ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings )
{
m_Parent = parent;
m_Zone_Container = zone_container;
m_Zone_Setting = zone_setting;
DIALOG_NON_COPPER_ZONES_EDITOR dlg( aParent, aZone, aSettings );
ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() );
// D(printf( "%s: result:%d\n", __FUNCTION__, result );)
return result;
}
DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
ZONE_CONTAINER* aZone,
ZONE_SETTINGS* aSettings ) :
DialogNonCopperZonesPropertiesBase( aParent )
{
m_Parent = aParent;
m_zone = aZone;
m_ptr = aSettings;
m_settings = *aSettings;
Init();
/* the size of some items has changed, so we must call SetSizeHints() */
// the size of some items has changed, so we must call SetSizeHints()
GetSizer()->SetSizeHints( this );
}
DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor()
{
}
bool PCB_EDIT_FRAME::InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone )
{
DialogNonCopperZonesEditor frame( this, aZone, &g_Zone_Default_Setting );
bool diag = frame.ShowModal();
return diag;
}
void DialogNonCopperZonesEditor::Init()
void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
SetFocus();
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
SetReturnCode( ZONE_ABORT ); // Will be changed on button click
m_FillModeCtrl->SetSelection( m_Zone_Setting->m_FillMode ? 1 : 0 );
m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneMinThickness,
m_settings.m_ZoneMinThickness,
m_Parent->GetInternalUnits() );
m_ZoneMinThicknessCtrl->SetValue( msg );
if( g_Zone_45_Only )
if( m_settings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
switch( g_Zone_Default_Setting.m_Zone_HatchingStyle )
switch( m_settings.m_Zone_HatchingStyle )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
@ -108,9 +111,9 @@ void DialogNonCopperZonesEditor::Init()
msg = m_Parent->GetBoard()->GetLayerName( layer_number ).Trim();
m_LayerSelectionCtrl->InsertItems( 1, &msg, ii );
if( m_Zone_Container )
if( m_zone )
{
if( m_Zone_Container->GetLayer() == layer_number )
if( m_zone->GetLayer() == layer_number )
m_LayerSelectionCtrl->SetSelection( ii );
}
else
@ -122,48 +125,49 @@ void DialogNonCopperZonesEditor::Init()
}
void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event )
{
wxString 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,
_( "Error :\nyou must choose a copper min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) );
return;
}
m_Zone_Setting->m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1;
m_settings.m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1;
switch( m_OutlineAppearanceCtrl->GetSelection() )
{
case 0:
g_Zone_Default_Setting.m_Zone_HatchingStyle = CPolyLine::NO_HATCH;
m_settings.m_Zone_HatchingStyle = CPolyLine::NO_HATCH;
break;
case 1:
g_Zone_Default_Setting.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE;
m_settings.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE;
break;
case 2:
g_Zone_Default_Setting.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_FULL;
m_settings.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_FULL;
break;
}
if( wxGetApp().GetSettings() )
{
wxGetApp().GetSettings()->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) g_Zone_Default_Setting.m_Zone_HatchingStyle );
(long) m_settings.m_Zone_HatchingStyle );
}
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;
/* Get the layer selection for this zone */
// Get the layer selection for this zone
int ii = m_LayerSelectionCtrl->GetSelection();
if( ii < 0 )
@ -172,12 +176,18 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
return;
}
g_Zone_Default_Setting.m_CurrentZone_Layer = ii + FIRST_NO_COPPER_LAYER;
m_settings.m_CurrentZone_Layer = ii + FIRST_NO_COPPER_LAYER;
*m_ptr = m_settings;
EndModal( ZONE_OK );
}
void DialogNonCopperZonesEditor::OnCancelClick( wxCommandEvent& event )
void DIALOG_NON_COPPER_ZONES_EDITOR::OnCancelClick( wxCommandEvent& event )
{
// do not save the edits.
EndModal( ZONE_ABORT );
}