From 6c7c9ca50c055277bf64d1f580c441725dad8535 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 28 Aug 2021 11:44:01 +0200 Subject: [PATCH] Fix compil warnings (UNDO_REDO::GROUP renamed to UNDO_REDO::REGROUP to fix collision name with a widows header on msys2) --- include/tool/tool_event.h | 2 +- include/undo_redo_container.h | 35 ++++++++++++++++++----------------- pcbnew/tools/group_tool.cpp | 4 ++-- pcbnew/undo_redo.cpp | 6 +++--- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/include/tool/tool_event.h b/include/tool/tool_event.h index 68427e14d1..c75603d1dd 100644 --- a/include/tool/tool_event.h +++ b/include/tool/tool_event.h @@ -444,7 +444,7 @@ public: template void SetParameter(T aParam) { - m_param = (void*) aParam; + m_param = reinterpret_cast( aParam ); } OPT GetCommandId() const diff --git a/include/undo_redo_container.h b/include/undo_redo_container.h index 3b292f68a6..13d39756c1 100644 --- a/include/undo_redo_container.h +++ b/include/undo_redo_container.h @@ -3,7 +3,7 @@ * * Copyright (C) 2009 jean-pierre.charras@gipsa-lab.inpg.fr * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 2009-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2009-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 @@ -54,22 +54,23 @@ class BASE_SCREEN; * Each type must be redo/undone by a specific operation. */ enum class UNDO_REDO { - UNSPECIFIED = 0, // illegal - NOP, // Undo/redo will ignore this entry. Only forces the start of a new stack - CHANGED, // params of items have a value changed: undo is made by exchange - // values with a copy of these values - NEWITEM, // new item, undo by changing in deleted - DELETED, // deleted item, undo by changing in deleted - LIBEDIT, // Specific to the component editor (symbol_editor creates a full copy - // of the current component when changed) - LIB_RENAME, // As LIBEDIT, but old copy should be removed from library - EXCHANGE_T, // Use for changing the schematic text type where swapping - // data structure is insufficient to restore the change. - DRILLORIGIN, // origin changed (like CHANGED, contains the origin and a copy) - GRIDORIGIN, // origin changed (like CHANGED, contains the origin and a copy) - PAGESETTINGS, // page settings or title block changes - GROUP, - UNGROUP + UNSPECIFIED = 0, // illegal + NOP, // Undo/redo will ignore this entry. Only forces the start of a new stack + CHANGED, // params of items have a value changed: undo is made by exchange + // values with a copy of these values + NEWITEM, // new item, undo by changing in deleted + DELETED, // deleted item, undo by changing in deleted + LIBEDIT, // Specific to the component editor (symbol_editor creates a full copy + // of the current component when changed) + LIB_RENAME, // As LIBEDIT, but old copy should be removed from library + EXCHANGE_T, // Use for changing the schematic text type where swapping + // data structure is insufficient to restore the change. + DRILLORIGIN, // origin changed (like CHANGED, contains the origin and a copy) + GRIDORIGIN, // origin changed (like CHANGED, contains the origin and a copy) + PAGESETTINGS, // page settings or title block changes + REGROUP, // new group of items created (do not use GROUP to avoid collision + // with an header on msys2) + UNGROUP // existing group destroyed (items not destroyed) }; diff --git a/pcbnew/tools/group_tool.cpp b/pcbnew/tools/group_tool.cpp index 12735b42ba..748ded0c89 100644 --- a/pcbnew/tools/group_tool.cpp +++ b/pcbnew/tools/group_tool.cpp @@ -279,10 +279,10 @@ int GROUP_TOOL::Group( const TOOL_EVENT& aEvent ) for( EDA_ITEM* item : selection ) { group->AddItem( static_cast( item ) ); - undoList.PushItem( ITEM_PICKER( nullptr, item, UNDO_REDO::GROUP ) ); + undoList.PushItem( ITEM_PICKER( nullptr, item, UNDO_REDO::REGROUP ) ); } - m_frame->SaveCopyInUndoList( undoList, UNDO_REDO::GROUP ); + m_frame->SaveCopyInUndoList( undoList, UNDO_REDO::REGROUP ); } selTool->ClearSelection(); diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index 0f7f26792d..70674684e0 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -284,7 +284,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis case UNDO_REDO::NEWITEM: case UNDO_REDO::DELETED: case UNDO_REDO::PAGESETTINGS: - case UNDO_REDO::GROUP: + case UNDO_REDO::REGROUP: case UNDO_REDO::UNGROUP: break; @@ -489,13 +489,13 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList ) break; - case UNDO_REDO::GROUP: + case UNDO_REDO::REGROUP: aList->SetPickedItemStatus( UNDO_REDO::UNGROUP, ii ); static_cast( eda_item )->SetParentGroup( nullptr ); break; case UNDO_REDO::UNGROUP: - aList->SetPickedItemStatus( UNDO_REDO::GROUP, ii ); + aList->SetPickedItemStatus( UNDO_REDO::REGROUP, ii ); if( group ) group->AddItem( static_cast( eda_item ) );