void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); // Fetch grid settings from Symbol Editor wxString symbolEditor = LIB_EDIT_FRAME_NAME; bool btmp; COLOR4D wtmp; if( aCfg->Read( symbolEditor + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); if( wtmp.SetFromWxString( aCfg->Read( symbolEditor + GridColorEntryKeyword, wxT( "NONE" ) ) ) ) SetGridColor( wtmp ); // Grid shape, etc. GetGalDisplayOptions().ReadAppConfig( *aCfg, symbolEditor ); aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 ); aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 ); m_showPinElectricalTypeName = aCfg->Read( CMPVIEW_SHOW_PINELECTRICALTYPE_KEY, true ); // Set parameters to a reasonable value. if( m_libListWidth > m_FrameSize.x/2 ) m_libListWidth = m_FrameSize.x/2; if( m_cmpListWidth > m_FrameSize.x/2 ) m_cmpListWidth = m_FrameSize.x/2; }
void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_BASE_FRAME::LoadSettings( aCfg ); wxString baseCfgName = ConfigBaseName(); bool btmp; if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); // Read grid color: COLOR4D wtmp = COLOR4D::UNSPECIFIED; if( wtmp.SetFromWxString( aCfg->Read( baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) ) SetGridColor( wtmp ); aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L ); // m_LastGridSizeId is an offset, expected to be >= 0 if( m_LastGridSizeId < 0 ) m_LastGridSizeId = 0; m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry, long( DEFAULT_MAX_UNDO_ITEMS ) ); aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L ); m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword ); }
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent ) { SetGridVisibility( !IsGridVisible() ); if( IsGalCanvasActive() ) { GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() ); GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); } m_canvas->Refresh(); }
void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_BASE_FRAME::LoadSettings( aCfg ); aCfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_cursorShape, ( long )0 ); bool btmp; if( aCfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); int itmp; if( aCfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) ) SetGridColor( ColorFromInt( itmp ) ); aCfg->Read( m_FrameName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L ); // m_LastGridSizeId is an offset, expected to be >= 0 if( m_LastGridSizeId < 0 ) m_LastGridSizeId = 0; }
/** * Function SetElementVisibility * changes the visibility of an element category * @param aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID * @param aNewState = The new visibility state of the element category */ void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible, bool aNewState ) { switch( aItemIdVisible ) { case DCODES_VISIBLE: m_DisplayOptions.m_DisplayDCodes = aNewState; break; case NEGATIVE_OBJECTS_VISIBLE: m_DisplayOptions.m_DisplayNegativeObjects = aNewState; break; case GERBER_GRID_VISIBLE: SetGridVisibility( aNewState ); break; default: wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aItemIdVisible ); } m_LayersManager->SetRenderState( aItemIdVisible, aNewState ); }
void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_BASE_FRAME::LoadSettings( aCfg ); wxString baseCfgName = ConfigBaseName(); wxConfigBase* cmnCfg = Pgm().CommonSettings(); // Read units used in dialogs and toolbars EDA_UNITS_T unitsTmp; if( aCfg->Read( baseCfgName + UserUnitsEntryKeyword, (int*) &unitsTmp ) ) SetUserUnits( unitsTmp ); else SetUserUnits( MILLIMETRES ); // Read show/hide grid entry bool btmp; if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); // Read grid color: COLOR4D wtmp = COLOR4D::UNSPECIFIED; if( wtmp.SetFromWxString( aCfg->Read( baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) ) SetGridColor( wtmp ); aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L ); // m_LastGridSizeId is an offset, expected to be >= 0 if( m_LastGridSizeId < 0 ) m_LastGridSizeId = 0; m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry, long( DEFAULT_MAX_UNDO_ITEMS ) ); aCfg->Read( baseCfgName + FirstRunShownKeyword, &m_firstRunDialogSetting, 0L ); m_galDisplayOptions.ReadConfig( *cmnCfg, *aCfg, baseCfgName, 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 ); }