/* Updates the different parameters for the component being edited */ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event ) { 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 ); if( m_Target->GetFlags() != 0 ) // other edition in progress (MOVE, NEW ..) m_Target->SetFlags( IN_EDIT ); // set flag in edit to force // undo/redo/abort proper operation int tmp = ValueFromString( g_UserUnit, m_TargetThicknessCtrl->GetValue() ); m_Target->SetWidth( tmp ); MireDefaultSize = ValueFromString( g_UserUnit, m_TargetSizeCtrl->GetValue() ); m_Target->SetSize( MireDefaultSize ); m_Target->SetShape( m_TargetShape->GetSelection() ? 1 : 0 ); if( m_DC ) m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR ); m_Parent->OnModify(); EndModal( 1 ); }
bool DIALOG_TARGET_PROPERTIES::TransferDataFromWindow() { // Zero-size targets are hard to see/select. if( !m_Size.Validate( Mils2iu( 1 ), INT_MAX ) ) return false; 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) bool pushCommit = ( m_Target->GetFlags() == 0 ); if( m_Target->GetFlags() != 0 ) // other edit in progress (MOVE, NEW ..) m_Target->SetFlags( IN_EDIT ); // set flag in edit to force // undo/redo/abort proper operation m_Target->SetWidth( m_Thickness.GetValue() ); m_Target->SetSize( m_Size.GetValue() ); m_Target->SetShape( m_TargetShape->GetSelection() ? 1 : 0 ); if( m_DC ) m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR ); if( pushCommit ) commit.Push( _( "Modified alignment target" ) ); return true; }
PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ) { PCB_TARGET* target = new PCB_TARGET( GetBoard() ); target->SetFlags( IS_NEW ); GetBoard()->Add( target ); target->SetLayer( Edge_Cuts ); target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth ); target->SetSize( MireDefaultSize ); target->SetPosition( GetCrossHairPosition() ); PlaceTarget( target, DC ); return target; }