Upgrade some symbol editor stuff to SCHEMATIC_COMMIT.
Also renames SCHEMATIC_COMMIT to SCH_COMMIT since it's not schematic-specifc.
This commit is contained in:
parent
e698156975
commit
8f1b9119bf
|
@ -310,6 +310,7 @@ set( EESCHEMA_SRCS
|
|||
sch_base_frame.cpp
|
||||
sch_bitmap.cpp
|
||||
sch_bus_entry.cpp
|
||||
sch_commit.cpp
|
||||
sch_connection.cpp
|
||||
sch_draw_panel.cpp
|
||||
sch_edit_frame.cpp
|
||||
|
@ -338,7 +339,6 @@ set( EESCHEMA_SRCS
|
|||
sch_validators.cpp
|
||||
sch_view.cpp
|
||||
schematic.cpp
|
||||
schematic_commit.cpp
|
||||
schematic_settings.cpp
|
||||
schematic_undo_redo.cpp
|
||||
sheet.cpp
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <reporter.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <erc_settings.h>
|
||||
#include <sch_reference_list.h>
|
||||
#include <symbol_library.h>
|
||||
|
@ -64,7 +64,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRe
|
|||
SCH_SHEET_LIST sheets = Schematic().GetSheets();
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
SCH_SHEET_PATH currentSheet = GetCurrentSheet();
|
||||
SCHEMATIC_COMMIT commit( this );
|
||||
SCH_COMMIT commit( this );
|
||||
|
||||
auto clearSymbolAnnotation =
|
||||
[&]( EDA_ITEM* aItem, SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet, bool aResetPrefixes )
|
||||
|
@ -192,15 +192,10 @@ std::unordered_set<SCH_SYMBOL*> getInferredSymbols( const EE_SELECTION& aSelecti
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::AnnotateSymbols( SCHEMATIC_COMMIT* aCommit,
|
||||
ANNOTATE_SCOPE_T aAnnotateScope,
|
||||
ANNOTATE_ORDER_T aSortOption,
|
||||
ANNOTATE_ALGO_T aAlgoOption,
|
||||
bool aRecursive,
|
||||
int aStartNumber,
|
||||
bool aResetAnnotation,
|
||||
bool aRepairTimestamps,
|
||||
REPORTER& aReporter )
|
||||
void SCH_EDIT_FRAME::AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAnnotateScope,
|
||||
ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption,
|
||||
bool aRecursive, int aStartNumber, bool aResetAnnotation,
|
||||
bool aRepairTimestamps, REPORTER& aReporter )
|
||||
{
|
||||
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||
EE_SELECTION& selection = selTool->GetSelection();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <sch_no_connect.h>
|
||||
#include <sch_screen.h>
|
||||
#include <sch_view.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_actions.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
|
@ -50,8 +50,7 @@ void SCH_EDIT_FRAME::TestDanglingEnds()
|
|||
}
|
||||
|
||||
|
||||
bool SCH_EDIT_FRAME::TrimWire( SCHEMATIC_COMMIT* aCommit, const VECTOR2I& aStart,
|
||||
const VECTOR2I& aEnd )
|
||||
bool SCH_EDIT_FRAME::TrimWire( SCH_COMMIT* aCommit, const VECTOR2I& aStart, const VECTOR2I& aEnd )
|
||||
{
|
||||
if( aStart == aEnd )
|
||||
return false;
|
||||
|
@ -116,7 +115,7 @@ bool SCH_EDIT_FRAME::TrimWire( SCHEMATIC_COMMIT* aCommit, const VECTOR2I& aStart
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::SchematicCleanUp( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aScreen )
|
||||
void SCH_EDIT_FRAME::SchematicCleanUp( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen )
|
||||
{
|
||||
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||
std::vector<SCH_LINE*> lines;
|
||||
|
@ -254,9 +253,8 @@ void SCH_EDIT_FRAME::SchematicCleanUp( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aS
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::BreakSegment( SCHEMATIC_COMMIT* aCommit, SCH_LINE* aSegment,
|
||||
const VECTOR2I& aPoint, SCH_LINE** aNewSegment,
|
||||
SCH_SCREEN* aScreen )
|
||||
void SCH_EDIT_FRAME::BreakSegment( SCH_COMMIT* aCommit, SCH_LINE* aSegment, const VECTOR2I& aPoint,
|
||||
SCH_LINE** aNewSegment, SCH_SCREEN* aScreen )
|
||||
{
|
||||
// Save the copy of aSegment before breaking it
|
||||
aCommit->Modify( aSegment, aScreen );
|
||||
|
@ -274,15 +272,14 @@ void SCH_EDIT_FRAME::BreakSegment( SCHEMATIC_COMMIT* aCommit, SCH_LINE* aSegment
|
|||
}
|
||||
|
||||
|
||||
bool SCH_EDIT_FRAME::BreakSegments( SCHEMATIC_COMMIT* aCommit, const VECTOR2I& aPoint,
|
||||
SCH_SCREEN* aScreen )
|
||||
bool SCH_EDIT_FRAME::BreakSegments( SCH_COMMIT* aCommit, const VECTOR2I& aPos, SCH_SCREEN* aScreen )
|
||||
{
|
||||
bool brokenSegments = false;
|
||||
SCH_LINE* new_line;
|
||||
|
||||
for( SCH_LINE* wire : aScreen->GetBusesAndWires( aPoint, true ) )
|
||||
for( SCH_LINE* wire : aScreen->GetBusesAndWires( aPos, true ) )
|
||||
{
|
||||
BreakSegment( aCommit, wire, aPoint, &new_line, aScreen );
|
||||
BreakSegment( aCommit, wire, aPos, &new_line, aScreen );
|
||||
brokenSegments = true;
|
||||
}
|
||||
|
||||
|
@ -290,7 +287,7 @@ bool SCH_EDIT_FRAME::BreakSegments( SCHEMATIC_COMMIT* aCommit, const VECTOR2I& a
|
|||
}
|
||||
|
||||
|
||||
bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aScreen )
|
||||
bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen )
|
||||
{
|
||||
bool brokenSegments = false;
|
||||
|
||||
|
@ -316,7 +313,7 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCHEMATIC_COMMIT* aCommit, SCH_SC
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::DeleteJunction( SCHEMATIC_COMMIT* aCommit, SCH_ITEM* aJunction )
|
||||
void SCH_EDIT_FRAME::DeleteJunction( SCH_COMMIT* aCommit, SCH_ITEM* aJunction )
|
||||
{
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
PICKED_ITEMS_LIST undoList;
|
||||
|
@ -389,7 +386,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCHEMATIC_COMMIT* aCommit, SCH_ITEM* aJunct
|
|||
}
|
||||
|
||||
|
||||
SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aScreen,
|
||||
SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen,
|
||||
const VECTOR2I& aPos )
|
||||
{
|
||||
SCH_JUNCTION* junction = new SCH_JUNCTION( aPos );
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <kiface_base.h>
|
||||
#include <widgets/wx_html_report_panel.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
// A window name for the annotate dialog to retrieve is if not destroyed
|
||||
#define DLG_WINDOW_NAME "DialogAnnotateWindowName"
|
||||
|
@ -214,7 +214,7 @@ void DIALOG_ANNOTATE::OnClose( wxCloseEvent& event )
|
|||
|
||||
void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
|
||||
{
|
||||
SCHEMATIC_COMMIT commit( m_Parent );
|
||||
SCH_COMMIT commit( m_Parent );
|
||||
|
||||
m_MessageWindow->Clear();
|
||||
REPORTER& reporter = m_MessageWindow->Reporter();
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <schematic.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <widgets/wx_html_report_panel.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
bool g_selectRefDes = false;
|
||||
bool g_selectValue = false;
|
||||
|
@ -370,9 +370,9 @@ void DIALOG_CHANGE_SYMBOLS::checkAll( bool aCheck )
|
|||
|
||||
void DIALOG_CHANGE_SYMBOLS::onOkButtonClicked( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxBusyCursor dummy;
|
||||
SCH_EDIT_FRAME* parent = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
||||
SCHEMATIC_COMMIT commit( parent );
|
||||
wxBusyCursor dummy;
|
||||
SCH_EDIT_FRAME* parent = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
||||
SCH_COMMIT commit( parent );
|
||||
|
||||
wxCHECK( parent, /* void */ );
|
||||
|
||||
|
@ -451,7 +451,7 @@ bool DIALOG_CHANGE_SYMBOLS::isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInsta
|
|||
|
||||
|
||||
|
||||
int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCHEMATIC_COMMIT* aCommit )
|
||||
int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit )
|
||||
{
|
||||
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
||||
|
||||
|
@ -517,7 +517,7 @@ int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCHEMATIC_COMMIT* aCommit )
|
|||
}
|
||||
|
||||
|
||||
int DIALOG_CHANGE_SYMBOLS::processSymbols( SCHEMATIC_COMMIT* aCommit,
|
||||
int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
|
||||
const std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO>& aSymbols )
|
||||
{
|
||||
wxCHECK( !aSymbols.empty(), 0 );
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
class SCH_SYMBOL;
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_SCREEN;
|
||||
class SCHEMATIC_COMMIT;
|
||||
class SCH_COMMIT;
|
||||
|
||||
|
||||
struct SYMBOL_CHANGE_INFO
|
||||
|
@ -84,8 +84,8 @@ private:
|
|||
void updateFieldsList();
|
||||
|
||||
bool isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInstance );
|
||||
int processMatchingSymbols( SCHEMATIC_COMMIT* aCommit );
|
||||
int processSymbols( SCHEMATIC_COMMIT* aCommit,
|
||||
int processMatchingSymbols( SCH_COMMIT* aCommit );
|
||||
int processSymbols( SCH_COMMIT* aCommit,
|
||||
const std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO>& aSymbols );
|
||||
wxString getSymbolReferences( SCH_SYMBOL& aSymbol, const LIB_ID& aNewId );
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <symbol_library.h>
|
||||
#include <sch_validators.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <dialog_field_properties.h>
|
||||
#include <sch_text.h>
|
||||
#include <scintilla_tricks.h>
|
||||
|
@ -629,7 +629,7 @@ void DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEven
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCHEMATIC_COMMIT* aCommit, SCH_FIELD* aField,
|
||||
void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aField,
|
||||
SCH_SHEET_PATH* aSheetPath )
|
||||
{
|
||||
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
||||
|
|
|
@ -35,7 +35,7 @@ class SCH_BASE_FRAME;
|
|||
class SCH_FIELD;
|
||||
class EDA_TEXT;
|
||||
class SCINTILLA_TRICKS;
|
||||
class SCHEMATIC_COMMIT;
|
||||
class SCH_COMMIT;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
|
||||
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
|
||||
|
||||
void UpdateField( SCHEMATIC_COMMIT* aCommit, SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath );
|
||||
void UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath );
|
||||
|
||||
private:
|
||||
const SCH_FIELD* m_field;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <tools/sch_edit_tool.h>
|
||||
|
@ -102,8 +102,8 @@ protected:
|
|||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
void visitItem( SCHEMATIC_COMMIT* aCommit, const SCH_SHEET_PATH& aSheetPath, SCH_ITEM* aItem );
|
||||
void processItem( SCHEMATIC_COMMIT* aCommit, const SCH_SHEET_PATH& aSheetPath, SCH_ITEM* aItem );
|
||||
void visitItem( SCH_COMMIT* aCommit, const SCH_SHEET_PATH& aSheetPath, SCH_ITEM* aItem );
|
||||
void processItem( SCH_COMMIT* aCommit, const SCH_SHEET_PATH& aSheetPath, SCH_ITEM* aItem );
|
||||
};
|
||||
|
||||
|
||||
|
@ -235,7 +235,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCHEMATIC_COMMIT* aCommit,
|
||||
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCH_COMMIT* aCommit,
|
||||
const SCH_SHEET_PATH& aSheetPath,
|
||||
SCH_ITEM* aItem )
|
||||
{
|
||||
|
@ -370,7 +370,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCHEMATIC_COMMIT* aCommi
|
|||
}
|
||||
}
|
||||
|
||||
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( SCHEMATIC_COMMIT* aCommit,
|
||||
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( SCH_COMMIT* aCommit,
|
||||
const SCH_SHEET_PATH& aSheetPath,
|
||||
SCH_ITEM* aItem )
|
||||
{
|
||||
|
@ -549,8 +549,8 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|||
if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::MILS ) ) // 1 mil .. 10 inches
|
||||
return false;
|
||||
|
||||
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();
|
||||
SCHEMATIC_COMMIT commit( m_parent );
|
||||
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();
|
||||
SCH_COMMIT commit( m_parent );
|
||||
|
||||
// Go through sheets
|
||||
for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().GetSheets() )
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
|
||||
DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_BITMAP* aBitmap ) :
|
||||
|
@ -60,7 +60,7 @@ bool DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow()
|
|||
{
|
||||
if( m_imageEditor->TransferDataFromWindow() )
|
||||
{
|
||||
SCHEMATIC_COMMIT commit( m_frame );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
|
||||
// Save old image in undo list if not already in edit
|
||||
if( m_bitmap->GetEditFlags() == 0 )
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <settings/settings_manager.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <widgets/color_swatch.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
|
||||
DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS( SCH_EDIT_FRAME* aParent,
|
||||
|
@ -96,7 +96,7 @@ void DIALOG_JUNCTION_PROPS::resetDefaults( wxCommandEvent& event )
|
|||
|
||||
bool DIALOG_JUNCTION_PROPS::TransferDataFromWindow()
|
||||
{
|
||||
SCHEMATIC_COMMIT commit( m_frame );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
|
||||
for( SCH_JUNCTION* junction : m_junctions )
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <string_utils.h>
|
||||
#include <kiface_base.h>
|
||||
#include <sch_label.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
|
||||
DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_LABEL_BASE* aLabel ) :
|
||||
|
@ -431,8 +431,8 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
|
|||
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
|
||||
return false;
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_Parent );
|
||||
wxString text;
|
||||
SCH_COMMIT commit( m_Parent );
|
||||
wxString text;
|
||||
|
||||
/* save old text in undo list if not already in edit */
|
||||
if( m_currentLabel->GetEditFlags() == 0 )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
|
@ -368,11 +368,12 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
return false;
|
||||
}
|
||||
|
||||
m_Parent->SaveCopyInUndoList( m_libEntry, UNDO_REDO::LIB_RENAME );
|
||||
m_Parent->SaveCopyInUndoList( _( "Edit Symbol Properties" ), m_libEntry,
|
||||
UNDO_REDO::LIB_RENAME );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Parent->SaveCopyInUndoList( m_libEntry );
|
||||
m_Parent->SaveCopyInUndoList( _( "Edit Symbol Properties" ), m_libEntry );
|
||||
}
|
||||
|
||||
// The Y axis for components in lib is from bottom to top while the screen axis is top
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <stroke_params.h>
|
||||
#include <widgets/color_swatch.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
|
||||
DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES( SCH_EDIT_FRAME* aParent,
|
||||
|
@ -129,7 +129,7 @@ void DIALOG_LINE_PROPERTIES::resetDefaults( wxCommandEvent& event )
|
|||
|
||||
bool DIALOG_LINE_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
SCHEMATIC_COMMIT commit( m_frame );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
|
||||
for( SCH_LINE* line : m_lines )
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <sch_shape.h>
|
||||
#include <dialog_shape_properties.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
|
||||
DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHAPE* aShape ) :
|
||||
|
@ -137,7 +137,7 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
|
|||
if( !wxDialog::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_frame );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
|
||||
if( !m_shape->IsNew() )
|
||||
commit.Modify( m_shape, m_frame->GetScreen() );
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <sch_validators.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <dialog_sheet_pin_properties.h>
|
||||
#include <dialogs/html_message_box.h>
|
||||
#include <string_utils.h>
|
||||
|
@ -134,7 +134,7 @@ bool DIALOG_SHEET_PIN_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
bool DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
SCHEMATIC_COMMIT commit( m_frame );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
|
||||
if( !m_sheetPin->IsNew() )
|
||||
commit.Modify( m_sheetPin->GetParent(), m_frame->GetScreen() );
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <sch_reference_list.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/actions.h>
|
||||
|
||||
|
@ -696,8 +696,8 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
if( !m_pinGrid->CommitPendingChanges() )
|
||||
return false;
|
||||
|
||||
SCHEMATIC_COMMIT commit( GetParent() );
|
||||
SCH_SCREEN* currentScreen = GetParent()->GetScreen();
|
||||
SCH_COMMIT commit( GetParent() );
|
||||
SCH_SCREEN* currentScreen = GetParent()->GetScreen();
|
||||
wxCHECK( currentScreen, false );
|
||||
|
||||
// This needs to be done before the LIB_ID is changed to prevent stale library symbols in
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <sch_textbox.h>
|
||||
#include <confirm.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <dialogs/html_message_box.h>
|
||||
#include <scintilla_tricks.h>
|
||||
#include <dialog_text_properties.h>
|
||||
|
@ -434,8 +434,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
|
||||
return false;
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_frame );
|
||||
wxString text;
|
||||
SCH_COMMIT commit( m_frame );
|
||||
wxString text;
|
||||
|
||||
/* save old text in undo list if not already in edit */
|
||||
if( m_currentItem->GetEditFlags() == 0 )
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <dialog_update_symbol_fields.h>
|
||||
#include <lib_symbol.h>
|
||||
#include <symbol_edit_frame.h>
|
||||
#include <sch_commit.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
|
@ -122,8 +123,9 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::checkAll( bool aCheck )
|
|||
void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxBusyCursor dummy;
|
||||
SCH_COMMIT commit( m_editFrame );
|
||||
|
||||
m_editFrame->SaveCopyInUndoList( m_symbol, UNDO_REDO::LIBEDIT );
|
||||
commit.Modify( m_symbol );
|
||||
|
||||
// Create the set of fields to be updated
|
||||
m_updateFields.clear();
|
||||
|
@ -216,8 +218,9 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
|
|||
|
||||
m_symbol->SetFields( result );
|
||||
|
||||
commit.Push( _( "Update Symbol Fields" ) );
|
||||
|
||||
m_editFrame->RebuildView();
|
||||
m_editFrame->OnModify();
|
||||
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <stroke_params.h>
|
||||
#include <widgets/color_swatch.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
|
||||
DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME* aParent,
|
||||
|
@ -175,7 +175,7 @@ void DIALOG_WIRE_BUS_PROPERTIES::resetDefaults( wxCommandEvent& event )
|
|||
|
||||
bool DIALOG_WIRE_BUS_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
SCHEMATIC_COMMIT commit( m_frame );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
|
||||
for( SCH_ITEM* item : m_items )
|
||||
{
|
||||
|
|
|
@ -32,38 +32,40 @@
|
|||
#include <schematic.h>
|
||||
|
||||
#include <view/view.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
||||
SCHEMATIC_COMMIT::SCHEMATIC_COMMIT( TOOL_MANAGER* aToolMgr ) :
|
||||
SCH_COMMIT::SCH_COMMIT( TOOL_MANAGER* aToolMgr ) :
|
||||
m_toolMgr( aToolMgr ),
|
||||
m_isLibEditor( false )
|
||||
{
|
||||
SCH_BASE_FRAME* frame = static_cast<SCH_BASE_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
m_isLibEditor = frame && frame->IsType( FRAME_SCH_SYMBOL_EDITOR );
|
||||
}
|
||||
|
||||
|
||||
SCHEMATIC_COMMIT::SCHEMATIC_COMMIT( EE_TOOL_BASE<SCH_BASE_FRAME>* aTool )
|
||||
SCH_COMMIT::SCH_COMMIT( EE_TOOL_BASE<SCH_BASE_FRAME>* aTool )
|
||||
{
|
||||
m_toolMgr = aTool->GetManager();
|
||||
m_isLibEditor = aTool->IsSymbolEditor();
|
||||
}
|
||||
|
||||
|
||||
SCHEMATIC_COMMIT::SCHEMATIC_COMMIT( EDA_DRAW_FRAME* aFrame )
|
||||
SCH_COMMIT::SCH_COMMIT( EDA_DRAW_FRAME* aFrame )
|
||||
{
|
||||
m_toolMgr = aFrame->GetToolManager();
|
||||
m_isLibEditor = aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR );
|
||||
}
|
||||
|
||||
|
||||
SCHEMATIC_COMMIT::~SCHEMATIC_COMMIT()
|
||||
SCH_COMMIT::~SCH_COMMIT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
COMMIT& SCHEMATIC_COMMIT::Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen )
|
||||
COMMIT& SCH_COMMIT::Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen )
|
||||
{
|
||||
wxCHECK( aItem, *this );
|
||||
|
||||
|
@ -96,8 +98,8 @@ COMMIT& SCHEMATIC_COMMIT::Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_
|
|||
}
|
||||
|
||||
|
||||
COMMIT& SCHEMATIC_COMMIT::Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE aChangeType,
|
||||
BASE_SCREEN *aScreen )
|
||||
COMMIT& SCH_COMMIT::Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE aChangeType,
|
||||
BASE_SCREEN *aScreen )
|
||||
{
|
||||
for( EDA_ITEM* item : container )
|
||||
Stage( item, aChangeType, aScreen );
|
||||
|
@ -106,54 +108,28 @@ COMMIT& SCHEMATIC_COMMIT::Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE
|
|||
}
|
||||
|
||||
|
||||
COMMIT& SCHEMATIC_COMMIT::Stage( const PICKED_ITEMS_LIST &aItems, UNDO_REDO aModFlag,
|
||||
BASE_SCREEN *aScreen )
|
||||
COMMIT& SCH_COMMIT::Stage( const PICKED_ITEMS_LIST &aItems, UNDO_REDO aModFlag,
|
||||
BASE_SCREEN *aScreen )
|
||||
{
|
||||
return COMMIT::Stage( aItems, aModFlag, aScreen );
|
||||
}
|
||||
|
||||
|
||||
void SCHEMATIC_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
|
||||
void SCH_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
|
||||
{
|
||||
// Objects potentially interested in changes:
|
||||
PICKED_ITEMS_LIST undoList;
|
||||
KIGFX::VIEW* view = m_toolMgr->GetView();
|
||||
|
||||
SYMBOL_EDIT_FRAME* sym_frame = static_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
LIB_SYMBOL* symbol = sym_frame->GetCurSymbol();
|
||||
std::set<EDA_ITEM*> savedModules;
|
||||
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
bool itemsDeselected = false;
|
||||
bool selectedModified = false;
|
||||
KIGFX::VIEW* view = m_toolMgr->GetView();
|
||||
SYMBOL_EDIT_FRAME* sym_frame = static_cast<SYMBOL_EDIT_FRAME*>( m_toolMgr->GetToolHolder() );
|
||||
LIB_SYMBOL* symbol = sym_frame->GetCurSymbol();
|
||||
bool selectedModified = false;
|
||||
|
||||
if( Empty() )
|
||||
return;
|
||||
|
||||
undoList.SetDescription( aMessage );
|
||||
|
||||
for( COMMIT_LINE& ent : m_changes )
|
||||
{
|
||||
int changeType = ent.m_type & CHT_TYPE;
|
||||
int changeFlags = ent.m_type & CHT_FLAGS;
|
||||
LIB_ITEM* libItem = static_cast<LIB_ITEM*>( ent.m_item );
|
||||
|
||||
wxASSERT( ent.m_item );
|
||||
|
||||
// Module items need to be saved in the undo buffer before modification
|
||||
if( ent.m_item->Type() != LIB_SYMBOL_T )
|
||||
{
|
||||
ent.m_item = ent.m_item->GetParent();
|
||||
wxASSERT( ent.m_item );
|
||||
}
|
||||
|
||||
// We have not saved the symbol yet, so let's create an entry
|
||||
if( savedModules.count( ent.m_item ) == 0 )
|
||||
{
|
||||
if( !( aCommitFlags & SKIP_UNDO ) && sym_frame )
|
||||
sym_frame->SaveCopyInUndoList( ent.m_item, UNDO_REDO::CHANGED, aCommitFlags & APPEND_UNDO );
|
||||
|
||||
savedModules.insert( ent.m_item );
|
||||
}
|
||||
// In the symbol editor everything should have been commited as a changed symbol.
|
||||
wxASSERT( ent.m_item == symbol );
|
||||
wxASSERT( ent.m_type == CHT_MODIFY );
|
||||
|
||||
if( ent.m_item->IsSelected() )
|
||||
selectedModified = true;
|
||||
|
@ -165,78 +141,34 @@ void SCHEMATIC_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
|
|||
selectedModified = true;
|
||||
} );
|
||||
|
||||
switch( changeType )
|
||||
if( view )
|
||||
{
|
||||
case CHT_ADD:
|
||||
{
|
||||
wxASSERT( libItem->Type() != LIB_SYMBOL_T );
|
||||
view->Update( symbol );
|
||||
|
||||
libItem->SetParent( symbol );
|
||||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
symbol->AddDrawItem( libItem );
|
||||
|
||||
if( view )
|
||||
view->Add( libItem );
|
||||
|
||||
break;
|
||||
symbol->RunOnChildren(
|
||||
[&]( LIB_ITEM* aChild )
|
||||
{
|
||||
view->Update( aChild );
|
||||
});
|
||||
}
|
||||
|
||||
case CHT_REMOVE:
|
||||
if( !( aCommitFlags & SKIP_UNDO ) && sym_frame )
|
||||
{
|
||||
if( libItem->IsSelected() )
|
||||
if( ent.m_copy )
|
||||
{
|
||||
if( selTool )
|
||||
selTool->RemoveItemFromSel( libItem, true /* quiet mode */ );
|
||||
|
||||
itemsDeselected = true;
|
||||
sym_frame->SaveCopyInUndoList( aMessage, ent.m_copy );
|
||||
ent.m_copy = nullptr;
|
||||
}
|
||||
|
||||
// Avoid removing mandatory fields
|
||||
if( libItem->Type() == LIB_FIELD_T && static_cast<LIB_FIELD*>( libItem )->IsMandatory() )
|
||||
break;
|
||||
|
||||
if( view )
|
||||
view->Remove( libItem );
|
||||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
symbol->RemoveDrawItem( libItem );
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case CHT_MODIFY:
|
||||
else
|
||||
{
|
||||
if( view )
|
||||
{
|
||||
view->Update( libItem );
|
||||
|
||||
symbol->RunOnChildren(
|
||||
[&]( LIB_ITEM* aChild )
|
||||
{
|
||||
view->Update( aChild );
|
||||
});
|
||||
}
|
||||
|
||||
// if no undo entry is needed, the copy would create a memory leak
|
||||
if( aCommitFlags & SKIP_UNDO )
|
||||
delete ent.m_copy;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
wxASSERT( false );
|
||||
break;
|
||||
delete ent.m_copy;
|
||||
}
|
||||
}
|
||||
|
||||
m_toolMgr->PostEvent( { TC_MESSAGE, TA_MODEL_CHANGE, AS_GLOBAL } );
|
||||
|
||||
if( itemsDeselected )
|
||||
m_toolMgr->PostEvent( EVENTS::UnselectedEvent );
|
||||
|
||||
if( selectedModified )
|
||||
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
|
||||
|
||||
|
@ -247,7 +179,7 @@ void SCHEMATIC_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
|
|||
}
|
||||
|
||||
|
||||
void SCHEMATIC_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
|
||||
void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
|
||||
{
|
||||
// Objects potentially interested in changes:
|
||||
PICKED_ITEMS_LIST undoList;
|
||||
|
@ -391,7 +323,7 @@ void SCHEMATIC_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
|
|||
}
|
||||
|
||||
|
||||
void SCHEMATIC_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
||||
void SCH_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
||||
{
|
||||
if( m_isLibEditor )
|
||||
pushLibEdit( aMessage, aCommitFlags );
|
||||
|
@ -400,7 +332,7 @@ void SCHEMATIC_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
}
|
||||
|
||||
|
||||
EDA_ITEM* SCHEMATIC_COMMIT::parentObject( EDA_ITEM* aItem ) const
|
||||
EDA_ITEM* SCH_COMMIT::parentObject( EDA_ITEM* aItem ) const
|
||||
{
|
||||
if( SCH_SYMBOL* parentSymbol = dyn_cast<SCH_SYMBOL*>( aItem->GetParent() ) )
|
||||
return parentSymbol;
|
||||
|
@ -415,7 +347,7 @@ EDA_ITEM* SCHEMATIC_COMMIT::parentObject( EDA_ITEM* aItem ) const
|
|||
}
|
||||
|
||||
|
||||
EDA_ITEM* SCHEMATIC_COMMIT::makeImage( EDA_ITEM* aItem ) const
|
||||
EDA_ITEM* SCH_COMMIT::makeImage( EDA_ITEM* aItem ) const
|
||||
{
|
||||
if( m_isLibEditor )
|
||||
{
|
||||
|
@ -427,7 +359,7 @@ EDA_ITEM* SCHEMATIC_COMMIT::makeImage( EDA_ITEM* aItem ) const
|
|||
}
|
||||
|
||||
|
||||
void SCHEMATIC_COMMIT::revertLibEdit()
|
||||
void SCH_COMMIT::revertLibEdit()
|
||||
{
|
||||
// The first element in the commit is the original, and libedit
|
||||
// just saves copies of the whole symbol, so grab the original and discard the rest
|
||||
|
@ -443,7 +375,7 @@ void SCHEMATIC_COMMIT::revertLibEdit()
|
|||
}
|
||||
|
||||
|
||||
void SCHEMATIC_COMMIT::Revert()
|
||||
void SCH_COMMIT::Revert()
|
||||
{
|
||||
PICKED_ITEMS_LIST undoList;
|
||||
KIGFX::VIEW* view = m_toolMgr->GetView();
|
|
@ -42,25 +42,25 @@ class EE_TOOL_BASE;
|
|||
#define SKIP_SET_DIRTY 0x0004
|
||||
#define SKIP_CONNECTIVITY 0x0008
|
||||
|
||||
class SCHEMATIC_COMMIT : public COMMIT
|
||||
class SCH_COMMIT : public COMMIT
|
||||
{
|
||||
public:
|
||||
SCHEMATIC_COMMIT( TOOL_MANAGER* aToolMgr );
|
||||
SCHEMATIC_COMMIT( EDA_DRAW_FRAME* aFrame );
|
||||
SCHEMATIC_COMMIT( EE_TOOL_BASE<SCH_BASE_FRAME>* aFrame );
|
||||
SCH_COMMIT( TOOL_MANAGER* aToolMgr );
|
||||
SCH_COMMIT( EDA_DRAW_FRAME* aFrame );
|
||||
SCH_COMMIT( EE_TOOL_BASE<SCH_BASE_FRAME>* aFrame );
|
||||
|
||||
virtual ~SCHEMATIC_COMMIT();
|
||||
virtual ~SCH_COMMIT();
|
||||
|
||||
virtual void Push( const wxString& aMessage = wxT( "A commit" ),
|
||||
int aCommitFlags = 0 ) override;
|
||||
|
||||
virtual void Revert() override;
|
||||
COMMIT& Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen = nullptr )
|
||||
override;
|
||||
COMMIT& Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE aChangeType,
|
||||
BASE_SCREEN *aScreen = nullptr ) override;
|
||||
COMMIT& Stage( const PICKED_ITEMS_LIST &aItems, UNDO_REDO aModFlag = UNDO_REDO::UNSPECIFIED,
|
||||
BASE_SCREEN *aScreen = nullptr ) override;
|
||||
COMMIT& Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType,
|
||||
BASE_SCREEN *aScreen = nullptr ) override;
|
||||
COMMIT& Stage( std::vector<EDA_ITEM*> &container, CHANGE_TYPE aChangeType,
|
||||
BASE_SCREEN *aScreen = nullptr ) override;
|
||||
COMMIT& Stage( const PICKED_ITEMS_LIST &aItems, UNDO_REDO aModFlag = UNDO_REDO::UNSPECIFIED,
|
||||
BASE_SCREEN *aScreen = nullptr ) override;
|
||||
|
||||
private:
|
||||
EDA_ITEM* parentObject( EDA_ITEM* aItem ) const override;
|
|
@ -53,7 +53,7 @@
|
|||
#include <sch_sheet.h>
|
||||
#include <sch_marker.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <advanced_config.h>
|
||||
#include <sim/simulator_frame.h>
|
||||
|
@ -1589,7 +1589,7 @@ void SCH_EDIT_FRAME::AutoRotateItem( SCH_SCREEN* aScreen, SCH_ITEM* aItem )
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::AddItemToCommitAndScreen( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aScreen,
|
||||
void SCH_EDIT_FRAME::AddItemToCommitAndScreen( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen,
|
||||
SCH_ITEM* aItem )
|
||||
{
|
||||
wxCHECK_RET( aItem != nullptr, wxT( "Cannot add null item to list." ) );
|
||||
|
@ -1736,16 +1736,15 @@ void SCH_EDIT_FRAME::initScreenZoom()
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::RecalculateConnections( SCHEMATIC_COMMIT* aCommit,
|
||||
SCH_CLEANUP_FLAGS aCleanupFlags )
|
||||
void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags )
|
||||
{
|
||||
wxString highlightedConn = GetHighlightedConnection();
|
||||
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
||||
SCH_SHEET_LIST list = Schematic().GetSheets();
|
||||
SCHEMATIC_COMMIT localInstance( m_toolManager );
|
||||
SCH_COMMIT localCommit( m_toolManager );
|
||||
|
||||
if( !aCommit )
|
||||
aCommit = &localInstance;
|
||||
aCommit = &localCommit;
|
||||
|
||||
#ifdef PROFILE
|
||||
PROF_TIMER timer;
|
||||
|
@ -1914,8 +1913,8 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCHEMATIC_COMMIT* aCommit,
|
|||
m_highlightedConnChanged = false;
|
||||
}
|
||||
|
||||
if( !localInstance.Empty() )
|
||||
localInstance.Push( _( "Schematic Cleanup" ) );
|
||||
if( !localCommit.Empty() )
|
||||
localCommit.Push( _( "Schematic Cleanup" ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2151,10 +2150,10 @@ void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
|
|||
void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol,
|
||||
const KIID& aSchematicSymbolUUID )
|
||||
{
|
||||
SCH_SHEET_PATH principalPath;
|
||||
SCH_ITEM* item = Schematic().GetSheets().GetItem( aSchematicSymbolUUID, &principalPath );
|
||||
SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
|
||||
SCHEMATIC_COMMIT commit( m_toolManager );
|
||||
SCH_SHEET_PATH principalPath;
|
||||
SCH_ITEM* item = Schematic().GetSheets().GetItem( aSchematicSymbolUUID, &principalPath );
|
||||
SCH_SYMBOL* principalSymbol = dynamic_cast<SCH_SYMBOL*>( item );
|
||||
SCH_COMMIT commit( m_toolManager );
|
||||
|
||||
if( !principalSymbol )
|
||||
return;
|
||||
|
|
|
@ -55,7 +55,7 @@ class SCH_SYMBOL;
|
|||
class SCH_FIELD;
|
||||
class SCH_JUNCTION;
|
||||
class SCHEMATIC;
|
||||
class SCHEMATIC_COMMIT;
|
||||
class SCH_COMMIT;
|
||||
class DIALOG_BOOK_REPORTER;
|
||||
class DIALOG_ERC;
|
||||
class DIALOG_SCH_FIND;
|
||||
|
@ -250,7 +250,7 @@ public:
|
|||
/**
|
||||
* Add an item to the schematic and adds the changes to the commit.
|
||||
*/
|
||||
void AddItemToCommitAndScreen( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aScreen, SCH_ITEM* aItem );
|
||||
void AddItemToCommitAndScreen( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen, SCH_ITEM* aItem );
|
||||
|
||||
/**
|
||||
* Run the Find or Find & Replace dialog.
|
||||
|
@ -284,7 +284,7 @@ public:
|
|||
* @param aNewSegment Pointer to the newly created segment (if created)
|
||||
* @param aScreen is the screen to examine
|
||||
*/
|
||||
void BreakSegment( SCHEMATIC_COMMIT* aCommit, SCH_LINE* aSegment, const VECTOR2I& aPoint,
|
||||
void BreakSegment( SCH_COMMIT* aCommit, SCH_LINE* aSegment, const VECTOR2I& aPoint,
|
||||
SCH_LINE** aNewSegment, SCH_SCREEN* aScreen );
|
||||
|
||||
/**
|
||||
|
@ -295,7 +295,7 @@ public:
|
|||
* @param aScreen is the screen to examine.
|
||||
* @return True if any wires or buses were broken.
|
||||
*/
|
||||
bool BreakSegments( SCHEMATIC_COMMIT* aCommit, const VECTOR2I& aPoint, SCH_SCREEN* aScreen );
|
||||
bool BreakSegments( SCH_COMMIT* aCommit, const VECTOR2I& aPoint, SCH_SCREEN* aScreen );
|
||||
|
||||
/**
|
||||
* Test all junctions and bus entries in the schematic for intersections with wires and
|
||||
|
@ -304,7 +304,7 @@ public:
|
|||
* @param aScreen is the screen to examine.
|
||||
* @return True if any wires or buses were broken.
|
||||
*/
|
||||
bool BreakSegmentsOnJunctions( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aScreen );
|
||||
bool BreakSegmentsOnJunctions( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen );
|
||||
|
||||
/**
|
||||
* Test all of the connectable objects in the schematic for unused connection points.
|
||||
|
@ -407,7 +407,7 @@ public:
|
|||
* number * 100. In other words the first sheet uses 100 to 199, the second sheet uses
|
||||
* 200 to 299, and so on.
|
||||
*/
|
||||
void AnnotateSymbols( SCHEMATIC_COMMIT* aCommit, ANNOTATE_SCOPE_T aAnnotateScope,
|
||||
void AnnotateSymbols( SCH_COMMIT* aCommit, ANNOTATE_SCOPE_T aAnnotateScope,
|
||||
ANNOTATE_ORDER_T aSortOption, ANNOTATE_ALGO_T aAlgoOption,
|
||||
bool aRecursive, int aStartNumber, bool aResetAnnotation,
|
||||
bool aRepairTimestamps, REPORTER& aReporter );
|
||||
|
@ -522,8 +522,7 @@ public:
|
|||
*/
|
||||
bool AskToSaveChanges();
|
||||
|
||||
SCH_JUNCTION* AddJunction( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aScreen,
|
||||
const VECTOR2I& aPos );
|
||||
SCH_JUNCTION* AddJunction( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen, const VECTOR2I& aPos );
|
||||
|
||||
/**
|
||||
* Perform routine schematic cleaning including breaking wire and buses and deleting
|
||||
|
@ -531,7 +530,7 @@ public:
|
|||
* @param aCommit Transaction container used to record changes for undo/redo
|
||||
* @param aScreen is the screen to examine, or nullptr to examine the current screen
|
||||
*/
|
||||
void SchematicCleanUp( SCHEMATIC_COMMIT* aCommit, SCH_SCREEN* aScreen = nullptr );
|
||||
void SchematicCleanUp( SCH_COMMIT* aCommit, SCH_SCREEN* aScreen = nullptr );
|
||||
|
||||
/**
|
||||
* If any single wire passes through _both points_, remove the portion between the two points,
|
||||
|
@ -541,7 +540,7 @@ public:
|
|||
* @param aEnd The ending point for trimming
|
||||
* @return True if any wires were changed by this operation
|
||||
*/
|
||||
bool TrimWire( SCHEMATIC_COMMIT* aCommit, const VECTOR2I& aStart, const VECTOR2I& aEnd );
|
||||
bool TrimWire( SCH_COMMIT* aCommit, const VECTOR2I& aStart, const VECTOR2I& aEnd );
|
||||
|
||||
void OnOpenPcbnew( wxCommandEvent& event );
|
||||
void OnOpenCvpcb( wxCommandEvent& event );
|
||||
|
@ -655,7 +654,7 @@ public:
|
|||
*
|
||||
* @param aItem The junction to delete
|
||||
*/
|
||||
void DeleteJunction( SCHEMATIC_COMMIT* aCommit, SCH_ITEM* aItem );
|
||||
void DeleteJunction( SCH_COMMIT* aCommit, SCH_ITEM* aItem );
|
||||
|
||||
void ConvertPart( SCH_SYMBOL* aSymbol );
|
||||
|
||||
|
@ -776,7 +775,7 @@ public:
|
|||
/**
|
||||
* Generate the connection data for the entire schematic hierarchy.
|
||||
*/
|
||||
void RecalculateConnections( SCHEMATIC_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags );
|
||||
void RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FLAGS aCleanupFlags );
|
||||
|
||||
/**
|
||||
* Called after the preferences dialog is run.
|
||||
|
|
|
@ -270,8 +270,8 @@ public:
|
|||
* Because a symbol in library editor does not have a lot of primitives, the full data is
|
||||
* duplicated. It is not worth to try to optimize this save function.
|
||||
*/
|
||||
void SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT,
|
||||
bool aAppend = false );
|
||||
void SaveCopyInUndoList( const wxString& aDescription, EDA_ITEM* aItem,
|
||||
UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT );
|
||||
|
||||
void GetSymbolFromUndoList();
|
||||
void GetSymbolFromRedoList();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 2014-2023 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
|
||||
|
@ -31,10 +31,9 @@
|
|||
#include <tools/ee_selection_tool.h>
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType, bool aAppend )
|
||||
void SYMBOL_EDIT_FRAME::SaveCopyInUndoList( const wxString& aDescription, EDA_ITEM* aItem,
|
||||
UNDO_REDO aUndoType )
|
||||
{
|
||||
wxASSERT_MSG( !aAppend, "Append not needed/supported for symbol editor" );
|
||||
|
||||
if( !aItem )
|
||||
return;
|
||||
|
||||
|
@ -50,6 +49,7 @@ void SYMBOL_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType
|
|||
|
||||
ITEM_PICKER wrapper( GetScreen(), copyItem, aUndoType );
|
||||
lastcmd->PushItem( wrapper );
|
||||
lastcmd->SetDescription( aDescription );
|
||||
PushCommandToUndoList( lastcmd );
|
||||
|
||||
// Clear redo list, because after new save there is no redo to do.
|
||||
|
@ -66,18 +66,23 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromRedoList()
|
|||
|
||||
// Load the last redo entry
|
||||
PICKED_ITEMS_LIST* redoCommand = PopCommandFromRedoList();
|
||||
ITEM_PICKER redoWrapper = redoCommand->PopItem();
|
||||
ITEM_PICKER redoWrapper = redoCommand->PopItem();
|
||||
wxString description = redoCommand->GetDescription();
|
||||
|
||||
delete redoCommand;
|
||||
|
||||
LIB_SYMBOL* symbol = (LIB_SYMBOL*) redoWrapper.GetItem();
|
||||
UNDO_REDO undoRedoType = redoWrapper.GetStatus();
|
||||
wxCHECK( symbol, /* void */ );
|
||||
symbol->ClearFlags( UR_TRANSIENT );
|
||||
UNDO_REDO undoRedoType = redoWrapper.GetStatus();
|
||||
|
||||
// Store the current symbol in the undo buffer
|
||||
PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
|
||||
LIB_SYMBOL* oldSymbol = m_symbol;
|
||||
LIB_SYMBOL* oldSymbol = m_symbol;
|
||||
|
||||
oldSymbol->SetFlags( UR_TRANSIENT );
|
||||
ITEM_PICKER undoWrapper( GetScreen(), oldSymbol, undoRedoType );
|
||||
undoCommand->SetDescription( description );
|
||||
undoCommand->PushItem( undoWrapper );
|
||||
PushCommandToUndoList( undoCommand );
|
||||
|
||||
|
@ -114,19 +119,24 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromUndoList()
|
|||
|
||||
// Load the last undo entry
|
||||
PICKED_ITEMS_LIST* undoCommand = PopCommandFromUndoList();
|
||||
ITEM_PICKER undoWrapper = undoCommand->PopItem();
|
||||
wxString description = undoCommand->GetDescription();
|
||||
ITEM_PICKER undoWrapper = undoCommand->PopItem();
|
||||
|
||||
delete undoCommand;
|
||||
|
||||
LIB_SYMBOL* symbol = (LIB_SYMBOL*) undoWrapper.GetItem();
|
||||
UNDO_REDO undoRedoType = undoWrapper.GetStatus();
|
||||
wxCHECK( symbol, /* void */ );
|
||||
symbol->ClearFlags( UR_TRANSIENT );
|
||||
UNDO_REDO undoRedoType = undoWrapper.GetStatus();
|
||||
|
||||
// Store the current symbol in the redo buffer
|
||||
PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
|
||||
LIB_SYMBOL* oldSymbol = m_symbol;
|
||||
LIB_SYMBOL* oldSymbol = m_symbol;
|
||||
|
||||
oldSymbol->SetFlags( UR_TRANSIENT );
|
||||
ITEM_PICKER redoWrapper( GetScreen(), oldSymbol, undoRedoType );
|
||||
redoCommand->PushItem( redoWrapper );
|
||||
redoCommand->SetDescription( description );
|
||||
PushCommandToRedoList( redoCommand );
|
||||
|
||||
// Do not delete the previous symbol by calling SetCurSymbol( symbol ),
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <sch_sheet_path.h>
|
||||
#include <sch_label.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <string_utils.h>
|
||||
#include <kiface_base.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
@ -335,8 +335,8 @@ void BACK_ANNOTATE::checkForUnusedSymbols()
|
|||
|
||||
void BACK_ANNOTATE::applyChangelist()
|
||||
{
|
||||
SCHEMATIC_COMMIT commit( m_frame );
|
||||
wxString msg;
|
||||
SCH_COMMIT commit( m_frame );
|
||||
wxString msg;
|
||||
|
||||
// Apply changes from change list
|
||||
for( CHANGELIST_ITEM& item : m_changelist )
|
||||
|
@ -557,8 +557,8 @@ void addConnections( SCH_ITEM* aItem, const SCH_SHEET_PATH& aSheetPath,
|
|||
}
|
||||
|
||||
|
||||
void BACK_ANNOTATE::processNetNameChange( SCHEMATIC_COMMIT* aCommit, const wxString& aRef,
|
||||
SCH_PIN* aPin, const SCH_CONNECTION* aConnection,
|
||||
void BACK_ANNOTATE::processNetNameChange( SCH_COMMIT* aCommit, const wxString& aRef, SCH_PIN* aPin,
|
||||
const SCH_CONNECTION* aConnection,
|
||||
const wxString& aOldName, const wxString& aNewName )
|
||||
{
|
||||
wxString msg;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
class REPORTER;
|
||||
class SCH_SHEET_LIST;
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCHEMATIC_COMMIT;
|
||||
class SCH_COMMIT;
|
||||
|
||||
/**
|
||||
* Back annotation algorithm class used to receive, check, and apply a \ref NETLIST from
|
||||
|
@ -131,7 +131,7 @@ private:
|
|||
*/
|
||||
void applyChangelist();
|
||||
|
||||
void processNetNameChange( SCHEMATIC_COMMIT* aCommit, const wxString& aRef, SCH_PIN* aPin,
|
||||
void processNetNameChange( SCH_COMMIT* aCommit, const wxString& aRef, SCH_PIN* aPin,
|
||||
const SCH_CONNECTION* aConnection, const wxString& aOldName,
|
||||
const wxString& aNewName );
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ protected:
|
|||
SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
|
||||
wxCHECK_RET( editFrame, wxT( "editFrame is null" ) );
|
||||
|
||||
editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
|
||||
editFrame->SaveCopyInUndoList( wxEmptyString, static_cast<LIB_ITEM*>( aItem ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <sch_sheet_pin.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <symbol_library_common.h>
|
||||
#include <eeschema_settings.h>
|
||||
#include <dialogs/dialog_label_properties.h>
|
||||
|
@ -111,7 +111,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
std::vector<PICKED_SYMBOL>* historyList = nullptr;
|
||||
bool ignorePrimePosition = false;
|
||||
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
EE_GRID_HELPER grid( m_toolMgr );
|
||||
|
||||
if( m_inPlaceSymbol )
|
||||
|
@ -149,7 +149,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto addSymbol =
|
||||
[this]( SCHEMATIC_COMMIT* aCommit, SCH_SYMBOL* aSymbol )
|
||||
[this]( SCH_COMMIT* aCommit, SCH_SYMBOL* aSymbol )
|
||||
{
|
||||
m_frame->SaveCopyForRepeatItem( aSymbol );
|
||||
|
||||
|
@ -643,7 +643,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
m_frame->AddItemToCommitAndScreen( &commit, m_frame->GetScreen(), image );
|
||||
commit.Push( _( "Add Image" ) );
|
||||
|
||||
|
@ -833,7 +833,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
newItem->SetPosition( cursorPos );
|
||||
newItem->SetFlags( IS_NEW );
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
m_frame->AddItemToCommitAndScreen( &commit, m_frame->GetScreen(), newItem );
|
||||
|
||||
if( type == SCH_JUNCTION_T )
|
||||
|
@ -1439,7 +1439,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
item->ClearFlags( IS_MOVING );
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
m_frame->AddItemToCommitAndScreen( &commit, m_frame->GetScreen(), item );
|
||||
commit.Push( description );
|
||||
|
||||
|
@ -1688,7 +1688,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_lastFillColor = item->GetFillColor();
|
||||
}
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
commit.Added( item, m_frame->GetScreen() );
|
||||
commit.Push( wxString::Format( _( "Draw %s" ), item->GetClass() ) );
|
||||
|
||||
|
@ -1880,7 +1880,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
sheet->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
m_frame->AddItemToCommitAndScreen( &commit, m_frame->GetScreen(), sheet );
|
||||
commit.Push( "Draw Sheet" );
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include <sch_junction.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <drawing_sheet/ds_proxy_view_item.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <dialogs/dialog_change_symbols.h>
|
||||
|
@ -671,15 +671,15 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
||||
SCH_ITEM* head = nullptr;
|
||||
int principalItemCount = 0; // User-selected items (as opposed to connected wires)
|
||||
VECTOR2I rotPoint;
|
||||
bool moving = false;
|
||||
SCHEMATIC_COMMIT localInstance( m_toolMgr );
|
||||
SCHEMATIC_COMMIT* commit = aEvent.Parameter<SCHEMATIC_COMMIT*>();
|
||||
SCH_ITEM* head = nullptr;
|
||||
int principalItemCount = 0; // User-selected items (as opposed to connected wires)
|
||||
VECTOR2I rotPoint;
|
||||
bool moving = false;
|
||||
SCH_COMMIT localCommit( m_toolMgr );
|
||||
SCH_COMMIT* commit = aEvent.Parameter<SCH_COMMIT*>();
|
||||
|
||||
if( !commit )
|
||||
commit = &localInstance;
|
||||
commit = &localCommit;
|
||||
|
||||
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
|
||||
{
|
||||
|
@ -927,8 +927,8 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
m_frame->SchematicCleanUp( commit );
|
||||
m_frame->TestDanglingEnds();
|
||||
|
||||
if( !localInstance.Empty() )
|
||||
localInstance.Push( _( "Rotate" ) );
|
||||
if( !localCommit.Empty() )
|
||||
localCommit.Push( _( "Rotate" ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -942,15 +942,15 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
||||
bool vertical = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) );
|
||||
SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
|
||||
bool connections = false;
|
||||
bool moving = item->IsMoving();
|
||||
SCHEMATIC_COMMIT localInstance( m_toolMgr );
|
||||
SCHEMATIC_COMMIT* commit = aEvent.Parameter<SCHEMATIC_COMMIT*>();
|
||||
bool vertical = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) );
|
||||
SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
|
||||
bool connections = false;
|
||||
bool moving = item->IsMoving();
|
||||
SCH_COMMIT localCommit( m_toolMgr );
|
||||
SCH_COMMIT* commit = aEvent.Parameter<SCH_COMMIT*>();
|
||||
|
||||
if( !commit )
|
||||
commit = &localInstance;
|
||||
commit = &localCommit;
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
{
|
||||
|
@ -1128,8 +1128,8 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
m_frame->TestDanglingEnds();
|
||||
}
|
||||
|
||||
if( !localInstance.Empty() )
|
||||
localInstance.Push( _( "Mirror" ) );
|
||||
if( !localCommit.Empty() )
|
||||
localCommit.Push( _( "Mirror" ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1247,8 +1247,8 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
EE_SELECTION newItems;
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
EE_SELECTION newItems;
|
||||
|
||||
for( const std::unique_ptr<SCH_ITEM>& item : sourceItems )
|
||||
{
|
||||
|
@ -1362,7 +1362,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
std::deque<EDA_ITEM*> items = m_selectionTool->RequestSelection( deletableItems ).GetItems();
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
std::vector<VECTOR2I> pts;
|
||||
|
||||
if( items.empty() )
|
||||
|
@ -1516,8 +1516,8 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
|
||||
{
|
||||
KICAD_T parentType = aField->GetParent() ? aField->GetParent()->Type() : SCHEMATIC_T;
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
KICAD_T parentType = aField->GetParent() ? aField->GetParent()->Type() : SCHEMATIC_T;
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
// Save old symbol in undo list if not already in edit, or moving.
|
||||
if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
|
||||
|
@ -1609,10 +1609,10 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( RotatableItems );
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_ITEM* head = static_cast<SCH_ITEM*>( selection.Front() );
|
||||
bool moving = head && head->IsMoving();
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( RotatableItems );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
SCH_ITEM* head = static_cast<SCH_ITEM*>( selection.Front() );
|
||||
bool moving = head && head->IsMoving();
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
@ -2340,7 +2340,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
|
|||
if( selected )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::removeItemFromSel, true, item );
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
if( !item->IsNew() )
|
||||
{
|
||||
|
@ -2386,9 +2386,8 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
|
|||
bool isSlice = aEvent.Matches( EE_ACTIONS::slice.MakeEvent() );
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() );
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_LINE_T } );
|
||||
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
std::vector<SCH_LINE*> lines;
|
||||
|
||||
for( EDA_ITEM* item : selection )
|
||||
|
@ -2555,7 +2554,7 @@ int SCH_EDIT_TOOL::DdAppendFile( const TOOL_EVENT& aEvent )
|
|||
int SCH_EDIT_TOOL::SetAttribute( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
@ -2588,7 +2587,7 @@ int SCH_EDIT_TOOL::SetAttribute( const TOOL_EVENT& aEvent )
|
|||
int SCH_EDIT_TOOL::UnsetAttribute( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
@ -2621,7 +2620,7 @@ int SCH_EDIT_TOOL::UnsetAttribute( const TOOL_EVENT& aEvent )
|
|||
int SCH_EDIT_TOOL::ToggleAttribute( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include <sch_sheet_pin.h>
|
||||
#include <sch_view.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <sim/simulator_frame.h>
|
||||
#include <sim/spice_generator.h>
|
||||
#include <sim/sim_lib_mgr.h>
|
||||
|
@ -1527,12 +1527,12 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
|
||||
// SCH_SEXP_PLUGIN added the items to the paste screen, but not to the view or anything
|
||||
// else. Pull them back out to start with.
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
EDA_ITEMS loadedItems;
|
||||
bool sheetsPasted = false;
|
||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
|
||||
SCH_SHEET_PATH& pasteRoot = m_frame->GetCurrentSheet();
|
||||
wxFileName destFn = pasteRoot.Last()->GetFileName();
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
EDA_ITEMS loadedItems;
|
||||
bool sheetsPasted = false;
|
||||
SCH_SHEET_LIST hierarchy = m_frame->Schematic().GetSheets();
|
||||
SCH_SHEET_PATH& pasteRoot = m_frame->GetCurrentSheet();
|
||||
wxFileName destFn = pasteRoot.Last()->GetFileName();
|
||||
|
||||
if( destFn.IsRelative() )
|
||||
destFn.MakeAbsolute( m_frame->Prj().GetProjectPath() );
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <ee_actions.h>
|
||||
#include <ee_grid_helper.h>
|
||||
#include <ee_selection.h>
|
||||
|
@ -1120,8 +1120,8 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
|
|||
// freed selected items.
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
// Remove segments backtracking over others
|
||||
simplifyWireList();
|
||||
|
@ -1227,8 +1227,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
|
|||
}
|
||||
|
||||
|
||||
int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( SCHEMATIC_COMMIT* aCommit,
|
||||
EE_SELECTION* aSelection )
|
||||
int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( SCH_COMMIT* aCommit, EE_SELECTION* aSelection )
|
||||
{
|
||||
SCHEMATIC* sch = getModel<SCHEMATIC>();
|
||||
SCH_SCREEN* screen = sch->CurrentSheet().LastScreen();
|
||||
|
@ -1272,10 +1271,9 @@ int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( SCHEMATIC_COMMIT* aCommit,
|
|||
}
|
||||
|
||||
|
||||
int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( SCHEMATIC_COMMIT* aCommit,
|
||||
EE_SELECTION* aSelection )
|
||||
int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( SCH_COMMIT* aCommit, EE_SELECTION* aSelection )
|
||||
{
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
|
||||
for( const VECTOR2I& point : screen->GetNeededJunctions( aSelection->Items() ) )
|
||||
m_frame->AddJunction( aCommit, m_frame->GetScreen(), point );
|
||||
|
|
|
@ -92,12 +92,12 @@ public:
|
|||
/**
|
||||
* Handle the addition of junctions to a selection of objects
|
||||
*/
|
||||
int AddJunctionsIfNeeded( SCHEMATIC_COMMIT* aCommit, EE_SELECTION* aSelection );
|
||||
int AddJunctionsIfNeeded( SCH_COMMIT* aCommit, EE_SELECTION* aSelection );
|
||||
|
||||
/**
|
||||
* Logic to remove wires when overlapping correct items
|
||||
*/
|
||||
int TrimOverLappingWires( SCHEMATIC_COMMIT* aCommit, EE_SELECTION* aSelection );
|
||||
int TrimOverLappingWires( SCH_COMMIT* aCommit, EE_SELECTION* aSelection );
|
||||
|
||||
private:
|
||||
int doDrawSegments( const TOOL_EVENT& aTool, int aType, bool aQuitOnDraw );
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <tools/ee_selection_tool.h>
|
||||
#include <tools/sch_line_wire_bus_tool.h>
|
||||
#include <ee_actions.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <eda_item.h>
|
||||
#include <sch_item.h>
|
||||
#include <sch_symbol.h>
|
||||
|
@ -87,8 +87,8 @@ bool SCH_MOVE_TOOL::Init()
|
|||
}
|
||||
|
||||
|
||||
void SCH_MOVE_TOOL::orthoLineDrag( SCH_LINE* line, const VECTOR2I& splitDelta, int& xBendCount,
|
||||
int& yBendCount, const EE_GRID_HELPER& grid )
|
||||
void SCH_MOVE_TOOL::orthoLineDrag( SCH_COMMIT* aCommit, SCH_LINE* line, const VECTOR2I& splitDelta,
|
||||
int& xBendCount, int& yBendCount, const EE_GRID_HELPER& grid )
|
||||
{
|
||||
// If the move is not the same angle as this move, then we need to do something special with
|
||||
// the unselected end to maintain orthogonality. Either drag some connected line that is the
|
||||
|
@ -197,7 +197,7 @@ void SCH_MOVE_TOOL::orthoLineDrag( SCH_LINE* line, const VECTOR2I& splitDelta, i
|
|||
|
||||
if( !foundLine->HasFlag( IS_CHANGED ) && !foundLine->HasFlag( IS_NEW ) )
|
||||
{
|
||||
saveCopyInUndoList( (SCH_ITEM*) foundLine, UNDO_REDO::CHANGED, true );
|
||||
aCommit->Modify( (SCH_ITEM*) foundLine, m_frame->GetScreen() );
|
||||
|
||||
if( !foundLine->IsSelected() )
|
||||
m_changedDragLines.insert( foundLine );
|
||||
|
@ -360,11 +360,11 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
EE_GRID_HELPER grid( m_toolMgr );
|
||||
bool wasDragging = m_moveInProgress && m_isDrag;
|
||||
bool isSlice = false;
|
||||
SCHEMATIC_COMMIT localInstance( m_toolMgr );
|
||||
SCHEMATIC_COMMIT* commit = aEvent.Parameter<SCHEMATIC_COMMIT*>();
|
||||
SCH_COMMIT localCommit( m_toolMgr );
|
||||
SCH_COMMIT* commit = aEvent.Parameter<SCH_COMMIT*>();
|
||||
|
||||
if( !commit )
|
||||
commit = &localInstance;
|
||||
commit = &localCommit;
|
||||
|
||||
m_anchorPos.reset();
|
||||
|
||||
|
@ -375,7 +375,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
else if( aEvent.IsAction( &EE_ACTIONS::drag ) )
|
||||
{
|
||||
m_isDrag = true;
|
||||
isSlice = commit != &localInstance;
|
||||
isSlice = commit != &localCommit;
|
||||
}
|
||||
else if( aEvent.IsAction( &EE_ACTIONS::moveActivate ) )
|
||||
{
|
||||
|
@ -752,7 +752,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
&& line
|
||||
&& line->HasFlag( STARTPOINT ) != line->HasFlag( ENDPOINT ) )
|
||||
{
|
||||
orthoLineDrag( line, splitDelta, xBendCount, yBendCount, grid );
|
||||
orthoLineDrag( commit, line, splitDelta, xBendCount, yBendCount, grid );
|
||||
}
|
||||
|
||||
// Move all other items normally, including the selected end of partially
|
||||
|
@ -970,7 +970,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_frame->SchematicCleanUp( commit );
|
||||
|
||||
if( commit == &localInstance )
|
||||
if( commit == &localCommit )
|
||||
commit->Push( m_isDrag ? _( "Drag" ) : _( "Move" ) );
|
||||
}
|
||||
|
||||
|
@ -996,7 +996,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void SCH_MOVE_TOOL::trimDanglingLines( SCHEMATIC_COMMIT* aCommit )
|
||||
void SCH_MOVE_TOOL::trimDanglingLines( SCH_COMMIT* aCommit )
|
||||
{
|
||||
// Need a local cleanup first to ensure we remove unneeded junctions
|
||||
m_frame->SchematicCleanUp( aCommit, m_frame->GetScreen() );
|
||||
|
@ -1160,7 +1160,7 @@ void SCH_MOVE_TOOL::getConnectedItems( SCH_ITEM* aOriginalItem, const VECTOR2I&
|
|||
}
|
||||
|
||||
|
||||
void SCH_MOVE_TOOL::getConnectedDragItems( SCHEMATIC_COMMIT* aCommit, SCH_ITEM* aSelectedItem,
|
||||
void SCH_MOVE_TOOL::getConnectedDragItems( SCH_COMMIT* aCommit, SCH_ITEM* aSelectedItem,
|
||||
const VECTOR2I& aPoint, EDA_ITEMS& aList )
|
||||
{
|
||||
EE_RTREE& items = m_frame->GetScreen()->Items();
|
||||
|
@ -1169,8 +1169,8 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCHEMATIC_COMMIT* aCommit, SCH_ITEM*
|
|||
bool ptHasUnselectedJunction = false;
|
||||
|
||||
auto makeNewWire =
|
||||
[this]( SCHEMATIC_COMMIT* commit, SCH_ITEM* fixed, SCH_ITEM* selected,
|
||||
const VECTOR2I& start, const VECTOR2I& end )
|
||||
[this]( SCH_COMMIT* commit, SCH_ITEM* fixed, SCH_ITEM* selected, const VECTOR2I& start,
|
||||
const VECTOR2I& end )
|
||||
{
|
||||
SCH_LINE* newWire;
|
||||
|
||||
|
@ -1198,7 +1198,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCHEMATIC_COMMIT* aCommit, SCH_ITEM*
|
|||
};
|
||||
|
||||
auto makeNewJunction =
|
||||
[this]( SCHEMATIC_COMMIT* commit, SCH_LINE* line, const VECTOR2I& pt )
|
||||
[this]( SCH_COMMIT* commit, SCH_LINE* line, const VECTOR2I& pt )
|
||||
{
|
||||
SCH_JUNCTION* junction = new SCH_JUNCTION( pt );
|
||||
junction->SetFlags( IS_NEW );
|
||||
|
@ -1592,9 +1592,9 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta )
|
|||
|
||||
int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EE_GRID_HELPER grid( m_toolMgr);
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::MovableItems );
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
EE_GRID_HELPER grid( m_toolMgr);
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::MovableItems );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
auto doMoveItem =
|
||||
[&]( EDA_ITEM* item, const VECTOR2I& delta )
|
||||
|
|
|
@ -69,11 +69,11 @@ private:
|
|||
///< Connected items with no wire are included (as there is no wire to adjust for the drag).
|
||||
///< Connected wires are included with any un-connected ends flagged (STARTPOINT or ENDPOINT).
|
||||
void getConnectedItems( SCH_ITEM* aOriginalItem, const VECTOR2I& aPoint, EDA_ITEMS& aList );
|
||||
void getConnectedDragItems( SCHEMATIC_COMMIT* aCommit, SCH_ITEM* fixed,
|
||||
const VECTOR2I& selected, EDA_ITEMS& aList );
|
||||
void getConnectedDragItems( SCH_COMMIT* aCommit, SCH_ITEM* fixed, const VECTOR2I& selected,
|
||||
EDA_ITEMS& aList );
|
||||
|
||||
void orthoLineDrag( SCH_LINE* line, const VECTOR2I& splitDelta, int& xBendCount,
|
||||
int& yBendCount, const EE_GRID_HELPER& grid );
|
||||
void orthoLineDrag( SCH_COMMIT* aCommit, SCH_LINE* line, const VECTOR2I& splitDelta,
|
||||
int& xBendCount, int& yBendCount, const EE_GRID_HELPER& grid );
|
||||
|
||||
///< Clears the new drag lines and removes them from the screen
|
||||
void clearNewDragLines();
|
||||
|
@ -82,7 +82,7 @@ private:
|
|||
void setTransitions() override;
|
||||
|
||||
///< Cleanup dangling lines left after a drag
|
||||
void trimDanglingLines( SCHEMATIC_COMMIT* aCommit );
|
||||
void trimDanglingLines( SCH_COMMIT* aCommit );
|
||||
|
||||
private:
|
||||
///< Re-entrancy guard
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <ee_actions.h>
|
||||
#include <symbol_edit_frame.h>
|
||||
#include <sch_commit.h>
|
||||
#include <tools/symbol_editor_drawing_tools.h>
|
||||
#include <tools/symbol_editor_pin_tool.h>
|
||||
#include <tools/ee_grid_helper.h>
|
||||
|
@ -92,6 +93,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
LIB_ITEM* item = nullptr;
|
||||
bool isText = aEvent.IsAction( &EE_ACTIONS::placeSymbolText );
|
||||
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
|
||||
wxString description;
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
|
@ -209,6 +211,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
item = pinTool->CreatePin( VECTOR2I( cursorPos.x, -cursorPos.y ), symbol );
|
||||
g_lastPinWeakPtr = item;
|
||||
description = _( "Add Pin" );
|
||||
break;
|
||||
}
|
||||
case LIB_TEXT_T:
|
||||
|
@ -233,6 +236,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
item = text;
|
||||
|
||||
description = _( "Add Text" );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -271,7 +275,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
// ... and second click places:
|
||||
else
|
||||
{
|
||||
m_frame->SaveCopyInUndoList( symbol );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
commit.Modify( symbol, m_frame->GetScreen() );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -289,8 +294,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
item = nullptr;
|
||||
m_view->ClearPreview();
|
||||
|
||||
commit.Push( description );
|
||||
m_frame->RebuildView();
|
||||
m_frame->OnModify();
|
||||
}
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
|
@ -334,6 +339,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
LIB_SHAPE* item = nullptr;
|
||||
bool isTextBox = aEvent.IsAction( &EE_ACTIONS::drawSymbolTextBox );
|
||||
wxString description;
|
||||
|
||||
if( m_inDrawShape )
|
||||
return 0;
|
||||
|
@ -439,10 +445,12 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
textbox->SetHorizJustify( m_lastTextJust );
|
||||
|
||||
item = textbox;
|
||||
description = _( "Add Text Box" );
|
||||
}
|
||||
else
|
||||
{
|
||||
item = new LIB_SHAPE( symbol, shapeType, lineWidth, m_lastFillStyle );
|
||||
description = wxString::Format( _( "Add %s" ), item->EDA_SHAPE::GetFriendlyName() );
|
||||
}
|
||||
|
||||
item->SetStroke( m_lastStroke );
|
||||
|
@ -508,12 +516,14 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_view->ClearPreview();
|
||||
|
||||
m_frame->SaveCopyInUndoList( symbol );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
commit.Modify( symbol, m_frame->GetScreen() );
|
||||
|
||||
symbol->AddDrawItem( item );
|
||||
item = nullptr;
|
||||
|
||||
commit.Push( description );
|
||||
m_frame->RebuildView();
|
||||
m_frame->OnModify();
|
||||
m_toolMgr->RunAction( ACTIONS::activatePointEditor );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <ee_actions.h>
|
||||
#include <string_utils.h>
|
||||
#include <symbol_edit_frame.h>
|
||||
#include <schematic_commit.h>
|
||||
#include <sch_commit.h>
|
||||
#include <dialogs/dialog_lib_shape_properties.h>
|
||||
#include <dialogs/dialog_lib_text_properties.h>
|
||||
#include <dialogs/dialog_lib_textbox_properties.h>
|
||||
|
@ -154,12 +154,17 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
||||
VECTOR2I rotPoint;
|
||||
bool ccw = ( aEvent.Matches( EE_ACTIONS::rotateCCW.MakeEvent() ) );
|
||||
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
||||
VECTOR2I rotPoint;
|
||||
bool ccw = ( aEvent.Matches( EE_ACTIONS::rotateCCW.MakeEvent() ) );
|
||||
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
||||
SCH_COMMIT localCommit( m_toolMgr );
|
||||
SCH_COMMIT* commit = aEvent.Parameter<SCH_COMMIT*>();
|
||||
|
||||
if( !commit )
|
||||
commit = &localCommit;
|
||||
|
||||
if( !item->IsMoving() )
|
||||
saveCopyInUndoList( m_frame->GetCurSymbol(), UNDO_REDO::LIBEDIT );
|
||||
commit->Modify( m_frame->GetCurSymbol(), m_frame->GetScreen() );
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
rotPoint = item->GetPosition();
|
||||
|
@ -184,7 +189,8 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
if( selection.IsHover() )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_frame->OnModify();
|
||||
if( !localCommit.Empty() )
|
||||
localCommit.Push( _( "Rotate" ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -252,8 +258,9 @@ static std::vector<KICAD_T> nonFields =
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL *symbol = m_frame->GetCurSymbol();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
std::deque<EDA_ITEM*> items = m_selectionTool->RequestSelection( nonFields ).GetItems();
|
||||
SCH_COMMIT commit( m_frame );
|
||||
|
||||
if( items.empty() )
|
||||
return 0;
|
||||
|
@ -261,9 +268,9 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
// Don't leave a freed pointer in the selection
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
saveCopyInUndoList( symbol, UNDO_REDO::LIBEDIT );
|
||||
commit.Modify( symbol, m_frame->GetScreen() );
|
||||
|
||||
std::set<LIB_ITEM *> toDelete;
|
||||
std::set<LIB_ITEM*> toDelete;
|
||||
|
||||
for( EDA_ITEM* item : items )
|
||||
{
|
||||
|
@ -318,8 +325,9 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
for( LIB_ITEM* item : toDelete )
|
||||
symbol->RemoveDrawItem( item );
|
||||
|
||||
commit.Push( _( "Delete" ) );
|
||||
|
||||
m_frame->RebuildView();
|
||||
m_frame->OnModify();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -780,7 +788,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
|||
if( !newPart )
|
||||
return -1;
|
||||
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
commit.Modify( symbol );
|
||||
m_selectionTool->ClearSelection();
|
||||
|
@ -823,9 +831,9 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
|
||||
SCHEMATIC_COMMIT commit( m_toolMgr );
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
||||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <tools/ee_selection_tool.h>
|
||||
#include <ee_actions.h>
|
||||
#include <eda_item.h>
|
||||
#include <sch_commit.h>
|
||||
#include <wx/log.h>
|
||||
#include "symbol_editor_move_tool.h"
|
||||
#include "symbol_editor_pin_tool.h"
|
||||
|
@ -90,6 +91,11 @@ void SYMBOL_EDITOR_MOVE_TOOL::Reset( RESET_REASON aReason )
|
|||
int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||
SCH_COMMIT localCommit( m_toolMgr );
|
||||
SCH_COMMIT* commit = aEvent.Parameter<SCH_COMMIT*>();
|
||||
|
||||
if( !commit )
|
||||
commit = &localCommit;
|
||||
|
||||
m_anchorPos = { 0, 0 };
|
||||
|
||||
|
@ -124,7 +130,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
VECTOR2I prevPos;
|
||||
|
||||
if( !selection.Front()->IsNew() )
|
||||
saveCopyInUndoList( m_frame->GetCurSymbol(), UNDO_REDO::LIBEDIT );
|
||||
commit->Modify( m_frame->GetCurSymbol(), m_frame->GetScreen() );
|
||||
|
||||
m_cursor = controls->GetCursorPosition( !aEvent.DisableGridSnapping() );
|
||||
|
||||
|
@ -355,7 +361,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( restore_state )
|
||||
{
|
||||
m_frame->RollbackSymbolFromUndo();
|
||||
commit->Revert();
|
||||
|
||||
if( unselect )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
@ -367,7 +373,8 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( unselect )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_frame->OnModify();
|
||||
if( !localCommit.Empty() )
|
||||
localCommit.Push( _( "Move" ) );
|
||||
}
|
||||
|
||||
m_moveInProgress = false;
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <symbol_edit_frame.h>
|
||||
#include <sch_commit.h>
|
||||
#include <confirm.h>
|
||||
#include <ee_actions.h>
|
||||
#include <dialogs/dialog_pin_properties.h>
|
||||
|
@ -118,19 +118,15 @@ bool SYMBOL_EDITOR_PIN_TOOL::Init()
|
|||
|
||||
bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||
{
|
||||
LIB_PIN original_pin( *aPin );
|
||||
LIB_PIN original_pin( *aPin );
|
||||
DIALOG_PIN_PROPERTIES dlg( m_frame, aPin );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
|
||||
if( aPin->GetEditFlags() == 0 )
|
||||
m_frame->SaveCopyInUndoList( aPin->GetParent() );
|
||||
commit.Modify( aPin->GetParent() );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
{
|
||||
if( aPin->GetEditFlags() == 0 )
|
||||
m_frame->PopCommandFromUndoList();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
aPin->SetModified();
|
||||
|
||||
|
@ -194,8 +190,8 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
|||
}
|
||||
}
|
||||
|
||||
commit.Push( _( "Edit Pin Properties" ) );
|
||||
m_frame->UpdateItem( aPin, false, true );
|
||||
m_frame->OnModify( );
|
||||
|
||||
std::vector<MSG_PANEL_ITEM> items;
|
||||
aPin->GetMsgPanelInfo( m_frame, items );
|
||||
|
|
Loading…
Reference in New Issue