From 3b085f0d03504c46380d0d26b8e451093dea88b4 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 18 Feb 2018 14:21:23 +0000 Subject: [PATCH] Pcbnew new menubar structure --- include/id.h | 1 + include/pcb_base_frame.h | 6 + pcbnew/footprint_edit_frame.cpp | 19 +- pcbnew/menubar_pcb_editor.cpp | 400 +++++++++++++++--------- pcbnew/pcb_base_frame.cpp | 51 +++ pcbnew/pcb_edit_frame.cpp | 2 - pcbnew/pcbnew_config.cpp | 21 -- pcbnew/pcbnew_id.h | 2 - pcbnew/tool_pcb_editor.cpp | 8 - pcbnew/tools/footprint_editor_tools.cpp | 65 ---- pcbnew/tools/footprint_editor_tools.h | 14 - pcbnew/tools/pcb_actions.cpp | 3 + pcbnew/tools/pcb_actions.h | 1 + pcbnew/tools/pcbnew_control.cpp | 80 +++++ pcbnew/tools/pcbnew_control.h | 5 +- 15 files changed, 410 insertions(+), 268 deletions(-) diff --git a/include/id.h b/include/id.h index bfb6e14416..48eda944a1 100644 --- a/include/id.h +++ b/include/id.h @@ -278,6 +278,7 @@ enum main_id // Common to Pcbnew and CvPcb ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, ID_TB_OPTIONS_SHOW_PADS_SKETCH, ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 95b168898e..949348e23c 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -646,12 +646,18 @@ public: void OnTogglePolarCoords( wxCommandEvent& aEvent ); void OnTogglePadDrawMode( wxCommandEvent& aEvent ); + void OnToggleGraphicDrawMode( wxCommandEvent& aEvent ); + void OnToggleEdgeDrawMode( wxCommandEvent& aEvent ); + void OnToggleTextDrawMode( wxCommandEvent& aEvent ); virtual void OnSwitchCanvas( wxCommandEvent& aEvent ); // User interface update event handlers. void OnUpdateCoordType( wxUpdateUIEvent& aEvent ); void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent ); + void OnUpdateGraphicDrawMode( wxUpdateUIEvent& aEvent ); + void OnUpdateEdgeDrawMode( wxUpdateUIEvent& aEvent ); + void OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent ); void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent ); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 41c714cdfa..5840750c45 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -123,9 +123,10 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar ) - // Options Toolbar (ID_TB_OPTIONS_SHOW_PADS_SKETCH id is managed in PCB_BASE_FRAME) - EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) - EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) + // Options Toolbar + // ID_TB_OPTIONS_SHOW_PADS_SKETCH id is managed in PCB_BASE_FRAME + // ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH id is managed in PCB_BASE_FRAME + // ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH id is managed in PCB_BASE_FRAME EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) // Preferences and option menus @@ -205,10 +206,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) // Option toolbar: - EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, - FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) - EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, - FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) @@ -620,14 +617,6 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ) switch( id ) { - case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - state = displ_opts->m_DisplayModTextFill == SKETCH; - break; - - case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - state = displ_opts->m_DisplayModEdgeFill == SKETCH; - break; - case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: state = displ_opts->m_ContrastModeDisplay; break; diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 90942f2ef2..a95736ad40 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -41,8 +41,6 @@ #include "pcbnew_id.h" -// Build the place submenu -static void preparePlaceMenu( wxMenu* aParentMenu ); // Build the files menu. Because some commands are available only if // Pcbnew is run outside a project (run alone), aIsOutsideProject is false @@ -52,33 +50,36 @@ static void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ); // Build the export submenu (inside files menu) static void prepareExportMenu( wxMenu* aParentMenu ); -// Build the tools menu -static void prepareToolsMenu( wxMenu* aParentMenu ); - -// Build the help menu -static void prepareHelpMenu( wxMenu* aParentMenu ); - // Build the edit menu static void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal ); +// Build the view menu +static void prepareViewMenu( wxMenu* aParentMenu, bool aUseGal ); + +// Build the place submenu +static void preparePlaceMenu( wxMenu* aParentMenu ); + // Build the route menu static void prepareRouteMenu( wxMenu* aParentMenu ); -// Build the view menu -static void prepareViewMenu( wxMenu* aParentMenu ); - -// Build the dimensions menu -static void prepareDimensionsMenu( wxMenu* aParentMenu ); +// Build the inspect menu +static void prepareInspectMenu( wxMenu* aParentMenu ); // Build the library management menu static void prepareLibraryMenu( wxMenu* aParentMenu ); -// Build the design rules menu -static void prepareDesignRulesMenu( wxMenu* aParentMenu ); - // Build the preferences menu static void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu ); +// Build the tools menu +static void prepareToolsMenu( wxMenu* aParentMenu ); + +// Build the design rules menu +static void prepareSetupMenu( wxMenu* aParentMenu ); + +// Build the help menu +static void prepareHelpMenu( wxMenu* aParentMenu ); + void PCB_EDIT_FRAME::ReCreateMenuBar() { @@ -107,45 +108,36 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() //----- View menu ----------------------------------------------------------- wxMenu* viewMenu = new wxMenu; - prepareViewMenu( viewMenu ); + prepareViewMenu( viewMenu, IsGalCanvasActive() ); + + //----- Setup menu ---------------------------------------------------------- + wxMenu* setupMenu = new wxMenu; + prepareSetupMenu( setupMenu ); //----- Place Menu ---------------------------------------------------------- wxMenu* placeMenu = new wxMenu; preparePlaceMenu( placeMenu ); - //----------- Route Menu ---------------------------------------------------- + //----- Route Menu ---------------------------------------------------------- wxMenu* routeMenu = new wxMenu; prepareRouteMenu( routeMenu ); - //----- Preferences and configuration menu------------------------------------ - wxMenu* configmenu = new wxMenu; - prepareLibraryMenu( configmenu ); - configmenu->AppendSeparator(); - - preparePreferencesMenu( this, configmenu ); - - // Update menu labels: - configmenu->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER, - m_show_layer_manager_tools ? - _( "Hide La&yers Manager" ) : _("Show La&yers Manager" ) ); - configmenu->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, - m_show_microwave_tools ? - _( "Hide Microwa&ve Toolbar" ): _( "Show Microwa&ve Toolbar" ) ); - - - //--- dimensions submenu ------------------------------------------------------ - wxMenu* dimensionsMenu = new wxMenu; - prepareDimensionsMenu( dimensionsMenu ); + //----- Inspect Menu -------------------------------------------------------- + wxMenu* inspectMenu = new wxMenu; + prepareInspectMenu( inspectMenu ); //----- Tools menu ---------------------------------------------------------- wxMenu* toolsMenu = new wxMenu; prepareToolsMenu( toolsMenu ); - //----- Design Rules menu ----------------------------------------------------- - wxMenu* designRulesMenu = new wxMenu; - prepareDesignRulesMenu( designRulesMenu ); + //----- Preferences and configuration menu ---------------------------------- + wxMenu* configmenu = new wxMenu; + prepareLibraryMenu( configmenu ); + configmenu->AppendSeparator(); + + preparePreferencesMenu( this, configmenu ); - //------ Help menu ---------------------------------------------------------------- + //------ Help menu ---------------------------------------------------------- wxMenu* helpMenu = new wxMenu; prepareHelpMenu( helpMenu ); @@ -153,12 +145,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); + menuBar->Append( setupMenu, _( "&Setup" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( routeMenu, _( "Ro&ute" ) ); - menuBar->Append( configmenu, _( "P&references" ) ); - menuBar->Append( dimensionsMenu, _( "D&imensions" ) ); + menuBar->Append( inspectMenu, _( "&Inspect" ) ); menuBar->Append( toolsMenu, _( "&Tools" ) ); - menuBar->Append( designRulesMenu, _( "&Design Rules" ) ); + menuBar->Append( configmenu, _( "P&references" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); @@ -176,31 +168,48 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() } -// Build the design rules menu -void prepareDesignRulesMenu( wxMenu* aParentMenu ) +// Build the setup menu +void prepareSetupMenu( wxMenu* aParentMenu ) { + AddMenuItem( aParentMenu, ID_PCB_LAYERS_SETUP, + _( "&Layers Setup..." ), + _( "Enable and set layer properties" ), + KiBitmap( copper_layers_setup_xpm ) ); + AddMenuItem( aParentMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, _( "&Design Rules..." ), _( "Open design rules editor" ), KiBitmap( config_xpm ) ); - AddMenuItem( aParentMenu, ID_PCB_LAYERS_SETUP, - _( "&Layers Setup..." ), _( "Enable and set layer properties" ), - KiBitmap( copper_layers_setup_xpm ) ); + aParentMenu->AppendSeparator(); + + AddMenuItem( aParentMenu, ID_PCB_DRAWINGS_WIDTHS_SETUP, + _( "Te&xts and Drawings..." ), + _( "Adjust dimensions for texts and drawings" ), + KiBitmap( text_xpm ) ); + + AddMenuItem( aParentMenu, ID_PCB_PAD_SETUP, + _( "Default &Pad Properties..." ), + _( "Adjust default pad characteristics" ), + KiBitmap( pad_dimensions_xpm ) ); + + AddMenuItem( aParentMenu, ID_PCB_MASK_CLEARANCE, + _( "Pads to &Mask Clearance..." ), + _( "Adjust global clearance between pads and solder resist mask" ), + KiBitmap( pads_mask_layers_xpm ) ); + + AddMenuItem( aParentMenu, ID_MENU_DIFF_PAIR_DIMENSIONS, + _( "&Differential Pairs..." ), + _( "Define global gap/width for differential pairs." ), + KiBitmap( ps_diff_pair_xpm ) ); } // Build the preferences menu void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu ) { - AddMenuItem( aParentMenu, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER, - _( "Hide La&yers Manager" ), - HELP_SHOW_HIDE_LAYERMANAGER, - KiBitmap( layers_manager_xpm ) ); - AddMenuItem( aParentMenu, ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, - _( "Hide Microwa&ve Toolbar" ), - HELP_SHOW_HIDE_MICROWAVE_TOOLS, - KiBitmap( mw_toolbar_xpm ) ); + wxString text; + #ifdef __WXMAC__ aParentMenu->Append( wxID_PREFERENCES ); #else @@ -209,23 +218,47 @@ void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu ) KiBitmap( preference_xpm ) ); #endif - AddMenuItem( aParentMenu, ID_PCB_DISPLAY_OPTIONS_SETUP, - _( "&Display Settings..." ), - _( "Select how items (pads, tracks, texts) are displayed" ), + // Display Settings submenu + wxMenu* displaySettingsSubMenu = new wxMenu; + + AddMenuItem( displaySettingsSubMenu, ID_PCB_DISPLAY_OPTIONS_SETUP, + _( "&Display Options..." ), + _( "Graphics acceleration, grid, cursor, annotation and clearance outline settings." ), + KiBitmap( display_options_xpm ) ); + + displaySettingsSubMenu->AppendSeparator(); + + text = AddHotkeyName( _( "Legacy Graphic&s" ), g_Pcbnew_Editor_Hotkeys_Descr, + HK_CANVAS_LEGACY ); + displaySettingsSubMenu->Append( + new wxMenuItem( displaySettingsSubMenu, ID_MENU_CANVAS_LEGACY, + text, _( "Use legacy graphics mode (not all features will be available)" ), + wxITEM_RADIO ) ); + + text = AddHotkeyName( _( "Modern (&Accelerated)" ), g_Pcbnew_Editor_Hotkeys_Descr, + HK_CANVAS_OPENGL ); + displaySettingsSubMenu->Append( + new wxMenuItem( displaySettingsSubMenu, ID_MENU_CANVAS_OPENGL, + text, _( "Use modern hardware-accelerated (OpenGL) graphics mode (recommended)" ), + wxITEM_RADIO ) ); + + text = AddHotkeyName( _( "Modern (Fallba&ck)" ), g_Pcbnew_Editor_Hotkeys_Descr, + HK_CANVAS_CAIRO ); + displaySettingsSubMenu->Append( + new wxMenuItem( displaySettingsSubMenu, ID_MENU_CANVAS_CAIRO, + text, _( "Use modern fallback (Cairo) graphics mode" ), + wxITEM_RADIO ) ); + + AddMenuItem( aParentMenu, displaySettingsSubMenu, -1, + _( "&Display Settings" ), + _( "Select toolset and other display options" ), KiBitmap( display_options_xpm ) ); - AddMenuItem( aParentMenu, ID_MENU_INTERACTIVE_ROUTER_SETTINGS, - _( "&Interactive Routing..." ), - _( "Configure interactive router" ), - KiBitmap( add_tracks_xpm ) ); // fixme: icon // Language submenu aParentMenu->AppendSeparator(); Pgm().AddMenuLanguageList( aParentMenu ); - // Icons options submenu - aFrame->AddMenuIconsOptions( aParentMenu ); - // Hotkey submenu AddHotkeyConfigMenu( aParentMenu ); @@ -251,7 +284,8 @@ void prepareRouteMenu( wxMenu* aParentMenu ) text = AddHotkeyName( _( "&Single Track" ), g_Pcbnew_Editor_Hotkeys_Descr, HK_ADD_NEW_TRACK, IS_ACCELERATOR ); AddMenuItem( aParentMenu, ID_TRACK_BUTT, text, - _( "Interactively route single track" ), KiBitmap( add_tracks_xpm ) ); + _( "Interactively route single track" ), + KiBitmap( add_tracks_xpm ) ); AddMenuItem( aParentMenu, ID_DIFF_PAIR_BUTT, _( "&Differential Pair" ), @@ -274,6 +308,35 @@ void prepareRouteMenu( wxMenu* aParentMenu ) _( "Tune Differential Pair &Skew/Phase" ), _( "Tune skew/phase of a differential pair" ), KiBitmap( ps_diff_pair_tune_phase_xpm ) ); + + aParentMenu->AppendSeparator(); + + AddMenuItem( aParentMenu, ID_MENU_INTERACTIVE_ROUTER_SETTINGS, + _( "&Interactive Router Settings..." ), + _( "Configure interactive router" ), + KiBitmap( add_tracks_xpm ) ); // fixme: icon +} + + +// Build the inspect menu +void prepareInspectMenu( wxMenu* aParentMenu ) +{ + AddMenuItem( aParentMenu, ID_MENU_LIST_NETS, + _( "&List Nets" ), + _( "View list of nets with names and IDs" ), + KiBitmap( list_nets_xpm ) ); + + AddMenuItem( aParentMenu, ID_PCB_MEASUREMENT_TOOL, + _( "&Measure" ), + _( "Measure distance" ), + KiBitmap( measurement_xpm ) ); + + aParentMenu->AppendSeparator(); + + AddMenuItem( aParentMenu, ID_DRC_CONTROL, + _( "&Design Rules Checker" ), + _( "Perform design rules check" ), + KiBitmap( erc_xpm ) ); } @@ -281,11 +344,13 @@ void prepareRouteMenu( wxMenu* aParentMenu ) void prepareLibraryMenu( wxMenu* aParentMenu ) { AddMenuItem( aParentMenu, ID_PCB_LIB_WIZARD, - _( "&Footprint Library Wizard..." ), _( "Add footprint library using wizard" ), + _( "&Footprint Library Wizard..." ), + _( "Add footprint library using wizard" ), KiBitmap( wizard_add_fplib_small_xpm ) ); AddMenuItem( aParentMenu, ID_PCB_LIB_TABLE_EDIT, - _( "Footprint Li&brary Table..." ), _( "Configure footprint library table" ), + _( "Footprint Li&brary Table..." ), + _( "Configure footprint library table" ), KiBitmap( library_table_xpm ) ); // Path configuration edit dialog. @@ -304,7 +369,7 @@ void prepareLibraryMenu( wxMenu* aParentMenu ) } -// Build the place submenu +// Build the place menu void preparePlaceMenu( wxMenu* aParentMenu ) { wxString text; @@ -314,6 +379,10 @@ void preparePlaceMenu( wxMenu* aParentMenu ) AddMenuItem( aParentMenu, ID_PCB_MODULE_BUTT, text, _( "Add footprints" ), KiBitmap( module_xpm ) ); + AddMenuItem( aParentMenu, ID_PCB_DRAW_VIA_BUTT, + _( "&Via" ), + _( "Add vias" ), KiBitmap( add_via_xpm ) ); + AddMenuItem( aParentMenu, ID_PCB_ZONES_BUTT, _( "&Zone" ), _( "Add filled zones" ), KiBitmap( add_zone_xpm ) ); @@ -368,27 +437,30 @@ void preparePlaceMenu( wxMenu* aParentMenu ) // Build the tools menu void prepareToolsMenu( wxMenu* aParentMenu ) { + AddMenuItem( aParentMenu, ID_GET_NETLIST, + _( "Load &Netlist..." ), + _( "Read netlist and update board connectivity" ), + KiBitmap( netlist_xpm ) ); + AddMenuItem( aParentMenu, ID_UPDATE_PCB_FROM_SCH, _( "Update PCB from Schematic..." ), _( "Update PCB design with current schematic (forward annotation)" ), KiBitmap( import_brd_file_xpm ) ); - aParentMenu->AppendSeparator( ); + aParentMenu->AppendSeparator(); - AddMenuItem( aParentMenu, ID_GET_NETLIST, - _( "Load &Netlist..." ), - _( "Read netlist and update board connectivity" ), - KiBitmap( netlist_xpm ) ); + AddMenuItem( aParentMenu, ID_MENU_PCB_UPDATE_FOOTPRINTS, + _( "Update Footprints from Library..." ), + _( "Update footprints to include any changes from the library" ), + KiBitmap( reload_xpm ) ); + + aParentMenu->AppendSeparator(); AddMenuItem( aParentMenu, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, _( "Set &Layer Pair..." ), _( "Change active layer pair" ), KiBitmap( select_layer_pair_xpm ) ); - AddMenuItem( aParentMenu, ID_DRC_CONTROL, - _( "&Design Rules Checker" ), - _( "Perform design rules check" ), KiBitmap( erc_xpm ) ); - AddMenuItem( aParentMenu, ID_TOOLBARH_PCB_FREEROUTE_ACCESS, _( "&FreeRoute" ), _( "Fast access to the FreeROUTE external advanced router" ), @@ -506,11 +578,6 @@ void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal ) _( "Set text size and width of footprint fields" ), KiBitmap( reset_text_xpm ) ); - AddMenuItem( aParentMenu, ID_MENU_PCB_UPDATE_FOOTPRINTS, - _( "Update Footprints from Library..." ), - _( "Update footprints to include any changes from the library" ), - KiBitmap( reload_xpm ) ); - AddMenuItem( aParentMenu, ID_MENU_PCB_EXCHANGE_FOOTPRINTS, _( "Change Footprints..." ), _( "Assign different footprints from the library" ), @@ -535,9 +602,27 @@ void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal ) // Build the view menu -void prepareViewMenu( wxMenu* aParentMenu ) +void prepareViewMenu( wxMenu* aParentMenu, bool aUseGal ) { wxString text; + + AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, + _( "Show La&yers Manager" ), + HELP_SHOW_HIDE_LAYERMANAGER, + KiBitmap( layers_manager_xpm ), wxITEM_CHECK ); + + AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, + _( "Show Microwa&ve Toolbar" ), + HELP_SHOW_HIDE_MICROWAVE_TOOLS, + KiBitmap( mw_toolbar_xpm ), wxITEM_CHECK ); + + text = AddHotkeyName( _( "&3D Viewer" ), g_Pcbnew_Editor_Hotkeys_Descr, HK_3D_VIEWER ); + AddMenuItem( aParentMenu, ID_MENU_PCB_SHOW_3D_FRAME, + text, _( "Show board in 3D viewer" ), + KiBitmap( three_d_xpm ) ); + + aParentMenu->AppendSeparator(); + /* Important Note for ZOOM IN and ZOOM OUT commands from menubar: * we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command: @@ -568,81 +653,116 @@ void prepareViewMenu( wxMenu* aParentMenu ) aParentMenu->AppendSeparator(); - text = AddHotkeyName( _( "&3D Viewer" ), g_Pcbnew_Editor_Hotkeys_Descr, HK_3D_VIEWER ); + AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_GRID, + _( "Show &Grid" ), wxEmptyString, + KiBitmap( grid_xpm ), wxITEM_CHECK ); - AddMenuItem( aParentMenu, ID_MENU_PCB_SHOW_3D_FRAME, text, _( "Show board in 3D viewer" ), - KiBitmap( three_d_xpm ) ); + AddMenuItem( aParentMenu, ID_PCB_USER_GRID_SETUP, + _( "Grid &Settings..." ),_( "Adjust custom user-defined grid dimensions" ), + KiBitmap( grid_xpm ) ); - AddMenuItem( aParentMenu, ID_MENU_LIST_NETS, - _( "&List Nets" ), _( "View list of nets with names and IDs" ), - KiBitmap( list_nets_xpm ) ); + AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_POLAR_COORD, + _( "Display &Polar Coordinates" ), wxEmptyString, + KiBitmap( polar_coord_xpm ), wxITEM_CHECK ); - aParentMenu->AppendSeparator(); + // Units submenu + wxMenu* unitsSubMenu = new wxMenu; + AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_INCH, + _( "&Imperial" ), _( "Use imperial units" ), + KiBitmap( unit_inch_xpm ), wxITEM_RADIO ); - AddMenuItem( aParentMenu, ID_MENU_PCB_FLIP_VIEW, - _( "Flip &Board View" ), - _( "Flip (mirror) the board view" ), - KiBitmap( flip_board_xpm ), wxITEM_CHECK ); + AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_MM, + _( "&Metric" ), _( "Use metric units" ), + KiBitmap( unit_mm_xpm ), wxITEM_RADIO ); + + AddMenuItem( aParentMenu, unitsSubMenu, + -1, _( "&Units" ), + _( "Select which units are displayed" ), + KiBitmap( unit_mm_xpm ) ); +#ifndef __APPLE__ + AddMenuItem( aParentMenu, ID_TB_OPTIONS_SELECT_CURSOR, + _( "Full Window Crosshair" ), + _( "Change cursor shape" ), + KiBitmap( cursor_shape_xpm ), wxITEM_CHECK ); +#else + AddMenuItem( aParentMenu, ID_TB_OPTIONS_SELECT_CURSOR, + _( "Full Window Crosshair" ), + _( "Change cursor shape (not supported in Legacy graphics)" ), + KiBitmap( cursor_shape_xpm ), wxITEM_CHECK ); +#endif + aParentMenu->AppendSeparator(); - text = AddHotkeyName( _( "Legacy Graphic&s" ), g_Pcbnew_Editor_Hotkeys_Descr, - HK_CANVAS_LEGACY ); + AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_RATSNEST, + _( "Show Ratsnest" ), + _( "Show board ratsnest" ), + KiBitmap( general_ratsnest_xpm ), wxITEM_CHECK ); - aParentMenu->Append( - new wxMenuItem( aParentMenu, ID_MENU_CANVAS_LEGACY, - text, _( "Use legacy graphics mode (not all features will be available)" ), - wxITEM_RADIO ) ); + aParentMenu->AppendSeparator(); - text = AddHotkeyName( _( "Modern (&Accelerated)" ), g_Pcbnew_Editor_Hotkeys_Descr, - HK_CANVAS_OPENGL ); + // Drawing Mode Submenu + wxMenu* drawingModeSubMenu = new wxMenu; - aParentMenu->Append( - new wxMenuItem( aParentMenu, ID_MENU_CANVAS_OPENGL, - text, _( "Use modern hardware-accelerated (OpenGL) graphics mode (recommended)" ), - wxITEM_RADIO ) ); + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_ZONES, + _( "&Fill Zones" ), _( "Show filled areas in zones" ), + KiBitmap( show_zone_xpm ), wxITEM_RADIO ); - text = AddHotkeyName( _( "Modern (Fallba&ck)" ), g_Pcbnew_Editor_Hotkeys_Descr, - HK_CANVAS_CAIRO ); + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_ZONES_DISABLE, + _( "&Wireframe Zones" ), _( "Show outlines of filled areas only in zones" ), + KiBitmap( show_zone_disable_xpm ), wxITEM_RADIO ); - aParentMenu->Append( - new wxMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO, - text, _( "Use modern fallback (Cairo) graphics mode" ), - wxITEM_RADIO ) ); -} + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, + _( "&Sketch Zones" ), _( "Do not show filled areas in zones" ), + KiBitmap( show_zone_outline_only_xpm ), wxITEM_RADIO ); + drawingModeSubMenu->AppendSeparator(); -// Build the dimensions menu -void prepareDimensionsMenu( wxMenu* aParentMenu ) -{ - AddMenuItem( aParentMenu, ID_PCB_USER_GRID_SETUP, - _( "User Defined G&rid..." ),_( "Adjust custom user-defined grid dimensions" ), - KiBitmap( grid_xpm ) ); + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_PADS_SKETCH, + _( "Sketch &Pads" ), _( "Show pads in outline mode" ), + KiBitmap( pad_sketch_xpm ), wxITEM_CHECK ); - AddMenuItem( aParentMenu, ID_PCB_DRAWINGS_WIDTHS_SETUP, - _( "Te&xts and Drawings..." ), - _( "Adjust dimensions for texts and drawings" ), - KiBitmap( text_xpm ) ); + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_VIAS_SKETCH, + _( "Sketch &Vias" ), _( "Show vias in outline mode" ), + KiBitmap( via_sketch_xpm ), wxITEM_CHECK ); - AddMenuItem( aParentMenu, ID_PCB_PAD_SETUP, - _( "Default &Pad Properties..." ), _( "Adjust default pad characteristics" ), - KiBitmap( pad_dimensions_xpm ) ); + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, + _( "Sketch &Tracks" ), _( "Show tracks in outline mode" ), + KiBitmap( showtrack_xpm ), wxITEM_CHECK ); + + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, + _( "Sketch &Graphic Items" ), _( "Show graphic items in outline mode" ), + KiBitmap( text_sketch_xpm ), wxITEM_CHECK ); - AddMenuItem( aParentMenu, ID_PCB_MASK_CLEARANCE, - _( "Pads to &Mask Clearance..." ), - _( "Adjust global clearance between pads and solder resist mask" ), - KiBitmap( pads_mask_layers_xpm ) ); + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + _( "Sketch Footprint &Edges" ), _( "Show footprint edges in outline mode" ), + KiBitmap( show_mod_edge_xpm ), wxITEM_CHECK ); - AddMenuItem( aParentMenu, ID_MENU_DIFF_PAIR_DIMENSIONS, - _( "&Differential Pairs..." ), - _( "Define global gap/width for differential pairs." ), - KiBitmap( ps_diff_pair_xpm ) ); + AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, + _( "Sketch Footprint Te&xt" ), _( "Show footprint text in outline mode" ), + KiBitmap( text_sketch_xpm ), wxITEM_CHECK ); + + AddMenuItem( aParentMenu, drawingModeSubMenu, + -1, _( "&Drawing Mode" ), + _( "Select how items are displayed" ), + KiBitmap( add_zone_xpm ) ); + + + text = AddHotkeyName( _( "&High Contrast Mode" ), g_Pcbnew_Editor_Hotkeys_Descr, + HK_SWITCH_HIGHCONTRAST_MODE ); + AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, + text, _( "Use high contrast display mode" ), + KiBitmap( contrast_mode_xpm ), wxITEM_CHECK ); + + AddMenuItem( aParentMenu, ID_MENU_PCB_FLIP_VIEW, + _( "Flip &Board View" ), + _( "Flip (mirror) the board view" ), + KiBitmap( flip_board_xpm ), wxITEM_CHECK ); +#ifdef __APPLE__ aParentMenu->AppendSeparator(); - AddMenuItem( aParentMenu, ID_CONFIG_SAVE, - _( "&Save Preferences..." ), _( "Save dimension preferences" ), - KiBitmap( save_xpm ) ); +#endif } diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 515b19d310..e5f754d27e 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -81,9 +81,15 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnTogglePolarCoords ) EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnTogglePadDrawMode ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, PCB_BASE_FRAME::OnToggleGraphicDrawMode ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, PCB_BASE_FRAME::OnToggleEdgeDrawMode ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, PCB_BASE_FRAME::OnToggleTextDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnUpdateCoordType ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnUpdatePadDrawMode ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, PCB_BASE_FRAME::OnUpdateGraphicDrawMode ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, PCB_BASE_FRAME::OnUpdateEdgeDrawMode ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, PCB_BASE_FRAME::OnUpdateTextDrawMode ) EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid ) EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom ) // Switching canvases @@ -475,6 +481,30 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent ) } +void PCB_BASE_FRAME::OnToggleGraphicDrawMode( wxCommandEvent& aEvent ) +{ + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); + displ_opts->m_DisplayDrawItemsFill = !displ_opts->m_DisplayDrawItemsFill; + m_canvas->Refresh(); +} + + +void PCB_BASE_FRAME::OnToggleEdgeDrawMode( wxCommandEvent& aEvent ) +{ + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); + displ_opts->m_DisplayModEdgeFill = !displ_opts->m_DisplayModEdgeFill; + m_canvas->Refresh(); +} + + +void PCB_BASE_FRAME::OnToggleTextDrawMode( wxCommandEvent& aEvent ) +{ + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); + displ_opts->m_DisplayModTextFill = !displ_opts->m_DisplayModTextFill; + m_canvas->Refresh(); +} + + void PCB_BASE_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent ) { switch( aEvent.GetId() ) @@ -518,6 +548,27 @@ void PCB_BASE_FRAME::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent ) } +void PCB_BASE_FRAME::OnUpdateGraphicDrawMode( wxUpdateUIEvent& aEvent ) +{ + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); + aEvent.Check( !displ_opts->m_DisplayDrawItemsFill); +} + + +void PCB_BASE_FRAME::OnUpdateEdgeDrawMode( wxUpdateUIEvent& aEvent ) +{ + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); + aEvent.Check( !displ_opts->m_DisplayModEdgeFill ); +} + + +void PCB_BASE_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ) +{ + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); + aEvent.Check( !displ_opts->m_DisplayModTextFill ); +} + + void PCB_BASE_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent ) { // No need to update the grid select box if it doesn't exist or the grid setting change diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 43a0184253..062c594d5b 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -151,8 +151,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_CONFIG_READ, PCB_EDIT_FRAME::Process_Config ) EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, PCB_EDIT_FRAME::Process_Config ) - EVT_MENU( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER, PCB_EDIT_FRAME::Process_Config ) - EVT_MENU( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( wxID_PREFERENCES, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_PCB_LAYERS_SETUP, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_PCB_MASK_CLEARANCE, PCB_EDIT_FRAME::Process_Config ) diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 6e622e1c6b..1540584805 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -68,27 +68,6 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) switch( id ) { - case ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER: - m_show_layer_manager_tools = ! m_show_layer_manager_tools; - m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); - m_auimgr.Update(); - - GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER, - m_show_layer_manager_tools ? - _( "Hide &Layers Manager" ) : _( "Show &Layers Manager" )); - break; - - case ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR: - m_show_microwave_tools = ! m_show_microwave_tools; - m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); - m_auimgr.Update(); - - GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, - m_show_microwave_tools ? - _( "Hide Microwa&ve Toolbar" ): _( "Show Microwa&ve Toolbar" )); - break; - - case ID_PCB_LAYERS_SETUP: if( InvokeLayerSetup( this, GetBoard() ) ) { diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 02d35e49e5..e7d56a21d2 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -308,8 +308,6 @@ enum pcbnew_ids ID_PCB_3DSHAPELIB_WIZARD, ID_PCB_LIB_TABLE_EDIT, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, - ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER, - ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, ID_TB_OPTIONS_SHOW_ZONES, diff --git a/pcbnew/tool_pcb_editor.cpp b/pcbnew/tool_pcb_editor.cpp index 104d917ce5..c12d2d54d7 100644 --- a/pcbnew/tool_pcb_editor.cpp +++ b/pcbnew/tool_pcb_editor.cpp @@ -831,10 +831,6 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) m_show_microwave_tools = state; m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); m_auimgr.Update(); - - GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, - m_show_microwave_tools ? - _( "Hide Microwa&ve Toolbar" ): _( "Show Microwa&ve Toolbar" )); break; case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR: @@ -842,10 +838,6 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) m_show_layer_manager_tools = state; m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); m_auimgr.Update(); - - GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER, - m_show_layer_manager_tools ? - _( "Hide &Layers Manager" ) : _( "Show &Layers Manager" ) ); break; default: diff --git a/pcbnew/tools/footprint_editor_tools.cpp b/pcbnew/tools/footprint_editor_tools.cpp index d49b56b4cd..e381338d1f 100644 --- a/pcbnew/tools/footprint_editor_tools.cpp +++ b/pcbnew/tools/footprint_editor_tools.cpp @@ -78,14 +78,6 @@ TOOL_ACTION PCB_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads", AS_GLOBAL, 0, _( "Renumber Pads..." ), _( "Renumber pads by clicking on them in the desired order" ), pad_enumerate_xpm, AF_ACTIVATE ); -TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.ModuleEditor.graphicOutlines", - AS_GLOBAL, 0, - "", "" ); - -TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.ModuleEditor.textOutlines", - AS_GLOBAL, 0, - "", "" ); - MODULE_EDITOR_TOOLS::MODULE_EDITOR_TOOLS() : PCB_TOOL( "pcbnew.ModuleEditor" ) @@ -277,61 +269,6 @@ int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent ) } -int MODULE_EDITOR_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent ) -{ - KIGFX::PCB_VIEW* pcbview = view(); - - auto displ_opts = (PCB_DISPLAY_OPTIONS*)frame()->GetDisplayOptions(); - - // Switch the render mode: - bool enable = !displ_opts->m_DisplayModTextFill == SKETCH; - displ_opts->m_DisplayModTextFill = enable ? SKETCH : FILLED; - - pcbview->UpdateDisplayOptions( displ_opts ); - - for( auto module : board()->Modules() ) - { - for( auto item : module->GraphicalItems() ) - { - if( item->Type() == PCB_MODULE_TEXT_T ) - pcbview->Update( item, KIGFX::GEOMETRY ); - } - - pcbview->Update( &module->Reference(), KIGFX::GEOMETRY ); - pcbview->Update( &module->Value(), KIGFX::GEOMETRY ); - } - - frame()->GetGalCanvas()->Refresh(); - - return 0; -} - - -int MODULE_EDITOR_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent ) -{ - KIGFX::PCB_VIEW* pcbview = view(); - - auto displ_opts = (PCB_DISPLAY_OPTIONS*)frame()->GetDisplayOptions(); - // switch the render mode: - bool enable_outline_mode = !displ_opts->m_DisplayModEdgeFill == SKETCH; - displ_opts->m_DisplayModEdgeFill = enable_outline_mode ? SKETCH : FILLED; - - pcbview->UpdateDisplayOptions( displ_opts ); - - for( auto module : board()->Modules() ) - { - for( auto item : module->GraphicalItems() ) - { - if( item->Type() == PCB_MODULE_EDGE_T ) - pcbview->Update( item, KIGFX::GEOMETRY ); - } - } - - frame()->GetGalCanvas()->Refresh(); - - return 0; -} - int MODULE_EDITOR_TOOLS::ExplodePadToShapes( const TOOL_EVENT& aEvent ) { SELECTION& selection = m_toolMgr->GetTool()->GetSelection(); @@ -530,6 +467,4 @@ void MODULE_EDITOR_TOOLS::setTransitions() Go( &MODULE_EDITOR_TOOLS::CreatePadFromShapes, PCB_ACTIONS::createPadFromShapes.MakeEvent() ); Go( &MODULE_EDITOR_TOOLS::ExplodePadToShapes, PCB_ACTIONS::explodePadToShapes.MakeEvent() ); Go( &MODULE_EDITOR_TOOLS::EnumeratePads, PCB_ACTIONS::enumeratePads.MakeEvent() ); - Go( &MODULE_EDITOR_TOOLS::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() ); - Go( &MODULE_EDITOR_TOOLS::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() ); } diff --git a/pcbnew/tools/footprint_editor_tools.h b/pcbnew/tools/footprint_editor_tools.h index 3524fc1935..56fb5e2ffe 100644 --- a/pcbnew/tools/footprint_editor_tools.h +++ b/pcbnew/tools/footprint_editor_tools.h @@ -68,20 +68,6 @@ public: */ int CreateArray( TOOL_EVENT& aEvent ); - /** - * Function ModuleTextOutlines() - * - * Toggles display mode for module texts (outline/filled). - */ - int ModuleTextOutlines( const TOOL_EVENT& aEvent ); - - /** - * Function ModuleEdgeOutlines() - * - * Toggles display mode for module edges (outline/filled). - */ - int ModuleEdgeOutlines( const TOOL_EVENT& aEvent ); - /** * Function CreatePadFromShapes() * diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index bc10bc298b..83ff15e819 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -133,6 +133,9 @@ OPT PCB_ACTIONS::TranslateLegacyId( int aId ) case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY: return PCB_ACTIONS::zoneDisplayOutlines.MakeEvent(); + case ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH:; + return PCB_ACTIONS::graphicDisplayMode.MakeEvent(); + case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: return PCB_ACTIONS::moduleEdgeOutlines.MakeEvent(); diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index af596e0e92..ed714b3219 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -257,6 +257,7 @@ public: static TOOL_ACTION trackDisplayMode; static TOOL_ACTION padDisplayMode; static TOOL_ACTION viaDisplayMode; + static TOOL_ACTION graphicDisplayMode; static TOOL_ACTION zoneDisplayEnable; static TOOL_ACTION zoneDisplayDisable; static TOOL_ACTION zoneDisplayOutlines; diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index f1266b6570..39a85a20ce 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -80,6 +80,18 @@ TOOL_ACTION PCB_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode", AS_GLOBAL, 0, "", "" ); +TOOL_ACTION PCB_ACTIONS::graphicDisplayMode( "pcbnew.Control.graphicDisplayMode", + AS_GLOBAL, 0, + "", "" ); + +TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.Control.graphicOutlines", + AS_GLOBAL, 0, + "", "" ); + +TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.Control.textOutlines", + AS_GLOBAL, 0, + "", "" ); + TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable", AS_GLOBAL, 0, "", "" ); @@ -318,6 +330,71 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent ) } +int PCBNEW_CONTROL::GraphicDisplayMode( const TOOL_EVENT& aEvent ) +{ + auto opts = displayOptions(); + + Flip( opts->m_DisplayDrawItemsFill ); + view()->UpdateDisplayOptions( opts ); + + for( auto item : board()->Drawings() ) + { + view()->Update( item, KIGFX::GEOMETRY ); + } + + canvas()->Refresh(); + + return 0; +} + + +int PCBNEW_CONTROL::ModuleEdgeOutlines( const TOOL_EVENT& aEvent ) +{ + auto opts = displayOptions(); + + Flip( opts->m_DisplayModEdgeFill ); + view()->UpdateDisplayOptions( opts ); + + for( auto module : board()->Modules() ) + { + for( auto item : module->GraphicalItems() ) + { + if( item->Type() == PCB_MODULE_EDGE_T ) + view()->Update( item, KIGFX::GEOMETRY ); + } + } + + canvas()->Refresh(); + + return 0; +} + + +int PCBNEW_CONTROL::ModuleTextOutlines( const TOOL_EVENT& aEvent ) +{ + auto opts = displayOptions(); + + Flip( opts->m_DisplayModTextFill ); + view()->UpdateDisplayOptions( opts ); + + for( auto module : board()->Modules() ) + { + for( auto item : module->GraphicalItems() ) + { + if( item->Type() == PCB_MODULE_TEXT_T ) + view()->Update( item, KIGFX::GEOMETRY ); + } + + view()->Update( &module->Reference(), KIGFX::GEOMETRY ); + view()->Update( &module->Value(), KIGFX::GEOMETRY ); + } + + canvas()->Refresh(); + + return 0; +} + + int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent ) { auto opts = displayOptions(); @@ -1013,6 +1090,9 @@ void PCBNEW_CONTROL::setTransitions() Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() ); + Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() ); + Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() ); + Go( &PCBNEW_CONTROL::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() ); diff --git a/pcbnew/tools/pcbnew_control.h b/pcbnew/tools/pcbnew_control.h index aafcd6fc6c..69c7cccdee 100644 --- a/pcbnew/tools/pcbnew_control.h +++ b/pcbnew/tools/pcbnew_control.h @@ -51,10 +51,13 @@ public: void Reset( RESET_REASON aReason ) override; // Display modes + int ZoneDisplayMode( const TOOL_EVENT& aEvent ); int TrackDisplayMode( const TOOL_EVENT& aEvent ); int PadDisplayMode( const TOOL_EVENT& aEvent ); int ViaDisplayMode( const TOOL_EVENT& aEvent ); - int ZoneDisplayMode( const TOOL_EVENT& aEvent ); + int GraphicDisplayMode( const TOOL_EVENT& aEvent ); + int ModuleEdgeOutlines( const TOOL_EVENT& aEvent ); + int ModuleTextOutlines( const TOOL_EVENT& aEvent ); int HighContrastMode( const TOOL_EVENT& aEvent ); int HighContrastInc( const TOOL_EVENT& aEvent ); int HighContrastDec( const TOOL_EVENT& aEvent );