From 29aabcf77e25e8903c0e3e169bf99ffd03a2faf4 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 5 Jun 2023 10:32:11 +0100 Subject: [PATCH] Naming clarity. No functional changes. --- pcbnew/footprint_edit_frame.h | 5 +++-- pcbnew/initpcb.cpp | 8 ++++---- pcbnew/pcb_base_edit_frame.cpp | 10 +++++----- pcbnew/pcb_edit_frame.h | 5 +++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index aa4d897c12..62157b0f2a 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -196,9 +196,10 @@ public: /** * Delete all and reinitialize the current board. * - * @param aQuery = true to prompt user for confirmation, false to initialize silently + * @param doAskAboutUnsavedChanges = true to prompt user for confirmation if existing board + * contains unsaved changes, false to re-initialize silently */ - bool Clear_Pcb( bool aQuery ); + bool Clear_Pcb( bool doAskAboutUnsavedChanges ); /// Return the LIB_ID of the part or library selected in the footprint tree. LIB_ID GetTreeFPID() const; diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index ad49a6dccd..302a7e3394 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -39,12 +39,12 @@ #include -bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery, bool aFinal ) +bool PCB_EDIT_FRAME::Clear_Pcb( bool doAskAboutUnsavedChanges, bool aFinal ) { if( GetBoard() == nullptr ) return false; - if( aQuery && !GetBoard()->IsEmpty() ) + if( doAskAboutUnsavedChanges && !GetBoard()->IsEmpty() ) { if( !IsOK( this, _( "Current Board will be lost and this operation cannot be undone. " "Continue?" ) ) ) @@ -93,14 +93,14 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery, bool aFinal ) } -bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery ) +bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool doAskAboutUnsavedChanges ) { if( GetBoard() == nullptr ) return false; bool is_last_fp_from_brd = IsCurrentFPFromBoard(); - if( aQuery && IsContentModified() ) + if( doAskAboutUnsavedChanges && IsContentModified() ) { wxSafeYield( this, true ); // Allow frame to come to front before showing warning. diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index dda6eb52cc..d0ac06a542 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 CERN - * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -189,9 +189,9 @@ void PCB_BASE_EDIT_FRAME::ActivateGalCanvas() void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter ) { - bool new_board = ( aBoard != m_pcb ); + bool is_new_board = ( aBoard != m_pcb ); - if( new_board ) + if( is_new_board ) { if( m_toolManager ) m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); @@ -204,7 +204,7 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter GetCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetDesignSettings().GetGridOrigin() ) ); - if( new_board ) + if( is_new_board ) { BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings(); bds.m_DRCEngine = std::make_shared( aBoard, &bds ); @@ -219,7 +219,7 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter m_toolManager->SetEnvironment( aBoard, GetCanvas()->GetView(), GetCanvas()->GetViewControls(), config(), this ); - if( new_board ) + if( is_new_board ) m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); } } diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index ea98b473a6..d80e402734 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -411,10 +411,11 @@ public: /** * Delete all and reinitialize the current board. * - * @param aQuery true to prompt user for confirmation, false to initialize silently. + * @param doAskAboutUnsavedChanges true to prompt user if existing board contains unsaved + * changes, false to re-initialize silently. * @param aFinal if true, we are clearing the board to exit, so don't run more events. */ - bool Clear_Pcb( bool aQuery, bool aFinal = false ); + bool Clear_Pcb( bool doAskAboutUnsavedChanges, bool aFinal = false ); ///< @copydoc PCB_BASE_FRAME::SetBoard() void SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter = nullptr ) override