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...)
This commit is contained in:
jean-pierre charras 2012-02-28 21:14:17 +01:00
parent 4a7394038f
commit 75d2dc7311
17 changed files with 54 additions and 19 deletions

View File

@ -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() );
} }

View File

@ -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();
} }

View File

@ -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;

View File

@ -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()
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()
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 );

View File

@ -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

View File

@ -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() );

View File

@ -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 );
} }

View File

@ -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:

View File

@ -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

View File

@ -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:
*/ */
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:
} }
//-----</overloads>-------------------------------------------------------- //-----</overloads>--------------------------------------------------------
#endif
}; };
#endif // _XATTR_H_ #endif // _XATTR_H_

View File

@ -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
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
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 */

View File

@ -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 @@
#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
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
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;

View File

@ -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
// 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
// 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 );

View File

@ -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 ) )
{ {

View File

@ -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;

View File

@ -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 );

View File

@ -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 );