mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Don't push someone else's commit.
This commit is contained in:
parent
e9f8b72666
commit
b0945ee697
@ -72,7 +72,10 @@ COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType, BASE_SCREEN* aS
|
|||||||
makeEntry( aItem, CHT_REMOVE | flags, makeImage( aItem ), aScreen );
|
makeEntry( aItem, CHT_REMOVE | flags, makeImage( aItem ), aScreen );
|
||||||
|
|
||||||
if( EDA_GROUP* parentGroup = aItem->GetParentGroup() )
|
if( EDA_GROUP* parentGroup = aItem->GetParentGroup() )
|
||||||
|
{
|
||||||
|
if( parentGroup->AsEdaItem()->GetFlags() & STRUCT_DELETED )
|
||||||
Modify( parentGroup->AsEdaItem(), aScreen, RECURSE_MODE::NO_RECURSE );
|
Modify( parentGroup->AsEdaItem(), aScreen, RECURSE_MODE::NO_RECURSE );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -926,8 +926,6 @@ void PCB_TUNING_PATTERN::Remove( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COM
|
|||||||
for( BOARD_ITEM* item : routerAddedItems )
|
for( BOARD_ITEM* item : routerAddedItems )
|
||||||
aCommit->Add( item );
|
aCommit->Add( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
aCommit->Push( "Remove Tuning Pattern" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1233,8 +1231,7 @@ bool PCB_TUNING_PATTERN::Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COM
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TUNING_PATTERN::EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit,
|
void PCB_TUNING_PATTERN::EditFinish( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit )
|
||||||
const wxString& aCommitMsg, int aCommitFlags )
|
|
||||||
{
|
{
|
||||||
if( !( GetFlags() & IN_EDIT ) )
|
if( !( GetFlags() & IN_EDIT ) )
|
||||||
return;
|
return;
|
||||||
@ -1291,15 +1288,10 @@ void PCB_TUNING_PATTERN::EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aCommitMsg.IsEmpty() )
|
|
||||||
aCommit->Push( _( "Edit Tuning Pattern" ), aCommitFlags );
|
|
||||||
else
|
|
||||||
aCommit->Push( aCommitMsg, aCommitFlags );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TUNING_PATTERN::EditRevert( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit )
|
void PCB_TUNING_PATTERN::EditCancel( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit )
|
||||||
{
|
{
|
||||||
if( !( GetFlags() & IN_EDIT ) )
|
if( !( GetFlags() & IN_EDIT ) )
|
||||||
return;
|
return;
|
||||||
@ -1320,9 +1312,6 @@ void PCB_TUNING_PATTERN::EditRevert( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD
|
|||||||
}
|
}
|
||||||
|
|
||||||
aTool->Router()->StopRouting();
|
aTool->Router()->StopRouting();
|
||||||
|
|
||||||
if( aCommit )
|
|
||||||
aCommit->Revert();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1825,7 +1814,9 @@ void PCB_TUNING_PATTERN::ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame )
|
|||||||
GENERATOR_TOOL* generatorTool = aEditFrame->GetToolManager()->GetTool<GENERATOR_TOOL>();
|
GENERATOR_TOOL* generatorTool = aEditFrame->GetToolManager()->GetTool<GENERATOR_TOOL>();
|
||||||
EditStart( generatorTool, GetBoard(), &commit );
|
EditStart( generatorTool, GetBoard(), &commit );
|
||||||
Update( generatorTool, GetBoard(), &commit );
|
Update( generatorTool, GetBoard(), &commit );
|
||||||
EditPush( generatorTool, GetBoard(), &commit );
|
EditFinish( generatorTool, GetBoard(), &commit );
|
||||||
|
|
||||||
|
commit.Push( _( "Edit Tuning Pattern" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2248,7 +2239,7 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
|||||||
if( m_tuningPattern )
|
if( m_tuningPattern )
|
||||||
{
|
{
|
||||||
// First click already made; clean up tuning pattern preview
|
// First click already made; clean up tuning pattern preview
|
||||||
m_tuningPattern->EditRevert( generatorTool, m_board, nullptr );
|
m_tuningPattern->EditCancel( generatorTool, m_board, nullptr );
|
||||||
|
|
||||||
delete m_tuningPattern;
|
delete m_tuningPattern;
|
||||||
m_tuningPattern = nullptr;
|
m_tuningPattern = nullptr;
|
||||||
@ -2364,7 +2355,9 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
m_tuningPattern->EditStart( generatorTool, m_board, &commit );
|
m_tuningPattern->EditStart( generatorTool, m_board, &commit );
|
||||||
m_tuningPattern->Update( generatorTool, m_board, &commit );
|
m_tuningPattern->Update( generatorTool, m_board, &commit );
|
||||||
m_tuningPattern->EditPush( generatorTool, m_board, &commit, _( "Tune" ) );
|
m_tuningPattern->EditFinish( generatorTool, m_board, &commit );
|
||||||
|
|
||||||
|
commit.Push( _( "Tune" ) );
|
||||||
|
|
||||||
m_tuningPattern = nullptr;
|
m_tuningPattern = nullptr;
|
||||||
m_pickerItem = nullptr;
|
m_pickerItem = nullptr;
|
||||||
|
@ -99,17 +99,22 @@ public:
|
|||||||
|
|
||||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
|
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
|
||||||
{
|
{
|
||||||
return wxString( _( "Tuning Pattern" ) );
|
return _( "Tuning Pattern" );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GetFriendlyName() const override
|
wxString GetFriendlyName() const override
|
||||||
{
|
{
|
||||||
return wxString( _( "Tuning Pattern" ) );
|
return _( "Tuning Pattern" );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GetPluralName() const override
|
wxString GetPluralName() const override
|
||||||
{
|
{
|
||||||
return wxString( _( "Tuning Patterns" ) );
|
return _( "Tuning Patterns" );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString GetCommitMessage() const override
|
||||||
|
{
|
||||||
|
return _( "Edit Tuning Pattern" );
|
||||||
}
|
}
|
||||||
|
|
||||||
BITMAPS GetMenuImage() const override
|
BITMAPS GetMenuImage() const override
|
||||||
@ -129,13 +134,9 @@ public:
|
|||||||
LENGTH_TUNING_MODE aMode );
|
LENGTH_TUNING_MODE aMode );
|
||||||
|
|
||||||
void EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
void EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
||||||
|
|
||||||
bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
||||||
|
void EditFinish( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
||||||
void EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit,
|
void EditCancel( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
||||||
const wxString& aCommitMsg = wxEmptyString, int aCommitFlags = 0 ) override;
|
|
||||||
|
|
||||||
void EditRevert( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
|
||||||
|
|
||||||
void Remove( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
void Remove( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
|
||||||
|
|
||||||
|
@ -56,37 +56,6 @@ PCB_GENERATOR* PCB_GENERATOR::DeepClone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_GENERATOR::EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit )
|
|
||||||
{
|
|
||||||
aCommit->Modify( this, nullptr, RECURSE_MODE::NO_RECURSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_GENERATOR::EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit,
|
|
||||||
const wxString& aCommitMsg, int aCommitFlags )
|
|
||||||
{
|
|
||||||
aCommit->Push( aCommitMsg, aCommitFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_GENERATOR::EditRevert( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit )
|
|
||||||
{
|
|
||||||
aCommit->Revert();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_GENERATOR::Remove( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit )
|
|
||||||
{
|
|
||||||
aCommit->Remove( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PCB_GENERATOR::Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<EDA_ITEM*> PCB_GENERATOR::GetPreviewItems( GENERATOR_TOOL* aTool,
|
std::vector<EDA_ITEM*> PCB_GENERATOR::GetPreviewItems( GENERATOR_TOOL* aTool,
|
||||||
PCB_BASE_EDIT_FRAME* aFrame,
|
PCB_BASE_EDIT_FRAME* aFrame,
|
||||||
bool aStatusItemsOnly )
|
bool aStatusItemsOnly )
|
||||||
|
@ -53,16 +53,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
PCB_GENERATOR* DeepClone() const;
|
PCB_GENERATOR* DeepClone() const;
|
||||||
|
|
||||||
virtual void EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit );
|
virtual void EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) = 0;
|
||||||
|
virtual bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) = 0;
|
||||||
|
virtual void EditFinish( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) = 0;
|
||||||
|
virtual void EditCancel( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) = 0;
|
||||||
|
|
||||||
virtual void EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit,
|
virtual void Remove( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) = 0;
|
||||||
const wxString& aCommitMsg = wxEmptyString, int aCommitFlags = 0 );
|
|
||||||
|
|
||||||
virtual void EditRevert( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit );
|
|
||||||
|
|
||||||
virtual void Remove( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit );
|
|
||||||
|
|
||||||
virtual bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit );
|
|
||||||
|
|
||||||
#define STATUS_ITEMS_ONLY true
|
#define STATUS_ITEMS_ONLY true
|
||||||
|
|
||||||
@ -106,6 +102,7 @@ public:
|
|||||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
|
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
|
||||||
|
|
||||||
virtual wxString GetPluralName() const = 0;
|
virtual wxString GetPluralName() const = 0;
|
||||||
|
virtual wxString GetCommitMessage() const = 0;
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||||
|
@ -2557,6 +2557,7 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
|
|||||||
{
|
{
|
||||||
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||||
BOARD_COMMIT commit( this );
|
BOARD_COMMIT commit( this );
|
||||||
|
int commitFlags = 0;
|
||||||
|
|
||||||
// As we are about to remove items, they have to be removed from the selection first
|
// As we are about to remove items, they have to be removed from the selection first
|
||||||
m_toolMgr->RunAction( ACTIONS::selectionClear );
|
m_toolMgr->RunAction( ACTIONS::selectionClear );
|
||||||
@ -2680,6 +2681,8 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
|
|||||||
if( SELECTION_CONDITIONS::OnlyTypes( { PCB_GENERATOR_T } ) )
|
if( SELECTION_CONDITIONS::OnlyTypes( { PCB_GENERATOR_T } ) )
|
||||||
{
|
{
|
||||||
m_toolMgr->RunSynchronousAction<PCB_GENERATOR*>( PCB_ACTIONS::genRemove, &commit, generator );
|
m_toolMgr->RunSynchronousAction<PCB_GENERATOR*>( PCB_ACTIONS::genRemove, &commit, generator );
|
||||||
|
commit.Push( _( "Delete" ), commitFlags );
|
||||||
|
commitFlags |= APPEND_UNDO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2708,20 +2711,20 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
|
|||||||
|
|
||||||
if( aIsCut )
|
if( aIsCut )
|
||||||
{
|
{
|
||||||
commit.Push( _( "Cut" ) );
|
commit.Push( _( "Cut" ), commitFlags );
|
||||||
}
|
}
|
||||||
else if( itemsDeleted == 0 )
|
else if( itemsDeleted == 0 )
|
||||||
{
|
{
|
||||||
if( fieldsHidden == 1 )
|
if( fieldsHidden == 1 )
|
||||||
commit.Push( _( "Hide Field" ) );
|
commit.Push( _( "Hide Field" ), commitFlags );
|
||||||
else if( fieldsHidden > 1 )
|
else if( fieldsHidden > 1 )
|
||||||
commit.Push( _( "Hide Fields" ) );
|
commit.Push( _( "Hide Fields" ), commitFlags );
|
||||||
else if( fieldsAlreadyHidden > 0 )
|
else if( fieldsAlreadyHidden > 0 )
|
||||||
editFrame->ShowInfoBarError( _( "Use the Footprint Properties dialog to remove fields." ) );
|
editFrame->ShowInfoBarError( _( "Use the Footprint Properties dialog to remove fields." ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
commit.Push( _( "Delete" ) );
|
commit.Push( _( "Delete" ), commitFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,7 +827,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||||||
{
|
{
|
||||||
if( sel_items.size() == 1 && sel_items.back()->Type() == PCB_GENERATOR_T )
|
if( sel_items.size() == 1 && sel_items.back()->Type() == PCB_GENERATOR_T )
|
||||||
{
|
{
|
||||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genRevertEdit, aCommit,
|
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genCancelEdit, aCommit,
|
||||||
static_cast<PCB_GENERATOR*>( sel_items.back() ) );
|
static_cast<PCB_GENERATOR*>( sel_items.back() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -835,7 +835,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||||||
{
|
{
|
||||||
if( sel_items.size() == 1 && sel_items.back()->Type() == PCB_GENERATOR_T )
|
if( sel_items.size() == 1 && sel_items.back()->Type() == PCB_GENERATOR_T )
|
||||||
{
|
{
|
||||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genPushEdit, aCommit,
|
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genFinishEdit, aCommit,
|
||||||
static_cast<PCB_GENERATOR*>( sel_items.back() ) );
|
static_cast<PCB_GENERATOR*>( sel_items.back() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ GENERATOR_TOOL::GENERATOR_TOOL() :
|
|||||||
PROPERTY_MANAGER::Instance().RegisterListener( TYPE_HASH( PCB_GENERATOR ),
|
PROPERTY_MANAGER::Instance().RegisterListener( TYPE_HASH( PCB_GENERATOR ),
|
||||||
[&]( INSPECTABLE* aItem, PROPERTY_BASE* aProperty, COMMIT* aCommit )
|
[&]( INSPECTABLE* aItem, PROPERTY_BASE* aProperty, COMMIT* aCommit )
|
||||||
{
|
{
|
||||||
// Special case: regenerator generators when their properties change
|
// Special case: regenerate generators when their properties change
|
||||||
|
|
||||||
if( PCB_GENERATOR* generator = dynamic_cast<PCB_GENERATOR*>( aItem ) )
|
if( PCB_GENERATOR* generator = dynamic_cast<PCB_GENERATOR*>( aItem ) )
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ GENERATOR_TOOL::GENERATOR_TOOL() :
|
|||||||
|
|
||||||
generator->EditStart( this, board(), commit );
|
generator->EditStart( this, board(), commit );
|
||||||
generator->Update( this, board(), commit );
|
generator->Update( this, board(), commit );
|
||||||
generator->EditPush( this, board(), commit );
|
generator->EditFinish( this, board(), commit );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@ -181,8 +181,9 @@ int GENERATOR_TOOL::RegenerateAllOfType( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
generator->EditStart( this, board(), &commit );
|
generator->EditStart( this, board(), &commit );
|
||||||
generator->Update( this, board(), &commit );
|
generator->Update( this, board(), &commit );
|
||||||
generator->EditPush( this, board(), &commit, commitMsg, commitFlags );
|
generator->EditFinish( this, board(), &commit );
|
||||||
|
|
||||||
|
commit.Push( commitMsg, commitFlags );
|
||||||
commitFlags |= APPEND_UNDO;
|
commitFlags |= APPEND_UNDO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -232,8 +233,9 @@ int GENERATOR_TOOL::RegenerateSelected( const TOOL_EVENT& aEvent )
|
|||||||
{
|
{
|
||||||
gen->EditStart( this, board(), &commit );
|
gen->EditStart( this, board(), &commit );
|
||||||
gen->Update( this, board(), &commit );
|
gen->Update( this, board(), &commit );
|
||||||
gen->EditPush( this, board(), &commit, _( "Regenerate Selected" ), commitFlags );
|
gen->EditFinish( this, board(), &commit );
|
||||||
|
|
||||||
|
commit.Push( _( "Regenerate Selected" ), commitFlags );
|
||||||
commitFlags |= APPEND_UNDO;
|
commitFlags |= APPEND_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,13 +247,14 @@ int GENERATOR_TOOL::RegenerateSelected( const TOOL_EVENT& aEvent )
|
|||||||
int GENERATOR_TOOL::RegenerateItem( const TOOL_EVENT& aEvent )
|
int GENERATOR_TOOL::RegenerateItem( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
BOARD_COMMIT commit( this );
|
BOARD_COMMIT commit( this );
|
||||||
int commitFlags = 0;
|
|
||||||
|
|
||||||
PCB_GENERATOR* gen = aEvent.Parameter<PCB_GENERATOR*>();
|
PCB_GENERATOR* gen = aEvent.Parameter<PCB_GENERATOR*>();
|
||||||
|
|
||||||
gen->EditStart( this, board(), &commit );
|
gen->EditStart( this, board(), &commit );
|
||||||
gen->Update( this, board(), &commit );
|
gen->Update( this, board(), &commit );
|
||||||
gen->EditPush( this, board(), &commit, _( "Regenerate Item" ), commitFlags );
|
gen->EditFinish( this, board(), &commit );
|
||||||
|
|
||||||
|
commit.Push( gen->GetCommitMessage() );
|
||||||
|
|
||||||
frame()->RefreshCanvas();
|
frame()->RefreshCanvas();
|
||||||
return 0;
|
return 0;
|
||||||
@ -274,15 +277,15 @@ int GENERATOR_TOOL::GenEditAction( const TOOL_EVENT& aEvent )
|
|||||||
{
|
{
|
||||||
gen->Update( this, board(), commit );
|
gen->Update( this, board(), commit );
|
||||||
}
|
}
|
||||||
else if( aEvent.IsAction( &PCB_ACTIONS::genPushEdit ) )
|
else if( aEvent.IsAction( &PCB_ACTIONS::genFinishEdit ) )
|
||||||
{
|
{
|
||||||
gen->EditPush( this, board(), commit, wxEmptyString );
|
gen->EditFinish( this, board(), commit );
|
||||||
|
|
||||||
wxASSERT( commit->Empty() );
|
wxASSERT( commit->Empty() );
|
||||||
}
|
}
|
||||||
else if( aEvent.IsAction( &PCB_ACTIONS::genRevertEdit ) )
|
else if( aEvent.IsAction( &PCB_ACTIONS::genCancelEdit ) )
|
||||||
{
|
{
|
||||||
gen->EditRevert( this, board(), commit );
|
gen->EditCancel( this, board(), commit );
|
||||||
|
|
||||||
wxASSERT( commit->Empty() );
|
wxASSERT( commit->Empty() );
|
||||||
}
|
}
|
||||||
@ -306,7 +309,7 @@ void GENERATOR_TOOL::setTransitions()
|
|||||||
|
|
||||||
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genStartEdit.MakeEvent() );
|
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genStartEdit.MakeEvent() );
|
||||||
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genUpdateEdit.MakeEvent() );
|
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genUpdateEdit.MakeEvent() );
|
||||||
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genPushEdit.MakeEvent() );
|
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genFinishEdit.MakeEvent() );
|
||||||
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genRevertEdit.MakeEvent() );
|
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genCancelEdit.MakeEvent() );
|
||||||
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genRemove.MakeEvent() );
|
Go( &GENERATOR_TOOL::GenEditAction, PCB_ACTIONS::genRemove.MakeEvent() );
|
||||||
}
|
}
|
||||||
|
@ -2634,12 +2634,12 @@ TOOL_ACTION PCB_ACTIONS::genUpdateEdit( TOOL_ACTION_ARGS()
|
|||||||
.Name( "pcbnew.Generator.genUpdateEdit" )
|
.Name( "pcbnew.Generator.genUpdateEdit" )
|
||||||
.Scope( AS_CONTEXT ) );
|
.Scope( AS_CONTEXT ) );
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::genPushEdit( TOOL_ACTION_ARGS()
|
TOOL_ACTION PCB_ACTIONS::genFinishEdit( TOOL_ACTION_ARGS()
|
||||||
.Name( "pcbnew.Generator.genPushEdit" )
|
.Name( "pcbnew.Generator.genFinishEdit" )
|
||||||
.Scope( AS_CONTEXT ) );
|
.Scope( AS_CONTEXT ) );
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::genRevertEdit( TOOL_ACTION_ARGS()
|
TOOL_ACTION PCB_ACTIONS::genCancelEdit( TOOL_ACTION_ARGS()
|
||||||
.Name( "pcbnew.Generator.genRevertEdit" )
|
.Name( "pcbnew.Generator.genCacnelEdit" )
|
||||||
.Scope( AS_CONTEXT ) );
|
.Scope( AS_CONTEXT ) );
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::genRemove( TOOL_ACTION_ARGS()
|
TOOL_ACTION PCB_ACTIONS::genRemove( TOOL_ACTION_ARGS()
|
||||||
|
@ -276,8 +276,8 @@ public:
|
|||||||
static TOOL_ACTION regenerateItem;
|
static TOOL_ACTION regenerateItem;
|
||||||
static TOOL_ACTION genStartEdit;
|
static TOOL_ACTION genStartEdit;
|
||||||
static TOOL_ACTION genUpdateEdit;
|
static TOOL_ACTION genUpdateEdit;
|
||||||
static TOOL_ACTION genPushEdit;
|
static TOOL_ACTION genFinishEdit;
|
||||||
static TOOL_ACTION genRevertEdit;
|
static TOOL_ACTION genCancelEdit;
|
||||||
static TOOL_ACTION genRemove;
|
static TOOL_ACTION genRemove;
|
||||||
|
|
||||||
static TOOL_ACTION generatorsShowManager;
|
static TOOL_ACTION generatorsShowManager;
|
||||||
|
@ -1957,9 +1957,12 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
if( item->Type() == PCB_GENERATOR_T )
|
if( item->Type() == PCB_GENERATOR_T )
|
||||||
{
|
{
|
||||||
|
PCB_GENERATOR* generator = static_cast<PCB_GENERATOR*>( item );
|
||||||
|
|
||||||
m_preview.FreeItems();
|
m_preview.FreeItems();
|
||||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genPushEdit, &commit,
|
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genFinishEdit, &commit, generator );
|
||||||
static_cast<PCB_GENERATOR*>( item ) );
|
|
||||||
|
commit.Push( generator->GetCommitMessage() );
|
||||||
}
|
}
|
||||||
else if( item->Type() == PCB_TABLECELL_T )
|
else if( item->Type() == PCB_TABLECELL_T )
|
||||||
{
|
{
|
||||||
@ -1979,8 +1982,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
|||||||
inDrag = false;
|
inDrag = false;
|
||||||
frame()->UndoRedoBlock( false );
|
frame()->UndoRedoBlock( false );
|
||||||
|
|
||||||
m_toolMgr->PostAction<EDA_ITEM*>( ACTIONS::reselectItem,
|
m_toolMgr->PostAction<EDA_ITEM*>( ACTIONS::reselectItem, item ); // FIXME: Needed for generators
|
||||||
item ); // FIXME: Needed for generators
|
|
||||||
}
|
}
|
||||||
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
@ -1988,9 +1990,10 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
|||||||
{
|
{
|
||||||
if( item->Type() == PCB_GENERATOR_T )
|
if( item->Type() == PCB_GENERATOR_T )
|
||||||
{
|
{
|
||||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genRevertEdit, &commit,
|
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genCancelEdit, &commit,
|
||||||
static_cast<PCB_GENERATOR*>( item ) );
|
static_cast<PCB_GENERATOR*>( item ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
commit.Revert();
|
commit.Revert();
|
||||||
|
|
||||||
if( PCB_SHAPE* shape= dynamic_cast<PCB_SHAPE*>( item ) )
|
if( PCB_SHAPE* shape= dynamic_cast<PCB_SHAPE*>( item ) )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user