Commit 267bca58 authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5363

parents b941da6b 0cb7c3dc
......@@ -183,6 +183,12 @@ EDA_DRAW_FRAME* EDA_DRAW_PANEL::GetParent() const
}
void* EDA_DRAW_PANEL::GetDisplayOptions()
{
return GetParent()->GetDisplayOptions();
}
BASE_SCREEN* EDA_DRAW_PANEL::GetScreen()
{
EDA_DRAW_FRAME* parentFrame = GetParent();
......
......@@ -53,9 +53,6 @@
#include <3d_viewer.h>
DISPLAY_OPTIONS DisplayOpt; // General display options
BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
EVT_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize )
......@@ -100,10 +97,11 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
// Initialize some display options
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
displ_opts->m_DisplayPadIsol = false; // Pad clearance has no meaning here
// Track and via clearance has no meaning here.
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
ReCreateHToolbar();
......@@ -248,34 +246,36 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent )
{
wxString msgTextsFill[3] = { _( "Show texts in line mode" ),
_( "Show texts in filled mode" ),
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
wxString msgTextsFill[2] = { _( "Show texts in filled mode" ),
_( "Show texts in sketch mode" ) };
unsigned i = m_DisplayModText + 1;
unsigned i = displ_opts->m_DisplayModText + 1;
if ( i > 2 )
i = 0;
i = 1;
aEvent.Check( m_DisplayModText == 0 );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );
aEvent.Check( displ_opts->m_DisplayModText == 1 );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i-1] );
}
void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
{
wxString msgEdgesFill[3] = { _( "Show outlines in line mode" ),
_( "Show outlines in filled mode" ),
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
wxString msgEdgesFill[3] = { _( "Show outlines in filled mode" ),
_( "Show outlines in sketch mode" ) };
int i = m_DisplayModEdge + 1;
int i = displ_opts->m_DisplayModEdge + 1;
if ( i > 2 )
i = 0;
i = 1;
aEvent.Check( m_DisplayModEdge == 0 );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] );
aEvent.Check( displ_opts->m_DisplayModEdge == 2 );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i-1] );
}
......@@ -298,23 +298,24 @@ bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* Po
void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
switch( id )
{
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
m_DisplayModText++;
displ_opts->m_DisplayModText++;
if( m_DisplayModText > 2 )
m_DisplayModText = 0;
if( displ_opts->m_DisplayModText > 2 )
displ_opts->m_DisplayModText = 0;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
m_DisplayModEdge++;
displ_opts->m_DisplayModEdge++;
if( m_DisplayModEdge > 2 )
m_DisplayModEdge = 0;
if( displ_opts->m_DisplayModEdge > 2 )
displ_opts->m_DisplayModEdge = 0;
m_canvas->Refresh();
break;
......
......@@ -72,10 +72,12 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
/* mandatory to use escape key as cancel under wxGTK. */
SetFocus();
m_EdgesDisplayOption->SetSelection( m_Parent->m_DisplayModEdge );
m_TextDisplayOption->SetSelection( m_Parent->m_DisplayModText );
m_IsShowPadFill->SetValue( m_Parent->m_DisplayPadFill );
m_IsShowPadNum->SetValue( m_Parent->m_DisplayPadNum );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
m_EdgesDisplayOption->SetSelection( displ_opts->m_DisplayModEdge );
m_TextDisplayOption->SetSelection( displ_opts->m_DisplayModText );
m_IsShowPadFill->SetValue( displ_opts->m_DisplayPadFill );
m_IsShowPadNum->SetValue( displ_opts->m_DisplayPadNum );
m_IsZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() );
m_IsMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() );
m_IsMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() );
......@@ -90,10 +92,12 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
{
m_Parent->m_DisplayModEdge = m_EdgesDisplayOption->GetSelection();
m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection();
m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue();
m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
displ_opts->m_DisplayModEdge = m_EdgesDisplayOption->GetSelection();
displ_opts->m_DisplayModText = m_TextDisplayOption->GetSelection();
displ_opts->m_DisplayPadNum = m_IsShowPadNum->GetValue();
displ_opts->m_DisplayPadFill = m_IsShowPadFill->GetValue();
m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_IsZoomNoCenter->GetValue() );
m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_IsMiddleButtonPan->GetValue() );
m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_IsMiddleButtonPanLimited->GetValue() );
......
......@@ -31,6 +31,7 @@
#include <eeschema_id.h>
#include <hotkeys.h>
#include <wxEeschemaStruct.h>
#include <class_drawpanel.h>
#include <general.h>
#include <libeditframe.h>
......@@ -348,8 +349,6 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
SCH_SCREEN* screen = GetScreen();
// itemInEdit == false means no item currently edited. We can ask for editing a new item
......@@ -393,12 +392,19 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_LEFT_CLICK:
OnLeftClick( aDC, aPosition );
break;
case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
{
GetCanvas()->SetAutoPanRequest( false );
HandleBlockPlace( aDC );
}
else if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
{
OnLeftClick( aDC, aPosition );
if( hotKey->m_Idcommand == HK_LEFT_DCLICK )
OnLeftDClick( aDC, aPosition );
}
break;
case HK_ZOOM_IN:
......
......@@ -122,6 +122,13 @@ public:
EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size );
~EDA_DRAW_PANEL();
/**
* Function GetDisplayOptions
* A way to pass info to draw functions.
* this is just an accessor to the GetDisplayOptions() parent frame function.
*/
void* GetDisplayOptions();
BASE_SCREEN* GetScreen();
EDA_DRAW_FRAME* GetParent() const;
......
......@@ -730,6 +730,14 @@ public:
EDA_DRAW_PANEL_GAL* GetGalCanvas() const { return m_galCanvas; }
void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
/**
* Function GetDisplayOptions
* A way to pass info to draw functions. the base class has no knowledge about
* these options. It is virtual because this function must be overloaded to
* pass usefull info.
*/
virtual void* GetDisplayOptions() { return NULL; }
DECLARE_EVENT_TABLE()
};
......
......@@ -71,32 +71,33 @@ enum TRACE_CLEARANCE_DISPLAY_MODE_T {
class DISPLAY_OPTIONS
{
public:
bool DisplayPadFill;
bool DisplayViaFill;
bool DisplayPadNum;
bool DisplayPadIsol;
int DisplayModEdge;
int DisplayModText;
bool DisplayPcbTrackFill; /* false = sketch , true = filled */
bool m_DisplayPadFill;
bool m_DisplayViaFill;
bool m_DisplayPadNum; // show pads numbers
bool m_DisplayPadIsol;
int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch)
int m_DisplayModText; // How to display module texts (line/ filled / sketch)
bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled.
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
TRACE_CLEARANCE_DISPLAY_MODE_T ShowTrackClearanceMode;
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode;
VIA_DISPLAY_MODE_T m_DisplayViaMode; /* 0 do not show via hole,
* 1 show via hole for non default value
* 2 show all via hole */
bool DisplayPolarCood;
int DisplayZonesMode;
int DisplayNetNamesMode; /* 0 do not show netnames,
bool m_DisplayPolarCood;
int m_DisplayZonesMode;
int m_DisplayNetNamesMode; /* 0 do not show netnames,
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads
*/
int DisplayDrawItems;
bool ContrastModeDisplay;
int m_DisplayDrawItems;
bool m_ContrastModeDisplay;
int m_MaxLinksShowed; // in track creation: number of hairwires shown
bool m_Show_Module_Ratsnest; // When moving a footprint: allows displaying a ratsnest
public:
DISPLAY_OPTIONS();
......
......@@ -39,6 +39,7 @@
#include <eda_text.h> // EDA_DRAW_MODE_T
#include <richio.h>
#include <class_pcb_screen.h>
#include <pcbstruct.h>
/* Forward declarations of classes. */
......@@ -66,13 +67,7 @@ class TOOL_DISPATCHER;
class PCB_BASE_FRAME : public EDA_DRAW_FRAME
{
public:
bool m_DisplayPadFill; // How show pads
bool m_DisplayViaFill; // How show vias
bool m_DisplayPadNum; // show pads numbers
int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch)
int m_DisplayModText; // How to display module texts (line/ filled / sketch)
bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled.
DISPLAY_OPTIONS m_DisplayOptions;
EDA_UNITS_T m_UserGridUnit;
wxRealPoint m_UserGridSize;
......@@ -156,6 +151,16 @@ public:
virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
virtual void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
/**
* Function GetDisplayOptions
* returns the display options current in use
* Display options are relative to the way tracks, vias, outlines
* and other things are shown (for instance solid or sketch mode)
* Must be overloaded in frames which have display options
* (board editor and footprint editor)
*/
void* GetDisplayOptions() { return &m_DisplayOptions; }
const ZONE_SETTINGS& GetZoneSettings() const;
void SetZoneSettings( const ZONE_SETTINGS& aSettings );
......
......@@ -619,12 +619,13 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
wxPoint LastPosOK;
double min_cost, curr_cost, Score;
bool TstOtherSide;
bool showRats = g_Show_Module_Ratsnest;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aFrame->GetDisplayOptions();
BOARD* brd = aFrame->GetBoard();
aModule->CalculateBoundingBox();
g_Show_Module_Ratsnest = false;
bool showRats = displ_opts->m_Show_Module_Ratsnest;
displ_opts->m_Show_Module_Ratsnest = false;
brd->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
aFrame->SetMsgPanel( aModule );
......@@ -735,7 +736,7 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
// erasing the last traces
GRRect( aFrame->GetCanvas()->GetClipBox(), aDC, fpBBox, 0, BROWN );
g_Show_Module_Ratsnest = showRats;
displ_opts->m_Show_Module_Ratsnest = showRats;
// Regeneration of the modified variable.
CurrPosition = LastPosOK;
......
......@@ -98,14 +98,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_Pcb = NULL;
m_toolManager = NULL;
m_toolDispatcher = NULL;
m_DisplayPadFill = true; // How to draw pads
m_DisplayViaFill = true; // How to draw vias
m_DisplayPadNum = true; // show pads number
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
m_DisplayPcbTrackFill = true; // false = sketch , true = filled
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_UserGridSize = wxRealPoint( 100.0, 100.0 );
......@@ -381,6 +373,7 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
{
LAYER_ID preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
// Check if the specified layer matches the present layer
if( layer == preslayer )
......@@ -422,22 +415,27 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
GetScreen()->m_Active_Layer = layer;
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
m_canvas->Refresh();
}
void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = !DisplayOpt.DisplayPolarCood;
displ_opts->m_DisplayPolarCood = !displ_opts->m_DisplayPolarCood;
UpdateStatusBar();
}
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = !m_DisplayPadFill;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
EDA_DRAW_PANEL_GAL* gal = GetGalCanvas();
if( gal )
......@@ -447,7 +445,7 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
static_cast<KIGFX::PCB_PAINTER*> ( gal->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt );
settings->LoadDisplayOptions( displ_opts );
// Update pads
BOARD* board = GetBoard();
......@@ -464,9 +462,11 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
{
aEvent.Check( DisplayOpt.DisplayPolarCood );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( displ_opts->m_DisplayPolarCood );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ?
displ_opts->m_DisplayPolarCood ?
_( "Display rectangular coordinates" ) :
_( "Display polar coordinates" ) );
}
......@@ -474,9 +474,10 @@ void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
void PCB_BASE_FRAME::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayPadFill );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayPadFill );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ?
displ_opts->m_DisplayPadFill ?
_( "Show pads in outline mode" ) :
_( "Show pads in fill mode" ) );
}
......@@ -615,16 +616,18 @@ void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
if( aId < 0 )
return;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
// handle color changes for transitions in and out of ID_TRACK_BUTT
if( ( GetToolId() == ID_TRACK_BUTT && aId != ID_TRACK_BUTT )
|| ( GetToolId() != ID_TRACK_BUTT && aId == ID_TRACK_BUTT ) )
{
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
redraw = true;
}
// must do this after the tool has been set, otherwise pad::Draw() does
// not show proper color when DisplayOpt.ContrastModeDisplay is true.
// not show proper color when GetDisplayOptions().ContrastModeDisplay is true.
if( redraw && m_canvas )
m_canvas->Refresh();
}
......@@ -646,10 +649,11 @@ void PCB_BASE_FRAME::UpdateStatusBar()
double dYpos;
wxString line;
wxString locformatter;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
EDA_DRAW_FRAME::UpdateStatusBar();
if( DisplayOpt.DisplayPolarCood ) // display polar coordinates
if( displ_opts->m_DisplayPolarCood ) // display polar coordinates
{
double theta, ro;
......@@ -708,7 +712,7 @@ void PCB_BASE_FRAME::UpdateStatusBar()
line.Printf( absformatter, dXpos, dYpos );
SetStatusText( line, 2 );
if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates
if( !displ_opts->m_DisplayPolarCood ) // display relative cartesian coordinates
{
// Display relative coordinates:
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
......@@ -746,23 +750,23 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
long itmp;
aCfg->Read( m_FrameName + UserGridUnitsEntry, &itmp, ( long )INCHES );
m_UserGridUnit = (EDA_UNITS_T) itmp;
aCfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
aCfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
aCfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED );
aCfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true );
aCfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true );
aCfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true );
aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdge, ( long )FILLED );
aCfg->Read( m_FrameName + FastGrid1Entry, &itmp, ( long )0);
m_FastGrid1 = itmp;
aCfg->Read( m_FrameName + FastGrid2Entry, &itmp, ( long )0);
m_FastGrid2 = itmp;
if( m_DisplayModEdge < LINE || m_DisplayModEdge > SKETCH )
m_DisplayModEdge = FILLED;
if( m_DisplayOptions.m_DisplayModEdge < LINE || m_DisplayOptions.m_DisplayModEdge > SKETCH )
m_DisplayOptions.m_DisplayModEdge = FILLED;
aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, ( long )FILLED );
aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModText, ( long )FILLED );
if( m_DisplayModText < LINE || m_DisplayModText > SKETCH )
m_DisplayModText = FILLED;
if( m_DisplayOptions.m_DisplayModText < LINE || m_DisplayOptions.m_DisplayModText > SKETCH )
m_DisplayOptions.m_DisplayModText = FILLED;
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
// when reading doubles in config,
......@@ -778,11 +782,11 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x );
aCfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y );
aCfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnit );
aCfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayPadFill );
aCfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayViaFill );
aCfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum );
aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayModEdge );
aCfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayModText );
aCfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
aCfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );
aCfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum );
aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayOptions.m_DisplayModEdge );
aCfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayOptions.m_DisplayModText );
aCfg->Write( m_FrameName + FastGrid1Entry, ( long )m_FastGrid1 );
aCfg->Write( m_FrameName + FastGrid2Entry, ( long )m_FastGrid2 );
}
......
......@@ -565,8 +565,9 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
BASE_SCREEN* screen = aPanel->GetScreen();
// do not show local module rastnest in block move, it is not usable.
bool tmp = g_Show_Module_Ratsnest;
g_Show_Module_Ratsnest = false;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions();
bool showRats = displ_opts->m_Show_Module_Ratsnest;
displ_opts->m_Show_Module_Ratsnest = false;
if( aErase )
{
......@@ -596,7 +597,7 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
drawPickedItems( aPanel, aDC, screen->m_BlockLocate.GetMoveVector() );
}
g_Show_Module_Ratsnest = tmp;
displ_opts->m_Show_Module_Ratsnest = showRats;
}
......
......@@ -346,7 +346,8 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
gcolor = brd->GetLayerColor( m_Layer );
GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
typeaff = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED;
width = m_Width;
if( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH )
......
......@@ -183,7 +183,9 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
color = brd->GetLayerColor( GetLayer() );
if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) && !IsOnLayer( Edge_Cuts ) )
ColorTurnToDarkDarkGray( &color );
......@@ -200,7 +202,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
dx = m_End.x + aOffset.x;
dy = m_End.y + aOffset.y;
mode = DisplayOpt.DisplayDrawItems;
mode = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED;
if( m_Flags & FORCE_SKETCH )
mode = SKETCH;
......
......@@ -144,15 +144,14 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
return;
EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if(( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
if(( draw_mode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
ColorTurnToDarkDarkGray( &color );
}
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
ux0 = m_Start.x - offset.x;
uy0 = m_Start.y - offset.y;
......@@ -160,11 +159,11 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
dy = m_End.y - offset.y;
GRSetDrawMode( DC, draw_mode );
typeaff = frame->m_DisplayModEdge;
typeaff = displ_opts ? displ_opts->m_DisplayModEdge : FILLED;
if( IsCopperLayer( m_Layer ) )
{
typeaff = frame->m_DisplayPcbTrackFill;
typeaff = displ_opts ? displ_opts->m_DisplayPcbTrackFill : FILLED;
if( !typeaff )
typeaff = SKETCH;
......
......@@ -102,7 +102,8 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
EDA_COLOR_T gcolor = brd->GetLayerColor( m_Layer );
GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
typeaff = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED;
width = m_Width;
if( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH )
......
......@@ -117,9 +117,10 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
return;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions();
PCB_SCREEN* screen = frame->GetScreen();
if( frame->m_DisplayPadFill == FILLED )
if( displ_opts->m_DisplayPadFill == FILLED )
drawInfo.m_ShowPadFilled = true;
else
drawInfo.m_ShowPadFilled = false;
......@@ -165,7 +166,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// if SMD or connector pad and high contrast mode
if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
( GetAttribute() == PAD_SMD || GetAttribute() == PAD_CONN ) &&
DisplayOpt.ContrastModeDisplay )
displ_opts && displ_opts->m_ContrastModeDisplay )
{
// when routing tracks
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
......@@ -229,7 +230,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// layer so we can see pads on paste or solder layer and the size of the
// mask
if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
DisplayOpt.ContrastModeDisplay && !IsCopperLayer( screen->m_Active_Layer ) )
displ_opts && displ_opts->m_ContrastModeDisplay && !IsCopperLayer( screen->m_Active_Layer ) )
{
if( IsOnLayer( screen->m_Active_Layer ) )
{
......@@ -263,7 +264,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
ColorApplyHighlightFlag( &color );
bool DisplayIsol = DisplayOpt.DisplayPadIsol;
bool DisplayIsol = displ_opts && displ_opts->m_DisplayPadIsol;
if( !( m_layerMask & LSET::AllCuMask() ).any() )
DisplayIsol = false;
......@@ -284,23 +285,24 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
SetAlpha( &color, 170 );
/* Get the pad clearance. This has a meaning only for Pcbnew.
* for CvPcb (and GerbView) GetClearance() creates debug errors because
* for CvPcb GetClearance() creates debug errors because
* there is no net classes so a call to GetClearance() is made only when
* needed (never needed in CvPcb nor in GerbView)
* needed (never needed in CvPcb)
*/
drawInfo.m_PadClearance = DisplayIsol ? GetClearance() : 0;
// Draw the pad number
if( frame && !frame->m_DisplayPadNum )
if( displ_opts && !displ_opts->m_DisplayPadNum )
drawInfo.m_Display_padnum = false;
if( ( DisplayOpt.DisplayNetNamesMode == 0 ) || ( DisplayOpt.DisplayNetNamesMode == 2 ) )
if( displ_opts &&
(( displ_opts ->m_DisplayNetNamesMode == 0 ) || ( displ_opts->m_DisplayNetNamesMode == 2 )) )
drawInfo.m_Display_netname = false;
// Display net names is restricted to pads that are on the active layer
// in high contrast mode display
if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
!IsOnLayer( screen->m_Active_Layer ) && DisplayOpt.ContrastModeDisplay )
!IsOnLayer( screen->m_Active_Layer ) && displ_opts && displ_opts->m_ContrastModeDisplay )
drawInfo.m_Display_netname = false;
DrawShape( aPanel->GetClipBox(), aDC, drawInfo );
......
......@@ -431,10 +431,11 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
return false;
myframe->SetActiveLayer( layer );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)myframe->GetDisplayOptions();
if( m_alwaysShowActiveCopperLayer )
OnLayerSelected();
else if( DisplayOpt.ContrastModeDisplay )
else if( displ_opts->m_ContrastModeDisplay )
myframe->GetCanvas()->Refresh();
return true;
......
......@@ -91,8 +91,9 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
EDA_DRAW_MODE_T fillmode = FILLED;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if( DisplayOpt.DisplayDrawItems == SKETCH )
if( displ_opts && displ_opts->m_DisplayDrawItems == SKETCH )
fillmode = SKETCH;
EDA_COLOR_T anchor_color = UNSPECIFIED_COLOR;
......
......@@ -287,12 +287,12 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
}
// Draw mode compensation for the width
PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( panel->GetParent() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
int width = m_Thickness;
if( ( frame->m_DisplayModText == LINE )
if( ( displ_opts && displ_opts->m_DisplayModText == LINE )
|| ( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) )
width = 0;
else if( frame->m_DisplayModText == SKETCH )
else if( displ_opts && displ_opts->m_DisplayModText == SKETCH )
width = -width;
GRSetDrawMode( DC, draw_mode );
......
......@@ -52,14 +52,14 @@
* tests to see if the clearance border is drawn on the given track.
* @return bool - true if should draw clearance, else false.
*/
static bool ShowClearance( const TRACK* aTrack )
static bool ShowClearance( DISPLAY_OPTIONS* aDisplOpts, const TRACK* aTrack )
{
// maybe return true for tracks and vias, not for zone segments
return IsCopperLayer( aTrack->GetLayer() )
&& ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T )
&& ( ( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS
&& ( ( aDisplOpts->m_ShowTrackClearanceMode == SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS
&& ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) )
|| ( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
|| ( aDisplOpts->m_ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
);
}
......@@ -312,11 +312,8 @@ const EDA_RECT TRACK::GetBoundingBox() const
xmin = std::min( m_Start.x, m_End.x );
}
if( ShowClearance( this ) )
{
// + 1 is for the clearance line itself.
radius += GetClearance() + 1;
}
ymax += radius;
xmax += radius;
......@@ -538,7 +535,9 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel,
* - only tracks with a length > 10 * thickness are eligible
* and, of course, if we are not printing the board
*/
if( DisplayOpt.DisplayNetNamesMode == 0 || DisplayOpt.DisplayNetNamesMode == 1 )
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if( displ_opts->m_DisplayNetNamesMode == 0 || displ_opts->m_DisplayNetNamesMode == 1 )
return;
#define THRESHOLD 10
......@@ -596,7 +595,7 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel,
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( ( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE )
&& ( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay) ) )
&& ( !(!IsOnLayer( curr_layer )&& displ_opts->m_ContrastModeDisplay) ) )
{
if( (aDrawMode & GR_XOR) == 0 )
GRSetDrawMode( aDC, GR_COPY );
......@@ -629,7 +628,9 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
return;
#endif
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) panel->GetDisplayOptions();
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
{
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
......@@ -654,7 +655,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
return;
}
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
{
GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
}
......@@ -669,7 +670,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
return;
// Show clearance for tracks, not for zone segments
if( ShowClearance( this ) )
if( ShowClearance( displ_opts, this ) )
{
GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset,
m_Width + (GetClearance() * 2), color );
......@@ -682,7 +683,9 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset )
{
if( DisplayOpt.DisplayZonesMode != 0 )
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if( displ_opts->m_DisplayZonesMode != 0 )
return;
BOARD * brd = GetBoard( );
......@@ -697,7 +700,7 @@ void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
return;
#endif
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
{
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
......@@ -722,7 +725,7 @@ void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
return;
}
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
{
GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
}
......@@ -768,8 +771,9 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
int fillvia = 0;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
PCB_SCREEN* screen = frame->GetScreen();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions();
if( frame->m_DisplayViaFill == FILLED )
if( displ_opts->m_DisplayViaFill == FILLED )
fillvia = 1;
GRSetDrawMode( aDC, aDrawMode );
......@@ -785,7 +789,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() )
return;
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
ColorTurnToDarkDarkGray( &color );
......@@ -832,10 +836,10 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
}
// Draw the via hole if the display option allows it
if( DisplayOpt.m_DisplayViaMode != VIA_HOLE_NOT_SHOW )
if( displ_opts->m_DisplayViaMode != VIA_HOLE_NOT_SHOW )
{
// Display all drill holes requested or Display non default holes requested
if( (DisplayOpt.m_DisplayViaMode == ALL_VIA_HOLE_SHOW)
if( (displ_opts->m_DisplayViaMode == ALL_VIA_HOLE_SHOW)
|| ( (drill_radius > 0 ) && !IsDrillDefault() ) )
{
if( fillvia )
......@@ -871,7 +875,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
}
}
if( ShowClearance( this ) )
if( ShowClearance( displ_opts, this ) )
{
GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius + GetClearance(), 0, color );
}
......@@ -945,7 +949,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( GetNetCode() == NETINFO_LIST::UNCONNECTED )
return;
if( DisplayOpt.DisplayNetNamesMode == 0 || DisplayOpt.DisplayNetNamesMode == 1 )
if( displ_opts->m_DisplayNetNamesMode == 0 || displ_opts->m_DisplayNetNamesMode == 1 )
return;
NETINFO_ITEM* net = GetNet();
......
......@@ -155,8 +155,9 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod
return;
GRSetDrawMode( DC, aDrawMode );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
ColorTurnToDarkDarkGray( &color );
......@@ -215,15 +216,16 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
{
static std::vector <char> CornersTypeBuffer;
static std::vector <wxPoint> CornersBuffer;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
// outline_mode is false to show filled polys,
// and true to show polygons outlines only (test and debug purposes)
bool outline_mode = DisplayOpt.DisplayZonesMode == 2 ? true : false;
bool outline_mode = displ_opts->m_DisplayZonesMode == 2 ? true : false;
if( DC == NULL )
return;
if( DisplayOpt.DisplayZonesMode == 1 ) // Do not show filled areas
if( displ_opts->m_DisplayZonesMode == 1 ) // Do not show filled areas
return;
if( m_FilledPolysList.GetCornersCount() == 0 ) // Nothing to draw
......@@ -238,7 +240,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
GRSetDrawMode( DC, aDrawMode );
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
ColorTurnToDarkDarkGray( &color );
......@@ -293,7 +295,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
// Draw only basic outlines, not extra segments.
if( CornersTypeBuffer[ie] == 0 )
{
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
GRCSegm( panel->GetClipBox(), DC,
x0, y0, x1, y1,
m_ZoneMinThickness, color );
......@@ -323,7 +325,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
wxPoint start = m_FillSegmList[ic].m_Start + offset;
wxPoint end = m_FillSegmList[ic].m_End + offset;
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
GRCSegm( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y,
m_ZoneMinThickness, color );
else
......@@ -374,8 +376,9 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard();
EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
ColorTurnToDarkDarkGray( &color );
......
......@@ -202,26 +202,28 @@ int PCB_SCREEN::MilsToIuScalar()
DISPLAY_OPTIONS::DISPLAY_OPTIONS()
{
DisplayPadFill = FILLED;
DisplayViaFill = FILLED;
DisplayPadNum = true;
DisplayPadIsol = true;
DisplayModEdge = true;
DisplayModText = true;
DisplayPcbTrackFill = true; // false = sketch , true = filled
ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayPadFill = FILLED;
m_DisplayViaFill = FILLED;
m_DisplayPadNum = true;
m_DisplayPadIsol = true;
m_DisplayModEdge = true;
m_DisplayModText = true;
m_DisplayPcbTrackFill = true; // false = sketch , true = filled
m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
DisplayPolarCood = false; /* false = display absolute coordinates,
m_DisplayPolarCood = false; /* false = display absolute coordinates,
* true = display polar cordinates */
DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
m_DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
* 1 = do not show filled areas outlines
* 2 = show outlines of filled areas */
DisplayNetNamesMode = 3; /* 0 do not show netnames,
m_DisplayNetNamesMode = 3; /* 0 do not show netnames,
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads */
DisplayDrawItems = true;
ContrastModeDisplay = false;
m_DisplayDrawItems = true;
m_ContrastModeDisplay = false;
m_MaxLinksShowed = 3; // in track creation: number of hairwires shown
m_Show_Module_Ratsnest = true; // When moving a footprint: allows displaying a ratsnest
}
......@@ -104,6 +104,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
BOARD_ITEM* item;
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
// Assign to scanList the proper item types desired based on tool type
// or hotkey that is in play.
......@@ -120,7 +121,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) )
scanList = GENERAL_COLLECTOR::Modules;
else
scanList = (DisplayOpt.DisplayZonesMode == 0) ?
scanList = (displ_opts->m_DisplayZonesMode == 0) ?
GENERAL_COLLECTOR::AllBoardItems :
GENERAL_COLLECTOR::AllButZones;
}
......@@ -146,7 +147,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
break;
default:
scanList = DisplayOpt.DisplayZonesMode == 0 ?
scanList = displ_opts->m_DisplayZonesMode == 0 ?
GENERAL_COLLECTOR::AllBoardItems :
GENERAL_COLLECTOR::AllButZones;
}
......
......@@ -68,13 +68,14 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) :
void DIALOG_DISPLAY_OPTIONS::init()
{
SetFocus();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
if ( DisplayOpt.DisplayPcbTrackFill )
if ( displ_opts->m_DisplayPcbTrackFill )
m_OptDisplayTracks->SetSelection( 1 );
else
m_OptDisplayTracks->SetSelection( 0 );
switch ( DisplayOpt.ShowTrackClearanceMode )
switch ( displ_opts->m_ShowTrackClearanceMode )
{
case DO_NOT_SHOW_CLEARANCE:
m_OptDisplayTracksClearance->SetSelection( 0 );
......@@ -98,26 +99,26 @@ void DIALOG_DISPLAY_OPTIONS::init()
break;
}
if ( DisplayOpt.DisplayPadFill )
if ( displ_opts->m_DisplayPadFill )
m_OptDisplayPads->SetSelection( 1 );
else
m_OptDisplayPads->SetSelection( 0 );
if ( DisplayOpt.DisplayViaFill )
if ( displ_opts->m_DisplayViaFill )
m_OptDisplayVias->SetSelection( 1 );
else
m_OptDisplayVias->SetSelection( 0 );
m_Show_Page_Limits->SetSelection( m_Parent->ShowPageLimits() ? 0 : 1 );
m_OptDisplayViaHole->SetSelection( DisplayOpt.m_DisplayViaMode );
m_OptDisplayModTexts->SetSelection( DisplayOpt.DisplayModText );
m_OptDisplayModEdges->SetSelection( DisplayOpt.DisplayModEdge );
m_OptDisplayPadClearence->SetValue( DisplayOpt.DisplayPadIsol );
m_OptDisplayPadNumber->SetValue( DisplayOpt.DisplayPadNum );
m_OptDisplayViaHole->SetSelection( displ_opts->m_DisplayViaMode );
m_OptDisplayModTexts->SetSelection( displ_opts->m_DisplayModText );
m_OptDisplayModEdges->SetSelection( displ_opts->m_DisplayModEdge );
m_OptDisplayPadClearence->SetValue( displ_opts->m_DisplayPadIsol );
m_OptDisplayPadNumber->SetValue( displ_opts->m_DisplayPadNum );
m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ) );
m_OptDisplayDrawings->SetSelection( DisplayOpt.DisplayDrawItems );
m_ShowNetNamesOption->SetSelection( DisplayOpt.DisplayNetNamesMode );
m_OptDisplayDrawings->SetSelection( displ_opts->m_DisplayDrawItems );
m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode );
}
......@@ -131,74 +132,62 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event )
*/
void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions();
if ( m_Show_Page_Limits->GetSelection() == 0 )
m_Parent->SetShowPageLimits( true );
else
m_Parent->SetShowPageLimits( false );
if ( m_OptDisplayTracks->GetSelection() == 1 )
DisplayOpt.DisplayPcbTrackFill = true;
else
DisplayOpt.DisplayPcbTrackFill = false;
displ_opts->m_DisplayPcbTrackFill = m_OptDisplayTracks->GetSelection() == 1;
m_Parent->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.m_DisplayViaMode = (VIA_DISPLAY_MODE_T) m_OptDisplayViaHole->GetSelection();
displ_opts->m_DisplayViaMode = (VIA_DISPLAY_MODE_T) m_OptDisplayViaHole->GetSelection();
switch ( m_OptDisplayTracksClearance->GetSelection() )
{
case 0:
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
break;
case 1:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS;
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS;
break;
case 2:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
break;
case 3:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS;
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS;
break;
case 4:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
break;
}
m_Parent->m_DisplayModText = DisplayOpt.DisplayModText = m_OptDisplayModTexts->GetSelection();
m_Parent->m_DisplayModEdge = DisplayOpt.DisplayModEdge = m_OptDisplayModEdges->GetSelection();
if (m_OptDisplayPads->GetSelection() == 1 )
DisplayOpt.DisplayPadFill = true;
else
DisplayOpt.DisplayPadFill = false;
if (m_OptDisplayVias->GetSelection() == 1 )
DisplayOpt.DisplayViaFill = true;
else
DisplayOpt.DisplayViaFill = false;
displ_opts->m_DisplayModText = m_OptDisplayModTexts->GetSelection();
displ_opts->m_DisplayModEdge = m_OptDisplayModEdges->GetSelection();
m_Parent->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_Parent->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
displ_opts->m_DisplayPadFill = m_OptDisplayPads->GetSelection() == 1;
displ_opts->m_DisplayViaFill = m_OptDisplayVias->GetSelection() == 1;
DisplayOpt.DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
displ_opts->m_DisplayPadIsol = m_OptDisplayPadClearence->GetValue();
m_Parent->m_DisplayPadNum = DisplayOpt.DisplayPadNum = m_OptDisplayPadNumber->GetValue();
displ_opts->m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
m_Parent->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE),
m_OptDisplayPadNoConn->GetValue() );
DisplayOpt.DisplayDrawItems = m_OptDisplayDrawings->GetSelection();
DisplayOpt.DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
displ_opts->m_DisplayDrawItems = m_OptDisplayDrawings->GetSelection();
displ_opts->m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
// Apply changes to the GAL
KIGFX::VIEW* view = m_Parent->GetGalCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt );
settings->LoadDisplayOptions( displ_opts );
view->RecacheAllItems( true );
m_Parent->GetCanvas()->Refresh();
......
......@@ -63,9 +63,10 @@ void DIALOG_GENERALOPTIONS::init()
m_sdbSizerOK->SetDefault();
m_Board = GetParent()->GetBoard();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetParent()->GetDisplayOptions();
/* Set display options */
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_PolarDisplay->SetSelection( displ_opts->m_DisplayPolarCood ? 1 : 0 );
m_UnitsSelection->SetSelection( g_UserUnit ? 1 : 0 );
m_CursorShape->SetSelection( GetParent()->GetCursorShape() ? 1 : 0 );
......@@ -77,10 +78,10 @@ void DIALOG_GENERALOPTIONS::init()
wxString timevalue;
timevalue << GetParent()->GetAutoSaveInterval() / 60;
m_SaveTime->SetValue( timevalue );
m_MaxShowLinks->SetValue( g_MaxLinksShowed );
m_MaxShowLinks->SetValue( displ_opts->m_MaxLinksShowed );
m_DrcOn->SetValue( g_Drc_On );
m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest );
m_ShowModuleRatsnest->SetValue( displ_opts->m_Show_Module_Ratsnest );
m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible( RATSNEST_VISIBLE ) );
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
......@@ -107,8 +108,9 @@ void DIALOG_GENERALOPTIONS::OnCancelClick( wxCommandEvent& event )
void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
{
EDA_UNITS_T ii;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetParent()->GetDisplayOptions();
DisplayOpt.DisplayPolarCood = ( m_PolarDisplay->GetSelection() == 0 ) ? false : true;
displ_opts->m_DisplayPolarCood = ( m_PolarDisplay->GetSelection() == 0 ) ? false : true;
ii = g_UserUnit;
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
......@@ -120,7 +122,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
GetParent()->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) );
/* Updating the combobox to display the active layer. */
g_MaxLinksShowed = m_MaxShowLinks->GetValue();
displ_opts->m_MaxLinksShowed = m_MaxShowLinks->GetValue();
g_Drc_On = m_DrcOn->GetValue();
if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
......@@ -129,7 +131,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
GetParent()->GetCanvas()->Refresh( );
}
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
displ_opts->m_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
g_Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();
g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue();
......@@ -157,6 +159,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
bool state = event.IsChecked();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
switch( id )
{
......@@ -182,7 +185,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
g_Show_Module_Ratsnest = state; // TODO: use the visibility list
displ_opts->m_Show_Module_Ratsnest = state; // TODO: see if we can use the visibility list
break;
case ID_TB_OPTIONS_AUTO_DEL_TRACK:
......@@ -190,33 +193,33 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_ZONES:
DisplayOpt.DisplayZonesMode = 0;
displ_opts->m_DisplayZonesMode = 0;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
DisplayOpt.DisplayZonesMode = 1;
displ_opts->m_DisplayZonesMode = 1;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
DisplayOpt.DisplayZonesMode = 2;
displ_opts->m_DisplayZonesMode = 2;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state;
displ_opts->m_DisplayViaFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = !state;
displ_opts->m_DisplayPcbTrackFill = !state;
m_canvas->Refresh();
break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
{
DisplayOpt.ContrastModeDisplay = state;
displ_opts->m_ContrastModeDisplay = state;
m_canvas->Refresh();
break;
}
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -531,6 +531,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
wxBoxSizer* bSizerDisplayPad;
bSizerDisplayPad = new wxBoxSizer( wxVERTICAL );
bSizerDisplayPad->SetMinSize( wxSize( 100,-1 ) );
m_panelShowPad = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 200,200 ), wxFULL_REPAINT_ON_RESIZE|wxSIMPLE_BORDER );
m_panelShowPad->SetBackgroundColour( wxColour( 0, 0, 0 ) );
......
......@@ -8228,7 +8228,7 @@
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="minimum_size">100,-1</property>
<property name="name">bSizerDisplayPad</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......
......@@ -64,6 +64,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
INSTALL_UNBUFFERED_DC( dc, m_canvas );
MODULE* module;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
m_canvas->CrossHairOff( &dc );
......@@ -442,7 +443,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
settings.m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
m_canvas->Refresh();
}
break;
......@@ -967,7 +968,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
// if user changed colors and we are in high contrast mode, then redraw
// because the PAD_SMD pads may change color.
if( DisplayOpt.ContrastModeDisplay && GetActiveLayer() != itmp )
if( displ_opts->m_ContrastModeDisplay && GetActiveLayer() != itmp )
{
m_canvas->Refresh();
}
......@@ -1010,7 +1011,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_TOOLBARH_PCB_SELECT_LAYER:
SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
m_canvas->Refresh( true );
break;
......@@ -1310,6 +1311,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
{
LAYER_ID curLayer = GetActiveLayer();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
// Check if the specified layer matches the present layer
if( layer == curLayer )
......@@ -1354,7 +1356,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
if( Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC ) )
{
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
m_canvas->Refresh();
}
......@@ -1373,7 +1375,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
SetActiveLayer( layer );
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
m_canvas->Refresh();
}
......@@ -1386,6 +1388,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
return;
INSTALL_UNBUFFERED_DC( dc, m_canvas );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
// Stop the current command and deselect the current tool.
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
......@@ -1416,7 +1419,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
case ID_PCB_ZONES_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
if( DisplayOpt.DisplayZonesMode != 0 )
if( displ_opts->m_DisplayZonesMode != 0 )
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
if( !GetBoard()->IsHighLightNetON() && (GetBoard()->GetHighLightNetCode() > 0 ) )
......
......@@ -113,7 +113,8 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
{
EDA_ITEM* PtStruct;
int track_fill_copy = DisplayOpt.DisplayDrawItems;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
int tmp = displ_opts->m_DisplayDrawItems;
if( Segment == NULL )
return;
......@@ -121,7 +122,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
if( Segment->IsNew() ) // Trace in progress.
{
// Delete current segment.
DisplayOpt.DisplayDrawItems = SKETCH;
displ_opts->m_DisplayDrawItems = SKETCH;
Segment->Draw( m_canvas, DC, GR_XOR );
PtStruct = Segment->Back();
Segment ->DeleteStructure();
......@@ -129,7 +130,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
if( PtStruct && (PtStruct->Type() == PCB_LINE_T ) )
Segment = (DRAWSEGMENT*) PtStruct;
DisplayOpt.DisplayDrawItems = track_fill_copy;
displ_opts->m_DisplayDrawItems = tmp;
SetCurItem( NULL );
}
else if( Segment->GetFlags() == 0 )
......@@ -334,13 +335,14 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
*/
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions();
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
int t_fill = DisplayOpt.DisplayDrawItems;
int tmp = displ_opts->m_DisplayDrawItems;
if( Segment == NULL )
return;
DisplayOpt.DisplayDrawItems = SKETCH;
displ_opts->m_DisplayDrawItems = SKETCH;
if( aErase )
Segment->Draw( aPanel, aDC, GR_XOR );
......@@ -360,5 +362,5 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
}
Segment->Draw( aPanel, aDC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill;
displ_opts->m_DisplayDrawItems = tmp;
}
......@@ -677,10 +677,11 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) aPanel->GetDisplayOptions();
bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.DisplayPcbTrackFill = true;
TRACE_CLEARANCE_DISPLAY_MODE_T showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode;
bool tmp = displ_opts->m_DisplayPcbTrackFill;
displ_opts->m_DisplayPcbTrackFill = true;
TRACE_CLEARANCE_DISPLAY_MODE_T showTrackClearanceMode = displ_opts->m_ShowTrackClearanceMode;
if ( g_FirstTrackSegment == NULL )
return;
......@@ -688,7 +689,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
NETCLASSPTR netclass = g_FirstTrackSegment->GetNetClass();
if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE )
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
// Values to Via circle
int boardViaRadius = frame->GetDesignSettings().GetCurrentViaSize()/2;
......@@ -824,8 +825,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
msg.Printf( wxT( "%d" ), g_CurrentTrackList.GetCount() );
frame->AppendMsgPanel( _( "Segs Count" ), msg, DARKCYAN );
DisplayOpt.ShowTrackClearanceMode = showTrackClearanceMode;
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
displ_opts->m_ShowTrackClearanceMode = showTrackClearanceMode;
displ_opts->m_DisplayPcbTrackFill = tmp;
frame->BuildAirWiresTargetsList( NULL, g_CurrentTrackSegment->GetEnd(), false );
frame->TraceAirWiresToTargets( aDC );
......
......@@ -530,13 +530,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
}
}
// Update the option toolbar
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayModText = DisplayOpt.DisplayModText;
m_DisplayModEdge = DisplayOpt.DisplayModEdge;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
{
wxFileName fn = fullFileName;
......
......@@ -118,6 +118,7 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
MODULE* module = NULL;
int evt_type = 0; //Used to post a wxCommandEvent on demand
PCB_SCREEN* screen = GetScreen();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
/* Convert lower to upper case
* (the usual toupper function has problem with non ascii codes like function keys
......@@ -362,8 +363,7 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break;
case HK_SWITCH_TRACK_DISPLAY_MODE:
DisplayOpt.DisplayPcbTrackFill = !DisplayOpt.DisplayPcbTrackFill;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
m_canvas->Refresh();
break;
......@@ -457,7 +457,7 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( !itemCurrentlyEdited ) // no track in progress: switch layer only
{
Other_Layer_Route( NULL, aDC );
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
m_canvas->Refresh();
break;
}
......@@ -552,7 +552,7 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break;
case HK_SWITCH_HIGHCONTRAST_MODE: // switch to high contrast mode and refresh the canvas
DisplayOpt.ContrastModeDisplay = !DisplayOpt.ContrastModeDisplay;
displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay;
m_canvas->Refresh();
break;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
......@@ -31,46 +31,50 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <module_editor_frame.h>
#include <class_board_design_settings.h>
#include <pcbnew_id.h>
#include <protos.h>
void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
bool state = m_optionsToolBar->GetToolToggled( id );
switch( id )
{
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
m_DisplayPadFill = !m_optionsToolBar->GetToolToggled( id );
displ_opts->m_DisplayPadFill = !state;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
m_DisplayViaFill = !m_optionsToolBar->GetToolToggled( id );
displ_opts->m_DisplayViaFill = !state;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
m_DisplayModText = m_optionsToolBar->GetToolToggled( id ) ? SKETCH : FILLED;
displ_opts->m_DisplayModText = state ? SKETCH : FILLED;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
m_DisplayModEdge = m_optionsToolBar->GetToolToggled( id ) ? SKETCH : FILLED;
displ_opts->m_DisplayModEdge = state ? SKETCH : FILLED;
m_canvas->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
displ_opts->m_ContrastModeDisplay = state;
m_canvas->Refresh( );
break;
default:
DisplayError( this,
wxT( "FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar error" ) );
wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar error" ) );
break;
}
}
......@@ -113,6 +113,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
// popup commands
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
......@@ -160,6 +161,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_GEN_IMPORT_DXF_FILE,
FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
......@@ -193,6 +196,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetGalCanvas( drawPanel );
SetBoard( new BOARD() );
// In modedit, the default net clearance is not known.
// (it depends on the actual board)
// So we do not show the default clearance, by setting it to 0
// The footprint or pad specific clearance will be shown
GetBoard()->GetDesignSettings().GetDefault()->SetClearance(0);
// restore the last footprint from the project, if any
restoreLastFootprint();
......
......@@ -387,7 +387,9 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
s_PickedList.ClearItemsList();
}
if( g_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK ) && aDC )
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
if( displ_opts->m_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK ) && aDC )
TraceModuleRatsNest( aDC );
newpos = GetCrossHairPosition();
......@@ -506,19 +508,20 @@ void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module )
return;
module->DrawEdgesOnly( panel, DC, g_Offset_Module, GR_XOR );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
// Show pads in sketch mode to speedu up drawings
pad_fill_tmp = DisplayOpt.DisplayPadFill;
DisplayOpt.DisplayPadFill = true;
pad_fill_tmp = displ_opts->m_DisplayPadFill;
displ_opts->m_DisplayPadFill = true;
pt_pad = module->Pads();
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
pt_pad->Draw( panel, DC, GR_XOR, g_Offset_Module );
DisplayOpt.DisplayPadFill = pad_fill_tmp;
displ_opts->m_DisplayPadFill = pad_fill_tmp;
if( g_Show_Module_Ratsnest && panel )
if( displ_opts->m_Show_Module_Ratsnest && panel )
{
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
frame->build_ratsnest_module( module );
......
......@@ -30,14 +30,12 @@
#include <fctsys.h>
#include <pgm_base.h>
#include <kiway.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <pcb_draw_panel_gal.h>
#include <wxPcbStruct.h>
#include <3d_viewer.h>
#include <dialog_helpers.h>
#include <msgpanel.h>
#include <macros.h>
#include <fp_lib_table.h>
#include <fpid.h>
#include <confirm.h>
......@@ -133,6 +131,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL );
SetBoard( new BOARD() );
// In viewer, the default net clearance is not known (it depends on the actual board).
// So we do not show the default clearance, by setting it to 0
// The footprint or pad specific clearance will be shown
GetBoard()->GetDesignSettings().GetDefault()->SetClearance(0);
// Ensure all layers and items are visible:
GetBoard()->SetVisibleAlls();
......
......@@ -103,11 +103,12 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) aPanel->GetDisplayOptions();
wxPoint moveVector;
int tmp = DisplayOpt.DisplayPcbTrackFill;
int tmp = displ_opts->m_DisplayPcbTrackFill;
GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT;
DisplayOpt.DisplayPcbTrackFill = false;
displ_opts->m_DisplayPcbTrackFill = false;
#ifndef USE_WX_OVERLAY
aErase = true;
......@@ -142,7 +143,7 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
track->Draw( aPanel, aDC, draw_mode );
}
DisplayOpt.DisplayPcbTrackFill = tmp;
displ_opts->m_DisplayPcbTrackFill = tmp;
// Display track length
if( track )
......
......@@ -33,6 +33,7 @@
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <draw_frame.h>
#include <boost/bind.hpp>
......@@ -148,8 +149,16 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
// Load display options (such as filled/outline display of items)
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( DisplayOpt );
// Load display options (such as filled/outline display of items).
// Can be made only if the parent windos is a EDA_DRAW_FRAME (or a derived class)
// which is not always the case (namely when it is used from a wxDialog like the pad editor)
EDA_DRAW_FRAME* frame = dynamic_cast <EDA_DRAW_FRAME*> ( aParentWindow );
if( frame )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) frame->GetDisplayOptions();
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts );
}
}
......@@ -198,7 +207,16 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( const BOARD* aBoard )
m_view->Add( m_ratsnest );
UseColorScheme( aBoard->GetColorsSettings() );
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( DisplayOpt );
// We are expecting here the parent frame is a EDA_DRAW_FRAME or a derived class
// (usually a BASE_PCB_FRAME, PCB_EDIT_FRAME ...)
EDA_DRAW_FRAME* frame = dynamic_cast <EDA_DRAW_FRAME*> ( GetParent() );
if( frame )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) frame->GetDisplayOptions();
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts );
}
m_view->RecacheAllItems( true );
}
......
......@@ -98,19 +98,22 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet
}
void PCB_RENDER_SETTINGS::LoadDisplayOptions( const DISPLAY_OPTIONS& aOptions )
void PCB_RENDER_SETTINGS::LoadDisplayOptions( const DISPLAY_OPTIONS* aOptions )
{
m_hiContrastEnabled = aOptions.ContrastModeDisplay;
m_padNumbers = aOptions.DisplayPadNum;
if( aOptions == NULL )
return;
m_hiContrastEnabled = aOptions->m_ContrastModeDisplay;
m_padNumbers = aOptions->m_DisplayPadNum;
// Whether to draw tracks, vias & pads filled or as outlines
m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] = !aOptions.DisplayPadFill;
m_sketchMode[ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE )] = !aOptions.DisplayViaFill;
m_sketchMode[ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE )] = !aOptions.DisplayViaFill;
m_sketchMode[ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE )] = !aOptions.DisplayViaFill;
m_sketchMode[ITEM_GAL_LAYER( TRACKS_VISIBLE )] = !aOptions.DisplayPcbTrackFill;
m_sketchMode[ITEM_GAL_LAYER( PADS_VISIBLE )] = !aOptions->m_DisplayPadFill;
m_sketchMode[ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE )] = !aOptions->m_DisplayViaFill;
m_sketchMode[ITEM_GAL_LAYER( VIA_BBLIND_VISIBLE )] = !aOptions->m_DisplayViaFill;
m_sketchMode[ITEM_GAL_LAYER( VIA_MICROVIA_VISIBLE )] = !aOptions->m_DisplayViaFill;
m_sketchMode[ITEM_GAL_LAYER( TRACKS_VISIBLE )] = !aOptions->m_DisplayPcbTrackFill;
switch( aOptions.DisplayNetNamesMode )
switch( aOptions->m_DisplayNetNamesMode )
{
case 0:
m_netNamesOnPads = false;
......@@ -133,7 +136,7 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const DISPLAY_OPTIONS& aOptions )
break;
}
switch( aOptions.DisplayZonesMode )
switch( aOptions->m_DisplayZonesMode )
{
case 0:
m_displayZoneMode = DZ_SHOW_FILLED;
......
......@@ -87,7 +87,7 @@ public:
* for vias/pads/tracks and so on).
* @param aOptions are settings that you want to use for displaying items.
*/
void LoadDisplayOptions( const DISPLAY_OPTIONS& aOptions );
void LoadDisplayOptions( const DISPLAY_OPTIONS* aOptions );
/// @copydoc RENDER_SETTINGS::GetColor()
virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const;
......
......@@ -370,15 +370,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// initialize parameters in m_LayersManager
LoadSettings( config() );
// Be sure options are updated
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
m_DisplayModEdge = DisplayOpt.DisplayModEdge;
m_DisplayModText = DisplayOpt.DisplayModText;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
......
......@@ -65,7 +65,6 @@ COLORS_DESIGN_SETTINGS g_ColorsSettings;
bool g_Drc_On = true;
bool g_AutoDeleteOldTrack = true;
bool g_Show_Module_Ratsnest;
bool g_Raccord_45_Auto = true;
bool g_Alternate_Track_Posture = false;
bool g_Track_45_Only_Allowed = true; // True to allow horiz, vert. and 45deg only tracks
......@@ -74,14 +73,11 @@ bool g_TwoSegmentTrackBuild = true;
LAYER_ID g_Route_Layer_TOP;
LAYER_ID g_Route_Layer_BOTTOM;
int g_MaxLinksShowed;
int g_MagneticPadOption = capture_cursor_in_track_tool;
int g_MagneticTrackOption = capture_cursor_in_track_tool;
wxPoint g_Offset_Module; // module offset used when moving a footprint
DISPLAY_OPTIONS DisplayOpt; // General display options
/* Name of the document footprint list
* usually located in share/modules/footprints_doc
* this is of the responsibility to users to create this file
......
......@@ -79,7 +79,6 @@ extern wxString g_DocModulesFileName;
// variables
extern bool g_Drc_On;
extern bool g_AutoDeleteOldTrack;
extern bool g_Show_Module_Ratsnest;
extern bool g_Raccord_45_Auto;
extern bool g_Track_45_Only_Allowed;
extern bool g_Alternate_Track_Posture;
......@@ -89,7 +88,6 @@ extern bool g_Segments_45_Only;
extern LAYER_ID g_Route_Layer_TOP;
extern LAYER_ID g_Route_Layer_BOTTOM;
extern int g_MaxLinksShowed; // Max count links showed in routing
extern bool g_TwoSegmentTrackBuild;
extern int g_MagneticPadOption;
......@@ -104,9 +102,6 @@ extern DLIST<TRACK> g_CurrentTrackList;
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
class DISPLAY_OPTIONS;
extern DISPLAY_OPTIONS DisplayOpt;
enum MagneticPadOptionValues {
no_effect,
capture_cursor_in_track_tool,
......
......@@ -322,6 +322,8 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
if( m_configSettings.empty() )
{
COLORS_DESIGN_SETTINGS cds; // constructor fills this with sensible colors
......@@ -331,35 +333,35 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
(int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ),
&DisplayOpt.DisplayPolarCood, false ) );
&displ_opts->m_DisplayPolarCood, false ) );
// Display options and modes:
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ViaHoleDisplayMode" ),
(int*) &DisplayOpt.m_DisplayViaMode,
(int*) &displ_opts->m_DisplayViaMode,
VIA_SPECIAL_HOLE_SHOW, VIA_HOLE_NOT_SHOW,
OPT_VIA_HOLE_END - 1 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ),
&DisplayOpt.DisplayNetNamesMode, 3, 0, 3 ) );
&displ_opts->m_DisplayNetNamesMode, 3, 0, 3 ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ),
&DisplayOpt.DisplayPcbTrackFill, true ) );
&displ_opts->m_DisplayPcbTrackFill, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ),
(int*) &DisplayOpt.ShowTrackClearanceMode,
(int*) &displ_opts->m_ShowTrackClearanceMode,
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ),
&DisplayOpt.DisplayPadFill, true ) );
&displ_opts->m_DisplayPadFill, true ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ),
&DisplayOpt.DisplayViaFill, true ) );
&displ_opts->m_DisplayViaFill, true ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ),
&DisplayOpt.DisplayPadIsol, true ) );
&displ_opts->m_DisplayPadIsol, true ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ),
&DisplayOpt.DisplayPadNum, true ) );
&displ_opts->m_DisplayPadNum, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffC" ),
&DisplayOpt.DisplayModEdge, FILLED, 0, 2 ) );
&displ_opts->m_DisplayModEdge, FILLED, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffT" ),
&DisplayOpt.DisplayModText, FILLED, 0, 2 ) );
&displ_opts->m_DisplayModText, FILLED, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbAffT" ),
&DisplayOpt.DisplayDrawItems, FILLED, 0, 2 ) );
&displ_opts->m_DisplayDrawItems, FILLED, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ),
&DisplayOpt.DisplayZonesMode, 0, 0, 2 ) );
&displ_opts->m_DisplayZonesMode, 0, 0, 2 ) );
// layer colors:
wxASSERT( DIM( cds.m_LayersColors ) == LAYER_ID_COUNT );
......@@ -406,10 +408,11 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
// Miscellaneous:
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &m_rotationAngle,
900, 1, 900 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), &g_MaxLinksShowed,
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ),
&displ_opts->m_MaxLinksShowed,
3, 0, 15 ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ShowMRa" ),
&g_Show_Module_Ratsnest, true ) );
&displ_opts->m_Show_Module_Ratsnest, true ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ),
&g_TwoSegmentTrackBuild, true ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" )
......
......@@ -52,6 +52,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
{
GR_DRAWMODE drawmode = GR_COPY;
int defaultPenSize = Millimeter2iu( 0.2 );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
DISPLAY_OPTIONS save_opt;
......@@ -61,25 +62,22 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
if( printParameters )
defaultPenSize = printParameters->m_PenDefaultSize;
save_opt = DisplayOpt;
save_opt = *displ_opts;
DisplayOpt.ContrastModeDisplay = false;
DisplayOpt.DisplayPadFill = true;
DisplayOpt.DisplayViaFill = true;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
displ_opts->m_ContrastModeDisplay = false;
displ_opts->m_DisplayPadFill = true;
displ_opts->m_DisplayViaFill = true;
displ_opts->m_DisplayPadNum = false;
bool nctmp = GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE);
GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false);
DisplayOpt.DisplayPadIsol = false;
DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = true;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0;
DisplayOpt.DisplayNetNamesMode = 0;
displ_opts->m_DisplayPadIsol = false;
displ_opts->m_DisplayModEdge = FILLED;
displ_opts->m_DisplayModText = FILLED;
displ_opts->m_DisplayPcbTrackFill = true;
displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
displ_opts->m_DisplayDrawItems = FILLED;
displ_opts->m_DisplayZonesMode = 0;
displ_opts->m_DisplayNetNamesMode = 0;
m_canvas->SetPrintMirrored( aPrintMirrorMode );
......@@ -109,11 +107,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_canvas->SetPrintMirrored( false );
DisplayOpt = save_opt;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
*displ_opts = save_opt;
GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
}
......@@ -130,6 +124,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
bool onePagePerLayer = false;
PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData; // can be null
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
if( printParameters && printParameters->m_OptionPrintPage == 0 )
onePagePerLayer = true;
......@@ -142,13 +137,13 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
defaultPenSize = printParameters->m_PenDefaultSize;
}
save_opt = DisplayOpt;
save_opt = *displ_opts;
LAYER_ID activeLayer = GetScreen()->m_Active_Layer;
DisplayOpt.ContrastModeDisplay = false;
DisplayOpt.DisplayPadFill = true;
DisplayOpt.DisplayViaFill = true;
displ_opts->m_ContrastModeDisplay = false;
displ_opts->m_DisplayPadFill = true;
displ_opts->m_DisplayViaFill = true;
if( !( aPrintMask & LSET::AllCuMask() ).any() )
{
......@@ -157,8 +152,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
// We can print mask layers (solder mask and solder paste) with the actual
// pad sizes. To do that, we must set ContrastModeDisplay to true and set
// the GetScreen()->m_Active_Layer to the current printed layer
DisplayOpt.ContrastModeDisplay = true;
DisplayOpt.DisplayPadFill = true;
displ_opts->m_ContrastModeDisplay = true;
displ_opts->m_DisplayPadFill = true;
// Calculate the active layer number to print from its mask layer:
GetScreen()->m_Active_Layer = B_Cu;
......@@ -176,18 +171,16 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
if( GetScreen()->m_Active_Layer == B_SilkS ||
GetScreen()->m_Active_Layer == F_SilkS )
{
DisplayOpt.DisplayPadFill = false;
displ_opts->m_DisplayPadFill = false;
}
}
else
{
DisplayOpt.DisplayPadFill = false;
displ_opts->m_DisplayPadFill = false;
}
}
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum = false;
displ_opts->m_DisplayPadNum = false;
bool nctmp = GetBoard()->IsElementVisible( NO_CONNECTS_VISIBLE );
......@@ -197,14 +190,14 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, false );
DisplayOpt.DisplayPadIsol = false;
m_DisplayModEdge = DisplayOpt.DisplayModEdge = FILLED;
m_DisplayModText = DisplayOpt.DisplayModText = FILLED;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = true;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0;
DisplayOpt.DisplayNetNamesMode = 0;
displ_opts->m_DisplayPadIsol = false;
displ_opts->m_DisplayModEdge = FILLED;
displ_opts->m_DisplayModText = FILLED;
displ_opts->m_DisplayPcbTrackFill = true;
displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
displ_opts->m_DisplayDrawItems = FILLED;
displ_opts->m_DisplayZonesMode = 0;
displ_opts->m_DisplayNetNamesMode = 0;
m_canvas->SetPrintMirrored( aPrintMirrorMode );
......@@ -331,14 +324,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
m_canvas->SetPrintMirrored( false );
DisplayOpt = save_opt;
*displ_opts = save_opt;
GetScreen()->m_Active_Layer = activeLayer;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
m_DisplayModEdge = DisplayOpt.DisplayModEdge;
m_DisplayModText = DisplayOpt.DisplayModText;
GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, anchorsTmp );
......
......@@ -917,10 +917,11 @@ void PCB_BASE_FRAME::TraceAirWiresToTargets( wxDC* aDC )
return;
GRSetDrawMode( aDC, GR_XOR );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
for( int ii = 0; ii < (int) s_TargetsLocations.size(); ii++ )
{
if( ii >= g_MaxLinksShowed )
if( ii >= displ_opts->m_MaxLinksShowed )
break;
GRLine( m_canvas->GetClipBox(), aDC, s_CursorPos, s_TargetsLocations[ii], 0, YELLOW );
......
......@@ -338,11 +338,14 @@ PNS_ITEM* ROUTER_TOOL::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLa
}
PNS_ITEM* rv = NULL;
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME> ();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions();
for( int i = 0; i < 4; i++ )
{
PNS_ITEM* item = prioritized[i];
if( DisplayOpt.ContrastModeDisplay )
if( displ_opts->m_ContrastModeDisplay )
if( item && !item->Layers().Overlaps( tl ) )
item = NULL;
......
......@@ -38,12 +38,6 @@
#include <pcbnew_id.h>
#include <hotkeys.h>
#ifdef __UNIX__
#define LISTBOX_WIDTH 140
#else
#define LISTBOX_WIDTH 120
#endif
void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
{
......@@ -240,6 +234,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
KiBitmap( show_mod_edge_xpm ),
_( "Show Edges Sketch" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
KiBitmap( contrast_mode_xpm ),
_( "Enable high contrast display mode" ),
wxITEM_CHECK );
m_optionsToolBar->Realize();
}
......@@ -261,9 +260,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_gridSelectBox = new wxComboBox( m_auxiliaryToolBar,
ID_ON_GRID_SELECT,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
// Update tool bar to reflect setting.
updateGridSelectBox();
m_auxiliaryToolBar->AddControl( m_gridSelectBox );
// Zoom selection choice box.
......@@ -271,14 +271,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_zoomSelectBox = new wxComboBox( m_auxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxEmptyString,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ),
wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY );
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
// Update tool bar to reflect setting.
updateGridSelectBox();
updateZoomSelectBox();
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_auxiliaryToolBar->Realize();
......
......@@ -117,11 +117,12 @@ void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent )
{
int selected = aEvent.GetId() - ID_TB_OPTIONS_SHOW_ZONES;
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
if( aEvent.IsChecked() && ( DisplayOpt.DisplayZonesMode == selected ) )
if( aEvent.IsChecked() && ( displ_opts->m_DisplayZonesMode == selected ) )
return;
aEvent.Check( DisplayOpt.DisplayZonesMode == selected );
aEvent.Check( displ_opts->m_DisplayZonesMode == selected );
}
......@@ -147,9 +148,10 @@ void PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent )
{
aEvent.Check( g_Show_Module_Ratsnest );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( displ_opts->m_Show_Module_Ratsnest );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest ?
displ_opts->m_Show_Module_Ratsnest ?
_( "Hide footprint ratsnest" ) :
_( "Show footprint ratsnest" ) );
}
......@@ -167,9 +169,10 @@ void PCB_EDIT_FRAME::OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayViaFill );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayViaFill );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
m_DisplayViaFill ?
displ_opts->m_DisplayViaFill ?
_( "Show vias in outline mode" ) :
_( "Show vias in fill mode" ) );
}
......@@ -177,9 +180,10 @@ void PCB_EDIT_FRAME::OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayPcbTrackFill );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayPcbTrackFill );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
m_DisplayPcbTrackFill ?
displ_opts->m_DisplayPcbTrackFill ?
_( "Show tracks in outline mode" ) :
_( "Show tracks in fill mode" ) );
}
......@@ -187,9 +191,10 @@ void PCB_EDIT_FRAME::OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( DisplayOpt.ContrastModeDisplay );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( displ_opts->m_ContrastModeDisplay );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ?
displ_opts->m_ContrastModeDisplay ?
_( "Normal contrast display mode" ) :
_( "High contrast display mode" ) );
}
......
......@@ -148,9 +148,9 @@ int PCBNEW_CONTROL::TrackDisplayMode( TOOL_EVENT& aEvent )
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
// Apply new display options to the GAL canvas
DisplayOpt.DisplayPcbTrackFill = !DisplayOpt.DisplayPcbTrackFill;
m_frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
settings->LoadDisplayOptions( DisplayOpt );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
settings->LoadDisplayOptions( displ_opts );
for( TRACK* track = getModel<BOARD>()->m_Track; track; track = track->Next() )
{
......@@ -171,11 +171,11 @@ int PCBNEW_CONTROL::PadDisplayMode( TOOL_EVENT& aEvent )
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
// Apply new display options to the GAL canvas
DisplayOpt.DisplayPadFill = !DisplayOpt.DisplayPadFill;
m_frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
settings->LoadDisplayOptions( DisplayOpt );
displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
settings->LoadDisplayOptions( displ_opts );
for( MODULE* module = getModel<BOARD>()->m_Modules; module; module = module->Next() )
{
......@@ -196,11 +196,11 @@ int PCBNEW_CONTROL::ViaDisplayMode( TOOL_EVENT& aEvent )
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
// Apply new display options to the GAL canvas
DisplayOpt.DisplayViaFill = !DisplayOpt.DisplayViaFill;
m_frame->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
settings->LoadDisplayOptions( DisplayOpt );
displ_opts->m_DisplayViaFill = !displ_opts->m_DisplayViaFill;
settings->LoadDisplayOptions( displ_opts );
for( TRACK* track = getModel<BOARD>()->m_Track; track; track = track->Next() )
{
......@@ -221,18 +221,19 @@ int PCBNEW_CONTROL::ZoneDisplayMode( TOOL_EVENT& aEvent )
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
// Apply new display options to the GAL canvas
if( aEvent.IsAction( &COMMON_ACTIONS::zoneDisplayEnable ) )
DisplayOpt.DisplayZonesMode = 0;
displ_opts->m_DisplayZonesMode = 0;
else if( aEvent.IsAction( &COMMON_ACTIONS::zoneDisplayDisable ) )
DisplayOpt.DisplayZonesMode = 1;
displ_opts->m_DisplayZonesMode = 1;
else if( aEvent.IsAction( &COMMON_ACTIONS::zoneDisplayOutlines ) )
DisplayOpt.DisplayZonesMode = 2;
displ_opts->m_DisplayZonesMode = 2;
else
assert( false );
settings->LoadDisplayOptions( DisplayOpt );
settings->LoadDisplayOptions( displ_opts );
BOARD* board = getModel<BOARD>();
for( int i = 0; i < board->GetAreaCount(); ++i )
......@@ -251,9 +252,10 @@ int PCBNEW_CONTROL::HighContrastMode( TOOL_EVENT& aEvent )
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
DisplayOpt.ContrastModeDisplay = !DisplayOpt.ContrastModeDisplay;
settings->LoadDisplayOptions( DisplayOpt );
displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay;
settings->LoadDisplayOptions( displ_opts );
m_frame->GetGalCanvas()->SetHighContrastLayer( m_frame->GetActiveLayer() );
setTransitions();
......
......@@ -71,9 +71,7 @@ void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
// Redraw the footprints
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{
module->Draw( m_canvas, DC, GR_OR );
}
module->Draw( m_canvas, DC, GR_OR | GR_ALLOW_HIGHCONTRAST );
#ifdef USE_WX_OVERLAY
......@@ -297,11 +295,11 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode )
static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule,
int ox, int oy, LSET aLayerMask, GR_DRAWMODE draw_mode )
{
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
int tmp = frame->m_DisplayPadFill;
int tmp = displ_opts->m_DisplayPadFill;
frame->m_DisplayPadFill = false;
displ_opts->m_DisplayPadFill = false;
// Draw pads.
for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() )
......@@ -312,5 +310,5 @@ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule,
pad->Draw( panel, DC, draw_mode, wxPoint( ox, oy ) );
}
frame->m_DisplayPadFill = tmp;
displ_opts->m_DisplayPadFill = tmp;
}
......@@ -169,7 +169,7 @@ indent_case_shift = 0 # number
# Spaces to indent '{' from 'case'.
# By default, the brace will appear under the 'c' in case.
# Usually set to 0 or indent_columns.
indent_case_brace = 4 # number
indent_case_brace = 0 # number
# Whether to indent comments found in first column
indent_col1_comment = false # false/true
......
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