Grid settings for LibEdit.

This commit is contained in:
Jeff Young 2018-09-04 19:22:26 +01:00
parent 9e9db3afe5
commit 269e8159d4
5 changed files with 18 additions and 19 deletions

View File

@ -492,7 +492,8 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
auto painter = dynamic_cast<KIGFX::SCH_PAINTER*>( 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;
}

View File

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

View File

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

View File

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

View File

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