Prevent the board setup dialog from opening when DRC is open
The board setup dialog controls DRC error visibility, so the two dialogs shouldn't be open at the same time to prevent data contention. Follow-up to https://gitlab.com/kicad/code/kicad/-/issues/4023
This commit is contained in:
parent
457f12a5df
commit
f079c41118
|
@ -150,6 +150,15 @@ int DRC::ShowDRCDialog( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
bool DRC::IsDRCDialogShown()
|
||||
{
|
||||
if( m_drcDialog )
|
||||
return m_drcDialog->IsShown();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void DRC::addMarkerToPcb( MARKER_PCB* aMarker )
|
||||
{
|
||||
BOARD_COMMIT commit( m_pcbEditorFrame );
|
||||
|
|
|
@ -381,6 +381,13 @@ public:
|
|||
|
||||
int ShowDRCDialog( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Check to see if the DRC dialog is currently shown
|
||||
*
|
||||
* @return true if the dialog is shown
|
||||
*/
|
||||
bool IsDRCDialogShown();
|
||||
|
||||
/**
|
||||
* Deletes this ui dialog box and zeros out its pointer to remember
|
||||
* the state of the dialog's existence.
|
||||
|
|
|
@ -24,16 +24,17 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pcb_edit_frame.h>
|
||||
|
||||
#include "help_common_strings.h"
|
||||
#include "pcbnew.h"
|
||||
#include "pcbnew_id.h"
|
||||
#include <advanced_config.h>
|
||||
#include <drc/drc.h>
|
||||
#include <filehistory.h>
|
||||
#include <help_common_strings.h>
|
||||
#include <kiface_i.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <pgm_base.h>
|
||||
#include <advanced_config.h>
|
||||
#include <tool/actions.h>
|
||||
#include <tool/conditional_menu.h>
|
||||
#include <tool/selection_conditions.h>
|
||||
|
@ -168,8 +169,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
fileMenu->AddMenu( submenuFabOutputs, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
auto enableBoardSetupCondition = [ this ] ( const SELECTION& sel ) {
|
||||
if( DRC* tool = m_toolManager->GetTool<DRC>() )
|
||||
return !tool->IsDRCDialogShown();
|
||||
|
||||
return true;
|
||||
};
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddItem( PCB_ACTIONS::boardSetup, SELECTION_CONDITIONS::ShowAlways );
|
||||
fileMenu->AddItem( PCB_ACTIONS::boardSetup, enableBoardSetupCondition );
|
||||
|
||||
fileMenu->AddSeparator();
|
||||
fileMenu->AddItem( ACTIONS::pageSettings, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
|
Loading…
Reference in New Issue