From 269e8159d46ff6d2c30cce16ffb3a7a84085b264 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 4 Sep 2018 19:22:26 +0100 Subject: [PATCH] Grid settings for LibEdit. --- eeschema/eeschema_config.cpp | 3 ++- eeschema/libedit/lib_edit_frame.cpp | 10 ++-------- eeschema/libedit/menubar_libedit.cpp | 10 ++++++++++ eeschema/sch_edit_frame.cpp | 8 +------- eeschema/viewlib_frame.cpp | 6 +++--- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 280b2fee2f..0004156235 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -492,7 +492,8 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) auto painter = dynamic_cast( GetCanvas()->GetView()->GetPainter() ); KIGFX::SCH_RENDER_SETTINGS* settings = painter->GetSettings(); - settings->m_ShowPinsElectricalType = false ; + settings->m_ShowPinsElectricalType = false; + settings->m_ShowHiddenText = false; settings->m_ShowHiddenPins = m_showAllPins; } diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index 3133a4fb8d..a5f3640784 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -146,6 +146,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) + EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) EVT_MENU( wxID_PREFERENCES, LIB_EDIT_FRAME::OnPreferencesOptions ) @@ -230,17 +231,10 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SetCrossHairPosition( wxPoint( 0, 0 ) ); - // Ensure m_LastGridSizeId is an offset inside the allowed schematic range - if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 ) - m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; - - if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 ) - m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000; + SetPresetGrid( m_LastGridSizeId ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); - SetPresetGrid( m_LastGridSizeId ); - if( m_canvas ) m_canvas->SetEnableBlockCommands( true ); diff --git a/eeschema/libedit/menubar_libedit.cpp b/eeschema/libedit/menubar_libedit.cpp index 55035b64b4..eb23e6d0ea 100644 --- a/eeschema/libedit/menubar_libedit.cpp +++ b/eeschema/libedit/menubar_libedit.cpp @@ -208,6 +208,16 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() text = AddHotkeyName( _( "&Redraw" ), g_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW ); AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); + viewMenu->AppendSeparator(); + + AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GRID, + _( "Show &Grid" ), wxEmptyString, + KiBitmap( grid_xpm ), wxITEM_CHECK ); + + AddMenuItem( viewMenu, ID_GRID_SETTINGS, + _( "Grid Settings..." ), wxEmptyString, + KiBitmap( grid_xpm ) ); + // Separator viewMenu->AppendSeparator(); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 9c78841ba4..9dcbc03c84 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -386,7 +386,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_toolManager = new TOOL_MANAGER; - SetForceHVLines( true ); SetSpiceAjustPassiveValues( false ); @@ -396,17 +395,12 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): SetIcon( icon ); // Initialize grid id to the default value (50 mils): - const int default_grid = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; - m_LastGridSizeId = default_grid; + m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; LoadSettings( config() ); CreateScreens(); - // Ensure m_LastGridSizeId is an offset inside the allowed schematic grid range - if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) ) - m_LastGridSizeId = default_grid; - SetPresetGrid( m_LastGridSizeId ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 4f9ec931ed..c6abab4c0f 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -131,15 +131,15 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame m_listPowerCmpOnly = false; SetShowElectricalType( true ); + // Initialize grid id to the default value (50 mils): + m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; + SetScreen( new SCH_SCREEN( aKiway ) ); GetScreen()->m_Center = true; // Axis origin centered on screen. LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); - // Initialize grid id to the default value (50 mils): - m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; - SetPresetGrid( m_LastGridSizeId ); // Menu bar is not mandatory: uncomment/comment the next line