diff --git a/3d-viewer/3d_cache/dialogs/3d_cache_dialogs.cpp b/3d-viewer/3d_cache/dialogs/3d_cache_dialogs.cpp index b0be2a30dd..f41e7893b2 100644 --- a/3d-viewer/3d_cache/dialogs/3d_cache_dialogs.cpp +++ b/3d-viewer/3d_cache/dialogs/3d_cache_dialogs.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2016 Cirilo Bernardo - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,7 +33,7 @@ bool S3D::Select3DModel( wxWindow* aParent, S3D_CACHE* aCache, wxString& prevModelSelectDir, int& prevModelWildcard, FP_3DMODEL* aModel ) { - if( NULL == aModel ) + if( nullptr == aModel ) return false; DIALOG_SELECT_3DMODEL dm( aParent, aCache, aModel, prevModelSelectDir, prevModelWildcard ); diff --git a/3d-viewer/3d_cache/dialogs/panel_preview_3d_model.cpp b/3d-viewer/3d_cache/dialogs/panel_preview_3d_model.cpp index a1b7488f05..cd55a23213 100644 --- a/3d-viewer/3d_cache/dialogs/panel_preview_3d_model.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_preview_3d_model.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2016 Mario Luzeiro * Copyright (C) 2015 Cirilo Bernardo * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -123,7 +123,8 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 ); for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } ) - Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), NULL, this ); + Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr, + this ); #ifdef __WXOSX__ // Call layout once to get the proper button sizes after the bitmaps have been set diff --git a/3d-viewer/3d_cache/sg/sg_coordindex.cpp b/3d-viewer/3d_cache/sg/sg_coordindex.cpp index e7171d374a..46e423333e 100644 --- a/3d-viewer/3d_cache/sg/sg_coordindex.cpp +++ b/3d-viewer/3d_cache/sg/sg_coordindex.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Cirilo Bernardo - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -29,7 +29,7 @@ SGCOORDINDEX::SGCOORDINDEX( SGNODE* aParent ) : SGINDEX( aParent ) { m_SGtype = S3D::SGTYPE_COORDINDEX; - if( NULL != aParent && S3D::SGTYPE_FACESET == aParent->GetNodeType() ) + if( nullptr != aParent && S3D::SGTYPE_FACESET == aParent->GetNodeType() ) { m_Parent->AddChildNode( this ); } diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 1bc084e8d2..387d488d5d 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -79,6 +79,7 @@ static const wxSize minSize( FRAME_T aFrameType ) } } + static const wxSize defaultSize( FRAME_T aFrameType ) { switch( aFrameType ) @@ -147,6 +148,7 @@ void EDA_BASE_FRAME::commonInit( FRAME_T aFrameType ) initExitKey(); } + EDA_BASE_FRAME::EDA_BASE_FRAME( FRAME_T aFrameType, KIWAY* aKiway ) : wxFrame(), TOOLS_HOLDER(), @@ -155,6 +157,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( FRAME_T aFrameType, KIWAY* aKiway ) : commonInit( aFrameType ); } + EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize, long aStyle, const wxString& aFrameName, KIWAY* aKiway ) : @@ -398,8 +401,8 @@ void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAM #else bool canCheck = true; - // wxMenuItems don't want to be checked unless they actually are checkable, so we have to check to - // see if they can be and can't just universally apply a check in this event. + // wxMenuItems don't want to be checked unless they actually are checkable, so we have to + // check to see if they can be and can't just universally apply a check in this event. if( auto menu = dynamic_cast( aEvent.GetEventObject() ) ) canCheck = menu->FindItem( aEvent.GetId() )->IsCheckable(); @@ -554,7 +557,8 @@ void EDA_BASE_FRAME::LoadWindowState( const WINDOW_STATE& aState ) m_frameSize = defaultSize( m_ident ); wasDefault = true; - wxLogTrace( traceDisplayLocation, "Using minimum size (%d, %d)", m_frameSize.x, m_frameSize.y ); + wxLogTrace( traceDisplayLocation, "Using minimum size (%d, %d)", + m_frameSize.x, m_frameSize.y ); } wxLogTrace( traceDisplayLocation, "Number of displays: %d", wxDisplay::GetCount() ); @@ -723,7 +727,8 @@ void EDA_BASE_FRAME::SaveWindowSettings( WINDOW_SETTINGS* aCfg ) aCfg->state.maximized = IsMaximized(); aCfg->state.display = wxDisplay::GetFromWindow( this ); - wxLogTrace( traceDisplayLocation, "Saving window maximized: %s", IsMaximized() ? "true" : "false" ); + wxLogTrace( traceDisplayLocation, "Saving window maximized: %s", + IsMaximized() ? "true" : "false" ); wxLogTrace( traceDisplayLocation, "Saving config position (%d, %d) with size (%d, %d)", m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y ); @@ -966,7 +971,7 @@ void EDA_BASE_FRAME::ClearFileHistory( FILE_HISTORY* aFileHistory ) void EDA_BASE_FRAME::OnKicadAbout( wxCommandEvent& event ) { - void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp + void ShowAboutDialog( EDA_BASE_FRAME * aParent ); // See AboutDialog_main.cpp ShowAboutDialog( this ); } @@ -1194,8 +1199,10 @@ void EDA_BASE_FRAME::OnMaximize( wxMaximizeEvent& aEvent ) { m_normalFrameSize = GetWindowSize(); m_normalFramePos = GetPosition(); - wxLogTrace( traceDisplayLocation, "Maximizing window - Saving position (%d, %d) with size (%d, %d)", - m_normalFramePos.x, m_normalFramePos.y, m_normalFrameSize.x, m_normalFrameSize.y ); + wxLogTrace( traceDisplayLocation, + "Maximizing window - Saving position (%d, %d) with size (%d, %d)", + m_normalFramePos.x, m_normalFramePos.y, + m_normalFrameSize.x, m_normalFrameSize.y ); } // Skip event to actually maximize the window diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 80d943c010..8a93a9ae6f 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -84,20 +84,20 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ) { m_socketServer = nullptr; - m_mainToolBar = NULL; - m_drawToolBar = NULL; - m_optionsToolBar = NULL; - m_auxiliaryToolBar = NULL; - m_gridSelectBox = NULL; - m_zoomSelectBox = NULL; + m_mainToolBar = nullptr; + m_drawToolBar = nullptr; + m_optionsToolBar = nullptr; + m_auxiliaryToolBar = nullptr; + m_gridSelectBox = nullptr; + m_zoomSelectBox = nullptr; m_firstRunDialogSetting = 0; m_undoRedoCountMax = DEFAULT_MAX_UNDO_ITEMS; m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE; - m_canvas = NULL; - m_toolDispatcher = NULL; - m_messagePanel = NULL; - m_currentScreen = NULL; + m_canvas = nullptr; + m_toolDispatcher = nullptr; + m_messagePanel = nullptr; + m_currentScreen = nullptr; m_showBorderAndTitleBlock = false; // true to display reference sheet. m_gridColor = COLOR4D( DARKGRAY ); // Default grid color m_showPageLimits = false; @@ -185,7 +185,7 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME() delete m_canvas; delete m_currentScreen; - m_currentScreen = NULL; + m_currentScreen = nullptr; delete m_findReplaceData; @@ -292,7 +292,7 @@ void EDA_DRAW_FRAME::UpdateGridSelectBox() UpdateStatusBar(); DisplayUnitsMsg(); - if( m_gridSelectBox == NULL ) + if( m_gridSelectBox == nullptr ) return; // Update grid values with the current units setting. @@ -315,7 +315,7 @@ void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent ) { // No need to update the grid select box if it doesn't exist or the grid setting change // was made using the select box. - if( m_gridSelectBox == NULL ) + if( m_gridSelectBox == nullptr ) return; int idx = config()->m_Window.grid.last_size_idx; @@ -332,9 +332,6 @@ void EDA_DRAW_FRAME::PrintPage( const RENDER_SETTINGS* aSettings ) } -/* - * Respond to selections in the toolbar grid popup - */ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event ) { wxCHECK_RET( m_gridSelectBox, "m_gridSelectBox uninitialized" ); @@ -411,7 +408,7 @@ void EDA_DRAW_FRAME::SetGridVisibility( bool aVisible ) void EDA_DRAW_FRAME::UpdateZoomSelectBox() { - if( m_zoomSelectBox == NULL ) + if( m_zoomSelectBox == nullptr ) return; double zoom = m_canvas->GetGAL()->GetZoomFactor(); @@ -434,7 +431,7 @@ void EDA_DRAW_FRAME::UpdateZoomSelectBox() void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent ) { - if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL ) + if( m_zoomSelectBox == nullptr || m_zoomSelectBox->GetParent() == nullptr ) return; int current = 0; // display Auto if no match found @@ -456,9 +453,6 @@ void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent ) } -/* - * Respond to selections in the toolbar zoom popup - */ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event ) { wxCHECK_RET( m_zoomSelectBox, "m_zoomSelectBox uninitialized" ); @@ -522,7 +516,8 @@ void EDA_DRAW_FRAME::DisplayGridMsg() wxString line; line.Printf( "grid %s", - MessageTextFromValue( GetUserUnits(), GetCanvas()->GetGAL()->GetGridSize().x, false ) ); + MessageTextFromValue( GetUserUnits(), GetCanvas()->GetGAL()->GetGridSize().x, + false ) ); SetStatusText( line, 4 ); } @@ -671,8 +666,8 @@ void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList ) } -void EDA_DRAW_FRAME::SetMsgPanel( - const wxString& aTextUpper, const wxString& aTextLower, int aPadding ) +void EDA_DRAW_FRAME::SetMsgPanel( const wxString& aTextUpper, const wxString& aTextLower, + int aPadding ) { if( m_messagePanel ) { @@ -842,7 +837,8 @@ wxWindow* findDialog( wxWindowList& aList ) if( dynamic_cast( window ) ) return window; } - return NULL; + + return nullptr; } @@ -876,7 +872,7 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos ) if( dialog ) { BOX2D dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ), - dialog->GetSize() ); + dialog->GetSize() ); GetCanvas()->GetView()->SetCenter( aPos, dialogRect ); } else @@ -889,6 +885,7 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos ) static const wxString productName = wxT( "KiCad E.D.A. " ); + void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo, const wxString& aFullSheetName, const wxString& aFileName, const TITLE_BLOCK& aTitleBlock, int aSheetCount, diff --git a/common/kiway_player.cpp b/common/kiway_player.cpp index ccb1d043ae..e7bccfad83 100644 --- a/common/kiway_player.cpp +++ b/common/kiway_player.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -53,8 +53,8 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle, - const wxPoint& aPos, const wxSize& aSize, long aStyle, - const wxString& aWdoName ) : + const wxPoint& aPos, const wxSize& aSize, long aStyle, + const wxString& aWdoName ) : EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName, nullptr ), m_modal( false ), m_modal_loop( nullptr ), @@ -64,6 +64,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a { } + KIWAY_PLAYER::~KIWAY_PLAYER() throw() {} @@ -83,7 +84,7 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow It works in tandem with DismissModal(). But only ShowModal() is in the vtable and therefore cross-module capable. - */ + */ // This is an exception safe way to zero a pointer before returning. // Yes, even though DismissModal() clears this first normally, this is @@ -114,8 +115,10 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow std::vector enabledTopLevelWindows; for( unsigned ii = 0; ii < wlist.size(); ii++ ) + { if( wlist[ii]->IsTopLevel() && wlist[ii]->IsEnabled() ) enabledTopLevelWindows.push_back( wlist[ii] ); + } // exception safe way to disable all top level windows except the modal one, // re-enables only those that were disabled on exit @@ -147,11 +150,13 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow return m_modal_ret_val; } + bool KIWAY_PLAYER::Destroy() { return EDA_BASE_FRAME::Destroy(); } + bool KIWAY_PLAYER::IsDismissed() { return !m_modal_loop; @@ -189,3 +194,6 @@ void KIWAY_PLAYER::language_change( wxCommandEvent& event ) } + +// LocalWords: ShowModal DismissModal vtable wxWindowDisabler aui +// LocalWords: miniframe reenables KIWAY PLAYERs diff --git a/common/widgets/progress_reporter.cpp b/common/widgets/progress_reporter.cpp index 27f595bfcf..41c779352a 100644 --- a/common/widgets/progress_reporter.cpp +++ b/common/widgets/progress_reporter.cpp @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * Author: Tomasz Wlostowski * * This program is free software; you can redistribute it and/or @@ -74,7 +76,7 @@ void PROGRESS_REPORTER::SetMaxProgress( int aMaxProgress ) void PROGRESS_REPORTER::SetCurrentProgress( double aProgress ) { m_maxProgress.store( 1000 ); - m_progress.store( (int) (aProgress * 1000.0) ); + m_progress.store( (int) ( aProgress * 1000.0 ) ); } @@ -119,6 +121,7 @@ bool PROGRESS_REPORTER::KeepRefreshing( bool aWait ) wxMilliSleep( 20 ); } + return true; } else @@ -174,6 +177,7 @@ bool WX_PROGRESS_REPORTER::updateUI() bool msgChanged = false; wxString message; + { std::lock_guard guard( m_mutex ); message = m_rptMessage; @@ -207,10 +211,7 @@ bool GAUGE_PROGRESS_REPORTER::updateUI() cur = 0; wxGauge::SetValue( cur ); - wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI); + wxEventLoopBase::GetActive()->YieldFor( wxEVT_CATEGORY_UI ); return true; // No cancel button on a wxGauge } - - - diff --git a/include/widgets/progress_reporter.h b/include/widgets/progress_reporter.h index 54cc1b8342..0e993c8492 100644 --- a/include/widgets/progress_reporter.h +++ b/include/widgets/progress_reporter.h @@ -2,8 +2,10 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * Author: Tomasz Wlostowski -* + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -30,7 +32,7 @@ #include #include -#if wxCHECK_VERSION(3, 1, 0) +#if wxCHECK_VERSION( 3, 1, 0 ) #include #endif @@ -52,58 +54,63 @@ public: } /** - * sets the number of phases + * Set the number of phases. */ void SetNumPhases( int aNumPhases ); void AddPhases( int aNumPhases ); /** - * initialize the aPhase virtual zone of the dialog progress bar + * Initialize the \a aPhase virtual zone of the dialog progress bar. */ virtual void BeginPhase( int aPhase ); /** - * Uses the next available virtual zone of the dialog progress bar + * Use the next available virtual zone of the dialog progress bar. */ virtual void AdvancePhase(); /** - * Uses the next available virtual zone of the dialog progress bar and updates + * Use the next available virtual zone of the dialog progress bar and updates * the message. */ virtual void AdvancePhase( const wxString& aMessage ); /** - * Display aMessage in the progress bar dialog + * Display \a aMessage in the progress bar dialog. */ virtual void Report( const wxString& aMessage ); /** - * Set the progress value to aProgress (0..1) + * Set the progress value to aProgress (0..1). */ virtual void SetCurrentProgress( double aProgress ); /** - * Fix the value thar gives the 100 percent progress bar length - * (inside the current virtual zone) + * Fix the value that gives the 100 percent progress bar length + * (inside the current virtual zone). */ void SetMaxProgress( int aMaxProgress ); /** - * Increment the progress bar length (inside the current virtual zone) + * Increment the progress bar length (inside the current virtual zone). */ void AdvanceProgress(); /** - * Update the UI dialog. *MUST* only be called from the main thread. - * Returns false if the user clicked Cancel. + * Update the UI dialog. + * + * @warning This should only be called from the main thread. + * + * @return false if the user clicked Cancel. */ bool KeepRefreshing( bool aWait = false ); - /** change the title displayed on the window caption - * *MUST* only be called from the main thread. - * Has meaning only for some reporters. - * Do nothing for others + /** + * Change the title displayed on the window caption. + * + * Has meaning only for some reporters. Does nothing for others. + * + * @warning This should only be called from the main thread. */ virtual void SetTitle( const wxString& aTitle ) {} @@ -127,30 +134,35 @@ protected: }; /** -* Multi-thread safe progress reporter dialog, intended for use of tasks that paralleize reporting back of work status -* See PROGRESS_REPORTER +* Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting +* back of work status. +* +* @see PROGRESS_REPORTER. */ class WX_PROGRESS_REPORTER : public PROGRESS_REPORTER, public wxProgressDialog { public: /** - * Ctor: the PROGRESS_REPORTER will stay on top of aParent. - * the style is wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME + * The #PROGRESS_REPORTER will stay on top of \a aParent. + * + * The style is wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME. + * * @param aParent is the wxDialog of Frame that manage this. * @param aTitle is the dialog progress title * @param aNumPhases is the number of "virtual sections" of the progress bar - * aNumPhases = 1 is the usual progress bar - * aNumPhases = n creates n virtual progress bar zones: a 0 to 100 percent width - * of a virtual zone fills 0 to 1/n progress bar full size of the nth virtual zone index + * aNumPhases = 1 is the usual progress bar + * aNumPhases = n creates n virtual progress bar zones: a 0 to 100 percent width + * of a virtual zone fills 0 to 1/n progress bar full size of the nth virtual zone index * @param aCanAbort is true if the abort button should be shown * @param aReserveSpaceForMessage will ensure that the dialog is laid out for status messages, - * preventing layout issues on Windows when reporting a message after the initial layout + * preventing layout issues on Windows when reporting a message after the initial layout */ WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& aTitle, int aNumPhases, bool aCanAbort = true, bool aReserveSpaceForMessage = true ); ~WX_PROGRESS_REPORTER(); - /** change the title displayed on the window caption + /** + * Change the title displayed on the window caption. */ virtual void SetTitle( const wxString& aTitle ) override { @@ -158,7 +170,7 @@ public: } private: -#if wxCHECK_VERSION(3, 1, 0) +#if wxCHECK_VERSION( 3, 1, 0 ) wxAppProgressIndicator m_appProgressIndicator; #endif @@ -172,9 +184,9 @@ public: /** * @param aParent is the parent of the wxGauge control * @param aNumPhases is the number of "virtual sections" of the progress bar - * aNumPhases = 1 is the usual progress bar - * aNumPhases = n creates n virtual progress bar zones: a 0 to 100 percent width - * of a virtual zone fills 0 to 1/n progress bar full size of the nth virtual zone index + * aNumPhases = 1 is the usual progress bar + * aNumPhases = n creates n virtual progress bar zones: a 0 to 100 percent width + * of a virtual zone fills 0 to 1/n progress bar full size of the nth virtual zone index */ GAUGE_PROGRESS_REPORTER( wxWindow* aParent, int aNumPhases ); diff --git a/kicad/dialogs/dialog_template_selector.cpp b/kicad/dialogs/dialog_template_selector.cpp index eb6435d845..3c94d63c2e 100644 --- a/kicad/dialogs/dialog_template_selector.cpp +++ b/kicad/dialogs/dialog_template_selector.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 Brian Sidebotham - * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -48,15 +48,15 @@ TEMPLATE_WIDGET::TEMPLATE_WIDGET( wxWindow* aParent, DIALOG_TEMPLATE_SELECTOR* a // Bind(wxEVT_LEFT_DOWN, &TEMPLATE_WIDGET::OnMouse, this ); m_bitmapIcon->Connect( wxEVT_LEFT_DOWN, - wxMouseEventHandler( TEMPLATE_WIDGET::OnMouse ), NULL, this ); + wxMouseEventHandler( TEMPLATE_WIDGET::OnMouse ), nullptr, this ); m_staticTitle->Connect( wxEVT_LEFT_DOWN, - wxMouseEventHandler( TEMPLATE_WIDGET::OnMouse ), NULL, this ); + wxMouseEventHandler( TEMPLATE_WIDGET::OnMouse ), nullptr, this ); // We're not selected until we're clicked Unselect(); // Start with template being NULL - m_currTemplate = NULL; + m_currTemplate = nullptr; } @@ -77,11 +77,11 @@ void TEMPLATE_WIDGET::Unselect() } -void TEMPLATE_WIDGET::SetTemplate(PROJECT_TEMPLATE* aTemplate) +void TEMPLATE_WIDGET::SetTemplate( PROJECT_TEMPLATE* aTemplate ) { m_currTemplate = aTemplate; - m_staticTitle->SetLabel( *(aTemplate->GetTitle() ) ); - m_bitmapIcon->SetBitmap( *(aTemplate->GetIcon() ) ); + m_staticTitle->SetLabel( *( aTemplate->GetTitle() ) ); + m_bitmapIcon->SetBitmap( *( aTemplate->GetIcon() ) ); } @@ -93,7 +93,7 @@ void TEMPLATE_WIDGET::OnMouse( wxMouseEvent& event ) } -void DIALOG_TEMPLATE_SELECTOR::onNotebookResize(wxSizeEvent& event) +void DIALOG_TEMPLATE_SELECTOR::onNotebookResize( wxSizeEvent& event ) { for( size_t i=0; i < m_notebook->GetPageCount(); i++ ) { @@ -103,6 +103,7 @@ void DIALOG_TEMPLATE_SELECTOR::onNotebookResize(wxSizeEvent& event) m_panels[i]->GetSize().GetHeight() - 6 ); m_panels[i]->m_SizerChoice->FitInside( m_panels[i]->m_scrolledWindow ); } + m_notebook->Refresh(); event.Skip(); @@ -126,14 +127,14 @@ DIALOG_TEMPLATE_SELECTOR::DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent ) : m_htmlWin->SetPage( _( "

Template Selector

" ) ); m_notebook->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_TEMPLATE_SELECTOR::onNotebookResize ), - NULL, this ); - m_selectedWidget = NULL; + nullptr, this ); + m_selectedWidget = nullptr; } void DIALOG_TEMPLATE_SELECTOR::SetWidget( TEMPLATE_WIDGET* aWidget ) { - if( m_selectedWidget != NULL ) + if( m_selectedWidget != nullptr ) m_selectedWidget->Unselect(); m_selectedWidget = aWidget; @@ -160,7 +161,7 @@ void DIALOG_TEMPLATE_SELECTOR::AddTemplate( int aPage, PROJECT_TEMPLATE* aTempla PROJECT_TEMPLATE* DIALOG_TEMPLATE_SELECTOR::GetSelectedTemplate() { - return m_selectedWidget? m_selectedWidget->GetTemplate() : NULL; + return m_selectedWidget? m_selectedWidget->GetTemplate() : nullptr; } @@ -279,7 +280,7 @@ void DIALOG_TEMPLATE_SELECTOR::replaceCurrentPage() buildPageContent( m_tcTemplatePath->GetValue(), page ); - m_selectedWidget = NULL; + m_selectedWidget = nullptr; } diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index 30d808ce33..70ff3466c2 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -148,7 +148,7 @@ bool PGM_KICAD::OnPgmInit() m_bm.m_search.Insert( it->second.GetValue(), 0 ); } - KICAD_MANAGER_FRAME* frame = new KICAD_MANAGER_FRAME( NULL, wxT( "KiCad" ), + KICAD_MANAGER_FRAME* frame = new KICAD_MANAGER_FRAME( nullptr, wxT( "KiCad" ), wxDefaultPosition, wxSize( 775, -1 ) ); App().SetTopWindow( frame ); diff --git a/kicad/project_tree_item.h b/kicad/project_tree_item.h index a947735ec1..96437257db 100644 --- a/kicad/project_tree_item.h +++ b/kicad/project_tree_item.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010-2014 Jean-Pierre Charras - * Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,8 +34,7 @@ class PROJECT_TREE_PANE; class wxTreeCtrl; /** - * PROJECT_TREE_ITEM - * handles one item (a file or a directory name) for the tree file + * Handle one item (a file or a directory name) for the tree file. */ class PROJECT_TREE_ITEM : public wxTreeItemData { @@ -44,7 +43,7 @@ public: PROJECT_TREE_ITEM( TREE_FILE_TYPE type, const wxString& data, wxTreeCtrl* parent ); PROJECT_TREE_ITEM() : - m_parent( NULL ) + m_parent( nullptr ) { } PROJECT_TREE_ITEM( const PROJECT_TREE_ITEM& src ) : diff --git a/kicad/project_tree_pane.cpp b/kicad/project_tree_pane.cpp index 373dadfced..6594882a7f 100644 --- a/kicad/project_tree_pane.cpp +++ b/kicad/project_tree_pane.cpp @@ -97,7 +97,7 @@ static const wxChar* s_allowedExtensionsToList[] = { wxT( "^.*\\.xnc$" ), // Excellon NC drill files (alternate file ext) wxT( "^.*\\.svg$" ), // SVG print/plot files wxT( "^.*\\.ps$" ), // PostScript plot files - NULL // end of list + nullptr // end of list }; @@ -114,9 +114,9 @@ const wxString GerberFileExtensionWildCard( ".((gbr|gbrjob|(gb|gt)[alops])|pho)" /** - * @brief class PROJECT_TREE_PANE is the frame that shows the tree list of files and subdirs - * inside the working directory. Files are filtered (see s_allowedExtensionsToList) so - * only useful files are shown. + * The frame that shows the tree list of files and subdirectories inside the working directory. + * + * Files are filtered (see s_allowedExtensionsToList) so only useful files are shown. */ @@ -140,7 +140,7 @@ PROJECT_TREE_PANE::PROJECT_TREE_PANE( KICAD_MANAGER_FRAME* parent ) : wxNO_BORDER | wxTAB_TRAVERSAL ) { m_Parent = parent; - m_TreeProject = NULL; + m_TreeProject = nullptr; m_isRenaming = false; m_selectedItem = nullptr; m_watcherNeedReset = false; @@ -153,7 +153,7 @@ PROJECT_TREE_PANE::PROJECT_TREE_PANE( KICAD_MANAGER_FRAME* parent ) : * Filtering is now inverted: the filters are actually used to _enable_ support * for a given file type. */ - for( int ii = 0; s_allowedExtensionsToList[ii] != NULL; ii++ ) + for( int ii = 0; s_allowedExtensionsToList[ii] != nullptr; ii++ ) m_filters.emplace_back( s_allowedExtensionsToList[ii] ); m_filters.emplace_back( wxT( "^no KiCad files found" ) ); @@ -1180,7 +1180,7 @@ void PROJECT_TREE_PANE::FileWatcherReset() wxString prj_dir = wxPathOnly( m_Parent->GetProjectFileName() ); - #if defined( _WIN32 ) +#if defined( _WIN32 ) if( KIPLATFORM::ENV::IsNetworkPath( prj_dir ) ) { // Due to a combination of a bug in SAMBA sending bad change event IDs and wxWidgets @@ -1194,7 +1194,7 @@ void PROJECT_TREE_PANE::FileWatcherReset() { m_Parent->SetStatusText( _( "Local path: monitoring folder changes" ), 1 ); } - #endif +#endif // Prepare file watcher: if( m_watcher )