Commit 7c99a242 authored by jean-pierre charras's avatar jean-pierre charras

Remove 2 global variables: g_DrawBgColor and g_ShowPageLimits.

They are now member of EDA_DRAW_FRAME.
This change could fix Bug #1330781 (Background color change in Eeschema affects background color in Pcbnew)
Show page limits has meaning only for the schematic editor,  the board editor and the page layout editor.
Draw background color selection exists only in eeschema and  page layout editor.
In pcbnew, only a black background is allowed.
A side effect is now the user should set the background color in schematic editor, and the library editor (2 different options).
The default is still the white color.
parent 94d78047
...@@ -117,6 +117,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, ...@@ -117,6 +117,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_LastGridSizeId = 0; m_LastGridSizeId = 0;
m_DrawGrid = true; // hide/Show grid. default = show m_DrawGrid = true; // hide/Show grid. default = show
m_GridColor = DARKGRAY; // Grid color m_GridColor = DARKGRAY; // Grid color
m_showPageLimits = false;
m_drawBgColor = BLACK; // the background color of the draw canvas:
// BLACK for Pcbnew, BLACK or WHITeEfor eeschema
m_snapToGrid = true; m_snapToGrid = true;
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
m_movingCursorWithKeyboard = false; m_movingCursorWithKeyboard = false;
......
...@@ -103,7 +103,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -103,7 +103,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_scrollIncrementX = std::min( size.x / 8, 10 ); m_scrollIncrementX = std::min( size.x / 8, 10 );
m_scrollIncrementY = std::min( size.y / 8, 10 ); m_scrollIncrementY = std::min( size.y / 8, 10 );
SetBackgroundColour( MakeColour( g_DrawBgColor ) ); SetBackgroundColour( MakeColour( parent->GetDrawBgColor() ) );
#if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC #if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC
SetBackgroundStyle( wxBG_STYLE_CUSTOM ); SetBackgroundStyle( wxBG_STYLE_CUSTOM );
...@@ -528,9 +528,11 @@ void EDA_DRAW_PANEL::EraseScreen( wxDC* DC ) ...@@ -528,9 +528,11 @@ void EDA_DRAW_PANEL::EraseScreen( wxDC* DC )
{ {
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
EDA_COLOR_T bgColor = GetParent()->GetDrawBgColor();
GRSFilledRect( NULL, DC, m_ClipBox.GetX(), m_ClipBox.GetY(), GRSFilledRect( NULL, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
m_ClipBox.GetRight(), m_ClipBox.GetBottom(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
0, g_DrawBgColor, g_DrawBgColor ); 0, bgColor, bgColor );
// Set to one (1) to draw bounding box validate bounding box calculation. // Set to one (1) to draw bounding box validate bounding box calculation.
#if DEBUG_SHOW_CLIP_RECT #if DEBUG_SHOW_CLIP_RECT
...@@ -583,10 +585,12 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg ) ...@@ -583,10 +585,12 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
if( Screen == NULL ) if( Screen == NULL )
return; return;
if( ( g_DrawBgColor != WHITE ) && ( g_DrawBgColor != BLACK ) ) EDA_COLOR_T bgColor = GetParent()->GetDrawBgColor();
g_DrawBgColor = BLACK;
if( ( bgColor != WHITE ) && ( bgColor != BLACK ) )
bgColor = BLACK;
if( g_DrawBgColor == WHITE ) if( bgColor == WHITE )
{ {
g_XorMode = GR_NXOR; g_XorMode = GR_NXOR;
g_GhostColor = BLACK; g_GhostColor = BLACK;
...@@ -599,7 +603,7 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg ) ...@@ -599,7 +603,7 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
GRResetPenAndBrush( DC ); GRResetPenAndBrush( DC );
DC->SetBackground( g_DrawBgColor == BLACK ? *wxBLACK_BRUSH : *wxWHITE_BRUSH ); DC->SetBackground( bgColor == BLACK ? *wxBLACK_BRUSH : *wxWHITE_BRUSH );
DC->SetBackgroundMode( wxSOLID ); DC->SetBackgroundMode( wxSOLID );
if( erasebg ) if( erasebg )
......
...@@ -31,12 +31,6 @@ ...@@ -31,12 +31,6 @@
#include <pgm_base.h> #include <pgm_base.h>
#include <common.h> #include <common.h>
#include <gr_basic.h>
static const wxChar showPageLimitsKey[] = wxT( "ShowPageLimits" );
static const wxChar backgroundColorKey[] = wxT( "BackgroundColor" );
/// Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings. /// Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.
/// A non-member function so it an be moved easily, plus it's nobody's business. /// A non-member function so it an be moved easily, plus it's nobody's business.
...@@ -97,24 +91,7 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId ) ...@@ -97,24 +91,7 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
bool KIFACE_I::start_common( int aCtlBits ) bool KIFACE_I::start_common( int aCtlBits )
{ {
m_start_flags = aCtlBits; m_start_flags = aCtlBits;
m_bm.Init(); m_bm.Init();
m_bm.m_config->Read( showPageLimitsKey, &g_ShowPageLimits );
// FIXME OSX Mountain Lion (10.8)
// Seems that Read doesn't found anything and ColorFromInt
// Asserts - I'm unable to reproduce on 10.7
int draw_bg_color = BLACK; // Default for all apps but Eeschema
if( m_id == KIWAY::FACE_SCH )
draw_bg_color = WHITE; // Default for Eeschema
m_bm.m_config->Read( backgroundColorKey, &draw_bg_color );
g_DrawBgColor = ColorFromInt( draw_bg_color );
setSearchPaths( &m_bm.m_search, m_id ); setSearchPaths( &m_bm.m_search, m_id );
return true; return true;
...@@ -123,14 +100,6 @@ bool KIFACE_I::start_common( int aCtlBits ) ...@@ -123,14 +100,6 @@ bool KIFACE_I::start_common( int aCtlBits )
void KIFACE_I::end_common() void KIFACE_I::end_common()
{ {
if( m_bm.m_config )
{
// Save common preferences; the background still uses the old legacy
// color numbers, not the new names
m_bm.m_config->Write( showPageLimitsKey, g_ShowPageLimits );
m_bm.m_config->Write( backgroundColorKey, int( g_DrawBgColor ) );
}
m_bm.End(); m_bm.End();
} }
...@@ -83,12 +83,12 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi ...@@ -83,12 +83,12 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi
wxSize pageSize = pageInfo.GetSizeMils(); wxSize pageSize = pageInfo.GetSizeMils();
// if not printing, draw the page limits: // if not printing, draw the page limits:
if( !aScreen->m_IsPrinting && g_ShowPageLimits ) if( !aScreen->m_IsPrinting && m_showPageLimits )
{ {
GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY );
GRRect( m_canvas->GetClipBox(), aDC, 0, 0, GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth, pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY ); m_drawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
} }
TITLE_BLOCK t_block = GetTitleBlock(); TITLE_BLOCK t_block = GetTitleBlock();
......
...@@ -294,8 +294,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) ...@@ -294,8 +294,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// SetFootprintLibTablePath(); // SetFootprintLibTablePath();
*/ */
g_DrawBgColor = BLACK;
try try
{ {
// The global table is not related to a specific project. All projects // The global table is not related to a specific project. All projects
......
...@@ -232,7 +232,7 @@ void DIALOG_COLOR_CONFIG::CreateControls() ...@@ -232,7 +232,7 @@ void DIALOG_COLOR_CONFIG::CreateControls()
m_SelBgColor = new wxRadioBox( this, wxID_ANY, _( "Background Color" ), m_SelBgColor = new wxRadioBox( this, wxID_ANY, _( "Background Color" ),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
m_SelBgColorStrings, 1, wxRA_SPECIFY_COLS ); m_SelBgColorStrings, 1, wxRA_SPECIFY_COLS );
m_SelBgColor->SetSelection( ( g_DrawBgColor == BLACK ) ? 1 : 0 ); m_SelBgColor->SetSelection( ( m_parent->GetDrawBgColor() == BLACK ) ? 1 : 0 );
m_columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 ); m_columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 );
// Provide a line to separate all of the controls added so far from the // Provide a line to separate all of the controls added so far from the
...@@ -318,9 +318,9 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() ...@@ -318,9 +318,9 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
{ {
// Update color of background // Update color of background
if( m_SelBgColor->GetSelection() == 0 ) if( m_SelBgColor->GetSelection() == 0 )
g_DrawBgColor = WHITE; m_parent->SetDrawBgColor( WHITE );
else else
g_DrawBgColor = BLACK; m_parent->SetDrawBgColor( BLACK );
bool warning = false; bool warning = false;
...@@ -328,13 +328,13 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() ...@@ -328,13 +328,13 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
{ {
SetLayerColor( currentColors[ ii ], ii ); SetLayerColor( currentColors[ ii ], ii );
if( g_DrawBgColor == GetLayerColor( ii ) ) if( m_parent->GetDrawBgColor() == GetLayerColor( ii ) )
warning = true; warning = true;
} }
m_parent->SetGridColor( GetLayerColor( LAYER_GRID ) ); m_parent->SetGridColor( GetLayerColor( LAYER_GRID ) );
if( g_DrawBgColor == GetLayerColor( LAYER_GRID ) ) if( m_parent->GetDrawBgColor() == GetLayerColor( LAYER_GRID ) )
warning = true; warning = true;
return warning; return warning;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <dialog_lib_edit_pin.h> #include <dialog_lib_edit_pin.h>
DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( EDA_DRAW_FRAME* parent, LIB_PIN* aPin ) :
DIALOG_LIB_EDIT_PIN_BASE( parent ) DIALOG_LIB_EDIT_PIN_BASE( parent )
{ {
// Creates a dummy pin to show on a panel, inside this dialog: // Creates a dummy pin to show on a panel, inside this dialog:
...@@ -20,7 +20,7 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : ...@@ -20,7 +20,7 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) :
m_dummyPin->SetParent( NULL ); m_dummyPin->SetParent( NULL );
m_dummyPin->ClearFlags(); m_dummyPin->ClearFlags();
m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); m_panelShowPin->SetBackgroundColour( MakeColour( parent->GetDrawBgColor() ) );
// Set tab order // Set tab order
m_textPadName->MoveAfterInTabOrder(m_textPinName); m_textPadName->MoveAfterInTabOrder(m_textPinName);
......
...@@ -17,7 +17,7 @@ class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE ...@@ -17,7 +17,7 @@ class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE
public: public:
/** Constructor */ /** Constructor */
DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ); DIALOG_LIB_EDIT_PIN( EDA_DRAW_FRAME* parent, LIB_PIN* aPin );
~DIALOG_LIB_EDIT_PIN(); ~DIALOG_LIB_EDIT_PIN();
void OnCloseDialog( wxCloseEvent& event ); void OnCloseDialog( wxCloseEvent& event );
......
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
m_Parent = aParent; m_Parent = aParent;
} }
SCH_EDIT_FRAME* GetSchFrameParent() { return m_Parent->GetParent(); }
bool OnPrintPage( int page ); bool OnPrintPage( int page );
bool HasPage( int page ); bool HasPage( int page );
bool OnBeginDocument( int startPage, int endPage ); bool OnBeginDocument( int startPage, int endPage );
...@@ -425,7 +425,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) ...@@ -425,7 +425,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
aScreen->m_IsPrinting = true; aScreen->m_IsPrinting = true;
EDA_COLOR_T bg_color = g_DrawBgColor; EDA_COLOR_T bg_color = GetSchFrameParent()->GetDrawBgColor();
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE ); aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
...@@ -433,7 +433,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) ...@@ -433,7 +433,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
parent->DrawWorkSheet( dc, aScreen, GetDefaultLineThickness(), parent->DrawWorkSheet( dc, aScreen, GetDefaultLineThickness(),
IU_PER_MILS, aScreen->GetFileName() ); IU_PER_MILS, aScreen->GetFileName() );
g_DrawBgColor = bg_color; GetSchFrameParent()->SetDrawBgColor( bg_color );
aScreen->m_IsPrinting = false; aScreen->m_IsPrinting = false;
panel->SetClipBox( oldClipBox ); panel->SetClipBox( oldClipBox );
......
...@@ -311,7 +311,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -311,7 +311,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() ); dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() );
dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() );
dlg.SetEnableHVBusOrientation( GetForceHVLines() ); dlg.SetEnableHVBusOrientation( GetForceHVLines() );
dlg.SetShowPageLimits( g_ShowPageLimits ); dlg.SetShowPageLimits( m_showPageLimits );
dlg.Layout(); dlg.Layout();
dlg.Fit(); dlg.Fit();
dlg.SetMinSize( dlg.GetSize() ); dlg.SetMinSize( dlg.GetSize() );
...@@ -357,7 +357,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -357,7 +357,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() ); m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() );
m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() ); m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() );
SetForceHVLines( dlg.GetEnableHVBusOrientation() ); SetForceHVLines( dlg.GetEnableHVBusOrientation() );
g_ShowPageLimits = dlg.GetShowPageLimits(); m_showPageLimits = dlg.GetShowPageLimits();
wxString templateFieldName; wxString templateFieldName;
...@@ -534,8 +534,14 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void ) ...@@ -534,8 +534,14 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
if( !m_configSettings.empty() ) if( !m_configSettings.empty() )
return m_configSettings; return m_configSettings;
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ShowPageLimits" ),
&m_showPageLimits, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*)&g_UserUnit, MILLIMETRES ) ); (int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "SchEditorBgColor" ),
&m_drawBgColor,
WHITE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorWireEx" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorWireEx" ),
&s_layerColor[LAYER_WIRE], &s_layerColor[LAYER_WIRE],
GREEN ) ); GREEN ) );
......
...@@ -295,6 +295,7 @@ const wxChar* LIB_EDIT_FRAME::GetLibEditFrameName() ...@@ -295,6 +295,7 @@ const wxChar* LIB_EDIT_FRAME::GetLibEditFrameName()
return LIB_EDIT_FRAME_NAME; return LIB_EDIT_FRAME_NAME;
} }
static const wxChar drawBgColorKey[] = wxT( "LibeditBgColor" );
void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
{ {
...@@ -312,6 +313,9 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) ...@@ -312,6 +313,9 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
wxConfigPathChanger cpc( aCfg, m_configPath ); wxConfigPathChanger cpc( aCfg, m_configPath );
EDA_COLOR_T itmp = ColorByName( aCfg->Read( drawBgColorKey, wxT("WHITE") ) );
SetDrawBgColor( itmp );
m_lastLibExportPath = aCfg->Read( lastLibExportPathEntry, ::wxGetCwd() ); m_lastLibExportPath = aCfg->Read( lastLibExportPathEntry, ::wxGetCwd() );
m_lastLibImportPath = aCfg->Read( lastLibImportPathEntry, ::wxGetCwd() ); m_lastLibImportPath = aCfg->Read( lastLibImportPathEntry, ::wxGetCwd() );
...@@ -335,6 +339,7 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) ...@@ -335,6 +339,7 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
wxConfigPathChanger cpc( aCfg, m_configPath ); wxConfigPathChanger cpc( aCfg, m_configPath );
aCfg->Write( drawBgColorKey, ColorGetName( GetDrawBgColor() ) );
aCfg->Write( lastLibExportPathEntry, m_lastLibExportPath ); aCfg->Write( lastLibExportPathEntry, m_lastLibExportPath );
aCfg->Write( lastLibImportPathEntry, m_lastLibImportPath ); aCfg->Write( lastLibImportPathEntry, m_lastLibImportPath );
} }
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <base_units.h> #include <base_units.h>
#include <kiway.h> #include <kiway.h>
SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
FRAME_T aWindowType, const wxString& aTitle, FRAME_T aWindowType, const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize, long aStyle, const wxPoint& aPosition, const wxSize& aSize, long aStyle,
...@@ -36,6 +35,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, ...@@ -36,6 +35,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition,
aSize, aStyle, aFrameName ) aSize, aStyle, aFrameName )
{ {
SetDrawBgColor( WHITE ); // the background color of the draw canvas, BLACK or WHITE
} }
......
...@@ -191,6 +191,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): ...@@ -191,6 +191,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_previewSize = wxDefaultSize; m_previewSize = wxDefaultSize;
m_printMonochrome = true; m_printMonochrome = true;
m_printSheetReference = true; m_printSheetReference = true;
SetShowPageLimits( true );
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
m_dlgFindReplace = NULL; m_dlgFindReplace = NULL;
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
......
...@@ -496,6 +496,11 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event ) ...@@ -496,6 +496,11 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
#define LIBLIST_WIDTH_KEY wxT( "ViewLiblistWidth" ) #define LIBLIST_WIDTH_KEY wxT( "ViewLiblistWidth" )
#define CMPLIST_WIDTH_KEY wxT( "ViewCmplistWidth" ) #define CMPLIST_WIDTH_KEY wxT( "ViewCmplistWidth" )
// Currently, the library viewer has no dialog to change the background color
// of the draw canvas. Therefore the background color is here just
// in case of this option is added to some library viewer config dialog
#define LIBVIEW_BGCOLOR wxT( "LibviewBgColor" )
void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
{ {
...@@ -503,6 +508,9 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) ...@@ -503,6 +508,9 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
wxConfigPathChanger cpc( aCfg, m_configPath ); wxConfigPathChanger cpc( aCfg, m_configPath );
EDA_COLOR_T itmp = ColorByName( aCfg->Read( LIBVIEW_BGCOLOR, wxT( "WHITE" ) ) );
SetDrawBgColor( itmp );
aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 100 ); aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 100 );
aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 100 ); aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 100 );
...@@ -529,6 +537,7 @@ void LIB_VIEW_FRAME::SaveSettings( wxConfigBase* aCfg ) ...@@ -529,6 +537,7 @@ void LIB_VIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
m_cmpListWidth = m_cmpList->GetSize().x; m_cmpListWidth = m_cmpList->GetSize().x;
aCfg->Write( CMPLIST_WIDTH_KEY, m_cmpListWidth ); aCfg->Write( CMPLIST_WIDTH_KEY, m_cmpListWidth );
aCfg->Write( LIBVIEW_BGCOLOR, ColorGetName( GetDrawBgColor() ) );
} }
......
...@@ -138,6 +138,8 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -138,6 +138,8 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset, bool aPrintBlackAndWhite ) const wxPoint& aOffset, bool aPrintBlackAndWhite )
{ {
GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent();
// Because Images can be negative (i.e with background filled in color) items are drawn // Because Images can be negative (i.e with background filled in color) items are drawn
// graphic layer per graphic layer, after the background is filled // graphic layer per graphic layer, after the background is filled
// to a temporary bitmap // to a temporary bitmap
...@@ -145,7 +147,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, ...@@ -145,7 +147,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
// If aDrawMode = UNSPECIFIED_DRAWMODE, items are drawn to the main screen, and therefore // If aDrawMode = UNSPECIFIED_DRAWMODE, items are drawn to the main screen, and therefore
// artifacts can happen with negative items or negative images // artifacts can happen with negative items or negative images
wxColour bgColor = MakeColour( g_DrawBgColor ); wxColour bgColor = MakeColour( gerbFrame->GetDrawBgColor() );
#if wxCHECK_VERSION( 3, 0, 0 ) #if wxCHECK_VERSION( 3, 0, 0 )
wxBrush bgBrush( bgColor, wxBRUSHSTYLE_SOLID ); wxBrush bgBrush( bgColor, wxBRUSHSTYLE_SOLID );
...@@ -153,8 +155,6 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, ...@@ -153,8 +155,6 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
wxBrush bgBrush( bgColor, wxSOLID ); wxBrush bgBrush( bgColor, wxSOLID );
#endif #endif
GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent();
int bitmapWidth, bitmapHeight; int bitmapWidth, bitmapHeight;
wxDC* plotDC = aDC; wxDC* plotDC = aDC;
...@@ -236,7 +236,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, ...@@ -236,7 +236,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
// Force black and white draw mode on request: // Force black and white draw mode on request:
if( aPrintBlackAndWhite ) if( aPrintBlackAndWhite )
gerbFrame->SetLayerColor( layer, g_DrawBgColor == BLACK ? WHITE : BLACK ); gerbFrame->SetLayerColor( layer, gerbFrame->GetDrawBgColor() == BLACK ? WHITE : BLACK );
if( useBufferBitmap ) if( useBufferBitmap )
{ {
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
// Colors for layers and items // Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings; COLORS_DESIGN_SETTINGS g_ColorsSettings;
extern EDA_COLOR_T g_DrawBgColor;
int g_Default_GERBER_Format; int g_Default_GERBER_Format;
...@@ -146,8 +145,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) ...@@ -146,8 +145,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
// display the real hotkeys in menus or tool tips // display the real hotkeys in menus or tool tips
ReadHotkeyConfig( wxT("GerberFrame"), s_Gerbview_Hokeys_Descr ); ReadHotkeyConfig( wxT("GerberFrame"), s_Gerbview_Hokeys_Descr );
g_DrawBgColor = BLACK;
return true; return true;
} }
......
...@@ -656,7 +656,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const ...@@ -656,7 +656,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const
if( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ) if( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) )
return GetVisibleElementColor( NEGATIVE_OBJECTS_VISIBLE ); return GetVisibleElementColor( NEGATIVE_OBJECTS_VISIBLE );
else else
return g_DrawBgColor; return GetDrawBgColor();
} }
......
...@@ -385,8 +385,6 @@ private: ...@@ -385,8 +385,6 @@ private:
void setMargins(); void setMargins();
}; };
extern bool g_ShowPageLimits; ///< true to display the page limits
extern EDA_UNITS_T g_UserUnit; ///< display units extern EDA_UNITS_T g_UserUnit; ///< display units
/// Draw color for moving objects. /// Draw color for moving objects.
......
...@@ -56,7 +56,10 @@ protected: ...@@ -56,7 +56,10 @@ protected:
// 0 is for the grid corresponding to // 0 is for the grid corresponding to
// a wxCommand ID = ID_POPUP_GRID_LEVEL_1000. // a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
bool m_DrawGrid; // hide/Show grid bool m_DrawGrid; // hide/Show grid
bool m_showPageLimits; ///< true to display the page limits
EDA_COLOR_T m_GridColor; // Grid color EDA_COLOR_T m_GridColor; // Grid color
EDA_COLOR_T m_drawBgColor; ///< the background color of the draw canvas
///< BLACK for Pcbnew, BLACK or WHITE for eeschema
/// The area to draw on. /// The area to draw on.
EDA_DRAW_PANEL* m_canvas; EDA_DRAW_PANEL* m_canvas;
...@@ -235,6 +238,10 @@ public: ...@@ -235,6 +238,10 @@ public:
virtual const TITLE_BLOCK& GetTitleBlock() const = 0; virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0; virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
// the background color of the draw canvas:
EDA_COLOR_T GetDrawBgColor() const { return m_drawBgColor; }
void SetDrawBgColor( EDA_COLOR_T aColor) { m_drawBgColor= aColor ; }
int GetCursorShape() const { return m_cursorShape; } int GetCursorShape() const { return m_cursorShape; }
void SetCursorShape( int aCursorShape ) { m_cursorShape = aCursorShape; } void SetCursorShape( int aCursorShape ) { m_cursorShape = aCursorShape; }
...@@ -242,6 +249,8 @@ public: ...@@ -242,6 +249,8 @@ public:
bool GetShowBorderAndTitleBlock() const { return m_showBorderAndTitleBlock; } bool GetShowBorderAndTitleBlock() const { return m_showBorderAndTitleBlock; }
void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; } void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
bool ShowPageLimits() const { return m_showPageLimits; }
void SetShowPageLimits( bool aShow ) { m_showPageLimits = aShow; }
EDA_DRAW_PANEL* GetCanvas() { return m_canvas; } EDA_DRAW_PANEL* GetCanvas() { return m_canvas; }
......
...@@ -88,7 +88,6 @@ typedef int wxPenStyle; ...@@ -88,7 +88,6 @@ typedef int wxPenStyle;
extern GR_DRAWMODE g_XorMode; extern GR_DRAWMODE g_XorMode;
extern EDA_COLOR_T g_DrawBgColor;
typedef enum { typedef enum {
......
...@@ -486,10 +486,11 @@ public: ...@@ -486,10 +486,11 @@ public:
} }
/** /**
* Function ScriptingToolbarPane * Function ScriptingConsolePane
* Change *this to a scripting toolbar for KiCad. * Change *this to a python scripting console pane for KiCad.
* Used in Pcbnew
*/ */
EDA_PANEINFO& ScriptingToolbarPane() EDA_PANEINFO& ScriptingConsolePane()
{ {
CloseButton( false ); CloseButton( false );
Floatable( true ); Floatable( true );
......
...@@ -186,13 +186,13 @@ void PLEDITOR_PRINTOUT::DrawPage( int aPageNum ) ...@@ -186,13 +186,13 @@ void PLEDITOR_PRINTOUT::DrawPage( int aPageNum )
GRForceBlackPen( true ); GRForceBlackPen( true );
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
EDA_COLOR_T bg_color = g_DrawBgColor; EDA_COLOR_T bg_color = m_parent->GetDrawBgColor();
g_DrawBgColor = WHITE; m_parent->SetDrawBgColor( WHITE );
screen->m_ScreenNumber = aPageNum; screen->m_ScreenNumber = aPageNum;
m_parent->DrawWorkSheet( dc, screen, 0, IU_PER_MILS, wxEmptyString ); m_parent->DrawWorkSheet( dc, screen, 0, IU_PER_MILS, wxEmptyString );
g_DrawBgColor = bg_color; m_parent->SetDrawBgColor( bg_color );
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->SetClipBox( oldClipBox ); panel->SetClipBox( oldClipBox );
......
...@@ -117,7 +117,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() ...@@ -117,7 +117,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
AddMenuItem( preferencesMenu, AddMenuItem( preferencesMenu,
ID_MENU_SWITCH_BGCOLOR, ID_MENU_SWITCH_BGCOLOR,
g_DrawBgColor == WHITE ? GetDrawBgColor() == WHITE ?
_( "&BackGround Black" ) : _( "&BackGround White" ), _( "&BackGround Black" ) : _( "&BackGround White" ),
wxEmptyString, KiBitmap( palette_xpm ) ); wxEmptyString, KiBitmap( palette_xpm ) );
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <confirm.h> #include <confirm.h>
#include <gestfich.h> #include <gestfich.h>
...@@ -41,8 +40,6 @@ ...@@ -41,8 +40,6 @@
#include <wx/file.h> #include <wx/file.h>
#include <wx/snglinst.h> #include <wx/snglinst.h>
extern EDA_COLOR_T g_DrawBgColor;
namespace PGE { namespace PGE {
...@@ -128,8 +125,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) ...@@ -128,8 +125,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
ReadHotkeyConfig( wxT("PlEditorFrame"), s_PlEditor_Hokeys_Descr ); ReadHotkeyConfig( wxT("PlEditorFrame"), s_PlEditor_Hokeys_Descr );
g_UserUnit = MILLIMETRES; g_UserUnit = MILLIMETRES;
g_DrawBgColor = WHITE;
g_ShowPageLimits = true;
return true; return true;
} }
...@@ -156,8 +151,6 @@ bool MYFACE::OnKifaceStart( PGM_BASE* aProgram ) ...@@ -156,8 +151,6 @@ bool MYFACE::OnKifaceStart( PGM_BASE* aProgram )
} }
g_UserUnit = MILLIMETRES; g_UserUnit = MILLIMETRES;
g_DrawBgColor = WHITE;
g_ShowPageLimits = true;
// read current setup and reopen last directory if no filename to open in // read current setup and reopen last directory if no filename to open in
// command line // command line
......
...@@ -51,13 +51,13 @@ void PL_EDITOR_FRAME::Process_Config( wxCommandEvent& event ) ...@@ -51,13 +51,13 @@ void PL_EDITOR_FRAME::Process_Config( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_MENU_SWITCH_BGCOLOR: case ID_MENU_SWITCH_BGCOLOR:
if( g_DrawBgColor == WHITE ) if( GetDrawBgColor() == WHITE )
g_DrawBgColor = BLACK; SetDrawBgColor( BLACK );
else else
g_DrawBgColor = WHITE; SetDrawBgColor( WHITE );
GetMenuBar()->SetLabel( ID_MENU_SWITCH_BGCOLOR, GetMenuBar()->SetLabel( ID_MENU_SWITCH_BGCOLOR,
g_DrawBgColor == WHITE ? GetDrawBgColor() == WHITE ?
_( "&BackGround Black" ) : _( "&BackGround Black" ) :
_( "&BackGround White" ) ); _( "&BackGround White" ) );
m_canvas->Refresh(); m_canvas->Refresh();
......
...@@ -64,6 +64,8 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ...@@ -64,6 +64,8 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_showBorderAndTitleBlock = true; // true for reference drawings. m_showBorderAndTitleBlock = true; // true for reference drawings.
m_HotkeysZoomAndGridList = s_PlEditor_Hokeys_Descr; m_HotkeysZoomAndGridList = s_PlEditor_Hokeys_Descr;
m_originSelectChoice = 0; m_originSelectChoice = 0;
SetDrawBgColor( WHITE ); // default value, user option (WHITE/BLACK)
SetShowPageLimits( true );
m_designTreeWidth = 150; m_designTreeWidth = 150;
m_propertiesFrameWidth = 200; m_propertiesFrameWidth = 200;
...@@ -295,17 +297,21 @@ double PL_EDITOR_FRAME::BestZoom() ...@@ -295,17 +297,21 @@ double PL_EDITOR_FRAME::BestZoom()
return bestzoom; return bestzoom;
} }
#define DESIGN_TREE_WIDTH_KEY wxT("DesignTreeWidth") static const wxChar designTreeWidthKey[] = wxT("DesignTreeWidth");
#define PROPERTIES_FRAME_WIDTH_KEY wxT("PropertiesFrameWidth") static const wxChar propertiesFrameWidthKey[] = wxT("PropertiesFrameWidth");
#define CORNER_ORIGIN_CHOICE_KEY wxT("CornerOriginChoice") static const wxChar cornerOriginChoiceKey[] = wxT("CornerOriginChoice");
static const wxChar blackBgColorKey[] = wxT( "BlackBgColor" );
void PL_EDITOR_FRAME::LoadSettings( wxConfigBase* aCfg ) void PL_EDITOR_FRAME::LoadSettings( wxConfigBase* aCfg )
{ {
EDA_DRAW_FRAME::LoadSettings( aCfg ); EDA_DRAW_FRAME::LoadSettings( aCfg );
aCfg->Read( DESIGN_TREE_WIDTH_KEY, &m_designTreeWidth, 100); aCfg->Read( designTreeWidthKey, &m_designTreeWidth, 100);
aCfg->Read( PROPERTIES_FRAME_WIDTH_KEY, &m_propertiesFrameWidth, 150); aCfg->Read( propertiesFrameWidthKey, &m_propertiesFrameWidth, 150);
aCfg->Read( CORNER_ORIGIN_CHOICE_KEY, &m_originSelectChoice ); aCfg->Read( cornerOriginChoiceKey, &m_originSelectChoice );
bool tmp;
aCfg->Read( blackBgColorKey, &tmp, false );
SetDrawBgColor( tmp ? BLACK : WHITE );
} }
...@@ -316,9 +322,10 @@ void PL_EDITOR_FRAME::SaveSettings( wxConfigBase* aCfg ) ...@@ -316,9 +322,10 @@ void PL_EDITOR_FRAME::SaveSettings( wxConfigBase* aCfg )
m_designTreeWidth = m_treePagelayout->GetSize().x; m_designTreeWidth = m_treePagelayout->GetSize().x;
m_propertiesFrameWidth = m_propertiesPagelayout->GetSize().x; m_propertiesFrameWidth = m_propertiesPagelayout->GetSize().x;
aCfg->Write( DESIGN_TREE_WIDTH_KEY, m_designTreeWidth); aCfg->Write( designTreeWidthKey, m_designTreeWidth);
aCfg->Write( PROPERTIES_FRAME_WIDTH_KEY, m_propertiesFrameWidth); aCfg->Write( propertiesFrameWidthKey, m_propertiesFrameWidth);
aCfg->Write( CORNER_ORIGIN_CHOICE_KEY, m_originSelectChoice ); aCfg->Write( cornerOriginChoiceKey, m_originSelectChoice );
aCfg->Write( blackBgColorKey, GetDrawBgColor() == BLACK );
// was: wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() ); // was: wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
...@@ -517,7 +524,7 @@ void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg ) ...@@ -517,7 +524,7 @@ void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg )
WORKSHEET_DATAITEM* selecteditem = GetSelectedItem(); WORKSHEET_DATAITEM* selecteditem = GetSelectedItem();
// the color to draw selected items // the color to draw selected items
if( g_DrawBgColor == WHITE ) if( GetDrawBgColor() == WHITE )
WORKSHEET_DATAITEM::m_SelectedColor = DARKCYAN; WORKSHEET_DATAITEM::m_SelectedColor = DARKCYAN;
else else
WORKSHEET_DATAITEM::m_SelectedColor = YELLOW; WORKSHEET_DATAITEM::m_SelectedColor = YELLOW;
......
...@@ -416,7 +416,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) ...@@ -416,7 +416,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
{ {
blackpenstate = GetGRForceBlackPenState(); blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false ); GRForceBlackPen( false );
aDrawInfo.m_HoleColor = g_DrawBgColor; aDrawInfo.m_HoleColor = WHITE;
} }
if( aDrawInfo.m_DrawMode != GR_XOR ) if( aDrawInfo.m_DrawMode != GR_XOR )
......
...@@ -840,7 +840,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, ...@@ -840,7 +840,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
{ {
blackpenstate = GetGRForceBlackPenState(); blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false ); GRForceBlackPen( false );
color = g_DrawBgColor; color = WHITE;
} }
else else
{ {
......
///////////////////////////////////////////////////////////////////////////// /**
// Name: dialog_general_options.cpp * @file pcbnew/dialogs/dialog_general_options.cpp
// Author: jean-pierre Charras */
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* functions relatives to the dialog opened from the main menu : /* functions relatives to the dialog opened from the main menu :
Prefernces/display Preferences/display
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <confirm.h> #include <confirm.h>
...@@ -84,7 +109,7 @@ void DIALOG_DISPLAY_OPTIONS::init() ...@@ -84,7 +109,7 @@ void DIALOG_DISPLAY_OPTIONS::init()
else else
m_OptDisplayVias->SetSelection( 0 ); m_OptDisplayVias->SetSelection( 0 );
m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1 ); m_Show_Page_Limits->SetSelection( m_Parent->ShowPageLimits() ? 0 : 1 );
m_OptDisplayViaHole->SetSelection( DisplayOpt.m_DisplayViaMode ); m_OptDisplayViaHole->SetSelection( DisplayOpt.m_DisplayViaMode );
m_OptDisplayModTexts->SetSelection( DisplayOpt.DisplayModText ); m_OptDisplayModTexts->SetSelection( DisplayOpt.DisplayModText );
...@@ -108,9 +133,9 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event ) ...@@ -108,9 +133,9 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event )
void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event) void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
{ {
if ( m_Show_Page_Limits->GetSelection() == 0 ) if ( m_Show_Page_Limits->GetSelection() == 0 )
g_ShowPageLimits = true; m_Parent->SetShowPageLimits( true );
else else
g_ShowPageLimits = false; m_Parent->SetShowPageLimits( false );
if ( m_OptDisplayTracks->GetSelection() == 1 ) if ( m_OptDisplayTracks->GetSelection() == 1 )
DisplayOpt.DisplayPcbTrackFill = true; DisplayOpt.DisplayPcbTrackFill = true;
......
...@@ -436,8 +436,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) ...@@ -436,8 +436,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
SetFootprintLibTablePath(); SetFootprintLibTablePath();
*/ */
g_DrawBgColor = BLACK;
try try
{ {
// The global table is not related to a specific project. All projects // The global table is not related to a specific project. All projects
......
...@@ -240,25 +240,6 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) ...@@ -240,25 +240,6 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
// was: wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); // was: wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
Prj().ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_PCB, GetProjectFileParameters(), false ); Prj().ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP_PCB, GetProjectFileParameters(), false );
// Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate
// what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings
// have no control over what is visible (see PCB_EDIT_FRAME::GetProjectFileParameters())
// this is recklessly turning on things the user may not want to see.
#if 0
/* Reset the items visibility flag when loading a new configuration because it could
* create SERIOUS mistakes for the user if board items are not visible after loading
* a board. Grid and ratsnest can be left to their previous state.
*/
bool showGrid = IsElementVisible( GRID_VISIBLE );
bool showRats = IsElementVisible( RATSNEST_VISIBLE );
SetVisibleAlls();
SetElementVisibility( GRID_VISIBLE, showGrid );
SetElementVisibility( RATSNEST_VISIBLE, showRats );
#endif
Prj().ElemClear( PROJECT::ELEM_FPTBL ); // Force it to be reloaded on demand. Prj().ElemClear( PROJECT::ELEM_FPTBL ); // Force it to be reloaded on demand.
// Load the page layout decr file, from the filename stored in // Load the page layout decr file, from the filename stored in
...@@ -315,6 +296,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() ...@@ -315,6 +296,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
if( !m_configSettings.empty() ) if( !m_configSettings.empty() )
return m_configSettings; return m_configSettings;
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ShowPageLimits" ),
&m_showPageLimits, true ) );
// Units used in dialogs and toolbars // Units used in dialogs and toolbars
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*)&g_UserUnit, MILLIMETRES ) ); (int*)&g_UserUnit, MILLIMETRES ) );
......
...@@ -302,7 +302,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ...@@ -302,7 +302,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE ) if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
{ {
TRACK * track = Pcb->m_Track; TRACK * track = Pcb->m_Track;
EDA_COLOR_T color = g_DrawBgColor; EDA_COLOR_T color = GetDrawBgColor();
bool blackpenstate = GetGRForceBlackPenState(); bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false ); GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY ); GRSetDrawMode( aDC, GR_COPY );
......
...@@ -299,9 +299,9 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage() ...@@ -299,9 +299,9 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) ); panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
EDA_COLOR_T bg_color = g_DrawBgColor; EDA_COLOR_T bg_color = m_Parent->GetDrawBgColor();
// Print frame reference, if reqquested, before // Print frame reference, if requested, before
if( m_PrintParams.m_Print_Black_and_White ) if( m_PrintParams.m_Print_Black_and_White )
GRForceBlackPen( true ); GRForceBlackPen( true );
...@@ -351,7 +351,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage() ...@@ -351,7 +351,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
devLeft, devTop, devRight, devBottom ); devLeft, devTop, devRight, devBottom );
#endif #endif
g_DrawBgColor = WHITE; m_Parent->SetDrawBgColor( WHITE );
/* when printing in color mode, we use the graphic OR mode that gives the same look as /* when printing in color mode, we use the graphic OR mode that gives the same look as
* the screen but because the background is white when printing, we must use a trick: * the screen but because the background is white when printing, we must use a trick:
...@@ -380,7 +380,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage() ...@@ -380,7 +380,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror, m_Parent->PrintPage( dc, m_PrintParams.m_PrintMaskLayer, printMirror,
&m_PrintParams ); &m_PrintParams );
g_DrawBgColor = bg_color; m_Parent->SetDrawBgColor( bg_color );
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->SetClipBox( tmp ); panel->SetClipBox( tmp );
GRForceBlackPen( false ); GRForceBlackPen( false );
......
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