From 9bcdef85cde37db85baeea673bb73aa07e7daed6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 26 Sep 2014 12:35:11 +0200 Subject: [PATCH] Eeschema: canvas background color: all frame are now using the same parameter. fix recent bug which prevent eeschema to save color preferences. fix few other minor issues. --- common/draw_frame.cpp | 4 +- cvpcb/class_DisplayFootprintsFrame.cpp | 4 +- eeschema/dialogs/dialog_choose_component.cpp | 6 ++- eeschema/dialogs/dialog_choose_component.h | 16 ++++---- eeschema/dialogs/dialog_color_config.cpp | 31 ++++++++------- eeschema/eeschema.cpp | 21 +++++----- eeschema/eeschema_config.cpp | 40 +++++++++++++------- eeschema/general.h | 20 ++++++---- eeschema/sch_base_frame.cpp | 13 ++++++- eeschema/sch_screen.cpp | 2 +- eeschema/viewlib_frame.cpp | 11 +++--- include/draw_frame.h | 24 ++++++++---- include/sch_base_frame.h | 5 +++ include/sch_item_struct.h | 10 ++--- 14 files changed, 130 insertions(+), 77 deletions(-) diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index ed84567e76..524fe39300 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -119,8 +119,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, m_showOriginAxis = false; // true to draw the grid origin m_cursorShape = 0; m_LastGridSizeId = 0; - m_DrawGrid = true; // hide/Show grid. default = show - m_GridColor = DARKGRAY; // Grid color + m_drawGrid = true; // hide/Show grid. default = show + m_gridColor = DARKGRAY; // Default grid color m_showPageLimits = false; m_drawBgColor = BLACK; // the background color of the draw canvas: // BLACK for Pcbnew, BLACK or WHITE for eeschema diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 660057f7a1..feb10e01a1 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -425,13 +425,13 @@ void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int ) bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible() const { - return m_DrawGrid; + return m_drawGrid; } void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible) { - m_DrawGrid = aVisible; + m_drawGrid = aVisible; } diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp index 383f7faee4..9352c94dde 100644 --- a/eeschema/dialogs/dialog_choose_component.cpp +++ b/eeschema/dialogs/dialog_choose_component.cpp @@ -35,7 +35,7 @@ static wxTreeItemId GetPrevItem( const wxTreeCtrl& tree, const wxTreeItemId& item ); static wxTreeItemId GetNextItem( const wxTreeCtrl& tree, const wxTreeItemId& item ); -DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( wxWindow* aParent, const wxString& aTitle, +DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, COMPONENT_TREE_SEARCH_CONTAINER* aContainer, int aDeMorganConvert ) : DIALOG_CHOOSE_COMPONENT_BASE( aParent, wxID_ANY, aTitle ), @@ -44,6 +44,7 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( wxWindow* aParent, const wxStr m_external_browser_requested( false ), m_received_doubleclick_in_tree( false ) { + m_parent = aParent; m_search_container->SetTree( m_libraryComponentTree ); m_searchBox->SetFocus(); m_componentDetails->SetEditable( false ); @@ -260,7 +261,8 @@ void DIALOG_CHOOSE_COMPONENT::OnHandlePreviewRepaint( wxPaintEvent& aRepaintEven void DIALOG_CHOOSE_COMPONENT::renderPreview( LIB_PART* aComponent, int aUnit ) { wxPaintDC dc( m_componentView ); - dc.SetBackground( *wxWHITE_BRUSH ); + EDA_COLOR_T bgcolor = m_parent->GetDrawBgColor(); + dc.SetBackground( bgcolor == BLACK ? *wxBLACK_BRUSH : *wxWHITE_BRUSH ); dc.Clear(); if( aComponent == NULL ) diff --git a/eeschema/dialogs/dialog_choose_component.h b/eeschema/dialogs/dialog_choose_component.h index b61b3a2815..2cd5af4f32 100644 --- a/eeschema/dialogs/dialog_choose_component.h +++ b/eeschema/dialogs/dialog_choose_component.h @@ -30,20 +30,27 @@ class COMPONENT_TREE_SEARCH_CONTAINER; class LIB_ALIAS; class LIB_PART; class wxTreeItemId; +class SCH_BASE_FRAME; class DIALOG_CHOOSE_COMPONENT : public DIALOG_CHOOSE_COMPONENT_BASE { + SCH_BASE_FRAME* m_parent; + COMPONENT_TREE_SEARCH_CONTAINER* const m_search_container; + const int m_deMorganConvert; + bool m_external_browser_requested; + bool m_received_doubleclick_in_tree; + public: /** * Create dialog to choose component. * - * @param aParent Parent window. + * @param aParent a SCH_BASE_FRAME parent window. * @param aTitle Dialog title. * @param aSearchContainer The tree selection search container. Needs to be pre-populated * This dialog does not take over ownership of this object. * @param aDeMorganConvert preferred deMorgan conversion (TODO: should happen in dialog) */ - DIALOG_CHOOSE_COMPONENT( wxWindow* aParent, const wxString& aTitle, + DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, COMPONENT_TREE_SEARCH_CONTAINER* aSearchContainer, int aDeMorganConvert ); virtual ~DIALOG_CHOOSE_COMPONENT(); @@ -80,11 +87,6 @@ private: bool updateSelection(); void selectIfValid( const wxTreeItemId& aTreeId ); void renderPreview( LIB_PART* aComponent, int aUnit ); - - COMPONENT_TREE_SEARCH_CONTAINER* const m_search_container; - const int m_deMorganConvert; - bool m_external_browser_requested; - bool m_received_doubleclick_in_tree; }; #endif /* DIALOG_CHOOSE_COMPONENT_H */ diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp index d256a6a7cd..9cf1b79b67 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -3,14 +3,12 @@ */ #include -#include #include #include #include #include -#include #define ID_COLOR_SETUP 1800 @@ -86,7 +84,7 @@ static BUTTONINDEX buttonGroups[] = { }; -static EDA_COLOR_T currentColors[ NB_SCH_LAYERS ]; +static EDA_COLOR_T currentColors[ LAYERSCH_ID_COUNT ]; IMPLEMENT_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG, wxDialog ) @@ -188,7 +186,7 @@ void DIALOG_COLOR_CONFIG::CreateControls() iconDC.SelectObject( bitmap ); - EDA_COLOR_T color = GetLayerColor( LayerNumber( buttons->m_Layer ) ); + EDA_COLOR_T color = GetLayerColor( LAYERSCH_ID( buttons->m_Layer ) ); currentColors[ buttons->m_Layer ] = color; iconDC.SetPen( *wxBLACK_PEN ); @@ -235,6 +233,9 @@ void DIALOG_COLOR_CONFIG::CreateControls() m_SelBgColor->SetSelection( ( m_parent->GetDrawBgColor() == BLACK ) ? 1 : 0 ); m_columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 ); + currentColors[ LAYER_BACKGROUND ] = m_parent->GetDrawBgColor(); + + // Provide a line to separate all of the controls added so far from the // "OK", "Cancel", and "Apply" buttons (which will be added after that // line). @@ -317,24 +318,27 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event ) bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() { // Update color of background - if( m_SelBgColor->GetSelection() == 0 ) - m_parent->SetDrawBgColor( WHITE ); - else - m_parent->SetDrawBgColor( BLACK ); + EDA_COLOR_T bgcolor = WHITE; + + if( m_SelBgColor->GetSelection() > 0 ) + bgcolor = BLACK; + + m_parent->SetDrawBgColor( bgcolor ); + currentColors[ LAYER_BACKGROUND ] = bgcolor; bool warning = false; - for( LayerNumber ii = LAYER_WIRE; ii < NB_SCH_LAYERS; ++ii ) + for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr ) { - SetLayerColor( currentColors[ ii ], ii ); + SetLayerColor( currentColors[ clyr ], clyr ); - if( m_parent->GetDrawBgColor() == GetLayerColor( ii ) ) + if( bgcolor == GetLayerColor( clyr ) && clyr != LAYER_BACKGROUND ) warning = true; } m_parent->SetGridColor( GetLayerColor( LAYER_GRID ) ); - if( m_parent->GetDrawBgColor() == GetLayerColor( LAYER_GRID ) ) + if( bgcolor == GetLayerColor( LAYER_GRID ) ) warning = true; return warning; @@ -348,7 +352,8 @@ void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& event ) // Prompt the user if an item has the same color as the background // because this item cannot be seen: if( warning ) - wxMessageBox( _("Warning:\nSome items have the same color as the background\nand they will not be seen on screen") ); + wxMessageBox( _("Warning:\nSome items have the same color as the background\n" + "and they will not be seen on screen") ); m_parent->GetCanvas()->Refresh(); diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index eb60af31e5..58f936fbae 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -70,7 +70,7 @@ static struct IFACE : public KIFACE_I bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ); - void OnKifaceEnd( PGM_BASE* aProgram ); + void OnKifaceEnd(); wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) { @@ -154,15 +154,15 @@ PGM_BASE& Pgm() } -static EDA_COLOR_T s_layerColor[NB_SCH_LAYERS]; +static EDA_COLOR_T s_layerColor[LAYERSCH_ID_COUNT]; -EDA_COLOR_T GetLayerColor( LayerNumber aLayer ) +EDA_COLOR_T GetLayerColor( LAYERSCH_ID aLayer ) { wxASSERT( unsigned( aLayer ) < DIM( s_layerColor ) ); return s_layerColor[aLayer]; } -void SetLayerColor( EDA_COLOR_T aColor, int aLayer ) +void SetLayerColor( EDA_COLOR_T aColor, LAYERSCH_ID aLayer ) { wxASSERT( unsigned( aLayer ) < DIM( s_layerColor ) ); s_layerColor[aLayer] = aColor; @@ -178,7 +178,8 @@ static PARAM_CFG_ARRAY& cfg_params() // These are KIFACE specific, they need to be loaded once when the // eeschema KIFACE comes in. -#define CLR(x, y, z) ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ), &s_layerColor[y], z )); +#define CLR(x, y, z)\ + ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ), &s_layerColor[y], z ) ); CLR( "ColorWireEx", LAYER_WIRE, GREEN ) CLR( "ColorBusEx", LAYER_BUS, BLUE ) @@ -204,6 +205,7 @@ static PARAM_CFG_ARRAY& cfg_params() CLR( "ColorErcWEx", LAYER_ERC_WARN, GREEN ) CLR( "ColorErcEEx", LAYER_ERC_ERR, RED ) CLR( "ColorGridEx", LAYER_GRID, DARKGRAY ) + CLR( "ColorBgCanvasEx", LAYER_BACKGROUND, WHITE ) } return ca; @@ -220,23 +222,24 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) // Give a default colour for all layers // (actual color will be initialized by config) - for( int ii = 0; ii < NB_SCH_LAYERS; ii++ ) + for( LAYERSCH_ID ii = LAYER_FIRST; ii < LAYERSCH_ID_COUNT; ++ii ) SetLayerColor( DARKGRAY, ii ); + SetLayerColor( WHITE, LAYER_BACKGROUND ); + // Must be called before creating the main frame in order to // display the real hotkeys in menus or tool tips ReadHotkeyConfig( wxT("SchematicFrame"), s_Eeschema_Hokeys_Descr ); - wxConfigLoadSetups( KifaceSettings(), cfg_params() ); + wxConfigLoadSetups( KifaceSettings(), cfg_params() ); return true; } -void IFACE::OnKifaceEnd( PGM_BASE* aProgram ) +void IFACE::OnKifaceEnd() { wxConfigSaveSetups( KifaceSettings(), cfg_params() ); - end_common(); } diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index ce35e57880..b7a1e395bb 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -307,6 +307,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) { wxArrayString units; GRIDS grid_list = GetScreen()->GetGrids(); + bool saveProjectConfig = false; DIALOG_EESCHEMA_OPTIONS dlg( this ); @@ -356,19 +357,33 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) int sep, firstId; dlg.GetRefIdSeparator( sep, firstId); + if( sep != (int)LIB_PART::GetSubpartIdSeparator() || firstId != (int)LIB_PART::GetSubpartFirstId() ) { LIB_PART::SetSubpartIdNotation( sep, firstId ); - SaveProjectSettings( true ); + saveProjectConfig = true; } SetDefaultBusThickness( dlg.GetBusWidth() ); SetDefaultLineThickness( dlg.GetLineWidth() ); - SetDefaultTextSize( dlg.GetTextSize() ); - g_RepeatStep.x = dlg.GetRepeatHorizontal(); - g_RepeatStep.y = dlg.GetRepeatVertical(); - g_RepeatDeltaLabel = dlg.GetRepeatLabel(); + + if( dlg.GetTextSize() != GetDefaultTextSize() ) + { + SetDefaultTextSize( dlg.GetTextSize() ); + saveProjectConfig = true; + } + + if( g_RepeatStep.x != dlg.GetRepeatHorizontal() || + g_RepeatStep.y != dlg.GetRepeatVertical() || + g_RepeatDeltaLabel != dlg.GetRepeatLabel() ) + { + g_RepeatStep.x = dlg.GetRepeatHorizontal(); + g_RepeatStep.y = dlg.GetRepeatVertical(); + g_RepeatDeltaLabel = dlg.GetRepeatLabel(); + saveProjectConfig = true; + } + SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 ); SetGridVisibility( dlg.GetShowGrid() ); m_showAllPins = dlg.GetShowHiddenPins(); @@ -402,6 +417,9 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) SaveSettings( config() ); // save values shared by eeschema applications. + if( saveProjectConfig ) + SaveProjectSettings( true ); + m_canvas->Refresh( true ); } @@ -534,7 +552,6 @@ static const wxChar SimulatorCommandEntry[] = wxT( "SimCmdLine" ); // Library editor wxConfig entry names. static const wxChar lastLibExportPathEntry[] = wxT( "LastLibraryExportPath" ); static const wxChar lastLibImportPathEntry[] = wxT( "LastLibraryImportPath" ); -static const wxChar libeditdrawBgColorEntry[] = wxT( "LibeditBgColor" ); static const wxChar defaultPinNumSizeEntry[] = wxT( "LibeditPinNumSize" ); static const wxChar defaultPinNameSizeEntry[] = wxT( "LibeditPinNameSize" ); static const wxChar DefaultPinLengthEntry[] = wxT( "DefaultPinLength" ); @@ -549,9 +566,6 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings() &m_showPageLimits, true ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), (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_BOOL( true, wxT( "PrintMonochrome" ), &m_printMonochrome, true ) ); @@ -570,7 +584,8 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); - m_GridColor = GetLayerColor( LAYER_GRID ); + SetGridColor( GetLayerColor( LAYER_GRID ) ); + SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) ); SetDefaultBusThickness( aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) ); SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) ); @@ -732,8 +747,8 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) wxConfigPathChanger cpc( aCfg, m_configPath ); - EDA_COLOR_T itmp = ColorByName( aCfg->Read( libeditdrawBgColorEntry, wxT("WHITE") ) ); - SetDrawBgColor( itmp ); + SetGridColor( GetLayerColor( LAYER_GRID ) ); + SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) ); wxString pro_dir = Prj().GetProjectFullName(); @@ -753,7 +768,6 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) wxConfigPathChanger cpc( aCfg, m_configPath ); - aCfg->Write( libeditdrawBgColorEntry, ColorGetName( GetDrawBgColor() ) ); aCfg->Write( lastLibExportPathEntry, m_lastLibExportPath ); aCfg->Write( lastLibImportPathEntry, m_lastLibImportPath ); aCfg->Write( DefaultPinLengthEntry, (long) GetDefaultPinLength() ); diff --git a/eeschema/general.h b/eeschema/general.h index b96f6ff252..fa1c976a23 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -36,8 +36,12 @@ class SCH_SHEET; #define GR_DEFAULT_DRAWMODE GR_COPY // this enum is for color management +// Using here "LAYER" in name is due to historical reasons. +// Eeschema does not actually use layers. It just uses "LAYER_XX" as identifier +// mainly for item color typedef enum { - LAYER_WIRE, + LAYER_FIRST, + LAYER_WIRE = LAYER_FIRST, LAYER_BUS, LAYER_JUNCTION, LAYER_LOCLABEL, @@ -61,12 +65,13 @@ typedef enum { LAYER_ERC_ERR, LAYER_DEVICE_BACKGROUND, LAYER_GRID, - NB_SCH_LAYERS -} LayerNumber; + LAYER_BACKGROUND, + LAYERSCH_ID_COUNT +} LAYERSCH_ID; -inline LayerNumber operator++( LayerNumber& a ) +inline LAYERSCH_ID operator++( LAYERSCH_ID& a ) { - a = LayerNumber( int( a ) + 1 ); + a = LAYERSCH_ID( int( a ) + 1 ); return a; } @@ -104,7 +109,8 @@ void SetDefaultTextSize( int aSize ); int GetDefaultBusThickness(); void SetDefaultBusThickness( int aThickness ); -EDA_COLOR_T GetLayerColor( LayerNumber aLayer ); +EDA_COLOR_T GetLayerColor( LAYERSCH_ID aLayer ); +void SetLayerColor( EDA_COLOR_T aColor, LAYERSCH_ID aLayer ); // Color to draw selected items EDA_COLOR_T GetItemSelectedColor(); @@ -112,6 +118,4 @@ EDA_COLOR_T GetItemSelectedColor(); // Color to draw items flagged invisible, in libedit (they are invisible in Eeschema EDA_COLOR_T GetInvisibleItemColor(); -void SetLayerColor( EDA_COLOR_T aColor, int aLayer ); - #endif // _GENERAL_H_ diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 411697ad4c..bf7abda766 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -35,7 +35,6 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, aFrameName ) { - SetDrawBgColor( WHITE ); // the background color of the draw canvas, BLACK or WHITE } @@ -47,6 +46,18 @@ void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event ) viewlibFrame->Raise(); } +// Virtual from EDA_DRAW_FRAME +EDA_COLOR_T SCH_BASE_FRAME::GetDrawBgColor() const +{ + return GetLayerColor( LAYER_BACKGROUND ); +} + +void SCH_BASE_FRAME::SetDrawBgColor( EDA_COLOR_T aColor) +{ + m_drawBgColor= aColor; + SetLayerColor( aColor, LAYER_BACKGROUND ); +} + SCH_SCREEN* SCH_BASE_FRAME::GetScreen() const { diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index fae15baf34..4b5f2c850a 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -504,7 +504,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const } // This section is not used, but written for file compatibility - if( fprintf( aFile, "EELAYER %d %d\n", NB_SCH_LAYERS, 0 ) < 0 + if( fprintf( aFile, "EELAYER %d %d\n", LAYERSCH_ID_COUNT, 0 ) < 0 || fprintf( aFile, "EELAYER END\n" ) < 0 ) return false; diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 0596d192f1..7d7805e7c8 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -507,13 +507,13 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); + SetGridColor( GetLayerColor( LAYER_GRID ) ); + SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) ); + 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( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 100 ); + aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 ); + aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 ); // Set parameters to a reasonable value. if( m_libListWidth > m_FrameSize.x/2 ) @@ -538,7 +538,6 @@ void LIB_VIEW_FRAME::SaveSettings( wxConfigBase* aCfg ) m_cmpListWidth = m_cmpList->GetSize().x; aCfg->Write( CMPLIST_WIDTH_KEY, m_cmpListWidth ); - aCfg->Write( LIBVIEW_BGCOLOR, ColorGetName( GetDrawBgColor() ) ); } diff --git a/include/draw_frame.h b/include/draw_frame.h index 4df5f8bb88..e58fcede9c 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -60,9 +60,9 @@ protected: int m_LastGridSizeId; // the command id offset (>= 0) of the last selected grid // 0 is for the grid corresponding to // 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 @@ -258,8 +258,16 @@ public: 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 ; } + // Virtual because some frames can have a specific way to get/set the bg color + /** + * @return the EDA_COLOR_T for the canvas background + */ + virtual EDA_COLOR_T GetDrawBgColor() const { return m_drawBgColor; } + + /** + * @param aColor: the EDA_COLOR_T for the canvas background + */ + virtual void SetDrawBgColor( EDA_COLOR_T aColor) { m_drawBgColor= aColor ; } int GetCursorShape() const { return m_cursorShape; } @@ -355,7 +363,7 @@ public: */ virtual bool IsGridVisible() const { - return m_DrawGrid; + return m_drawGrid; } /** @@ -365,7 +373,7 @@ public: */ virtual void SetGridVisibility( bool aVisible ) { - m_DrawGrid = aVisible; + m_drawGrid = aVisible; } /** @@ -374,7 +382,7 @@ public: */ virtual EDA_COLOR_T GetGridColor() const { - return m_GridColor; + return m_gridColor; } /** @@ -383,7 +391,7 @@ public: */ virtual void SetGridColor( EDA_COLOR_T aColor ) { - m_GridColor = aColor; + m_gridColor = aColor; } /** diff --git a/include/sch_base_frame.h b/include/sch_base_frame.h index 7d09636be2..0172b6e17e 100644 --- a/include/sch_base_frame.h +++ b/include/sch_base_frame.h @@ -68,6 +68,11 @@ public: } void SetGridOrigin( const wxPoint& aPoint ) {} // overload EDA_DRAW_FRAME + // Virtual from EDA_DRAW_FRAME + // the background color of the draw canvas: + EDA_COLOR_T GetDrawBgColor() const; + void SetDrawBgColor( EDA_COLOR_T aColor); + const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 37cc8d4a37..f69a79cde3 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -35,7 +35,7 @@ #include #include - + class SCH_ITEM; class SCH_SHEET_PATH; class LINE_READER; @@ -115,7 +115,7 @@ public: class SCH_ITEM : public EDA_ITEM { protected: - LayerNumber m_Layer; + LAYERSCH_ID m_Layer; EDA_ITEMS m_connections; ///< List of items connected to this item. public: @@ -145,14 +145,14 @@ public: * Function GetLayer * returns the layer this item is on. */ - LayerNumber GetLayer() const { return m_Layer; } + LAYERSCH_ID GetLayer() const { return m_Layer; } /** * Function SetLayer * sets the layer this item is on. * @param aLayer The layer number. */ - void SetLayer( LayerNumber aLayer ) { m_Layer = aLayer; } + void SetLayer( LAYERSCH_ID aLayer ) { m_Layer = aLayer; } /** * Function GetPenSize virtual pure @@ -293,7 +293,7 @@ public: bool IsConnected( const wxPoint& aPoint ) const; /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ - virtual bool HitTest( const wxPoint& aPosition ) const + virtual bool HitTest( const wxPoint& aPosition ) const { return HitTest( aPosition, 0 ); }