Commit e7b3ed2e authored by Dick Hollenbeck's avatar Dick Hollenbeck

merge

parents 08ef7417 6c04e605
...@@ -4,6 +4,32 @@ KiCad ChangeLog 2012 ...@@ -4,6 +4,32 @@ KiCad ChangeLog 2012
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. 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> 2012-Feb-2 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++pcbnew ++pcbnew
......
...@@ -106,7 +106,7 @@ set(PCB_COMMON_SRCS ...@@ -106,7 +106,7 @@ set(PCB_COMMON_SRCS
../pcbnew/class_text_mod.cpp ../pcbnew/class_text_mod.cpp
../pcbnew/class_track.cpp ../pcbnew/class_track.cpp
../pcbnew/class_zone.cpp ../pcbnew/class_zone.cpp
../pcbnew/class_zone_setting.cpp ../pcbnew/class_zone_settings.cpp
../pcbnew/classpcb.cpp ../pcbnew/classpcb.cpp
../pcbnew/collectors.cpp ../pcbnew/collectors.cpp
../pcbnew/sel_layer.cpp ../pcbnew/sel_layer.cpp
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <plot_common.h> #include <plot_common.h>
#include <class_pad.h> #include <class_pad.h>
#include <class_zone_setting.h> #include <class_zone_settings.h>
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
...@@ -100,9 +100,6 @@ int g_PadCUColor = GREEN; ...@@ -100,9 +100,6 @@ int g_PadCUColor = GREEN;
int g_PadCMPColor = RED; 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, * 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 * 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; ...@@ -111,9 +108,4 @@ class BOARD_DESIGN_SETTINGS g_DesignSettings;
*/ */
DLIST<TRACK> g_CurrentTrackList; 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 ); D_PAD g_Pad_Master( (MODULE*) NULL );
...@@ -2,21 +2,14 @@ ...@@ -2,21 +2,14 @@
/* class_board_design_settings.h : handle board options */ /* class_board_design_settings.h : handle board options */
/**********************************************************/ /**********************************************************/
#ifndef _BOARD_DESIGN_SETTING_H #ifndef BOARD_DESIGN_SETTINGS_H_
#define _BOARD_DESIGN_SETTING_H #define BOARD_DESIGN_SETTINGS_H_
#include <pcbstruct.h> // NB_COLORS #include <pcbstruct.h> // NB_COLORS
// Class for handle current printed board design settings // Class for handle current printed board design settings
class 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: public:
bool m_MicroViasAllowed; ///< true to allow micro vias bool m_MicroViasAllowed; ///< true to allow micro vias
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA) int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
...@@ -57,9 +50,10 @@ public: ...@@ -57,9 +50,10 @@ public:
/** /**
* Function SetVisibleAlls * 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 * Function SetVisibleLayers
...@@ -177,9 +171,13 @@ public: ...@@ -177,9 +171,13 @@ public:
* @param aNewLayerCount = The new number of enabled copper layers * @param aNewLayerCount = The new number of enabled copper layers
*/ */
void SetCopperLayerCount( int aNewLayerCount ); void SetCopperLayerCount( int aNewLayerCount );
};
#endif 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
};
// _BOARD_DESIGN_SETTING_H #endif // BOARD_DESIGN_SETTINGS_H_
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <richio.h> #include <richio.h>
#include <class_pcb_screen.h> #include <class_pcb_screen.h>
#ifndef PCB_INTERNAL_UNIT #ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000 #define PCB_INTERNAL_UNIT 10000
#endif #endif
...@@ -56,6 +57,7 @@ class EDA_3D_FRAME; ...@@ -56,6 +57,7 @@ class EDA_3D_FRAME;
class GENERAL_COLLECTOR; class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE; class GENERAL_COLLECTORS_GUIDE;
class BOARD_DESIGN_SETTINGS; class BOARD_DESIGN_SETTINGS;
class ZONE_SETTINGS;
/** /**
* class PCB_BASE_FRAME * class PCB_BASE_FRAME
...@@ -130,6 +132,9 @@ public: ...@@ -130,6 +132,9 @@ public:
virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const; virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
virtual void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ); virtual void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
const ZONE_SETTINGS& GetZoneSettings() const;
void SetZoneSettings( const ZONE_SETTINGS& aSettings );
/** /**
* Function SetBoard * Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous * sets the m_Pcb member in such as way as to ensure deleting any previous
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <class_layer_box_selector.h> #include <class_layer_box_selector.h>
#include <class_macros_record.h> #include <class_macros_record.h>
#include <class_undoredo_container.h> #include <class_undoredo_container.h>
#include <zones.h>
#ifndef PCB_INTERNAL_UNIT #ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000 #define PCB_INTERNAL_UNIT 10000
...@@ -119,7 +119,7 @@ protected: ...@@ -119,7 +119,7 @@ protected:
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer; ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
if( doLayerWidgetUpdate ) if( doLayerWidgetUpdate )
syncLayerWidget(); syncLayerWidgetLayer();
} }
/** /**
...@@ -132,7 +132,7 @@ protected: ...@@ -132,7 +132,7 @@ protected:
} }
/** /**
* Function syncLayerWidget * Function syncLayerWidgetLayer
* updates the currently "selected" layer within the PCB_LAYER_WIDGET. * updates the currently "selected" layer within the PCB_LAYER_WIDGET.
* The currently active layer is defined by the return value of getActiveLayer(). * The currently active layer is defined by the return value of getActiveLayer().
* <p> * <p>
...@@ -140,7 +140,15 @@ protected: ...@@ -140,7 +140,15 @@ protected:
* here and we do not want to do that. * here and we do not want to do that.
* </p> * </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(); virtual void unitsChangeRefresh();
...@@ -702,7 +710,7 @@ public: ...@@ -702,7 +710,7 @@ public:
void OnConfigurePcbOptions( wxCommandEvent& aEvent ); void OnConfigurePcbOptions( wxCommandEvent& aEvent );
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent ); void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
bool InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone );
void InstallDialogLayerSetup(); void InstallDialogLayerSetup();
void GenModulesPosition( wxCommandEvent& event ); void GenModulesPosition( wxCommandEvent& event );
......
...@@ -194,6 +194,20 @@ void PCB_BASE_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ) ...@@ -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 EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{ {
wxASSERT( m_Pcb ); wxASSERT( m_Pcb );
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <common.h> #include <common.h>
#include <pcbcommon.h> #include <pcbcommon.h>
#include <wxBasePcbFrame.h> #include <wxBasePcbFrame.h>
#include <build_version.h> // BOARD_FILE_VERSION
#include <pcbnew.h> #include <pcbnew.h>
#include <colors_selection.h> #include <colors_selection.h>
...@@ -52,16 +51,18 @@ BOARD::BOARD() : ...@@ -52,16 +51,18 @@ BOARD::BOARD() :
m_Layer[layer].m_Type = LT_SIGNAL; 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_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
m_ViaSizeSelector = 0; m_ViaSizeSelector = 0;
m_TrackWidthSelector = 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. // Initialize default values in default netclass.
*/
m_NetClasses.GetDefault()->SetParams(); m_NetClasses.GetDefault()->SetParams();
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() ); SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
} }
...@@ -530,14 +531,14 @@ void BOARD::SetVisibleElements( int aMask ) ...@@ -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. // 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 ); SetVisibleLayers( FULL_LAYERS );
/* Call SetElementVisibility for each item, // Call SetElementVisibility for each item,
* to ensure specific calculations that can be needed by some items // to ensure specific calculations that can be needed by some items
*/
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ ) for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
SetElementVisibility( ii, true ); SetElementVisibility( ii, true );
} }
...@@ -557,14 +558,16 @@ bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const ...@@ -557,14 +558,16 @@ bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const
void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
{ {
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
switch( aPCB_VISIBLE ) switch( aPCB_VISIBLE )
{ {
case RATSNEST_VISIBLE: case RATSNEST_VISIBLE:
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet // 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 // 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 // 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++ ) for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status |= CH_VISIBLE; m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
...@@ -574,12 +577,10 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) ...@@ -574,12 +577,10 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ ) for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE; m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
} }
break; break;
default: default:
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled ); ;
} }
} }
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
#include <common.h> // PAGE_INFO #include <common.h> // PAGE_INFO
#include <class_title_block.h> #include <class_title_block.h>
#include <class_zone_settings.h>
class PCB_BASE_FRAME; class PCB_BASE_FRAME;
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
...@@ -174,6 +176,7 @@ private: ...@@ -174,6 +176,7 @@ private:
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints .. NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
BOARD_DESIGN_SETTINGS m_designSettings; BOARD_DESIGN_SETTINGS m_designSettings;
ZONE_SETTINGS m_zoneSettings;
COLORS_DESIGN_SETTINGS* m_colorsSettings; COLORS_DESIGN_SETTINGS* m_colorsSettings;
PAGE_INFO m_paper; PAGE_INFO m_paper;
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
...@@ -549,8 +552,11 @@ public: ...@@ -549,8 +552,11 @@ public:
TITLE_BLOCK& GetTitleBlock() { return m_titles; } TITLE_BLOCK& GetTitleBlock() { return m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; } 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 * @return the current COLORS_DESIGN_SETTINGS in use
*/ */
COLORS_DESIGN_SETTINGS* GetColorsSettings() const { return m_colorsSettings; } COLORS_DESIGN_SETTINGS* GetColorsSettings() const { return m_colorsSettings; }
......
...@@ -17,7 +17,11 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() ...@@ -17,7 +17,11 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
{ {
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first. m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this. // 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 SetCopperLayerCount( 2 ); // Default design is a double sided board
...@@ -62,15 +66,10 @@ int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const ...@@ -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() void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{ {
SetVisibleLayers( FULL_LAYERS ); SetVisibleLayers( FULL_LAYERS );
m_VisibleElements = 0xFFFFFFFF; m_VisibleElements = -1;
} }
......
...@@ -66,13 +66,21 @@ void NETCLASS::SetParams( const NETCLASS* defaults ) ...@@ -66,13 +66,21 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
SetuViaDrill( defaults->GetuViaDrill() ); SetuViaDrill( defaults->GetuViaDrill() );
} }
else 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 // We use m_Parent->GetDesignSettings() to get some default values
// But when this function is called when instantiating a BOARD class, // But when this function is called when instantiating a BOARD class,
// by the NETCLASSES constructor that calls NETCLASS constructor, // by the NETCLASSES constructor that calls NETCLASS constructor,
// the BOARD constructor (see BOARD::BOARD) is not yet run, // the BOARD constructor (see BOARD::BOARD) is not yet run,
// and BOARD::m_designSettings contains not yet initialized values. // and BOARD::m_designSettings contains not yet initialized values.
// So inside the BOARD constructor itself, you SHOULD recall SetParams // So inside the BOARD constructor itself, you SHOULD recall SetParams
*/
const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings(); const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings();
SetTrackWidth( g.m_TrackMinWidth ); SetTrackWidth( g.m_TrackMinWidth );
......
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
* @param aParent = the parent board * @param aParent = the parent board
* @param aName = the name of this new netclass * @param aName = the name of this new netclass
* @param initialParameters is a NETCLASS to copy parameters from, or if * @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 ); NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters = NULL );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 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. * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -46,12 +46,32 @@ ...@@ -46,12 +46,32 @@
#include <pcbnew_id.h> #include <pcbnew_id.h>
/** // this is a read only template that is copied and modified before adding to LAYER_WIDGET
* Class PCB_LAYER_WIDGET const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
* 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 #define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
* menu which is specific to Pcbnew's needs.
*/ // 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 ) : 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 ...@@ -61,7 +81,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwn
ReFillRender(); ReFillRender();
// Update default tabs labels for GerbView // Update default tabs labels for GerbView
SetLayersManagerTabsText( ); SetLayersManagerTabsText();
//-----<Popup menu>------------------------------------------------- //-----<Popup menu>-------------------------------------------------
// handle the popup menu over the layer window. // handle the popup menu over the layer window.
...@@ -100,17 +120,16 @@ void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) ...@@ -100,17 +120,16 @@ void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
// menu text is capitalized: // menu text is capitalized:
// http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization // 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, menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, _( "Show All Copper Layers" ) ) );
_("Show All Copper Layers") ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, _( "Hide All Copper Layers" ) ) );
_( "Hide All Copper Layers" ) ) );
PopupMenu( &menu ); PopupMenu( &menu );
passOnFocus(); passOnFocus();
} }
void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{ {
int rowCount; int rowCount;
...@@ -160,68 +179,48 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -160,68 +179,48 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
} }
} }
/**
* Function SetLayersManagerTabsText void PCB_LAYER_WIDGET::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( )
{ {
m_notebook->SetPageText(0, _("Layer") ); m_notebook->SetPageText( 0, _( "Layer" ) );
m_notebook->SetPageText(1, _("Render") ); m_notebook->SetPageText( 1, _( "Render" ) );
} }
/**
* Function ReFillRender
* Rebuild Render for instance after the config is read
*/
void PCB_LAYER_WIDGET::ReFillRender() void PCB_LAYER_WIDGET::ReFillRender()
{ {
BOARD* board = myframe->GetBoard(); BOARD* board = myframe->GetBoard();
ClearRenderRows(); 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 // Add "Render" tab rows to LAYER_WIDGET, after setting color and checkbox state.
for( unsigned row=0; row<DIM(s_render_rows); ++row )
{
LAYER_WIDGET::ROW renderRow = s_render_rows[row];
// text id color tooltip checked if( renderRow.color != -1 ) // does this row show a color?
RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ), {
RR( _( "Bl/Buried Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show blind or buried vias" ) ), // this window frame must have an established BOARD, i.e. after SetBoard()
RR( _( "Micro Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show micro vias") ), renderRow.color = board->GetVisibleElementColor( renderRow.id );
RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ), }
renderRow.state = board->IsElementVisible( renderRow.id );
RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ), AppendRenderRow( renderRow );
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" ) ), void PCB_LAYER_WIDGET::SyncRenderStates()
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" ) ), BOARD* board = myframe->GetBoard();
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 ) for( unsigned row=0; row<DIM(s_render_rows); ++row )
{ {
if( renderRows[row].color != -1 ) // does this row show a color? // this does not fire an event
{ SetRenderState( s_render_rows[row].id, board->IsElementVisible( s_render_rows[row].id ) );
// 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 );
}
AppendRenderRows( renderRows, DIM(renderRows) );
} }
void PCB_LAYER_WIDGET::ReFill() void PCB_LAYER_WIDGET::ReFill()
{ {
BOARD* brd = myframe->GetBoard(); BOARD* brd = myframe->GetBoard();
...@@ -304,6 +303,7 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor ) ...@@ -304,6 +303,7 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor )
myframe->GetCanvas()->Refresh(); myframe->GetCanvas()->Refresh();
} }
bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{ {
// the layer change from the PCB_LAYER_WIDGET can be denied by returning // the layer change from the PCB_LAYER_WIDGET can be denied by returning
...@@ -316,6 +316,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) ...@@ -316,6 +316,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
return true; return true;
} }
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{ {
BOARD* brd = myframe->GetBoard(); BOARD* brd = myframe->GetBoard();
...@@ -369,5 +370,3 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) ...@@ -369,5 +370,3 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
} }
//-----</LAYER_WIDGET callbacks>------------------------------------------ //-----</LAYER_WIDGET callbacks>------------------------------------------
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
/* class_pcb_layer_widget.h : header for the layers manager */ /* class_pcb_layer_widget.h : header for the layers manager */
/************************************************************/ /************************************************************/
#ifndef _CLASS_PCB_LAYER_WIDGET_H_ #ifndef CLASS_PCB_LAYER_WIDGET_H_
#define _CLASS_PCB_LAYER_WIDGET_H_ #define CLASS_PCB_LAYER_WIDGET_H_
/** /**
* Class PCB_LAYER_WIDGET * Class PCB_LAYER_WIDGET
...@@ -39,24 +39,6 @@ ...@@ -39,24 +39,6 @@
*/ */
class PCB_LAYER_WIDGET : public LAYER_WIDGET class PCB_LAYER_WIDGET : public LAYER_WIDGET
{ {
PCB_EDIT_FRAME* myframe;
// popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
/**
* Function OnRightDownLayers
* puts up a popup menu for the layer panel.
*/
void onRightDownLayers( wxMouseEvent& event );
void onPopupSelection( wxCommandEvent& event );
/// 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: public:
/** /**
...@@ -73,23 +55,54 @@ public: ...@@ -73,23 +55,54 @@ public:
/** /**
* Function ReFillRender * Function ReFillRender
* Rebuild Render for instance after the config is read * rebuilds Render for instance after the config is read
*/ */
void ReFillRender(); 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>----------- //-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor ); void OnLayerColorChange( int aLayer, int aColor );
bool OnLayerSelect( int aLayer ); bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ); void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, int aColor ); void OnRenderColorChange( int aId, int aColor );
void OnRenderEnable( int aId, bool isEnabled ); 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.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
/** /**
* Function SetLayersManagerTabsText * Function OnRightDownLayers
* Update the layer manager tabs labels * puts up a popup menu for the layer panel.
* Useful when changing Language or to set labels to a non default value
*/ */
void SetLayersManagerTabsText( ); void onRightDownLayers( wxMouseEvent& event );
//-----</implement LAYER_WIDGET abstract callback functions>----------
void onPopupSelection( wxCommandEvent& event );
/// this is for the popup menu, the right click handler has to be installed
/// on every child control within the layer panel.
void installRightLayerClickHandler();
}; };
#endif // _CLASS_PCB_LAYER_WIDGET_H_ #endif // CLASS_PCB_LAYER_WIDGET_H_
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
#include <zones.h> #include <zones.h>
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) : ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
BOARD_CONNECTED_ITEM( parent, PCB_ZONE_AREA_T ) BOARD_CONNECTED_ITEM( aBoard, PCB_ZONE_AREA_T )
{ {
SetNet( -1 ); // Net number for fast comparisons SetNet( -1 ); // Net number for fast comparisons
m_CornerSelection = -1; m_CornerSelection = -1;
...@@ -57,12 +57,12 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) : ...@@ -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_FillMode = 0; // How to fill areas: 0 = use filled polygons, != 0 fill with segments
m_priority = 0; m_priority = 0;
smoothedPoly = NULL; smoothedPoly = NULL;
cornerSmoothingType = ZONE_SETTING::SMOOTHING_NONE; cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE;
cornerRadius = 0; cornerRadius = 0;
utility = 0; // flags used in polygon calculations utility = 0; // flags used in polygon calculations
utility2 = 0; // flags used in polygon calculations utility2 = 0; // flags used in polygon calculations
m_Poly = new CPolyLine(); // Outlines m_Poly = new CPolyLine(); // Outlines
g_Zone_Default_Setting.ExportSetting( *this ); aBoard->GetZoneSettings().ExportSetting( *this );
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <class_board_connected_item.h> #include <class_board_connected_item.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <PolyLine.h> #include <PolyLine.h>
#include <class_zone_setting.h> #include <class_zone_settings.h>
class EDA_RECT; class EDA_RECT;
......
/******************************************************/ /******************************************************/
/* class ZONE_SETTING used to handle zones parameters */ /* class ZONE_SETTINGS used to handle zones parameters */
/******************************************************/ /******************************************************/
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <class_zone.h> #include <class_zone.h>
ZONE_SETTING::ZONE_SETTING( void ) ZONE_SETTINGS::ZONE_SETTINGS()
{ {
m_ZonePriority = 0; m_ZonePriority = 0;
m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons
...@@ -31,25 +31,24 @@ ZONE_SETTING::ZONE_SETTING( void ) ...@@ -31,25 +31,24 @@ ZONE_SETTING::ZONE_SETTING( void )
m_NetcodeSelection = 0; // Net code selection for the current zone m_NetcodeSelection = 0; // Net code selection for the current zone
m_CurrentZone_Layer = 0; // Layer used to create 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_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 m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle
* or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments */ // 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_ThermalReliefGap = 200; // tickness of the gap in thermal reliefs
m_ThermalReliefCopperBridge = 200; // tickness of the copper bridge in thermal reliefs m_ThermalReliefCopperBridge = 200; // tickness of the copper bridge in thermal reliefs
m_Zone_Pad_Options = THERMAL_PAD; // How pads are covered by copper in zone m_Zone_Pad_Options = THERMAL_PAD; // How pads are covered by copper in zone
m_Zone_45_Only = false;
cornerSmoothingType = SMOOTHING_NONE; cornerSmoothingType = SMOOTHING_NONE;
cornerRadius = 0; cornerRadius = 0;
} }
/** ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
* Function ImportSetting
* copy settings from a given zone
* @param aSource: the given zone
*/
void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource )
{ {
m_ZonePriority = aSource.GetPriority(); m_ZonePriority = aSource.GetPriority();
m_FillMode = aSource.m_FillMode; m_FillMode = aSource.m_FillMode;
...@@ -64,19 +63,12 @@ void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource ) ...@@ -64,19 +63,12 @@ void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource )
m_Zone_Pad_Options = aSource.m_PadOption; m_Zone_Pad_Options = aSource.m_PadOption;
cornerSmoothingType = aSource.GetCornerSmoothingType(); cornerSmoothingType = aSource.GetCornerSmoothingType();
cornerRadius = aSource.GetCornerRadius(); cornerRadius = aSource.GetCornerRadius();
return *this;
} }
/** void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) const
* 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 )
{ {
aTarget.m_FillMode = m_FillMode; aTarget.m_FillMode = m_FillMode;
aTarget.m_ZoneClearance = m_ZoneClearance; aTarget.m_ZoneClearance = m_ZoneClearance;
...@@ -88,6 +80,7 @@ void ZONE_SETTING::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) ...@@ -88,6 +80,7 @@ void ZONE_SETTING::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport )
aTarget.m_PadOption = m_Zone_Pad_Options; aTarget.m_PadOption = m_Zone_Pad_Options;
aTarget.SetCornerSmoothingType( cornerSmoothingType ); aTarget.SetCornerSmoothingType( cornerSmoothingType );
aTarget.SetCornerRadius( cornerRadius ); aTarget.SetCornerRadius( cornerRadius );
if( aFullExport ) if( aFullExport )
{ {
aTarget.SetPriority( m_ZonePriority ); aTarget.SetPriority( m_ZonePriority );
......
/** /**
* @file class_zone_setting.h * @file class_zone_settings.h
* @brief Class ZONE_SETTING used to handle zones parameters in dialogs. * @brief Class ZONE_SETTINGS used to handle zones parameters in dialogs.
*/ */
#ifndef ZONE_SETTING_H #ifndef ZONE_SETTINGS_H_
#define ZONE_SETTING_H #define ZONE_SETTINGS_H_
class ZONE_CONTAINER; class ZONE_CONTAINER;
...@@ -14,10 +14,10 @@ class ZONE_CONTAINER; ...@@ -14,10 +14,10 @@ class ZONE_CONTAINER;
/** /**
* Class ZONE_SETTING * Class ZONE_SETTINGS
* handles zones parameters. * handles zones parameters.
*/ */
class ZONE_SETTING class ZONE_SETTINGS
{ {
public: public:
enum { enum {
...@@ -27,39 +27,42 @@ public: ...@@ -27,39 +27,42 @@ public:
SMOOTHING_LAST SMOOTHING_LAST
}; };
// Mode for filling zone : 1 use segments, 0 use polygons /// Mode for filling zone : 1 use segments, 0 use polygons
int m_FillMode; int m_FillMode;
int m_ZonePriority; // Priority (0 ... N) of the zone int m_ZonePriority; ///< Priority (0 ... N) of the zone
int m_ZoneClearance; // Clearance value int m_ZoneClearance; ///< Clearance value
int m_ZoneMinThickness; // Min thickness value in filled areas int m_ZoneMinThickness; ///< Min thickness value in filled areas
int m_NetcodeSelection; // Net code selection for the current zone int m_NetcodeSelection; ///< Net code selection for the current zone
int m_CurrentZone_Layer; // Layer used to create 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 /// Option to show the zone area (outlines only, short hatches or full hatches
int m_Zone_HatchingStyle; int m_Zone_HatchingStyle;
// Option to select number of segments to approximate a circle 16 or 32 segments. /// Option to select number of segments to approximate a circle 16 or 32 segments.
int m_ArcToSegmentsCount; int m_ArcToSegmentsCount;
long m_ThermalReliefGap; // thickness of the gap in thermal reliefs long m_ThermalReliefGap; ///< thickness of the gap in thermal reliefs
long m_ThermalReliefCopperBridge; // thickness of the copper bridge 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 int m_Zone_Pad_Options; ///< How pads are covered by copper in zone
bool m_Zone_45_Only;
private: private:
int cornerSmoothingType; // Corner smoothing type int cornerSmoothingType; ///< Corner smoothing type
unsigned int cornerRadius; // Corner chamfer distance / fillet radius unsigned int cornerRadius; ///< Corner chamfer distance / fillet radius
public: public:
ZONE_SETTING( void ); ZONE_SETTINGS();
/** /**
* Function ImportSetting * operator << ( const ZONE_CONTAINER& )
* copy settings from a given zone * was Function ImportSetting
* copies settings from a given zone into this object.
* @param aSource: the given zone * @param aSource: the given zone
*/ */
void ImportSetting( const ZONE_CONTAINER& aSource ); ZONE_SETTINGS& operator << ( const ZONE_CONTAINER& aSource );
/** /**
* Function ExportSetting * Function ExportSetting
...@@ -70,7 +73,7 @@ public: ...@@ -70,7 +73,7 @@ public:
* Currently: * Currently:
* m_NetcodeSelection * m_NetcodeSelection
*/ */
void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true); void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true ) const;
void SetCornerSmoothingType( int aType) { cornerSmoothingType = aType; }; void SetCornerSmoothingType( int aType) { cornerSmoothingType = aType; };
...@@ -90,4 +93,4 @@ public: ...@@ -90,4 +93,4 @@ public:
}; };
#endif // ifndef ZONE_SETTING_H #endif // ZONE_SETTINGS_H_
This diff is collapsed.
/* 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_
...@@ -576,6 +576,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event ) ...@@ -576,6 +576,7 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
m_EnabledLayers = getUILayerMask(); m_EnabledLayers = getUILayerMask();
m_Pcb->SetEnabledLayers( m_EnabledLayers ); m_Pcb->SetEnabledLayers( m_EnabledLayers );
/* Ensure enabled layers are also visible /* Ensure enabled layers are also visible
* This is mainly to avoid mistakes if some enabled * This is mainly to avoid mistakes if some enabled
* layers are not visible when exiting this dialog * layers are not visible when exiting this dialog
......
...@@ -191,7 +191,7 @@ void DRC::RunTests( wxTextCtrl* aMessages ) ...@@ -191,7 +191,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
if( !testNetClasses() ) if( !testNetClasses() )
{ {
// testing the netclasses is a special case because if the netclasses // 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 // 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. // to also fail. So quit after *all* netclass errors have been reported.
if( aMessages ) if( aMessages )
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* Basic routine used by other routines when editing tracks or vias * Basic routine used by other routines when editing tracks or vias
* @param aTrackItem = the track segment or via to modify * @param aTrackItem = the track segment or via to modify
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL) * @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) * @return true if done, false if no not change (because DRC error)
*/ */
bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
...@@ -71,7 +71,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, ...@@ -71,7 +71,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
aTrackItem->m_Width = new_width; 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 ) if( initial_width < new_width )
{ {
int diagdrc = OK_DRC; int diagdrc = OK_DRC;
...@@ -218,16 +218,16 @@ bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNe ...@@ -218,16 +218,16 @@ bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNe
if( aNetcode <= 0 ) if( aNetcode <= 0 )
return false; return false;
/* Examine segments */ // Examine segments
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
bool change = false; bool change = false;
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() ) 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; 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 ) ) if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, aUseNetclassValue ) )
change = true; change = true;
} }
...@@ -245,7 +245,7 @@ bool PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, ...@@ -245,7 +245,7 @@ bool PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack,
{ {
TRACK* pt_segm; TRACK* pt_segm;
/* read and edit tracks and vias if required */ // read and edit tracks and vias if required
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
bool change = false; bool change = false;
......
...@@ -217,7 +217,7 @@ the changes?" ) ) ) ...@@ -217,7 +217,7 @@ the changes?" ) ) )
FILTER_READER reader( fileReader ); 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(); reader.ReadLine();
if( strncmp( reader.Line(), "PCBNEW-BOARD", 12 ) != 0 ) if( strncmp( reader.Line(), "PCBNEW-BOARD", 12 ) != 0 )
...@@ -324,7 +324,7 @@ this file again." ) ); ...@@ -324,7 +324,7 @@ this file again." ) );
GetScreen()->ClrModify(); 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 ) if( aAppend )
{ {
wxString new_filename = GetScreen()->GetFileName().BeforeLast( '.' ); wxString new_filename = GetScreen()->GetFileName().BeforeLast( '.' );
...@@ -343,9 +343,13 @@ this file again." ) ); ...@@ -343,9 +343,13 @@ this file again." ) );
UpdateTitle(); UpdateTitle();
UpdateFileHistory( GetScreen()->GetFileName() ); 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; 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 /* Reset the items visibility flag when loading a new config
* Because it could creates SERIOUS mistakes for the user, * Because it could creates SERIOUS mistakes for the user,
* if board items are not visible after loading a board... * if board items are not visible after loading a board...
...@@ -353,16 +357,21 @@ this file again." ) ); ...@@ -353,16 +357,21 @@ this file again." ) );
*/ */
bool showGrid = IsElementVisible( GRID_VISIBLE ); bool showGrid = IsElementVisible( GRID_VISIBLE );
bool showRats = IsElementVisible( RATSNEST_VISIBLE ); bool showRats = IsElementVisible( RATSNEST_VISIBLE );
SetVisibleAlls(); SetVisibleAlls();
SetElementVisibility( GRID_VISIBLE, showGrid ); SetElementVisibility( GRID_VISIBLE, showGrid );
SetElementVisibility( RATSNEST_VISIBLE, showRats ); SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif
// Update info shown by the horizontal toolbars // Update info shown by the horizontal toolbars
GetBoard()->SetCurrentNetClass( NETCLASS::Default ); GetBoard()->SetCurrentNetClass( NETCLASS::Default );
ReFillLayerWidget(); ReFillLayerWidget();
ReCreateLayerBox( NULL ); ReCreateLayerBox( NULL );
syncLayerWidget(); syncLayerWidgetLayer();
syncRenderStates();
updateTraceWidthSelectBox(); updateTraceWidthSelectBox();
updateViaSizeSelectBox(); updateViaSizeSelectBox();
...@@ -436,7 +445,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -436,7 +445,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
if( aCreateBackupFile ) if( aCreateBackupFile )
{ {
/* Get the backup file name */ // Get the backup file name
backupFileName = pcbFileName; backupFileName = pcbFileName;
backupFileName.SetExt( pcbBackupFileExtension ); backupFileName.SetExt( pcbBackupFileExtension );
...@@ -524,7 +533,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -524,7 +533,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
#endif #endif
/* Display the file names: */ // Display the file names:
m_messagePanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
if( saveok ) if( saveok )
......
...@@ -212,14 +212,14 @@ int PCB_BASE_FRAME::ReadGeneralDescrPcb( LINE_READER* aReader ) ...@@ -212,14 +212,14 @@ int PCB_BASE_FRAME::ReadGeneralDescrPcb( LINE_READER* aReader )
if( stricmp( data, "EnabledLayers" ) == 0 ) if( stricmp( data, "EnabledLayers" ) == 0 )
{ {
int EnabledLayers = 0; int enabledLayers = 0;
data = strtok( NULL, delims ); data = strtok( NULL, delims );
sscanf( data, "%X", &EnabledLayers ); sscanf( data, "%X", &enabledLayers );
// Setup layer visibility // Setup layer visibility
GetBoard()->SetEnabledLayers( EnabledLayers ); GetBoard()->SetEnabledLayers( enabledLayers );
GetBoard()->SetVisibleLayers( enabledLayers );
continue; continue;
} }
...@@ -333,6 +333,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -333,6 +333,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
char* data; char* data;
NETCLASS* netclass_default = GetBoard()->m_NetClasses.GetDefault(); NETCLASS* netclass_default = GetBoard()->m_NetClasses.GetDefault();
ZONE_SETTINGS zoneInfo = GetBoard()->GetZoneSettings();
while( aReader->ReadLine() ) while( aReader->ReadLine() )
{ {
...@@ -380,6 +381,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -380,6 +381,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
// projects. // projects.
GetBoard()->m_NetClasses.GetDefault()->SetParams(); GetBoard()->m_NetClasses.GetDefault()->SetParams();
GetBoard()->SetZoneSettings( zoneInfo );
return 0; return 0;
} }
...@@ -459,7 +462,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -459,7 +462,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "ZoneClearence" ) == 0 ) if( stricmp( line, "ZoneClearence" ) == 0 )
{ {
g_Zone_Default_Setting.m_ZoneClearance = atoi( data ); zoneInfo.m_ZoneClearance = atoi( data );
continue; continue;
} }
...@@ -697,7 +700,7 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard ) ...@@ -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, "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, "TrackMinWidth %d\n", aBoard->GetDesignSettings().m_TrackMinWidth );
fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetDesignSettings().m_DrawSegmentWidth ); fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetDesignSettings().m_DrawSegmentWidth );
......
...@@ -14,14 +14,6 @@ ...@@ -14,14 +14,6 @@
#include <macros.h> #include <macros.h>
#include <pcbcommon.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> #include <zones.h>
#ifdef CVPCB #ifdef CVPCB
...@@ -1825,7 +1817,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader ) ...@@ -1825,7 +1817,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
if( ret < 2 ) if( ret < 2 )
return false; return false;
if( tempSmoothingType >= ZONE_SETTING::SMOOTHING_LAST) if( tempSmoothingType >= ZONE_SETTINGS::SMOOTHING_LAST )
return false; return false;
if( tempSmoothingType < 0 ) if( tempSmoothingType < 0 )
......
...@@ -358,6 +358,7 @@ void KICAD_PLUGIN::loadGENERAL() ...@@ -358,6 +358,7 @@ void KICAD_PLUGIN::loadGENERAL()
// Setup layer visibility // Setup layer visibility
m_board->SetEnabledLayers( enabledLayers ); m_board->SetEnabledLayers( enabledLayers );
m_board->SetVisibleLayers( enabledLayers );
} }
else if( TESTLINE( "Ly" ) ) // Old format for Layer count else if( TESTLINE( "Ly" ) ) // Old format for Layer count
...@@ -558,6 +559,7 @@ void KICAD_PLUGIN::loadSETUP() ...@@ -558,6 +559,7 @@ void KICAD_PLUGIN::loadSETUP()
{ {
NETCLASS* netclass_default = m_board->m_NetClasses.GetDefault(); NETCLASS* netclass_default = m_board->m_NetClasses.GetDefault();
BOARD_DESIGN_SETTINGS bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS bds = m_board->GetDesignSettings();
ZONE_SETTINGS zs = m_board->GetZoneSettings();
while( READLINE() ) while( READLINE() )
{ {
...@@ -638,7 +640,13 @@ void KICAD_PLUGIN::loadSETUP() ...@@ -638,7 +640,13 @@ void KICAD_PLUGIN::loadSETUP()
else if( TESTLINE( "ZoneClearence" ) ) else if( TESTLINE( "ZoneClearence" ) )
{ {
BIU tmp = biuParse( line + SZ( "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" ) ) else if( TESTLINE( "DrawSegmWidth" ) )
...@@ -793,6 +801,7 @@ void KICAD_PLUGIN::loadSETUP() ...@@ -793,6 +801,7 @@ void KICAD_PLUGIN::loadSETUP()
else if( TESTLINE( "$EndSETUP" ) ) else if( TESTLINE( "$EndSETUP" ) )
{ {
m_board->SetDesignSettings( bds ); m_board->SetDesignSettings( bds );
m_board->SetZoneSettings( zs );
// Until such time as the *.brd file does not have the // Until such time as the *.brd file does not have the
// global parameters: // global parameters:
...@@ -2109,7 +2118,7 @@ void KICAD_PLUGIN::loadZONE_CONTAINER() ...@@ -2109,7 +2118,7 @@ void KICAD_PLUGIN::loadZONE_CONTAINER()
int smoothing = intParse( line + SZ( "ZSmoothing" ), &data ); int smoothing = intParse( line + SZ( "ZSmoothing" ), &data );
BIU cornerRadius = biuParse( 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() ); m_error.Printf( wxT( "Bad ZSmoothing for CZONE_CONTAINER '%s'" ), zc->GetNetName().GetData() );
THROW_IO_ERROR( m_error ); THROW_IO_ERROR( m_error );
...@@ -2804,9 +2813,9 @@ void KICAD_PLUGIN::saveSETUP() const ...@@ -2804,9 +2813,9 @@ void KICAD_PLUGIN::saveSETUP() const
fprintf( m_fp, "TrackClearence %s\n", fmtBIU( netclass_default->GetClearance() ).c_str() ); fprintf( m_fp, "TrackClearence %s\n", fmtBIU( netclass_default->GetClearance() ).c_str() );
/* @todo no globals in a plugin. // ZONE_SETTINGS
fprintf( m_fp, "ZoneClearence %d\n", g_Zone_Default_Setting.m_ZoneClearance ); 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() ); fprintf( m_fp, "TrackMinWidth %s\n", fmtBIU( bds.m_TrackMinWidth ).c_str() );
......
...@@ -49,8 +49,7 @@ ...@@ -49,8 +49,7 @@
/** /**
* Class LAYER_WIDGET * Class LAYER_WIDGET
* is abstract and is derived from a wxFormBuilder maintained class called * is abstract and is used to manage a list of layers, with the notion of
* LAYER_PANEL_BASE. It is used to manage a list of layers, with the notion of
* a "current" layer, and layer specific visibility control. You must derive from * 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 * 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 * events. Each layer is given its own color, and that color can be changed
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include <module_editor_frame.h> #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; wxString FOOTPRINT_EDIT_FRAME::m_CurrentLib = wxEmptyString;
...@@ -157,16 +157,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent, ...@@ -157,16 +157,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
SetBoard( s_Pcb ); SetBoard( s_Pcb );
if( s_screenModule == NULL ) if( !s_screenModule )
s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() ); s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() );
SetScreen( s_screenModule ); 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 ); GetScreen()->SetCurItem( NULL );
LoadSettings(); LoadSettings();
......
...@@ -403,8 +403,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, ...@@ -403,8 +403,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
m_Layers->ReFillRender(); // Update colors in Render after the config is read m_Layers->ReFillRender(); // Update colors in Render after the config is read
syncLayerWidget();
syncLayerWidgetLayer();
m_auimgr.Update(); m_auimgr.Update();
} }
...@@ -639,12 +642,18 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void ) ...@@ -639,12 +642,18 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void )
} }
void PCB_EDIT_FRAME::syncLayerWidget( ) void PCB_EDIT_FRAME::syncLayerWidgetLayer()
{ {
m_Layers->SelectLayer( getActiveLayer() ); m_Layers->SelectLayer( getActiveLayer() );
} }
void PCB_EDIT_FRAME::syncRenderStates()
{
m_Layers->SyncRenderStates();
}
void PCB_EDIT_FRAME::unitsChangeRefresh() void PCB_EDIT_FRAME::unitsChangeRefresh()
{ {
PCB_BASE_FRAME::unitsChangeRefresh(); // Update the grid size select box. PCB_BASE_FRAME::unitsChangeRefresh(); // Update the grid size select box.
...@@ -667,9 +676,9 @@ void PCB_EDIT_FRAME::SetElementVisibility( int aElement, bool aNewState ) ...@@ -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++ ) for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ )
m_Layers->SetRenderState( ii, true ); m_Layers->SetRenderState( ii, true );
......
...@@ -177,15 +177,25 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) ...@@ -177,15 +177,25 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
// User library path takes precedent over default library search paths. // User library path takes precedent over default library search paths.
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 ); 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 /* 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. * a board. Grid and ratsnest can be left to their previous state.
*/ */
bool showGrid = IsElementVisible( GRID_VISIBLE ); bool showGrid = IsElementVisible( GRID_VISIBLE );
bool showRats = IsElementVisible( RATSNEST_VISIBLE ); bool showRats = IsElementVisible( RATSNEST_VISIBLE );
SetVisibleAlls(); SetVisibleAlls();
SetElementVisibility( GRID_VISIBLE, showGrid ); SetElementVisibility( GRID_VISIBLE, showGrid );
SetElementVisibility( RATSNEST_VISIBLE, showRats ); SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif
return true; return true;
} }
......
...@@ -152,6 +152,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, ...@@ -152,6 +152,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
FILE* FichCmp, * NewFile; FILE* FichCmp, * NewFile;
char line[1024]; char line[1024];
wxString msg; wxString msg;
char* quiet_gcc_4_4_3;
if( old_name == new_name ) if( old_name == new_name )
return 0; return 0;
...@@ -189,7 +190,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, ...@@ -189,7 +190,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
return 1; 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() ) ); 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 ) ...@@ -587,6 +588,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
MODULE* Module = GetBoard()->m_Modules; MODULE* Module = GetBoard()->m_Modules;
wxString msg; wxString msg;
wxString wildcard; wxString wildcard;
char* quiet_gcc_4_4_3;
if( Module == NULL ) if( Module == NULL )
{ {
...@@ -617,7 +619,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) ...@@ -617,7 +619,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
return; 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() ) ); fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
......
...@@ -55,10 +55,10 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt> ...@@ -55,10 +55,10 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
switch( cornerSmoothingType ) switch( cornerSmoothingType )
{ {
case ZONE_SETTING::SMOOTHING_CHAMFER: case ZONE_SETTINGS::SMOOTHING_CHAMFER:
smoothedPoly = m_Poly->Chamfer( cornerRadius ); smoothedPoly = m_Poly->Chamfer( cornerRadius );
break; break;
case ZONE_SETTING::SMOOTHING_FILLET: case ZONE_SETTINGS::SMOOTHING_FILLET:
smoothedPoly = m_Poly->Fillet( cornerRadius, m_ArcToSegmentsCount ); smoothedPoly = m_Poly->Fillet( cornerRadius, m_ArcToSegmentsCount );
break; break;
default: default:
......
...@@ -2,12 +2,8 @@ ...@@ -2,12 +2,8 @@
/* constants used in zone dialogs and functions */ /* constants used in zone dialogs and functions */
/************************************************/ /************************************************/
#ifndef ZONES_H #ifndef ZONES_H_
#define ZONES_H #define ZONES_H_
#include <class_zone_setting.h>
// keys used to store net sort option in config file : // keys used to store net sort option in config file :
#define ZONE_NET_OUTLINES_HATCH_OPTION_KEY wxT( "Zone_Ouline_Hatch_Opt" ) #define ZONE_NET_OUTLINES_HATCH_OPTION_KEY wxT( "Zone_Ouline_Hatch_Opt" )
...@@ -16,28 +12,46 @@ ...@@ -16,28 +12,46 @@
#define ZONE_THERMAL_RELIEF_GAP_STRING_KEY wxT( "Zone_TH_Gap" ) #define ZONE_THERMAL_RELIEF_GAP_STRING_KEY wxT( "Zone_TH_Gap" )
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY wxT( "Zone_TH_Copper_Width" ) #define ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY wxT( "Zone_TH_Copper_Width" )
// Exit codes for dialog edit zones /// Exit codes for zone editing dialogs
enum zone_cmd { enum ZONE_EDIT_T {
ZONE_ABORT, // if no change ZONE_ABORT, ///< if no change
ZONE_OK, // if new values accepted ZONE_OK, ///< if new values were accepted
ZONE_EXPORT_VALUES // if values are exported to others zones ZONE_EXPORT_VALUES ///< if values were exported to others zones
}; };
enum { // How pads are covered by copper in zone /// How pads are covered by copper in zone
PAD_NOT_IN_ZONE, // Pads are not covered enum {
THERMAL_PAD, // Use thermal relief for pads PAD_NOT_IN_ZONE, ///< Pads are not covered
PAD_IN_ZONE // pads are covered by copper THERMAL_PAD, ///< Use thermal relief for pads
PAD_IN_ZONE ///< pads are covered by copper
}; };
class ZONE_CONTAINER;
/************************************************/ class ZONE_SETTINGS;
/* variables used in zone dialogs and functions */ class PCB_BASE_FRAME;
/************************************************/
/**
extern bool g_Zone_45_Only; * Function InvokeNonCopperZonesEditor
* invokes up a modal dialog window for non-copper zone editing.
// Default setting used when creating a new zone *
extern ZONE_SETTING g_Zone_Default_Setting; * @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().
#endif // ifndef ZONES_H * @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 );
/**
* 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 );
#endif // ZONES_H_
This diff is collapsed.
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <zones.h> #include <zones.h>
#define FORMAT_STRING _( "Filling zone %d out of %d (net %s)..." )
/** /**
* Function Delete_OldZone_Fill (obsolete) * Function Delete_OldZone_Fill (obsolete)
...@@ -70,7 +72,7 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp ) ...@@ -70,7 +72,7 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
if( zone->GetTimeStamp() == TimeStamp ) if( zone->GetTimeStamp() == TimeStamp )
{ {
modify = true; modify = true;
/* remove item from linked list and free memory */ // remove item from linked list and free memory
zone->DeleteStructure(); zone->DeleteStructure();
} }
} }
...@@ -83,15 +85,6 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp ) ...@@ -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 ) int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
{ {
wxString msg; wxString msg;
...@@ -99,7 +92,10 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone ) ...@@ -99,7 +92,10 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
ClearMsgPanel(); ClearMsgPanel();
// Shows the net // 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(); msg = aZone->GetNetName();
if( msg.IsEmpty() ) if( msg.IsEmpty() )
...@@ -119,22 +115,12 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone ) ...@@ -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 PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose )
{ {
int errorLevel = 0; int errorLevel = 0;
int areaCount = GetBoard()->GetAreaCount(); int areaCount = GetBoard()->GetAreaCount();
wxBusyCursor dummyCursor; wxBusyCursor dummyCursor;
wxString msg; wxString msg;
#define FORMAT_STRING _( "Filling zone %d out of %d (net %s)..." )
wxProgressDialog * progressDialog = NULL; wxProgressDialog * progressDialog = NULL;
// Create a message with a long net name, and build a wxProgressDialog // Create a message with a long net name, and build a wxProgressDialog
......
...@@ -16,75 +16,78 @@ ...@@ -16,75 +16,78 @@
#include <dialog_non_copper_zones_properties_base.h> #include <dialog_non_copper_zones_properties_base.h>
/* Class DialogNonCopperZonesEditor /**
* Dialog editor for non copper zones properties * Class DIALOG_NON_COPPER_ZONES_EDITOR
* Derived from DialogNonCopperZonesPropertiesBase, created by wxFormBuilder * 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: private:
PCB_EDIT_FRAME* m_Parent; PCB_BASE_FRAME* m_Parent;
ZONE_CONTAINER* m_Zone_Container; ZONE_CONTAINER* m_zone;
ZONE_SETTING* m_Zone_Setting; ZONE_SETTINGS* m_ptr;
ZONE_SETTINGS m_settings;
private:
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void Init(); void Init();
public: public:
DialogNonCopperZonesEditor( PCB_EDIT_FRAME* parent, DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
ZONE_CONTAINER* zone_container, ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings );
ZONE_SETTING* zone_setting );
~DialogNonCopperZonesEditor();
}; };
DialogNonCopperZonesEditor::DialogNonCopperZonesEditor( PCB_EDIT_FRAME* parent, ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent,
ZONE_CONTAINER* zone_container, ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings )
ZONE_SETTING* zone_setting ) :
DialogNonCopperZonesPropertiesBase( parent )
{ {
m_Parent = parent; DIALOG_NON_COPPER_ZONES_EDITOR dlg( aParent, aZone, aSettings );
m_Zone_Container = zone_container;
m_Zone_Setting = zone_setting;
Init();
/* the size of some items has changed, so we must call SetSizeHints() */
GetSizer()->SetSizeHints( this );
}
ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() );
DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor() // D(printf( "%s: result:%d\n", __FUNCTION__, result );)
{
return result;
} }
bool PCB_EDIT_FRAME::InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone ) DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
ZONE_CONTAINER* aZone,
ZONE_SETTINGS* aSettings ) :
DialogNonCopperZonesPropertiesBase( aParent )
{ {
DialogNonCopperZonesEditor frame( this, aZone, &g_Zone_Default_Setting ); m_Parent = aParent;
bool diag = frame.ShowModal();
m_zone = aZone;
m_ptr = aSettings;
m_settings = *aSettings;
return diag; Init();
// the size of some items has changed, so we must call SetSizeHints()
GetSizer()->SetSizeHints( this );
} }
void DialogNonCopperZonesEditor::Init() void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{ {
SetFocus(); 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 ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = ReturnStringFromValue( g_UserUnit, wxString msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneMinThickness, m_settings.m_ZoneMinThickness,
m_Parent->GetInternalUnits() ); m_Parent->GetInternalUnits() );
m_ZoneMinThicknessCtrl->SetValue( msg ); m_ZoneMinThicknessCtrl->SetValue( msg );
if( g_Zone_45_Only ) if( m_settings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 ); m_OrientEdgesOpt->SetSelection( 1 );
switch( g_Zone_Default_Setting.m_Zone_HatchingStyle ) switch( m_settings.m_Zone_HatchingStyle )
{ {
case CPolyLine::NO_HATCH: case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 ); m_OutlineAppearanceCtrl->SetSelection( 0 );
...@@ -108,9 +111,9 @@ void DialogNonCopperZonesEditor::Init() ...@@ -108,9 +111,9 @@ void DialogNonCopperZonesEditor::Init()
msg = m_Parent->GetBoard()->GetLayerName( layer_number ).Trim(); msg = m_Parent->GetBoard()->GetLayerName( layer_number ).Trim();
m_LayerSelectionCtrl->InsertItems( 1, &msg, ii ); 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 ); m_LayerSelectionCtrl->SetSelection( ii );
} }
else else
...@@ -122,48 +125,49 @@ void DialogNonCopperZonesEditor::Init() ...@@ -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(); wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness =
m_settings.m_ZoneMinThickness =
ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() ); ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() );
if( m_Zone_Setting->m_ZoneMinThickness < 10 ) if( m_settings.m_ZoneMinThickness < 10 )
{ {
DisplayError( this, DisplayError( this,
_( "Error :\nyou must choose a copper min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) ); _( "Error :\nyou must choose a copper min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) );
return; 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() ) switch( m_OutlineAppearanceCtrl->GetSelection() )
{ {
case 0: case 0:
g_Zone_Default_Setting.m_Zone_HatchingStyle = CPolyLine::NO_HATCH; m_settings.m_Zone_HatchingStyle = CPolyLine::NO_HATCH;
break; break;
case 1: case 1:
g_Zone_Default_Setting.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; m_settings.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE;
break; break;
case 2: case 2:
g_Zone_Default_Setting.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_FULL; m_settings.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_FULL;
break; break;
} }
if( wxGetApp().GetSettings() ) if( wxGetApp().GetSettings() )
{ {
wxGetApp().GetSettings()->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, 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 ) if( m_OrientEdgesOpt->GetSelection() == 0 )
g_Zone_45_Only = false; m_settings.m_Zone_45_Only = false;
else 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(); int ii = m_LayerSelectionCtrl->GetSelection();
if( ii < 0 ) if( ii < 0 )
...@@ -172,12 +176,18 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event ) ...@@ -172,12 +176,18 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
return; 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 ); 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 ); EndModal( ZONE_ABORT );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment