void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable ) { PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable ); if( aEnable && GetBoard() ) GetBoard()->GetRatsnest()->ProcessBoard(); else Compile_Ratsnest( NULL, true ); enableGALSpecificMenus(); }
void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable ) { if( aEnable ) { BOARD* board = GetBoard(); if( board ) board->GetRatsnest()->ProcessBoard(); } else { Compile_Ratsnest( NULL, true ); } PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable ); enableGALSpecificMenus(); }
PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB, wxT( "Pcbnew" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PCB_EDIT_FRAME_NAME ) { m_showBorderAndTitleBlock = true; // true to display sheet references m_showAxis = false; // true to display X and Y axis m_showOriginAxis = true; m_showGridAxis = true; m_SelTrackWidthBox = NULL; m_SelViaSizeBox = NULL; m_SelLayerBox = NULL; m_show_microwave_tools = false; m_show_layer_manager_tools = true; m_hotkeysDescrList = g_Board_Editor_Hokeys_Descr; m_hasAutoSave = true; m_RecordingMacros = -1; m_microWaveToolBar = NULL; m_rotationAngle = 900; for ( int i = 0; i < 10; i++ ) m_Macros[i].m_Record.clear(); // Create GAL canvas EDA_DRAW_PANEL_GAL* galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ); SetGalCanvas( galCanvas ); SetBoard( new BOARD() ); // Create the PCB_LAYER_WIDGET *after* SetBoard(): wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); int pointSize = font.GetPointSize(); int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); // printf( "pointSize:%d 80%%:%d\n", pointSize, (pointSize*8)/10 ); if( screenHeight <= 900 ) pointSize = (pointSize * 8) / 10; m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), pointSize ); m_drc = new DRC( this ); // these 2 objects point to each other wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) ); SetIcon( icon ); // LoadSettings() *after* creating m_LayersManager, because LoadSettings() // initialize parameters in m_LayersManager LoadSettings( config() ); SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); // PCB drawings start in the upper left corner. GetScreen()->m_Center = false; SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); if( m_canvas ) m_canvas->SetEnableBlockCommands( true ); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateAuxiliaryToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); ReCreateMicrowaveVToolbar(); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); EDA_PANEINFO vert; vert.VerticalToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template. // LAYER_WIDGET is floatable, but initially docked at far right EDA_PANEINFO lyrs; lyrs.LayersToolbarPane(); lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget lyrs.BestSize( m_Layers->GetBestSize() ); lyrs.Caption( _( "Visibles" ) ); lyrs.TopDockable( false ).BottomDockable( false ); if( m_mainToolBar ) // The main horizontal toolbar { m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) ); } if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows track and via sizes, zoom ...) { m_auimgr.AddPane( m_auxiliaryToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) ); } if( m_microWaveToolBar ) // The auxiliary vertical right toolbar (currently microwave tools) m_auimgr.AddPane( m_microWaveToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_microWaveToolBar" ) ). Right().Layer( 1 ).Position(1).Hide() ); if( m_drawToolBar ) // The main right vertical toolbar m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer( 2 ) ); // Add the layer manager ( most right side of pcbframe ) m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 3 ) ); if( m_optionsToolBar ) // The left vertical toolbar (fast acces display options of Pcbnew) { m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left().Layer(1) ); m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); } if( m_canvas ) m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); if( GetGalCanvas() ) m_auimgr.AddPane( (wxWindow*) GetGalCanvas(), wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() ); if( m_messagePanel ) m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); ReFillLayerWidget(); // this is near end because contents establish size m_Layers->ReFillRender(); // Update colors in Render after the config is read syncLayerWidgetLayer(); m_auimgr.Update(); setupTools(); Zoom_Automatique( false ); EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting(); if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ) { if( GetGalCanvas()->SwitchBackend( canvasType ) ) UseGalCanvas( true ); } enableGALSpecificMenus(); }