Modified properties dialog to take advantage of BOARD_COMMIT class.
This commit is contained in:
parent
38177b70b9
commit
c4be379b31
|
@ -41,6 +41,7 @@
|
|||
#include <wxPcbStruct.h>
|
||||
#include <base_units.h>
|
||||
#include <project.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <class_module.h>
|
||||
#include <class_text_mod.h>
|
||||
|
@ -610,6 +611,9 @@ bool DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow()
|
|||
wxPoint modpos;
|
||||
wxString msg;
|
||||
|
||||
BOARD_COMMIT commit( m_Parent );
|
||||
commit.Modify( m_CurrentModule );
|
||||
|
||||
if( !Validate() || !DIALOG_MODULE_BOARD_EDITOR_BASE::TransferDataFromWindow() ||
|
||||
!m_PanelProperties->TransferDataFromWindow() )
|
||||
{
|
||||
|
@ -623,10 +627,6 @@ bool DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow()
|
|||
return false;
|
||||
}
|
||||
|
||||
if( m_CurrentModule->GetFlags() == 0 ) // this is a simple edition, we
|
||||
// must create an undo entry
|
||||
m_Parent->SaveCopyInUndoList( m_CurrentModule, UR_CHANGED );
|
||||
|
||||
if( m_DC )
|
||||
{
|
||||
m_Parent->GetCanvas()->CrossHairOff( m_DC );
|
||||
|
@ -741,7 +741,9 @@ bool DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow()
|
|||
|
||||
m_CurrentModule->CalculateBoundingBox();
|
||||
|
||||
m_Parent->OnModify();
|
||||
// This is a simple edition, we must create an undo entry
|
||||
if( m_CurrentModule->GetFlags() == 0 )
|
||||
commit.Push( _( "Modify module properties" ) );
|
||||
|
||||
SetReturnCode( PRM_EDITOR_EDIT_OK );
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <macros.h>
|
||||
#include <validators.h>
|
||||
#include <kicad_string.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <class_module.h>
|
||||
#include <class_text_mod.h>
|
||||
|
@ -440,6 +441,7 @@ void DIALOG_MODULE_MODULE_EDITOR::OnCancelClick( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||
{
|
||||
BOARD_COMMIT commit( m_parent );
|
||||
wxString msg;
|
||||
|
||||
// First, test for invalid chars in module name
|
||||
|
@ -465,7 +467,8 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
m_parent->SaveCopyInUndoList( m_currentModule, UR_CHANGED );
|
||||
commit.Modify( m_currentModule );
|
||||
|
||||
m_currentModule->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
|
||||
|
||||
switch( m_AttributsCtrl->GetSelection() )
|
||||
|
@ -522,7 +525,7 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
|||
|
||||
m_currentModule->CalculateBoundingBox();
|
||||
|
||||
m_parent->OnModify();
|
||||
commit.Push( _( "Modify module properties" ) );
|
||||
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <wxBasePcbFrame.h>
|
||||
#include <base_units.h>
|
||||
#include <wx/numformatter.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <class_module.h>
|
||||
#include <class_text_mod.h>
|
||||
|
@ -207,11 +208,13 @@ bool DialogEditModuleText::TransferDataToWindow()
|
|||
|
||||
bool DialogEditModuleText::TransferDataFromWindow()
|
||||
{
|
||||
BOARD_COMMIT commit( m_parent );
|
||||
|
||||
if( !Validate() || !DialogEditModuleText_base::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
if( m_module )
|
||||
m_parent->SaveCopyInUndoList( m_module, UR_CHANGED );
|
||||
commit.Modify( m_currentText );
|
||||
|
||||
#ifndef USE_WX_OVERLAY
|
||||
if( m_dc ) //Erase old text on screen
|
||||
|
@ -325,7 +328,7 @@ bool DialogEditModuleText::TransferDataFromWindow()
|
|||
m_parent->Refresh();
|
||||
#endif
|
||||
|
||||
m_parent->OnModify();
|
||||
commit.Push( _( "Modify module text" ) );
|
||||
|
||||
if( m_module )
|
||||
m_module->SetLastEditTime();
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <class_board_design_settings.h>
|
||||
#include <base_units.h>
|
||||
#include <wx/valnum.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_drawsegment.h>
|
||||
|
@ -227,7 +228,8 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
m_parent->SaveCopyInUndoList( m_item, UR_CHANGED );
|
||||
BOARD_COMMIT commit( m_parent );
|
||||
commit.Modify( m_item );
|
||||
|
||||
wxString msg;
|
||||
|
||||
|
@ -264,7 +266,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
m_item->SetAngle( m_AngleValue * 10.0 );
|
||||
}
|
||||
|
||||
m_parent->OnModify();
|
||||
commit.Push( _( "Modify drawing properties" ) );
|
||||
|
||||
if( m_DC )
|
||||
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <module_editor_frame.h>
|
||||
#include <base_units.h>
|
||||
#include <wx/valnum.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
|
@ -212,6 +213,9 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& even
|
|||
|
||||
bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
BOARD_COMMIT commit( m_parent );
|
||||
commit.Modify( m_module );
|
||||
|
||||
if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
|
@ -223,14 +227,10 @@ bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
* confirmation is requested */
|
||||
if( !IsOK( NULL,
|
||||
_( "The graphic item will be on a copper layer. This is very dangerous. Are you sure?" ) ) )
|
||||
return false;;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_parent->SaveCopyInUndoList( m_module, UR_CHANGED );
|
||||
m_module->SetLastEditTime();
|
||||
|
||||
wxString msg;
|
||||
|
||||
wxPoint coord;
|
||||
|
||||
msg = m_Center_StartXCtrl->GetValue();
|
||||
|
@ -262,7 +262,8 @@ bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
m_item->SetAngle( m_AngleValue * 10.0 );
|
||||
}
|
||||
|
||||
m_parent->OnModify();
|
||||
commit.Push( _( "Modify module graphic item" ) );
|
||||
|
||||
m_parent->SetMsgPanel( m_item );
|
||||
|
||||
return true;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <wxBasePcbFrame.h>
|
||||
#include <pcbcommon.h>
|
||||
#include <base_units.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
|
@ -921,6 +922,8 @@ bool DIALOG_PAD_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
BOARD_COMMIT commit( m_parent );
|
||||
|
||||
if( !wxDialog::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
|
@ -940,114 +943,116 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
|||
// m_padMaster is a pattern: ensure there is no net for this pad:
|
||||
m_padMaster->SetNetCode( NETINFO_LIST::UNCONNECTED );
|
||||
|
||||
if( m_currentPad ) // Set current Pad parameters
|
||||
if( !m_currentPad ) // Set current Pad parameters
|
||||
return false;
|
||||
|
||||
commit.Modify( m_currentPad );
|
||||
|
||||
wxSize size;
|
||||
MODULE* footprint = m_currentPad->GetParent();
|
||||
|
||||
footprint->SetLastEditTime();
|
||||
|
||||
// redraw the area where the pad was, without pad (delete pad on screen)
|
||||
m_currentPad->SetFlags( DO_NOT_DRAW );
|
||||
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
||||
m_currentPad->ClearFlags( DO_NOT_DRAW );
|
||||
|
||||
// Update values
|
||||
m_currentPad->SetShape( m_padMaster->GetShape() );
|
||||
m_currentPad->SetAttribute( m_padMaster->GetAttribute() );
|
||||
|
||||
if( m_currentPad->GetPosition() != m_padMaster->GetPosition() )
|
||||
{
|
||||
wxSize size;
|
||||
MODULE* footprint = m_currentPad->GetParent();
|
||||
|
||||
m_parent->SaveCopyInUndoList( footprint, UR_CHANGED );
|
||||
footprint->SetLastEditTime();
|
||||
|
||||
// redraw the area where the pad was, without pad (delete pad on screen)
|
||||
m_currentPad->SetFlags( DO_NOT_DRAW );
|
||||
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
||||
m_currentPad->ClearFlags( DO_NOT_DRAW );
|
||||
|
||||
// Update values
|
||||
m_currentPad->SetShape( m_padMaster->GetShape() );
|
||||
m_currentPad->SetAttribute( m_padMaster->GetAttribute() );
|
||||
|
||||
if( m_currentPad->GetPosition() != m_padMaster->GetPosition() )
|
||||
{
|
||||
m_currentPad->SetPosition( m_padMaster->GetPosition() );
|
||||
rastnestIsChanged = true;
|
||||
}
|
||||
|
||||
// compute the pos 0 value, i.e. pad position for footprint with orientation = 0
|
||||
// i.e. relative to footprint origin (footprint position)
|
||||
wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
|
||||
|
||||
RotatePoint( &pt, -footprint->GetOrientation() );
|
||||
|
||||
m_currentPad->SetPos0( pt );
|
||||
|
||||
m_currentPad->SetOrientation( m_padMaster->GetOrientation() * isign
|
||||
+ footprint->GetOrientation() );
|
||||
|
||||
m_currentPad->SetSize( m_padMaster->GetSize() );
|
||||
|
||||
size = m_padMaster->GetDelta();
|
||||
size.y *= isign;
|
||||
m_currentPad->SetDelta( size );
|
||||
|
||||
m_currentPad->SetDrillSize( m_padMaster->GetDrillSize() );
|
||||
m_currentPad->SetDrillShape( m_padMaster->GetDrillShape() );
|
||||
|
||||
wxPoint offset = m_padMaster->GetOffset();
|
||||
offset.y *= isign;
|
||||
m_currentPad->SetOffset( offset );
|
||||
|
||||
m_currentPad->SetPadToDieLength( m_padMaster->GetPadToDieLength() );
|
||||
|
||||
if( m_currentPad->GetLayerSet() != m_padMaster->GetLayerSet() )
|
||||
{
|
||||
rastnestIsChanged = true;
|
||||
m_currentPad->SetLayerSet( m_padMaster->GetLayerSet() );
|
||||
}
|
||||
|
||||
if( m_isFlipped )
|
||||
{
|
||||
m_currentPad->SetLayerSet( FlipLayerMask( m_currentPad->GetLayerSet() ) );
|
||||
}
|
||||
|
||||
m_currentPad->SetPadName( m_padMaster->GetPadName() );
|
||||
|
||||
wxString padNetname;
|
||||
|
||||
// For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
|
||||
if( m_padMaster->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||
padNetname = m_PadNetNameCtrl->GetValue();
|
||||
|
||||
if( m_currentPad->GetNetname() != padNetname )
|
||||
{
|
||||
const NETINFO_ITEM* netinfo = m_board->FindNet( padNetname );
|
||||
|
||||
if( !padNetname.IsEmpty() && netinfo == NULL )
|
||||
{
|
||||
DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
|
||||
}
|
||||
else if( netinfo )
|
||||
{
|
||||
rastnestIsChanged = true;
|
||||
m_currentPad->SetNetCode( netinfo->GetNet() );
|
||||
}
|
||||
}
|
||||
|
||||
m_currentPad->SetLocalClearance( m_padMaster->GetLocalClearance() );
|
||||
m_currentPad->SetLocalSolderMaskMargin( m_padMaster->GetLocalSolderMaskMargin() );
|
||||
m_currentPad->SetLocalSolderPasteMargin( m_padMaster->GetLocalSolderPasteMargin() );
|
||||
m_currentPad->SetLocalSolderPasteMarginRatio( m_padMaster->GetLocalSolderPasteMarginRatio() );
|
||||
m_currentPad->SetZoneConnection( m_padMaster->GetZoneConnection() );
|
||||
m_currentPad->SetThermalWidth( m_padMaster->GetThermalWidth() );
|
||||
m_currentPad->SetThermalGap( m_padMaster->GetThermalGap() );
|
||||
m_currentPad->SetRoundRectRadiusRatio( m_padMaster->GetRoundRectRadiusRatio() );
|
||||
|
||||
// rounded rect pads with radius ratio = 0 are in fact rect pads.
|
||||
// So set the right shape (and perhaps issues with a radius = 0)
|
||||
if( m_currentPad->GetShape() == PAD_SHAPE_ROUNDRECT &&
|
||||
m_currentPad->GetRoundRectRadiusRatio() == 0.0 )
|
||||
{
|
||||
m_currentPad->SetShape( PAD_SHAPE_RECT );
|
||||
}
|
||||
|
||||
footprint->CalculateBoundingBox();
|
||||
m_parent->SetMsgPanel( m_currentPad );
|
||||
|
||||
// redraw the area where the pad was
|
||||
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
||||
m_parent->OnModify();
|
||||
m_currentPad->SetPosition( m_padMaster->GetPosition() );
|
||||
rastnestIsChanged = true;
|
||||
}
|
||||
|
||||
// compute the pos 0 value, i.e. pad position for footprint with orientation = 0
|
||||
// i.e. relative to footprint origin (footprint position)
|
||||
wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
|
||||
|
||||
RotatePoint( &pt, -footprint->GetOrientation() );
|
||||
|
||||
m_currentPad->SetPos0( pt );
|
||||
|
||||
m_currentPad->SetOrientation( m_padMaster->GetOrientation() * isign
|
||||
+ footprint->GetOrientation() );
|
||||
|
||||
m_currentPad->SetSize( m_padMaster->GetSize() );
|
||||
|
||||
size = m_padMaster->GetDelta();
|
||||
size.y *= isign;
|
||||
m_currentPad->SetDelta( size );
|
||||
|
||||
m_currentPad->SetDrillSize( m_padMaster->GetDrillSize() );
|
||||
m_currentPad->SetDrillShape( m_padMaster->GetDrillShape() );
|
||||
|
||||
wxPoint offset = m_padMaster->GetOffset();
|
||||
offset.y *= isign;
|
||||
m_currentPad->SetOffset( offset );
|
||||
|
||||
m_currentPad->SetPadToDieLength( m_padMaster->GetPadToDieLength() );
|
||||
|
||||
if( m_currentPad->GetLayerSet() != m_padMaster->GetLayerSet() )
|
||||
{
|
||||
rastnestIsChanged = true;
|
||||
m_currentPad->SetLayerSet( m_padMaster->GetLayerSet() );
|
||||
}
|
||||
|
||||
if( m_isFlipped )
|
||||
{
|
||||
m_currentPad->SetLayerSet( FlipLayerMask( m_currentPad->GetLayerSet() ) );
|
||||
}
|
||||
|
||||
m_currentPad->SetPadName( m_padMaster->GetPadName() );
|
||||
|
||||
wxString padNetname;
|
||||
|
||||
// For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
|
||||
if( m_padMaster->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||
padNetname = m_PadNetNameCtrl->GetValue();
|
||||
|
||||
if( m_currentPad->GetNetname() != padNetname )
|
||||
{
|
||||
const NETINFO_ITEM* netinfo = m_board->FindNet( padNetname );
|
||||
|
||||
if( !padNetname.IsEmpty() && netinfo == NULL )
|
||||
{
|
||||
DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
|
||||
}
|
||||
else if( netinfo )
|
||||
{
|
||||
rastnestIsChanged = true;
|
||||
m_currentPad->SetNetCode( netinfo->GetNet() );
|
||||
}
|
||||
}
|
||||
|
||||
m_currentPad->SetLocalClearance( m_padMaster->GetLocalClearance() );
|
||||
m_currentPad->SetLocalSolderMaskMargin( m_padMaster->GetLocalSolderMaskMargin() );
|
||||
m_currentPad->SetLocalSolderPasteMargin( m_padMaster->GetLocalSolderPasteMargin() );
|
||||
m_currentPad->SetLocalSolderPasteMarginRatio( m_padMaster->GetLocalSolderPasteMarginRatio() );
|
||||
m_currentPad->SetZoneConnection( m_padMaster->GetZoneConnection() );
|
||||
m_currentPad->SetThermalWidth( m_padMaster->GetThermalWidth() );
|
||||
m_currentPad->SetThermalGap( m_padMaster->GetThermalGap() );
|
||||
m_currentPad->SetRoundRectRadiusRatio( m_padMaster->GetRoundRectRadiusRatio() );
|
||||
|
||||
// rounded rect pads with radius ratio = 0 are in fact rect pads.
|
||||
// So set the right shape (and perhaps issues with a radius = 0)
|
||||
if( m_currentPad->GetShape() == PAD_SHAPE_ROUNDRECT &&
|
||||
m_currentPad->GetRoundRectRadiusRatio() == 0.0 )
|
||||
{
|
||||
m_currentPad->SetShape( PAD_SHAPE_RECT );
|
||||
}
|
||||
|
||||
footprint->CalculateBoundingBox();
|
||||
m_parent->SetMsgPanel( m_currentPad );
|
||||
|
||||
// redraw the area where the pad was
|
||||
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
||||
|
||||
commit.Push( _( "Modify pad" ) );
|
||||
|
||||
if( rastnestIsChanged ) // The net ratsnest must be recalculated
|
||||
m_board->m_Status_Pcb = 0;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <wx/wx.h>
|
||||
#include <dialog_pcb_text_properties_base.h>
|
||||
#include <class_pcb_layer_box_selector.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
|
||||
class PCB_EDIT_FRAME;
|
||||
|
@ -188,10 +189,12 @@ bool DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
bool DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
|
||||
if( !DIALOG_PCB_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
BOARD_COMMIT commit( m_Parent );
|
||||
commit.Modify( m_SelectedPCBText );
|
||||
|
||||
// Test for acceptable layer.
|
||||
// Incorrect layer can happen for old boards,
|
||||
// having texts on edge cut layer for instance
|
||||
|
@ -206,8 +209,7 @@ bool DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
// If no other command in progress, prepare undo command
|
||||
// (for a command in progress, will be made later, at the completion of command)
|
||||
if( m_SelectedPCBText->GetFlags() == 0 )
|
||||
m_Parent->SaveCopyInUndoList( m_SelectedPCBText, UR_CHANGED );
|
||||
bool pushCommit = ( m_SelectedPCBText->GetFlags() == 0 );
|
||||
|
||||
/* set flag in edit to force undo/redo/abort proper operation,
|
||||
* and avoid new calls to SaveCopyInUndoList for the same text
|
||||
|
@ -303,9 +305,11 @@ bool DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
|
||||
}
|
||||
#else
|
||||
m_parent->Refresh();
|
||||
m_Parent->Refresh();
|
||||
#endif
|
||||
m_Parent->OnModify();
|
||||
|
||||
if( pushCommit )
|
||||
commit.Push( _( "Change text properties" ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <wxPcbStruct.h>
|
||||
#include <confirm.h>
|
||||
|
||||
#include <board_commit.h>
|
||||
|
||||
DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const SELECTION& aItems ) :
|
||||
DIALOG_TRACK_VIA_PROPERTIES_BASE( aParent ), m_items( aItems ),
|
||||
m_trackStartX( aParent, m_TrackStartXCtrl, m_TrackStartXUnit ),
|
||||
|
@ -202,7 +204,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
}
|
||||
|
||||
|
||||
bool DIALOG_TRACK_VIA_PROPERTIES::Apply()
|
||||
bool DIALOG_TRACK_VIA_PROPERTIES::Apply( COMMIT& aCommit )
|
||||
{
|
||||
if( !check() )
|
||||
return false;
|
||||
|
@ -214,6 +216,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::Apply()
|
|||
for( int i = 0; i < m_items.Size(); ++i )
|
||||
{
|
||||
BOARD_ITEM* item = m_items.Item<BOARD_ITEM>( i );
|
||||
aCommit.Modify( item );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <layers_id_colors_and_visibility.h>
|
||||
|
||||
struct SELECTION;
|
||||
class COMMIT;
|
||||
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
class DIALOG_TRACK_VIA_PROPERTIES : public DIALOG_TRACK_VIA_PROPERTIES_BASE
|
||||
|
@ -36,7 +38,7 @@ public:
|
|||
DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const SELECTION& aItems );
|
||||
|
||||
///> Applies values from the dialog to the selected items.
|
||||
bool Apply();
|
||||
bool Apply( COMMIT& aCommit );
|
||||
|
||||
private:
|
||||
void onClose( wxCloseEvent& aEvent );
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <dialog_helpers.h>
|
||||
#include <macros.h>
|
||||
#include <base_units.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_pcb_text.h>
|
||||
|
@ -161,6 +162,8 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
|
|||
|
||||
void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
|
||||
{
|
||||
BOARD_COMMIT commit( m_parent );
|
||||
|
||||
LAYER_ID newlayer = ToLAYER_ID( m_SelLayerBox->GetLayerSelection() );
|
||||
|
||||
if( !m_parent->GetBoard()->IsLayerEnabled( newlayer ) )
|
||||
|
@ -177,7 +180,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
|
|||
}
|
||||
#endif
|
||||
|
||||
m_parent->SaveCopyInUndoList(m_currentDimension, UR_CHANGED);
|
||||
commit.Modify( m_currentDimension );
|
||||
|
||||
if( m_Name->GetValue() != wxEmptyString )
|
||||
{
|
||||
|
@ -228,7 +231,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
|
|||
m_parent->Refresh();
|
||||
#endif
|
||||
|
||||
m_parent->OnModify();
|
||||
commit.Push( _( "Modifed dimensions properties" ) );
|
||||
event.Skip(); // ends returning wxID_OK (default behavior)
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <dialog_helpers.h>
|
||||
#include <base_units.h>
|
||||
#include <gr_basic.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_mire.h>
|
||||
|
@ -128,12 +129,14 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnCancelClick( wxCommandEvent& event )
|
|||
*/
|
||||
void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||
{
|
||||
BOARD_COMMIT commit( m_Parent );
|
||||
commit.Modify( m_Target );
|
||||
|
||||
if( m_DC )
|
||||
m_Target->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
|
||||
|
||||
// Save old item in undo list, if is is not currently edited (will be later if so)
|
||||
if( m_Target->GetFlags() == 0 )
|
||||
m_Parent->SaveCopyInUndoList( m_Target, UR_CHANGED );
|
||||
bool pushCommit = ( m_Target->GetFlags() == 0 );
|
||||
|
||||
if( m_Target->GetFlags() != 0 ) // other edition in progress (MOVE, NEW ..)
|
||||
m_Target->SetFlags( IN_EDIT ); // set flag in edit to force
|
||||
|
@ -150,7 +153,9 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
|
|||
if( m_DC )
|
||||
m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR );
|
||||
|
||||
m_Parent->OnModify();
|
||||
if( pushCommit )
|
||||
commit.Push( _( "Modified alignment target" ) );
|
||||
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue