Commit 6c04e605 authored by Dick Hollenbeck's avatar Dick Hollenbeck

see CHANGELOG.txt

parent 716d21d8
......@@ -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
......
......@@ -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
......
......@@ -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 );
......@@ -10,13 +10,6 @@
// Class for handle current printed board design settings
class BOARD_DESIGN_SETTINGS
{
protected:
int m_CopperLayerCount; ///< Number of copper layers for this design
int m_EnabledLayers; ///< Bit-mask for layer enabling
int m_VisibleLayers; ///< Bit-mask for layer visibility
int m_VisibleElements; ///< Bit-mask for element category visibility
public:
bool m_MicroViasAllowed; ///< true to allow micro vias
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
......@@ -57,9 +50,10 @@ public:
/**
* Function SetVisibleAlls
* Set the bit-mask of all visible elements categories, including layers
* Set the bit-mask of all visible elements categories,
* including enabled layers
*/
void SetVisibleAlls( );
void SetVisibleAlls();
/**
* Function SetVisibleLayers
......@@ -177,6 +171,13 @@ public:
* @param aNewLayerCount = The new number of enabled copper layers
*/
void SetCopperLayerCount( int aNewLayerCount );
private:
int m_CopperLayerCount; ///< Number of copper layers for this design
int m_EnabledLayers; ///< Bit-mask for layer enabling
int m_VisibleLayers; ///< Bit-mask for layer visibility
int m_VisibleElements; ///< Bit-mask for element category visibility
};
......
......@@ -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
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -10,7 +10,6 @@
#include <common.h>
#include <pcbcommon.h>
#include <wxBasePcbFrame.h>
#include <build_version.h> // BOARD_FILE_VERSION
#include <pcbnew.h>
#include <colors_selection.h>
......@@ -52,16 +51,16 @@ BOARD::BOARD() :
m_Layer[layer].m_Type = LT_SIGNAL;
}
// Initial parameters for the default NETCLASS come from the global
// preferences within g_DesignSettings via the NETCLASS() constructor.
// Should user eventually load a board from a disk file, then these
// defaults will get overwritten during load.
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
m_ViaSizeSelector = 0;
m_TrackWidthSelector = 0;
/* Dick 5-Feb-2012: this seems unnecessary. I don't believe the comment in
near line 70 of class_netclass.cpp. I stepped through with debugger.
// Initialize default values in default netclass.
m_NetClasses.GetDefault()->SetParams();
*/
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
}
......@@ -530,14 +529,14 @@ void BOARD::SetVisibleElements( int aMask )
}
}
// these are not tidy, since there are PCB_VISIBLEs that are not stored in the bitmap.
void BOARD::SetVisibleAlls( )
void BOARD::SetVisibleAlls()
{
SetVisibleLayers( FULL_LAYERS );
/* Call SetElementVisibility for each item,
* to ensure specific calculations that can be needed by some items
*/
// Call SetElementVisibility for each item,
// to ensure specific calculations that can be needed by some items
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
SetElementVisibility( ii, true );
}
......@@ -557,14 +556,16 @@ bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const
void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
{
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
switch( aPCB_VISIBLE )
{
case RATSNEST_VISIBLE:
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet
// because we have a tool to show hide ratsnest relative to a pad or a module
// so the hide/show option is a per item selection
if( IsElementVisible(RATSNEST_VISIBLE) )
if( IsElementVisible( RATSNEST_VISIBLE ) )
{
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
......@@ -574,12 +575,10 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
for( unsigned ii = 0; ii < GetRatsnestsCount(); ii++ )
m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
}
break;
default:
m_designSettings.SetElementVisibility( aPCB_VISIBLE, isEnabled );
;
}
}
......
......@@ -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; }
......
......@@ -17,7 +17,11 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
{
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
SetVisibleAlls(); // All layers and all elements visible at first.
SetVisibleLayers( FULL_LAYERS );
// set all but hidden text as visible.
m_VisibleElements = 0xFFFFFFFF & ~( 1 << MOD_TEXT_INVISIBLE );
SetCopperLayerCount( 2 ); // Default design is a double sided board
......@@ -62,11 +66,6 @@ int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
}
/**
* Function SetVisibleAlls
* Set the bit-mask of all visible elements categories,
* including enabled layers
*/
void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{
SetVisibleLayers( FULL_LAYERS );
......
......@@ -66,13 +66,20 @@ void NETCLASS::SetParams( const NETCLASS* defaults )
SetuViaDrill( defaults->GetuViaDrill() );
}
else
{ // Note:
{
/* Dick 5-Feb-2012: I do not believe this comment to be true with current code.
It is certainly not a constructor race.
// Note:
// We use m_Parent->GetDesignSettings() to get some default values
// But when this function is called when instantiating a BOARD class,
// by the NETCLASSES constructor that calls NETCLASS constructor,
// the BOARD constructor (see BOARD::BOARD) is not yet run,
// and BOARD::m_designSettings contains not yet initialized values.
// So inside the BOARD constructor itself, you SHOULD recall SetParams
*/
const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings();
SetTrackWidth( g.m_TrackMinWidth );
......
......@@ -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 );
......
......@@ -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
// 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
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") ),
if( renderRow.color != -1 ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRow.color = board->GetVisibleElementColor( renderRow.id );
}
renderRow.state = board->IsElementVisible( renderRow.id );
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" ) ),
AppendRenderRow( renderRow );
}
}
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") ),
};
void PCB_LAYER_WIDGET::SyncRenderStates()
{
BOARD* board = myframe->GetBoard();
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 window frame must have an established BOARD, i.e. after SetBoard()
renderRows[row].color = board->GetVisibleElementColor( renderRows[row].id );
// this does not fire an event
SetRenderState( s_render_rows[row].id, board->IsElementVisible( s_render_rows[row].id ) );
}
renderRows[row].state = board->IsElementVisible( renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
}
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>------------------------------------------
......@@ -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,24 +39,6 @@
*/
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:
/**
......@@ -73,23 +55,54 @@ public:
/**
* Function ReFillRender
* Rebuild Render for instance after the config is read
* 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.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
/**
* Function SetLayersManagerTabsText
* Update the layer manager tabs labels
* Useful when changing Language or to set labels to a non default value
* Function OnRightDownLayers
* puts up a popup menu for the layer panel.
*/
void SetLayersManagerTabsText( );
//-----</implement LAYER_WIDGET abstract callback functions>----------
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();
};
#endif // _CLASS_PCB_LAYER_WIDGET_H_
#endif // CLASS_PCB_LAYER_WIDGET_H_
......@@ -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 );
}
......
......@@ -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;
......
/******************************************************/
/* 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 );
......
/**
* @file class_zone_setting.h
* @brief Class ZONE_SETTING used to handle zones parameters in dialogs.
* @file class_zone_settings.h
* @brief Class ZONE_SETTINGS used to handle zones parameters in dialogs.
*/
#ifndef ZONE_SETTING_H
#define ZONE_SETTING_H
#ifndef ZONE_SETTINGS_H_
#define ZONE_SETTINGS_H_
class ZONE_CONTAINER;
......@@ -14,10 +14,10 @@ class ZONE_CONTAINER;
/**
* Class ZONE_SETTING
* Class ZONE_SETTINGS
* handles zones parameters.
*/
class ZONE_SETTING
class ZONE_SETTINGS
{
public:
enum {
......@@ -27,39 +27,42 @@ public:
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_ZonePriority; // Priority (0 ... N) of the zone
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
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
/// 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.
/// 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
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
int cornerSmoothingType; ///< Corner smoothing type
unsigned int cornerRadius; ///< Corner chamfer distance / fillet radius
public:
ZONE_SETTING( void );
ZONE_SETTINGS();
/**
* Function ImportSetting
* copy settings from a given zone
* operator << ( const ZONE_CONTAINER& )
* was Function ImportSetting
* copies settings from a given zone into this object.
* @param aSource: the given zone
*/
void ImportSetting( const ZONE_CONTAINER& aSource );
ZONE_SETTINGS& operator << ( const ZONE_CONTAINER& aSource );
/**
* Function ExportSetting
......@@ -70,7 +73,7 @@ public:
* Currently:
* 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; };
......@@ -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_
......@@ -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 )
......
......@@ -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;
......
......@@ -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 I want the board to look like it did when I saved
// it, immediately after loading.
#if 0
/* Reset the items visibility flag when loading a new config
* Because it could creates SERIOUS mistakes for the user,
* 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 )
......
......@@ -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 );
......
......@@ -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 )
......
......@@ -558,6 +558,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 +639,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 +800,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 +2117,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 +2812,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() );
......
......@@ -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
......
......@@ -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();
......
......@@ -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 );
......
......@@ -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;
}
......
......@@ -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:
......
......@@ -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
};
/************************************************/
/* variables used in zone dialogs and functions */
/************************************************/
extern bool g_Zone_45_Only;
// Default setting used when creating a new zone
extern ZONE_SETTING g_Zone_Default_Setting;
#endif // ifndef ZONES_H
class ZONE_CONTAINER;
class ZONE_SETTINGS;
class PCB_BASE_FRAME;
/**
* 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 );
/**
* 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 @@
#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
......
......@@ -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;
Init();
/* the size of some items has changed, so we must call SetSizeHints() */
GetSizer()->SetSizeHints( this );
}
DIALOG_NON_COPPER_ZONES_EDITOR dlg( aParent, aZone, aSettings );
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 );
bool diag = frame.ShowModal();
m_Parent = aParent;
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();
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 );
}
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