void EDA_DRAW_FRAME::CommonSettingsChanged() { EDA_BASE_FRAME::CommonSettingsChanged(); wxConfigBase* settings = Pgm().CommonSettings(); int autosaveInterval; settings->Read( AUTOSAVE_INTERVAL_KEY, &autosaveInterval ); SetAutoSaveInterval( autosaveInterval ); int historySize; settings->Read( FILE_HISTORY_SIZE_KEY, &historySize, DEFAULT_FILE_HISTORY_SIZE ); Kiface().GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) ); bool option; settings->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option ); m_canvas->SetEnableMousewheelPan( option ); settings->Read( ENBL_ZOOM_NO_CENTER_KEY, &option ); m_canvas->SetEnableZoomNoCenter( option ); settings->Read( ENBL_AUTO_PAN_KEY, &option ); m_canvas->SetEnableAutoPan( option ); m_galDisplayOptions.ReadCommonConfig( *settings, this ); }
void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) { wxArrayString units; GRIDS grid_list = GetScreen()->GetGrids(); bool saveProjectConfig = false; DIALOG_EESCHEMA_OPTIONS dlg( this ); units.Add( GetUnitsLabel( INCHES ) ); units.Add( GetUnitsLabel( MILLIMETRES ) ); dlg.SetUnits( units, g_UserUnit ); dlg.SetGridSizes( grid_list, GetScreen()->GetGridCmdId() ); dlg.SetBusWidth( GetDefaultBusThickness() ); dlg.SetLineWidth( GetDefaultLineThickness() ); dlg.SetTextSize( GetDefaultTextSize() ); dlg.SetRepeatHorizontal( GetRepeatStep().x ); dlg.SetRepeatVertical( GetRepeatStep().y ); dlg.SetRepeatLabel( GetRepeatDeltaLabel() ); dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 ); dlg.SetRefIdSeparator( LIB_PART::GetSubpartIdSeparator(), LIB_PART::GetSubpartFirstId() ); dlg.SetShowGrid( IsGridVisible() ); dlg.SetShowHiddenPins( m_showAllPins ); dlg.SetEnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); dlg.SetEnableZoomNoCenter( m_canvas->GetEnableZoomNoCenter() ); dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); dlg.SetEnableHVBusOrientation( GetForceHVLines() ); dlg.SetShowPageLimits( m_showPageLimits ); dlg.SetFootprintPreview( m_footprintPreview ); dlg.SetAutoplaceFields( m_autoplaceFields ); dlg.SetAutoplaceJustify( m_autoplaceJustify ); dlg.SetAutoplaceAlign( m_autoplaceAlign ); dlg.Layout(); dlg.Fit(); dlg.SetMinSize( dlg.GetSize() ); dlg.SetTemplateFields( m_TemplateFieldNames.GetTemplateFieldNames() ); if( dlg.ShowModal() == wxID_CANCEL ) return; g_UserUnit = (EDA_UNITS_T)dlg.GetUnitsSelection(); wxRealPoint gridsize = grid_list[ (size_t) dlg.GetGridSelection() ].m_Size; m_LastGridSizeId = GetScreen()->SetGrid( gridsize ); int sep, firstId; dlg.GetRefIdSeparator( sep, firstId); if( sep != (int)LIB_PART::GetSubpartIdSeparator() || firstId != (int)LIB_PART::GetSubpartFirstId() ) { LIB_PART::SetSubpartIdNotation( sep, firstId ); saveProjectConfig = true; } SetDefaultBusThickness( dlg.GetBusWidth() ); SetDefaultLineThickness( dlg.GetLineWidth() ); if( dlg.GetTextSize() != GetDefaultTextSize() ) { SetDefaultTextSize( dlg.GetTextSize() ); saveProjectConfig = true; } wxPoint step; step.x = dlg.GetRepeatHorizontal(); step.y = dlg.GetRepeatVertical(); SetRepeatStep( step ); SetRepeatDeltaLabel( dlg.GetRepeatLabel() ); SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 ); SetGridVisibility( dlg.GetShowGrid() ); m_showAllPins = dlg.GetShowHiddenPins(); m_canvas->SetEnableMousewheelPan( dlg.GetEnableMousewheelPan() ); m_canvas->SetEnableZoomNoCenter( dlg.GetEnableZoomNoCenter() ); m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() ); SetForceHVLines( dlg.GetEnableHVBusOrientation() ); m_showPageLimits = dlg.GetShowPageLimits(); m_autoplaceFields = dlg.GetAutoplaceFields(); m_autoplaceJustify = dlg.GetAutoplaceJustify(); m_autoplaceAlign = dlg.GetAutoplaceAlign(); m_footprintPreview = dlg.GetFootprintPreview(); // Delete all template fieldnames and then restore them using the template field data from // the options dialog DeleteAllTemplateFieldNames(); TEMPLATE_FIELDNAMES newFieldNames = dlg.GetTemplateFields(); for( TEMPLATE_FIELDNAMES::iterator dlgfld = newFieldNames.begin(); dlgfld != newFieldNames.end(); ++dlgfld ) { TEMPLATE_FIELDNAME fld = *dlgfld; AddTemplateFieldName( fld ); } SaveSettings( config() ); // save values shared by eeschema applications. if( saveProjectConfig ) SaveProjectSettings( true ); m_canvas->Refresh( true ); }