diff --git a/gerbview/lay2plot.cpp b/gerbview/lay2plot.cpp index 5c9c5c6680..a205093877 100644 --- a/gerbview/lay2plot.cpp +++ b/gerbview/lay2plot.cpp @@ -20,7 +20,6 @@ void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer) DisplayOpt.DisplayPadFill = FILLED; DisplayOpt.DisplayViaFill = FILLED; DisplayOpt.DisplayPadNum = 0; - DisplayOpt.DisplayPadNoConn = 0; DisplayOpt.DisplayPadIsol = 0; DisplayOpt.DisplayPcbTrackFill = FILLED; DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; diff --git a/include/pcbstruct.h b/include/pcbstruct.h index d5ff45ad19..fd51ed3aa4 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -101,7 +101,6 @@ public: bool DisplayPadFill; bool DisplayViaFill; bool DisplayPadNum; - bool DisplayPadNoConn; bool DisplayPadIsol; int DisplayModEdge; diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index fb3ff299ef..8150ebed07 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -96,11 +96,8 @@ protected: *
* This function cannot be inline without including layer_widget.h in
* here and we do not want to do that.
- * @param aRenderOnly: true to update render only, false (default) for full update
- * if aRenderOnly = true, the page displayed by the layer manager is not changed
- * if aRenderOnly = false, the page displayed after update is the layers list
*/
- void syncLayerWidget(bool aRenderOnly = false);
+ void syncLayerWidget( );
/**
* Function syncLayerBox
@@ -186,6 +183,34 @@ public:
void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
+ /**
+ * Function IsElementVisible
+ * tests whether a given element category is visible. Keep this as an
+ * inline function.
+ * @param aPCB_VISIBLE is from the enum by the same name
+ * @return bool - true if the element is visible.
+ * @see enum PCB_VISIBLE
+ */
+ bool IsElementVisible( int aPCB_VISIBLE )
+ {
+ return GetBoard()->IsElementVisible( aPCB_VISIBLE );
+ }
+
+ /**
+ * Function SetElementVisibility
+ * changes the visibility of an element category
+ * @param aPCB_VISIBLE is from the enum by the same name
+ * @param aNewState = The new visibility state of the element category
+ * @see enum PCB_VISIBLE
+ */
+ void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );
+
+ /**
+ * Function SetVisibleAlls
+ * Set the status of all visible element categories and layers to VISIBLE
+ */
+ void SetVisibleAlls( );
+
/**
* Function ReFillLayerWidget
* changes out all the layers in m_Layers and may be called upon
diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp
index d008690be0..cfc5ce226b 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -392,6 +392,7 @@ void BOARD::SetVisibleElements( int aMask )
{
/* Call SetElementVisibility for each item,
* to ensure specific calculations that can be needed by some items
+ * just change the visibility flags could be not sufficient
*/
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
{
@@ -408,9 +409,7 @@ void BOARD::SetVisibleAlls( )
* 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 );
- }
}
diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp
index 2f66a99c87..8daa8ed42b 100644
--- a/pcbnew/classpcb.cpp
+++ b/pcbnew/classpcb.cpp
@@ -146,7 +146,6 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
DisplayPadFill = FILLED;
DisplayViaFill = FILLED;
DisplayPadNum = true;
- DisplayPadNoConn = true;
DisplayPadIsol = true;
DisplayModEdge = true;
diff --git a/pcbnew/dialog_display_options.cpp b/pcbnew/dialog_display_options.cpp
index 23e9ac29d9..9d15714ef9 100644
--- a/pcbnew/dialog_display_options.cpp
+++ b/pcbnew/dialog_display_options.cpp
@@ -29,7 +29,7 @@ void WinEDA_PcbFrame::InstallDisplayOptionsDialog( wxCommandEvent& aEvent )
/*******************************************************************************/
-Dialog_Display_Options::Dialog_Display_Options( WinEDA_BasePcbFrame* parent ) :
+Dialog_Display_Options::Dialog_Display_Options( WinEDA_PcbFrame* parent ) :
DialogDisplayOptions_base(parent)
/*******************************************************************************/
{
@@ -81,7 +81,7 @@ void Dialog_Display_Options::init()
m_OptDisplayModEdges->SetSelection( DisplayOpt.DisplayModEdge );
m_OptDisplayPadClearence->SetValue( DisplayOpt.DisplayPadIsol );
m_OptDisplayPadNumber->SetValue( DisplayOpt.DisplayPadNum );
- m_OptDisplayPadNoConn->SetValue( DisplayOpt.DisplayPadNoConn );
+ m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE(NO_CONNECTS_VISIBLE) ) );
m_OptDisplayDrawings->SetSelection( DisplayOpt.DisplayDrawItems );
m_ShowNetNamesOption->SetSelection( DisplayOpt.DisplayNetNamesMode);
@@ -152,7 +152,8 @@ void Dialog_Display_Options::OnOkClick(wxCommandEvent& event)
m_Parent->m_DisplayPadNum = DisplayOpt.DisplayPadNum = m_OptDisplayPadNumber->GetValue();
- DisplayOpt.DisplayPadNoConn = m_OptDisplayPadNoConn->GetValue();
+ m_Parent->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE),
+ m_OptDisplayPadNoConn->GetValue());
DisplayOpt.DisplayDrawItems = m_OptDisplayDrawings->GetSelection();
DisplayOpt.DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
diff --git a/pcbnew/dialog_display_options.h b/pcbnew/dialog_display_options.h
index 281418cb51..74040491ca 100644
--- a/pcbnew/dialog_display_options.h
+++ b/pcbnew/dialog_display_options.h
@@ -6,13 +6,12 @@
class Dialog_Display_Options : public DialogDisplayOptions_base
{
private:
- WinEDA_BasePcbFrame* m_Parent;
+ WinEDA_PcbFrame* m_Parent;
void init();
public:
- Dialog_Display_Options( WinEDA_BasePcbFrame* parent );
- Dialog_Display_Options(WinEDA_BasePcbFrame*, wxWindow*);
+ Dialog_Display_Options( WinEDA_PcbFrame* parent );
~Dialog_Display_Options( ) { };
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
diff --git a/pcbnew/dialog_general_options.cpp b/pcbnew/dialog_general_options.cpp
index bbe4a6b8c5..fd596519aa 100644
--- a/pcbnew/dialog_general_options.cpp
+++ b/pcbnew/dialog_general_options.cpp
@@ -98,7 +98,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
Drc_On = m_DrcOn->GetValue();
if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
{
- m_Board->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
+ m_Parent->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
m_Parent->DrawPanel->Refresh( );
}
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
@@ -159,20 +159,17 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_GRID:
- GetBoard()->SetElementVisibility(GRID_VISIBLE, state);
- syncLayerWidget( true );
+ SetElementVisibility(GRID_VISIBLE, state);
DrawPanel->Refresh();
break;
case ID_TB_OPTIONS_SHOW_RATSNEST:
- GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, state);
- syncLayerWidget( true );
+ SetElementVisibility(RATSNEST_VISIBLE, state);
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
g_Show_Module_Ratsnest = state; // TODO: use the visibility list
- syncLayerWidget( true );
break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp
index 376955035a..aa71e9d021 100644
--- a/pcbnew/files.cpp
+++ b/pcbnew/files.cpp
@@ -245,11 +245,16 @@ this file again."));
/* Rebuild the new pad list (for drc and ratsnet control ...) */
GetBoard()->m_Status_Pcb = 0;
- /* Reset the layers and 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,
- * if some enabled layers or items are not visible after loading a board...
+ * if board items are not visible after loading a board...
+ * Grid and ratsnest can be left to their previous state
*/
- GetBoard()->m_BoardSettings->SetVisibleAlls( );
+ bool showGrid = IsElementVisible(GRID_VISIBLE);
+ bool showRats = IsElementVisible(RATSNEST_VISIBLE);
+ SetVisibleAlls( );
+ SetElementVisibility(GRID_VISIBLE, showGrid);
+ SetElementVisibility(RATSNEST_VISIBLE, showRats);
// Update info shown by the horizontal toolbars
GetBoard()->SetCurrentNetClass( NETCLASS::Default );
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index 6e30047efc..68ace32de3 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -85,9 +85,6 @@ public:
PCB_LAYER_WIDGET( WinEDA_PcbFrame* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
void ReFill();
- // Update Show/hide checkbox state in render page
- // must be called when a Show/hide option is changed outside the layer manager
- void RenderSynchronize( );
//-----