Commit 75d2dc73 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Hight contrast mode: commit last patch from Miguel Angel Ajo Pelayo,...

Pcbnew: Hight contrast mode: commit last patch from Miguel Angel Ajo Pelayo, which also  fixes an old bug.
All: prepare better compatibility with wxWidgets 2.9.4. Works fine with 2.8.x (I hope...)
parent 4a739403
...@@ -330,5 +330,5 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -330,5 +330,5 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
screen->m_BlockLocate.m_Command = BLOCK_IDLE; screen->m_BlockLocate.m_Command = BLOCK_IDLE;
Panel->GetParent()->DisplayToolMsg( wxEmptyString ); Panel->GetParent()->DisplayToolMsg( wxEmptyString );
Panel->SetCursor( Panel->GetCurrentCursor() ); Panel->SetCursor( (wxStockCursor) Panel->GetCurrentCursor() );
} }
...@@ -46,7 +46,7 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event ) ...@@ -46,7 +46,7 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD ) if( event.GetId() == ID_GEN_COPY_BLOCK_TO_CLIPBOARD )
{ {
if( GetScreen()->IsBlockActive() ) if( GetScreen()->IsBlockActive() )
m_canvas->SetCursor( wxCursor( m_canvas->GetDefaultCursor() ) ); m_canvas->SetCursor( wxCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ) );
m_canvas->EndMouseCapture(); m_canvas->EndMouseCapture();
} }
......
...@@ -399,7 +399,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -399,7 +399,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
m_canvas->CallEndMouseCapture( DC ); m_canvas->CallEndMouseCapture( DC );
m_canvas->SetCursor( m_canvas->GetDefaultCursor() ); m_canvas->SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
Window_Zoom( GetScreen()->m_BlockLocate ); Window_Zoom( GetScreen()->m_BlockLocate );
break; break;
......
...@@ -299,7 +299,7 @@ void NETLIST_DIALOG::InstallPageSpice() ...@@ -299,7 +299,7 @@ void NETLIST_DIALOG::InstallPageSpice()
page->m_LeftBoxSizer->Add( page->m_NetOption, 0, wxGROW | wxALL, 5 ); page->m_LeftBoxSizer->Add( page->m_NetOption, 0, wxGROW | wxALL, 5 );
page->m_LowBoxSizer->Add( new wxStaticText( page, -1, _( "Simulator command:" ) ), 0, page->m_LowBoxSizer->Add( new wxStaticText( page, -1, _( "Simulator command:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
page->m_CommandStringCtrl = new wxTextCtrl( page, -1, m_Parent->GetSimulatorCommand(), page->m_CommandStringCtrl = new wxTextCtrl( page, -1, m_Parent->GetSimulatorCommand(),
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
...@@ -374,7 +374,7 @@ void NETLIST_DIALOG::InstallCustomPages() ...@@ -374,7 +374,7 @@ void NETLIST_DIALOG::InstallCustomPages()
CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage, CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage,
-1, _( "Netlist command:" ) ), 0, -1, _( "Netlist command:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
CurrPage->m_CommandStringCtrl = new wxTextCtrl( CurrPage, -1, Command, CurrPage->m_CommandStringCtrl = new wxTextCtrl( CurrPage, -1, Command,
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
...@@ -387,7 +387,7 @@ void NETLIST_DIALOG::InstallCustomPages() ...@@ -387,7 +387,7 @@ void NETLIST_DIALOG::InstallCustomPages()
CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage, CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage,
-1, _( "Title:" ) ), 0, -1, _( "Title:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
CurrPage->m_TitleStringCtrl = new wxTextCtrl( CurrPage, -1, title, CurrPage->m_TitleStringCtrl = new wxTextCtrl( CurrPage, -1, title,
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
......
...@@ -437,7 +437,7 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent ) ...@@ -437,7 +437,7 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
if( screen->IsBlockActive() ) if( screen->IsBlockActive() )
{ {
m_canvas->SetCursor( wxCursor( m_canvas->GetDefaultCursor() ) ); m_canvas->SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
screen->ClearBlockCommand(); screen->ClearBlockCommand();
// Stop the current command (if any) but keep the current tool // Stop the current command (if any) but keep the current tool
......
...@@ -333,7 +333,7 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC ) ...@@ -333,7 +333,7 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
if( GetToolId() != ID_NO_TOOL_SELECTED ) if( GetToolId() != ID_NO_TOOL_SELECTED )
SetCursor( wxCURSOR_PENCIL ); SetCursor( wxCURSOR_PENCIL );
else else
SetCursor( m_canvas->GetDefaultCursor() ); SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
if( GetTempCopyComponent() ) // used when editing an existing item if( GetTempCopyComponent() ) // used when editing an existing item
SaveCopyInUndoList( GetTempCopyComponent() ); SaveCopyInUndoList( GetTempCopyComponent() );
......
...@@ -161,10 +161,10 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -161,10 +161,10 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_BoxSelectLayer[ii]->SetValue( true ); m_BoxSelectLayer[ii]->SetValue( true );
if( ii < 16 ) if( ii < 16 )
m_leftLayersBoxSizer->Add( m_BoxSelectLayer[ii], m_leftLayersBoxSizer->Add( m_BoxSelectLayer[ii],
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE ); wxGROW | wxLEFT | wxRIGHT | wxTOP );
else else
m_rightLayersBoxSizer->Add( m_BoxSelectLayer[ii], m_rightLayersBoxSizer->Add( m_BoxSelectLayer[ii],
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE ); wxGROW | wxLEFT | wxRIGHT | wxTOP );
} }
......
...@@ -140,7 +140,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -140,7 +140,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( GetToolId() == ID_NO_TOOL_SELECTED ) if( GetToolId() == ID_NO_TOOL_SELECTED )
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
else else
m_canvas->SetCursor( m_canvas->GetCurrentCursor() ); m_canvas->SetCursor( (wxStockCursor) m_canvas->GetCurrentCursor() );
break; break;
default: default:
......
...@@ -41,6 +41,7 @@ class EDA_RECT; ...@@ -41,6 +41,7 @@ class EDA_RECT;
#define GR_AND 0x04000000 #define GR_AND 0x04000000
#define GR_NXOR 0x08000000 #define GR_NXOR 0x08000000
#define GR_INVERT 0x10000000 #define GR_INVERT 0x10000000
#define GR_ALLOW_HIGHCONTRAST 0x20000000
#define GR_HIGHLIGHT 0x80000000 #define GR_HIGHLIGHT 0x80000000
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#if wxCHECK_VERSION( 2, 9, 0 )
#define wxXmlProperty wxXmlAttribute
#endif
/** /**
* Class XNODE * Class XNODE
...@@ -78,6 +81,7 @@ public: ...@@ -78,6 +81,7 @@ public:
*/ */
virtual void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR ); virtual void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR );
#if !wxCHECK_VERSION( 2, 9, 0 )
// The following functions did not appear in the base class until recently. // The following functions did not appear in the base class until recently.
// Overload them even if they are present in base class, just to make sure // Overload them even if they are present in base class, just to make sure
// they are present in any older base class implementation. // they are present in any older base class implementation.
...@@ -101,6 +105,7 @@ public: ...@@ -101,6 +105,7 @@ public:
} }
//-----</overloads>-------------------------------------------------------- //-----</overloads>--------------------------------------------------------
#endif
}; };
#endif // _XATTR_H_ #endif // _XATTR_H_
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <gr_basic.h> #include <gr_basic.h>
#include <bezier_curves.h> #include <bezier_curves.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <class_pcb_screen.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <colors_selection.h> #include <colors_selection.h>
#include <trigo.h> #include <trigo.h>
...@@ -189,6 +190,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx ...@@ -189,6 +190,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
int l_trace; int l_trace;
int color, mode; int color, mode;
int radius; int radius;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD * brd = GetBoard( ); BOARD * brd = GetBoard( );
...@@ -197,6 +199,16 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx ...@@ -197,6 +199,16 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
color = brd->GetLayerColor( GetLayer() ); color = brd->GetLayerColor( GetLayer() );
if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
{
color &= ~MASKCOLOR;
color |= DARKDARKGRAY;
}
}
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
l_trace = m_Width >> 1; /* half trace width */ l_trace = m_Width >> 1; /* half trace width */
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <wxstruct.h> #include <wxstruct.h>
#include <trigo.h> #include <trigo.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <class_pcb_screen.h>
#include <confirm.h> #include <confirm.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <colors_selection.h> #include <colors_selection.h>
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
#include <class_module.h> #include <class_module.h>
#include <class_edge_mod.h> #include <class_edge_mod.h>
#include <stdio.h>
EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) : EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) :
DRAWSEGMENT( parent, PCB_MODULE_EDGE_T ) DRAWSEGMENT( parent, PCB_MODULE_EDGE_T )
...@@ -97,12 +99,14 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx ...@@ -97,12 +99,14 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
int ux0, uy0, dx, dy, radius, StAngle, EndAngle; int ux0, uy0, dx, dy, radius, StAngle, EndAngle;
int color, type_trace; int color, type_trace;
int typeaff; int typeaff;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
PCB_BASE_FRAME* frame; PCB_BASE_FRAME* frame;
MODULE* module = (MODULE*) m_Parent; MODULE* module = (MODULE*) m_Parent;
if( module == NULL ) if( module == NULL )
return; return;
BOARD * brd = GetBoard( ); BOARD * brd = GetBoard( );
if( brd->IsLayerVisible( m_Layer ) == false ) if( brd->IsLayerVisible( m_Layer ) == false )
...@@ -110,6 +114,16 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx ...@@ -110,6 +114,16 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
color = brd->GetLayerColor( m_Layer ); color = brd->GetLayerColor( m_Layer );
if(( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
{
color &= ~MASKCOLOR;
color |= DARKDARKGRAY;
}
}
frame = (PCB_BASE_FRAME*) panel->GetParent(); frame = (PCB_BASE_FRAME*) panel->GetParent();
type_trace = m_Shape; type_trace = m_Shape;
......
...@@ -234,7 +234,9 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi ...@@ -234,7 +234,9 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
} }
// if PAD_SMD pad and high contrast mode // if PAD_SMD pad and high contrast mode
if( ( GetAttribute() == PAD_SMD || GetAttribute() == PAD_CONN ) && DisplayOpt.ContrastModeDisplay ) if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
( GetAttribute() == PAD_SMD || GetAttribute() == PAD_CONN ) &&
DisplayOpt.ContrastModeDisplay )
{ {
// when routing tracks // when routing tracks
if( frame && frame->GetToolId() == ID_TRACK_BUTT ) if( frame && frame->GetToolId() == ID_TRACK_BUTT )
...@@ -301,7 +303,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi ...@@ -301,7 +303,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
// if Contrast mode is ON and a technical layer active, show pads on this // if Contrast mode is ON and a technical layer active, show pads on this
// layer so we can see pads on paste or solder layer and the size of the // layer so we can see pads on paste or solder layer and the size of the
// mask // mask
if( DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer > LAST_COPPER_LAYER ) if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer > LAST_COPPER_LAYER )
{ {
if( IsOnLayer( screen->m_Active_Layer ) ) if( IsOnLayer( screen->m_Active_Layer ) )
{ {
...@@ -373,7 +376,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi ...@@ -373,7 +376,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
// Display net names is restricted to pads that are on the active layer // Display net names is restricted to pads that are on the active layer
// in hight contrast mode display // in hight contrast mode display
if( !IsOnLayer( screen->m_Active_Layer ) && DisplayOpt.ContrastModeDisplay ) if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) &&
!IsOnLayer( screen->m_Active_Layer ) && DisplayOpt.ContrastModeDisplay )
drawInfo.m_Display_netname = false; drawInfo.m_Display_netname = false;
DrawShape( aPanel->GetClipBox(), aDC, drawInfo ); DrawShape( aPanel->GetClipBox(), aDC, drawInfo );
......
...@@ -604,7 +604,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint& ...@@ -604,7 +604,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
return; return;
#endif #endif
if( DisplayOpt.ContrastModeDisplay ) if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{ {
if( !IsOnLayer( curr_layer ) ) if( !IsOnLayer( curr_layer ) )
{ {
......
...@@ -160,7 +160,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -160,7 +160,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( GetToolId() == ID_NO_TOOL_SELECTED ) if( GetToolId() == ID_NO_TOOL_SELECTED )
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString ); SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
else else
SetCursor( m_canvas->GetDefaultCursor() ); SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
break; break;
......
...@@ -240,8 +240,7 @@ void WinEDA_PcbFindFrame::CreateControls() ...@@ -240,8 +240,7 @@ void WinEDA_PcbFindFrame::CreateControls()
0 ); 0 );
itemBoxSizer2->Add( itemStaticText3, itemBoxSizer2->Add( itemStaticText3,
0, 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
5 );
m_NewText = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), m_NewText = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
wxDefaultPosition, wxDefaultSize, 0 ); wxDefaultPosition, wxDefaultSize, 0 );
......
...@@ -109,7 +109,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -109,7 +109,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness ); TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness );
GetBoard()->Draw( m_canvas, DC, GR_OR ); GetBoard()->Draw( m_canvas, DC, GR_OR | GR_ALLOW_HIGHCONTRAST);
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
......
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