From b2124a34dce89b0869203d518f9b33493235933e Mon Sep 17 00:00:00 2001 From: Michael Kavanagh Date: Sun, 27 Sep 2020 18:27:25 +0100 Subject: [PATCH] Add grid properties context menu to grid toolbar Fixes https://gitlab.com/kicad/code/kicad/issues/5663 --- eeschema/libedit/toolbars_libedit.cpp | 7 +++++++ eeschema/toolbars_sch_editor.cpp | 6 ++++++ pcbnew/toolbars_footprint_editor.cpp | 7 +++++++ pcbnew/toolbars_pcb_editor.cpp | 5 +++++ 4 files changed, 25 insertions(+) diff --git a/eeschema/libedit/toolbars_libedit.cpp b/eeschema/libedit/toolbars_libedit.cpp index bac60b467d..9ae093187e 100644 --- a/eeschema/libedit/toolbars_libedit.cpp +++ b/eeschema/libedit/toolbars_libedit.cpp @@ -32,7 +32,9 @@ #include #include #include +#include #include +#include #ifdef __UNIX__ #define LISTBOX_WIDTH 140 @@ -165,5 +167,10 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->Add( EE_ACTIONS::showElectricalTypes, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( EE_ACTIONS::showComponentTree, ACTION_TOOLBAR::TOGGLE ); + EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); + std::unique_ptr gridMenu = std::make_unique( false, selTool ); + gridMenu->Add( ACTIONS::gridProperties ); + m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); + m_optionsToolBar->Realize(); } diff --git a/eeschema/toolbars_sch_editor.cpp b/eeschema/toolbars_sch_editor.cpp index f406942f5b..3b6a426897 100644 --- a/eeschema/toolbars_sch_editor.cpp +++ b/eeschema/toolbars_sch_editor.cpp @@ -32,6 +32,7 @@ #include #include #include +#include /* Create the main Horizontal Toolbar for the schematic editor */ @@ -176,5 +177,10 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->Add( EE_ACTIONS::toggleHiddenPins, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( EE_ACTIONS::toggleForceHV, ACTION_TOOLBAR::TOGGLE ); + EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); + std::unique_ptr gridMenu = std::make_unique( false, selTool ); + gridMenu->Add( ACTIONS::gridProperties ); + m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); + m_optionsToolBar->Realize(); } diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index f145cb2030..ed8b0d5313 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -27,7 +27,9 @@ #include #include #include +#include #include +#include #include void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() @@ -204,6 +206,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddScaledSeparator( this ); m_optionsToolBar->Add( PCB_ACTIONS::toggleFootprintTree, ACTION_TOOLBAR::TOGGLE ); + SELECTION_TOOL* selTool = m_toolManager->GetTool(); + std::unique_ptr gridMenu = std::make_unique( false, selTool ); + gridMenu->Add( ACTIONS::gridProperties ); + m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); + m_optionsToolBar->Realize(); } diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 88f6f35610..a7ccce5e23 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -366,6 +366,11 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddScaledSeparator( this ); m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE ); + SELECTION_TOOL* selTool = m_toolManager->GetTool(); + std::unique_ptr gridMenu = std::make_unique( false, selTool ); + gridMenu->Add( ACTIONS::gridProperties ); + m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); + m_optionsToolBar->Realize(); }