void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::SaveSettings( aCfg ); // was: wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); aCfg->Write( cfgShowPageSizeOption, GetPageSettings().GetType() ); aCfg->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock ); aCfg->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) ); aCfg->Write( cfgShowNegativeObjects, IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ); // Save the drill file history list. // Because we have more than one file history, we must save this one // in a specific path aCfg->SetPath( wxT( "drl_files" ) ); m_drillFileHistory.Save( *aCfg ); aCfg->SetPath( wxT( ".." ) ); // Save the zip file history list. aCfg->SetPath( wxT( "zip_files" ) ); m_zipFileHistory.Save( *aCfg ); aCfg->SetPath( wxT( ".." ) ); }
/** * Function Clear_Pcb * delete all and reinitialize the current board * @param aQuery = true to prompt user for confirmation, false to initialize silently */ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) { if( GetBoard() == NULL ) return false; if( aQuery ) { if( GetBoard()->m_Drawings || GetBoard()->m_Modules || GetBoard()->m_Track || GetBoard()->m_Zone ) { if( !IsOK( this, _( "Current Board will be lost and this operation cannot be undone. Continue ?" ) ) ) return false; } } // Clear undo and redo lists because we want a full deletion GetScreen()->ClearUndoRedoList(); /* Items visibility flags will be set becuse a new board will be created. * Grid and ratsnest can be left to their previous state */ bool showGrid = IsElementVisible( GRID_VISIBLE ); bool showRats = IsElementVisible( RATSNEST_VISIBLE ); // delete the old BOARD and create a new BOARD so that the default // layer names are put into the BOARD. SetBoard( new BOARD() ); SetElementVisibility( GRID_VISIBLE, showGrid ); SetElementVisibility( RATSNEST_VISIBLE, showRats ); SetCurItem( NULL ); // clear filename, to avoid overwriting an old file GetScreen()->GetFileName().Empty(); // preserve grid size accross call to InitDataPoints() // wxRealPoint gridsize = GetScreen()->GetGridSize(); GetScreen()->InitDataPoints( GetPageSizeIU() ); // GetScreen()->SetGrid( gridsize ); GetBoard()->ResetHighLight(); // Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled) GetBoard()->SetEnabledLayers( ALL_LAYERS ); // Default copper layers count set to 2: double layer board GetBoard()->SetCopperLayerCount( 2 ); // Update display: GetBoard()->SetVisibleLayers( ALL_LAYERS ); ReFillLayerWidget(); Zoom_Automatique( false ); return true; }
bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) { wxLogDebug( wxT( "Loading project '%s' settings." ), GetChars( aProjectFileName ) ); wxFileName fn = aProjectFileName; if( fn.GetExt() != ProjectFileExtension ) fn.SetExt( ProjectFileExtension ); // was: wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); Prj().ConfigLoad( Kiface().KifaceSearch(), fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); // Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate // what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings // have no control over what is visible (see PCB_EDIT_FRAME::GetProjectFileParameters()) // this is recklessly turning on things the user may not want to see. #if 0 /* Reset the items visibility flag when loading a new configuration because it could * create SERIOUS mistakes for the user if board items are not visible after loading * a board. Grid and ratsnest can be left to their previous state. */ bool showGrid = IsElementVisible( GRID_VISIBLE ); bool showRats = IsElementVisible( RATSNEST_VISIBLE ); SetVisibleAlls(); SetElementVisibility( GRID_VISIBLE, showGrid ); SetElementVisibility( RATSNEST_VISIBLE, showRats ); #endif wxString projectFpLibTableFileName = Prj().FootprintLibTblName(); FootprintLibs()->Clear(); try { FootprintLibs()->Load( projectFpLibTableFileName ); } catch( const IO_ERROR& ioe ) { DisplayError( this, ioe.errorText ); } // Load the page layout decr file, from the filename stored in // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file // If empty, the default descr is loaded WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance(); pglayout.SetPageLayout( BASE_SCREEN::m_PageLayoutDescrFileName ); return true; }
/* * Function GetNegativeItemsColor * returns the color of negative items. * This is usually the background color, but can be an other color * in order to see negative objects * therefore returns the background color if negative items not visible * and the color selection of negative items if they are visible */ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const { if( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ) return GetVisibleElementColor( NEGATIVE_OBJECTS_VISIBLE ); else return GetDrawBgColor(); }
bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) { wxFileName fn = aProjectFileName; if( fn.GetExt() != ProjectFileExtension ) fn.SetExt( ProjectFileExtension ); wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer ); // Initialize default values. g_LibraryNames.Clear(); wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); // User library path takes precedent over default library search paths. wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 ); // Dick 5-Feb-2012: I don't agree with this, the BOARD contents should dictate // what is visible or not, even initially. And since PCB_EDIT_FRAME projects settings // have no control over what is visible (see PCB_EDIT_FRAME::GetProjectFileParameters()) // this is recklessly turning on things the user may not want to see. #if 0 /* Reset the items visibility flag when loading a new configuration because it could * create SERIOUS mistakes for the user if board items are not visible after loading * a board. Grid and ratsnest can be left to their previous state. */ bool showGrid = IsElementVisible( GRID_VISIBLE ); bool showRats = IsElementVisible( RATSNEST_VISIBLE ); SetVisibleAlls(); SetElementVisibility( GRID_VISIBLE, showGrid ); SetElementVisibility( RATSNEST_VISIBLE, showRats ); #endif return true; }
void GERBVIEW_FRAME::SaveSettings() { wxConfig* config = wxGetApp().GetSettings(); if( config == NULL ) return; EDA_DRAW_FRAME::SaveSettings(); wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() ); config->Write( cfgShowPageSizeOption, GetPageSettings().GetType() ); config->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock ); config->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) ); config->Write( cfgShowNegativeObjects, IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ); // Save the drill file history list. // Because we have 2 file histories, we must save this one // in a specific path config->SetPath( wxT( "drl_files" ) ); m_drillFileHistory.Save( *config ); config->SetPath( wxT( ".." ) ); }
bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem ) { #define CHANGE( x ) ( x ) = not (x ) wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); /* Convert lower to upper case (the usual toupper function has problem with non ascii * codes like function keys */ if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') ) aHotkeyCode += 'A' - 'a'; EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, gerbviewHotkeyList ); if( HK_Descr == NULL ) return false; switch( HK_Descr->m_Idcommand ) { default: case HK_NOT_FOUND: return false; case HK_HELP: // Display Current hotkey list DisplayHotkeyList( this, GerbviewHokeysDescr ); break; case HK_ZOOM_IN: cmd.SetId( ID_POPUP_ZOOM_IN ); GetEventHandler()->ProcessEvent( cmd ); break; case HK_ZOOM_OUT: cmd.SetId( ID_POPUP_ZOOM_OUT ); GetEventHandler()->ProcessEvent( cmd ); break; case HK_ZOOM_REDRAW: cmd.SetId( ID_ZOOM_REDRAW ); GetEventHandler()->ProcessEvent( cmd ); break; case HK_ZOOM_CENTER: cmd.SetId( ID_POPUP_ZOOM_CENTER ); GetEventHandler()->ProcessEvent( cmd ); break; case HK_ZOOM_AUTO: cmd.SetId( ID_ZOOM_PAGE ); GetEventHandler()->ProcessEvent( cmd ); break; case HK_RESET_LOCAL_COORD: // Reset the relative coord GetScreen()->m_O_Curseur = GetCrossHairPosition(); break; case HK_SWITCH_UNITS: g_UserUnit = (g_UserUnit == INCHES ) ? MILLIMETRES : INCHES; break; case HK_GBR_LINES_DISPLAY_MODE: CHANGE( m_DisplayOptions.m_DisplayLinesFill ); m_canvas->Refresh(); break; case HK_GBR_FLASHED_DISPLAY_MODE: CHANGE( m_DisplayOptions.m_DisplayFlashedItemsFill ); m_canvas->Refresh( true ); break; case HK_GBR_POLYGON_DISPLAY_MODE: CHANGE( m_DisplayOptions.m_DisplayPolygonsFill ); m_canvas->Refresh(); break; case HK_GBR_NEGATIVE_DISPLAY_ONOFF: SetElementVisibility( LAYER_NEGATIVE_OBJECTS, not IsElementVisible( LAYER_NEGATIVE_OBJECTS ) ); m_canvas->Refresh(); break; case HK_GBR_DCODE_DISPLAY_ONOFF: SetElementVisibility( LAYER_DCODES, not IsElementVisible( LAYER_DCODES ) ); m_canvas->Refresh(); break; case HK_SWITCH_LAYER_TO_PREVIOUS: if( getActiveLayer() > 0 ) { setActiveLayer( getActiveLayer() - 1 ); m_canvas->Refresh(); } break; case HK_SWITCH_LAYER_TO_NEXT: if( getActiveLayer() < 31 ) { setActiveLayer( getActiveLayer() + 1 ); m_canvas->Refresh(); } break; } return true; }
bool FOOTPRINT_EDIT_FRAME::IsGridVisible() const { return IsElementVisible( GRID_VISIBLE ); }
// Redraw the BOARD items but not cursors, axis or grid void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset ) { /* The order of drawing is flexible on some systems and not on others. For * OSes which use OR to draw, the order is not important except for the * effect of the highlight and its relationship to markers. See comment * below. * This order independence comes from the fact that a binary OR operation is * commutative in nature. * However on the OSX, the OR operation is not used, and so this sequence * below is chosen to give MODULEs the highest visible priority. */ /* Draw all tracks and zones. As long as dark colors are used for the * tracks, Then the OR draw mode should show tracks underneath other * tracks. But a white track will cover any other color since it has * more bits to OR in. */ for( TRACK* track = m_Track; track; track = track->Next() ) { if( track->IsMoving() ) continue; track->Draw( aPanel, DC, aDrawMode ); } // Draw areas (i.e. zones) for( int ii = 0; ii < GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = GetArea( ii ); // Areas must be drawn here only if not moved or dragged, // because these areas are drawn by ManageCursor() in a specific manner if( ( zone->GetEditFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 ) { zone->Draw( aPanel, DC, aDrawMode ); zone->DrawFilledArea( aPanel, DC, aDrawMode ); } } // Draw the graphic items for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() ) { if( item->IsMoving() ) continue; switch( item->Type() ) { case PCB_DIMENSION_T: case PCB_TEXT_T: case PCB_TARGET_T: case PCB_LINE_T: item->Draw( aPanel, DC, aDrawMode ); break; default: break; } } LSET all_cu = LSET::AllCuMask(); for( MODULE* module = m_Modules; module; module = module->Next() ) { bool display = true; LSET layerMask = all_cu; if( module->IsMoving() ) continue; if( !IsElementVisible( LAYER_MOD_FR ) ) { if( module->GetLayer() == F_Cu ) display = false; layerMask.set( F_Cu, false ); } if( !IsElementVisible( LAYER_MOD_BK ) ) { if( module->GetLayer() == B_Cu ) display = false; layerMask.set( B_Cu, false ); } if( display ) module->Draw( aPanel, DC, aDrawMode ); else Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode ); } // draw the BOARD's markers last, otherwise the high light will erase any marker on a pad for( unsigned i = 0; i < m_markers.size(); ++i ) { m_markers[i]->Draw( aPanel, DC, aDrawMode ); } }
bool FOOTPRINT_EDIT_FRAME::IsGridVisible() const { return IsElementVisible( LAYER_GRID ); }