LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, const wxString& aLibraryName ) : SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Symbol Library Browser" ), wxDefaultPosition, wxDefaultSize, aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_STYLE_MODAL : LIB_VIEW_STYLE, aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_NAME_MODAL : LIB_VIEW_NAME ), m_libList( nullptr ), m_cmpList( nullptr ), m_previewItem( nullptr ) { wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL ); if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); // Force the frame name used in config. the lib viewer frame has a name // depending on aFrameType (needed to identify the frame by wxWidgets), // but only one configuration is preferable. m_configFrameName = LIB_VIEW_NAME; // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) ); SetIcon( icon ); m_hotkeysDescrList = g_Viewlib_Hotkeys_Descr; m_libListWidth = 200; m_cmpListWidth = 300; 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 ); // Menu bar is not mandatory: uncomment/comment the next line // to add/remove the menubar ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL | wxNO_BORDER ); m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL | wxNO_BORDER ); if( aLibraryName.empty() ) { ReCreateListLib(); } else { m_libraryName = aLibraryName; m_entryName.Clear(); m_unit = 1; m_convert = 1; } m_selection_changed = false; DisplayLibInfos(); m_auimgr.SetManagedWindow( this ); m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); // Manage main toolbar m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); m_auimgr.AddPane( m_libList, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(3) .CaptionVisible( false ).MinSize( 80, -1 ).BestSize( m_libListWidth, -1 ) ); m_auimgr.AddPane( m_cmpList, EDA_PANE().Palette().Name( "Symbols" ).Left().Layer(1) .CaptionVisible( false ).MinSize( 80, -1 ).BestSize( m_cmpListWidth, -1 ) ); m_auimgr.AddPane( m_canvas->GetWindow(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.GetPane( m_libList ).Show( aLibraryName.empty() ); m_auimgr.Update(); setupTools(); GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId ); GetToolManager()->RunAction( "common.Control.zoomFitScreen", true ); if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame { Raise(); Show( true ); } SyncView(); GetGalCanvas()->GetViewControls()->SetSnapping( true ); GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() ); // Set the working/draw area size to display a symbol to a reasonable value: // A 450mm x 450mm with a origin at the area center looks like a large working area double max_size_x = Millimeter2iu( 450 ); double max_size_y = Millimeter2iu( 450 ); BOX2D bbox; bbox.SetOrigin( -max_size_x /2, -max_size_y/2 ); bbox.SetSize( max_size_x, max_size_y ); GetCanvas()->GetView()->SetBoundary( bbox ); }
Config::Config(KConfig *config, KileInfo *ki, QWidget* parent) : KPageDialog(parent), m_config(config), m_ki(ki) { setWindowTitle(i18n("Configure")); setModal(true); setObjectName("kileconfiguration"); setFaceType(Tree); m_config->sync(); // we need a dialog manager m_manager = new KConfigDialogManager(this,KileConfig::self()); KPageWidgetItem* kilePageWidgetItem = addConfigFolder(i18n("Kile"), "kile"); KPageWidgetItem* latexPageWidgetItem = addConfigFolder(i18n("LaTeX"), "latex-config"); KPageWidgetItem* toolsPageWidgetItem = addConfigFolder(i18n("Tools"), "system-run"); KPageWidgetItem* editorPageWidgetItem = addConfigFolder(i18n("Editor"), "accessories-text-editor"); // setup all configuration pages setupGeneralOptions(kilePageWidgetItem); setupAppearance(kilePageWidgetItem); setupCodeCompletion(kilePageWidgetItem); // complete configuration (dani) setupHelp(kilePageWidgetItem); setupScripting(kilePageWidgetItem); setupUsermenu(kilePageWidgetItem); setupLivePreview(kilePageWidgetItem); setupLatex(latexPageWidgetItem); setupEnvironment(latexPageWidgetItem); setupGraphics(latexPageWidgetItem); setupStructure(latexPageWidgetItem); setupSymbolView(latexPageWidgetItem); setupTools(toolsPageWidgetItem); setupQuickPreview(toolsPageWidgetItem); // QuickPreview (dani) setupEditor(editorPageWidgetItem); m_configDialogSize = m_config->group("KileConfigDialog"); KWindowConfig::restoreWindowSize(windowHandle(), m_configDialogSize); // setup connections //connect(m_manager, SIGNAL(widgetModified()), this, SLOT(slotWidgetModified())); connect(this, &KPageDialog::accepted, this, &Config::slotAcceptChanges); connect(this, &KPageDialog::accepted, m_manager, &KConfigDialogManager::updateSettings); connect(this, &KPageDialog::rejected, this, [=] () { m_config->markAsClean(); }); }
// Draw void GameObject::draw(HDC hdcBackBuffer) { if(!_point.empty()){ setupTools(hdcBackBuffer); PointList::reverse_iterator riter = _point.rbegin(); MoveToEx(hdcBackBuffer, _rect.getCoord(X) + (*riter)[X], _rect.getCoord(Y) + (*riter)[Y], NULL); for(PointList::iterator iter = _point.begin(); iter != _point.end(); ++iter){ LineTo(hdcBackBuffer, _rect.getCoord(X) + (*iter)[X], _rect.getCoord(Y) + (*iter)[Y]); } } }
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME ) { m_showAxis = true; // true to draw axis SetShowDeMorgan( false ); m_DrawSpecificConvert = true; m_DrawSpecificUnit = false; m_hotkeysDescrList = g_Libedit_Hotkeys_Descr; m_SyncPinEdit = false; m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN; SetShowElectricalType( true ); m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs m_my_part = NULL; m_treePane = nullptr; m_libMgr = nullptr; m_unit = 1; m_convert = 1; m_AboutTitle = "LibEdit"; // Delayed initialization if( g_LastTextSize == -1 ) g_LastTextSize = GetDefaultTextSize(); // Initialize grid id to the default value 50 mils: m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) ); SetIcon( icon ); LoadSettings( config() ); // Ensure axis are always drawn KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions(); gal_opts.m_axesEnabled = true; m_dummyScreen = new SCH_SCREEN( aKiway ); SetScreen( m_dummyScreen ); GetScreen()->m_Center = true; GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); SetCrossHairPosition( wxPoint( 0, 0 ) ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); m_libMgr = new LIB_MANAGER( *this ); SyncLibraries( true ); m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr ); setupTools(); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); updateTitle(); DisplayCmpDoc(); RebuildSymbolUnitsList(); m_auimgr.SetManagedWindow( this ); m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1) .Caption( _( "Libraries" ) ).MinSize( 250, -1 ) .BestSize( m_defaultLibWidth, -1 ).Resizable() ); m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) ); m_auimgr.AddPane( m_canvas->GetWindow(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() ); m_auimgr.Update(); GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId ); Raise(); Show( true ); Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnConfigurePaths, this, ID_PREFERENCES_CONFIGURE_PATHS ); Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this, ID_EDIT_SYM_LIB_TABLE ); m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); SyncView(); GetGalCanvas()->GetViewControls()->SetSnapping( true ); GetGalCanvas()->GetView()->UseDrawPriority( true ); GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() ); GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); // Set the working/draw area size to display a symbol to a reasonable value: // A 600mm x 600mm with a origin at the area center looks like a large working area double max_size_x = Millimeter2iu( 600 ); double max_size_y = Millimeter2iu( 600 ); BOX2D bbox; bbox.SetOrigin( -max_size_x /2, -max_size_y/2 ); bbox.SetSize( max_size_x, max_size_y ); GetCanvas()->GetView()->SetBoundary( bbox ); }
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString, wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ) { m_showBorderAndTitleBlock = false; // true to show the frame references m_showAxis = true; // true to show X and Y axis on screen m_showGridAxis = true; // show the grid origin axis m_hotkeysDescrList = g_Module_Editor_Hokeys_Descr; // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) ); SetIcon( icon ); // Show a title (frame title + footprint name): updateTitle(); // Create GAL canvas PCB_BASE_FRAME* parentFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) ); PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, parentFrame->GetGalCanvas()->GetBackend() ); SetGalCanvas( drawPanel ); SetBoard( new BOARD() ); // In modedit, the default net clearance is not known. // (it depends on the actual board) // So we do not show the default clearance, by setting it to 0 // The footprint or pad specific clearance will be shown GetBoard()->GetDesignSettings().GetDefault()->SetClearance(0); // restore the last footprint from the project, if any restoreLastFootprint(); // Ensure all layers and items are visible: // In footprint editor, some layers have no meaning or // cannot be used, but we show all of them, at least to be able // to edit a bad layer GetBoard()->SetVisibleAlls(); wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true ); LoadSettings( config() ); SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); GetScreen()->SetCurItem( NULL ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); // In modedit, set the default paper size to A4: // this should be OK for all footprint to plot/print SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateAuxiliaryToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); if( m_canvas ) m_canvas->SetEnableBlockCommands( true ); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); EDA_PANEINFO vert; vert.VerticalToolbarPane(); EDA_PANEINFO mesg_pane; mesg_pane.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" ) ); m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) ); m_auimgr.AddPane( m_auxiliaryToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) ); // The main right vertical toolbar m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer(1) ); // Add the layer manager ( most right side of pcbframe ) m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 2 ) ); // Layers manager is visible m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( true ); // The left vertical toolbar (fast acces to display options) m_auimgr.AddPane( m_optionsToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ). Left().Layer(1) ); m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.AddPane( (wxWindow*) GetGalCanvas(), wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() ); m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg_pane ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); // Create the manager and dispatcher & route draw panel events to the dispatcher setupTools(); UseGalCanvas( parentFrame->IsGalCanvasActive() ); if( m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).IsShown() ) { m_Layers->ReFill(); m_Layers->ReFillRender(); GetScreen()->m_Active_Layer = F_SilkS; m_Layers->SelectLayer( F_SilkS ); m_Layers->OnLayerSelected(); } m_auimgr.Update(); Raise(); // On some window managers, this is needed Show( true ); Zoom_Automatique( false ); }
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(); }
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) : PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString, wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ) { m_showBorderAndTitleBlock = false; // true to show the frame references m_showAxis = true; // true to show X and Y axis on screen m_showGridAxis = true; // show the grid origin axis m_hotkeysDescrList = g_Module_Editor_Hotkeys_Descr; m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs m_canvasType = aBackend; m_AboutTitle = "ModEdit"; // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) ); SetIcon( icon ); // Create GAL canvas if( aBackend == EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN ) m_canvasType = LoadCanvasTypeSetting(); else m_canvasType = aBackend; PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, GetGalDisplayOptions(), m_canvasType ); SetGalCanvas( drawPanel ); SetBoard( new BOARD() ); // In modedit, the default net clearance is not known. // (it depends on the actual board) // So we do not show the default clearance, by setting it to 0 // The footprint or pad specific clearance will be shown GetBoard()->GetDesignSettings().GetDefault()->SetClearance( 0 ); // Don't show the default board solder mask clearance in the footprint editor. Only the // footprint or pad clearance setting should be shown if it is not 0. GetBoard()->GetDesignSettings().m_SolderMaskMargin = 0; // restore the last footprint from the project, if any restoreLastFootprint(); // Ensure all layers and items are visible: // In footprint editor, some layers have no meaning or // cannot be used, but we show all of them, at least to be able // to edit a bad layer GetBoard()->SetVisibleAlls(); // However the "no net" mark on pads is useless, because there is // no net in footprint editor: make it non visible GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false ); m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), true ); // LoadSettings() *after* creating m_LayersManager, because LoadSettings() // initialize parameters in m_LayersManager LoadSettings( config() ); GetGalDisplayOptions().m_axesEnabled = true; SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); // In modedit, set the default paper size to A4: // this should be OK for all footprint to plot/print SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); initLibraryTree(); m_treePane = new FOOTPRINT_TREE_PANE( this ); // Create the manager and dispatcher & route draw panel events to the dispatcher setupTools(); // ReCreateMenuBar(); // UseGalCanvas() will do this for us. ReCreateHToolbar(); ReCreateVToolbar(); ReCreateOptToolbar(); m_Layers->ReFill(); m_Layers->ReFillRender(); GetScreen()->m_Active_Layer = F_SilkS; m_Layers->SelectLayer( F_SilkS ); m_Layers->OnLayerSelected(); m_auimgr.SetManagedWindow( this ); m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); // Horizontal items; layers 4 - 6 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); // Vertical items; layers 1 - 3 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1) .Caption( _( "Libraries" ) ).MinSize( 250, 400 ) .BestSize( m_defaultLibWidth, -1 ) ); m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) ); m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3) .Caption( _( "Layers Manager" ) ).PaneBorder( false ) .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) ); m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() ); GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); // Set up viewport KIGFX::VIEW* view = GetGalCanvas()->GetView(); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); UseGalCanvas(); m_auimgr.Update(); updateTitle(); Raise(); // On some window managers, this is needed Show( true ); Zoom_Automatique( false ); }
PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME ) { m_UserUnits = MILLIMETRES; m_zoomLevelCoeff = 290.0; // Adjusted to roughly displays zoom level = 1 // when the screen shows a 1:1 image // obviously depends on the monitor, // but this is an acceptable value m_showAxis = false; // true to show X and Y axis on screen m_showGridAxis = true; m_showBorderAndTitleBlock = true; // true for reference drawings. m_hotkeysDescrList = PlEditorHotkeysDescr; m_originSelectChoice = 0; SetDrawBgColor( WHITE ); // default value, user option (WHITE/BLACK) WS_DATA_MODEL::GetTheInstance().m_EditMode = true; SetShowPageLimits( true ); m_AboutTitle = "PlEditor"; m_propertiesFrameWidth = 200; // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_pagelayout_editor_xpm ) ); SetIcon( icon ); // Create GAL canvas #ifdef __WXMAC__ // Cairo renderer doesn't handle Retina displays m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL; #else m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; #endif auto* drawPanel = new PL_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, GetGalDisplayOptions(), m_canvasType ); SetGalCanvas( drawPanel ); LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU(); SetScreen( new PL_EDITOR_SCREEN( pageSizeIU ) ); if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) ) m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1MM - ID_POPUP_GRID_LEVEL_1000; GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ); setupTools(); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); wxWindow* stsbar = GetStatusBar(); int dims[] = { // balance of status bar on far left is set to a default or whatever is left over. -1, // When using GetTextSize() remember the width of '1' is not the same // as the width of '0' unless the font is fixed width, and it usually won't be. // zoom: GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10, // cursor coords GetTextSize( wxT( "X 0234.567 Y 0234.567" ), stsbar ).x + 10, // delta distances GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10, // Coord origin (use the bigger message) GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10, // units display, Inches is bigger than mm GetTextSize( _( "Inches" ), stsbar ).x + 10 }; SetStatusWidths( arrayDim( dims ), dims ); m_auimgr.SetManagedWindow( this ); m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); m_propertiesPagelayout = new PROPERTIES_FRAME( this ); // Horizontal items; layers 4 - 6 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); // Vertical items; layers 1 - 3 m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) ); m_auimgr.AddPane( m_propertiesPagelayout, EDA_PANE().Palette().Name( "Props" ).Right().Layer(2) .Caption( _( "Properties" ) ).MinSize( m_propertiesPagelayout->GetMinSize() ) .BestSize( m_propertiesFrameWidth, -1 ) ); m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() ); // Set up viewport KIGFX::VIEW* view = GetGalCanvas()->GetView(); view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() ); view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) ); UseGalCanvas(); m_auimgr.Update(); // Initialize the current page layout WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance(); #if 0 //start with empty layout pglayout.AllowVoidList( true ); pglayout.ClearList(); #else // start with the default Kicad layout pglayout.SetPageLayout(); #endif OnNewPageLayout(); }
MainWindow::MainWindow() : KXmlGuiWindow() , m_view(new MainView(this)) , m_findBar(new FindBar(this)) , m_zoomBar(new ZoomBar(this)) , m_historyPanel(0) , m_bookmarksPanel(0) , m_webInspectorPanel(0) , m_analyzerPanel(0) , m_historyBackMenu(0) , m_encodingMenu(new KMenu(this)) , m_bookmarksBar(0) , m_popup(new KPassivePopup(this)) , m_hidePopup(new QTimer(this)) , m_toolsMenu(0) { // creating a centralWidget containing panel, m_view and the hidden findbar QWidget *centralWidget = new QWidget; centralWidget->setContentsMargins(0, 0, 0, 0); // setting layout QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_view); layout->addWidget(m_findBar); layout->addWidget(m_zoomBar); centralWidget->setLayout(layout); // central widget setCentralWidget(centralWidget); // setting size policies setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // then, setup our actions setupActions(); // setting Panels setupPanels(); // setting up rekonq tools setupTools(); // setting up rekonq toolbar(s) setupToolbars(); // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. // It also applies the saved mainwindow settings, if any, and ask the // mainwindow to automatically save settings if changed: window size, // toolbar position, icon size, etc. setupGUI(); // no menu bar in rekonq: we have other plans.. menuBar()->setVisible(false); // no more status bar.. setStatusBar(0); // give me some time to do all the other stuffs... QTimer::singleShot(100, this, SLOT(postLaunch())); kDebug() << "MainWindow ctor...DONE"; }
PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : PCB_BASE_FRAME( parent, PCB_FRAME_TYPE, title, pos, size, style, PCB_EDIT_FRAME_NAME ) { m_FrameName = 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_HotkeysZoomAndGridList = g_Board_Editor_Hokeys_Descr; m_hasAutoSave = true; m_RecordingMacros = -1; m_microWaveToolBar = NULL; m_useCmpFileForFpNames = true; m_footprintLibTable = NULL; m_globalFootprintTable = NULL; m_rotationAngle = 900; #ifdef KICAD_SCRIPTING_WXPYTHON m_pythonPanel = NULL; #endif for ( int i = 0; i < 10; i++ ) m_Macros[i].m_Record.clear(); SetBoard( new BOARD() ); if( GetGalCanvas() ) { ViewReloadBoard( m_Pcb ); // update the tool manager with the new board and its view. if( m_toolManager ) m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(), GetGalCanvas()->GetViewControls(), this ); } // 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 ); SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); // PCB drawings start in the upper left corner. GetScreen()->m_Center = false; // LoadSettings() *after* creating m_LayersManager, because LoadSettings() // initialize parameters in m_LayersManager LoadSettings(); // Be sure options are updated m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayPadNum = DisplayOpt.DisplayPadNum; m_DisplayModEdge = DisplayOpt.DisplayModEdge; m_DisplayModText = DisplayOpt.DisplayModText; 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" ) ); 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) ); #ifdef KICAD_SCRIPTING_WXPYTHON // Add the scripting panel EDA_PANEINFO pythonAuiInfo; pythonAuiInfo.ScriptingToolbarPane(); pythonAuiInfo.Caption( wxT( "Python Scripting" ) ); pythonAuiInfo.MinSize( wxSize( 200, 100 ) ); pythonAuiInfo.BestSize( wxSize( GetClientSize().x/2, 200 ) ); pythonAuiInfo.Hide(); m_pythonPanel = CreatePythonShellWindow( this ); m_auimgr.AddPane( m_pythonPanel, pythonAuiInfo.Name( wxT( "PythonPanel" ) ).Bottom().Layer(9) ); m_pythonPanelHidden = true; #endif 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(); if( m_globalFootprintTable == NULL ) { try { m_globalFootprintTable = new FP_LIB_TABLE(); if( !FP_LIB_TABLE::LoadGlobalTable( *m_globalFootprintTable ) ) { DisplayInfoMessage( this, wxT( "You have run Pcbnew for the first time using the " "new footprint library table method for finding " "footprints. Pcbnew has either copied the default " "table or created an empty table in your home " "folder. You must first configure the library " "table to include all footprint libraries not " "included with KiCad. See the \"Footprint Library " "Table\" section of the CvPcb documentation for " "more information." ) ); } } catch( IO_ERROR ioe ) { wxString msg; msg.Printf( _( "An error occurred attempting to load the global footprint library " "table:\n\n%s" ), GetChars( ioe.errorText ) ); DisplayError( this, msg ); } } setupTools(); }