Commit a1ac84e5 authored by Mikhail Karpenko's avatar Mikhail Karpenko
Browse files

Add teardrops to circular pads

The idea of removing teardrops from selected tracks proved to be
difficult to implement. The concept of teardrop implementation should be
reconsidered.
parent a8113135
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ bool TEARDROP::SetVector(TRACK &aTrack, const VIA & aVia, VECTOR2I &startPoint,
        endPoint = aTrack.GetEnd();
        endPoint = aTrack.GetEnd();
    }
    }
    else {
    else {
        // The via is too far from any ends or the track is too short
        // The via is too far from any end or the track is too short
        return false;
        return false;
    }
    }


@@ -80,7 +80,7 @@ bool TEARDROP::CurvedSegments(TRACK &aTrack, const VIA &aVia, std::vector<VECTOR


    // Check that the track is not too short
    // Check that the track is not too short
    double segOutsideVia = aTrack.GetLength() - (aVia.GetWidth() / 2);
    double segOutsideVia = aTrack.GetLength() - (aVia.GetWidth() / 2);
    double minLength = (90 * aVia.GetWidth()) / 100;
    double minLength = (90 * aVia.GetWidth() / 2) / 100;
    if (segOutsideVia < minLength) {
    if (segOutsideVia < minLength) {
        return false;
        return false;
    }
    }
@@ -188,7 +188,6 @@ BOARD_CONNECTED_ITEM* TEARDROP::GetObjectOnEnd(TRACK &aTrack, ENDPOINT_T endPoin
            bool hitTest = (*iter)->HitTest(trackPoint);
            bool hitTest = (*iter)->HitTest(trackPoint);
            if (shape == PAD_CIRCLE && hitTest == true) {
            if (shape == PAD_CIRCLE && hitTest == true) {
                item = *iter;
                item = *iter;
                printf("found circle pad\n");
            }
            }
        }
        }
    }
    }
+46 −9
Original line number Original line Diff line number Diff line
@@ -44,9 +44,12 @@ void DIALOG_TEARDROPS::InitDialogSettings()


void DIALOG_TEARDROPS::OnModeAdd(wxCommandEvent &event)
void DIALOG_TEARDROPS::OnModeAdd(wxCommandEvent &event)
{
{
    event.Skip();
    if (m_settings != NULL) {
    if (m_settings != NULL) {
        m_settings->m_mode = TEARDROPS_MODE_ADD;
        m_settings->m_mode = TEARDROPS_MODE_ADD;
        LockOptionsControls(false);
        LockOptionsControls(false);
        LockTracksControls(false);
        LockScopeControls(false);
    }
    }
}
}


@@ -56,11 +59,14 @@ void DIALOG_TEARDROPS::OnModeRemove(wxCommandEvent &event)
    if (m_settings != NULL) {
    if (m_settings != NULL) {
        m_settings->m_mode = TEARDROPS_MODE_REMOVE;
        m_settings->m_mode = TEARDROPS_MODE_REMOVE;
        LockOptionsControls(true);
        LockOptionsControls(true);
        LockTracksControls(true);
        LockScopeControls(true);
    }
    }
}
}


void DIALOG_TEARDROPS::OnTracksAll(wxCommandEvent &event)
void DIALOG_TEARDROPS::OnTracksAll(wxCommandEvent &event)
{
{
    event.Skip();
    if (m_settings != NULL) {
    if (m_settings != NULL) {
        m_settings->m_track = TEARDROPS_TRACKS_ALL;
        m_settings->m_track = TEARDROPS_TRACKS_ALL;
    }
    }
@@ -69,6 +75,7 @@ void DIALOG_TEARDROPS::OnTracksAll(wxCommandEvent &event)


void DIALOG_TEARDROPS::OnTracksSelected(wxCommandEvent &event)
void DIALOG_TEARDROPS::OnTracksSelected(wxCommandEvent &event)
{
{
    event.Skip();
    if (m_settings != NULL)	 {
    if (m_settings != NULL)	 {
        m_settings->m_track = TEARDROPS_TRACKS_SELECTED;
        m_settings->m_track = TEARDROPS_TRACKS_SELECTED;
    }
    }
@@ -77,6 +84,7 @@ void DIALOG_TEARDROPS::OnTracksSelected(wxCommandEvent &event)


void DIALOG_TEARDROPS::OnScopeVias(wxCommandEvent &event)
void DIALOG_TEARDROPS::OnScopeVias(wxCommandEvent &event)
{
{
    event.Skip();
    if (m_settings != NULL) {
    if (m_settings != NULL) {
        if (m_scopeVias->IsChecked()) {
        if (m_scopeVias->IsChecked()) {
            m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_VIAS);
            m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_VIAS);
@@ -87,19 +95,24 @@ void DIALOG_TEARDROPS::OnScopeVias(wxCommandEvent &event)
    }
    }
}
}


void DIALOG_TEARDROPS::OnScopePads(wxCommandEvent &event)
{
    event.Skip();
    if (m_settings != NULL) {
        if (m_scopePads->IsChecked()) {
            m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_PADS);
        }
        else {
            m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope & (~TEARDROPS_SCOPE_PADS));
        }
    }
}

void DIALOG_TEARDROPS::OnStyleChanged(wxCommandEvent &event)
void DIALOG_TEARDROPS::OnStyleChanged(wxCommandEvent &event)
{
{
    event.Skip();
    if (m_settings != NULL) {
    if (m_settings != NULL) {
        m_settings->m_type = static_cast<TEARDROPS_TYPE>(m_choiceStyle->GetSelection());
        m_settings->m_type = static_cast<TEARDROPS_TYPE>(m_choiceStyle->GetSelection());
//        if (selection == TEARDROPS_TYPE_STRAIGHT) {
//            m_settings->m_type= TEARDROPS_TYPE_STRAIGHT;
//        }
//        else if (selection == TEARDROPS_TYPE_CURVED) {
//            m_settings->m_type = TEARDROPS_TYPE_CURVED;
//        }
//        else {
//            m_settings->m_type = TEARDROPS_TYPE_NONE;
//        }
    }
    }
}
}


@@ -137,3 +150,27 @@ void DIALOG_TEARDROPS::LockOptionsControls(bool state)
        m_choiceStyle->Enable(true);
        m_choiceStyle->Enable(true);
    }
    }
}
}

void DIALOG_TEARDROPS::LockTracksControls(bool state)
{
    if (state == true) {
        m_tracksAll->Enable(false);
        m_tracksSelected->Enable(false);
    }
    else {
        m_tracksAll->Enable(true);
        m_tracksSelected->Enable(true);
    }
}

void DIALOG_TEARDROPS::LockScopeControls(bool state)
{
    if (state == true) {
        m_scopePads->Enable(false);
        m_scopeVias->Enable(false);
    }
    else {
        m_scopePads->Enable(true);
        m_scopeVias->Enable(true);
    }
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ public:
    void OnClearSelection(wxCommandEvent &event);
    void OnClearSelection(wxCommandEvent &event);
    void OnIgnoreDrc(wxCommandEvent &event);
    void OnIgnoreDrc(wxCommandEvent &event);
    void OnScopeVias(wxCommandEvent &event);
    void OnScopeVias(wxCommandEvent &event);
    void OnScopePads(wxCommandEvent &event);


private:
private:
    PCB_EDIT_FRAME *m_parent;
    PCB_EDIT_FRAME *m_parent;
@@ -52,6 +53,8 @@ private:


    void InitDialogSettings();
    void InitDialogSettings();
    void LockOptionsControls(bool state);
    void LockOptionsControls(bool state);
    void LockTracksControls(bool state);
    void LockScopeControls(bool state);
};
};


#endif // DIALOG_TEARDROPS_H
#endif // DIALOG_TEARDROPS_H
+6 −6
Original line number Original line Diff line number Diff line
@@ -86,19 +86,17 @@ DIALOG_TEARDROPS_BASE::DIALOG_TEARDROPS_BASE( wxWindow* parent, wxWindowID id, c
	
	
	m_scopeVias = new wxCheckBox( this, wxID_ANY, wxT("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
	m_scopeVias = new wxCheckBox( this, wxID_ANY, wxT("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
	m_scopeVias->SetValue(true); 
	m_scopeVias->SetValue(true); 
	sbSizer16->Add( m_scopeVias, 0, wxALL, 5 );
	sbSizer16->Add( m_scopeVias, 0, 0, 5 );
	
	
	m_scopePads = new wxCheckBox( this, wxID_ANY, wxT("Pads"), wxDefaultPosition, wxDefaultSize, 0 );
	m_scopePads = new wxCheckBox( this, wxID_ANY, wxT("Pads"), wxDefaultPosition, wxDefaultSize, 0 );
	m_scopePads->Enable( false );
	m_scopePads->SetValue(true); 
	m_scopePads->Hide();
	sbSizer16->Add( m_scopePads, 0, 0, 5 );
	
	sbSizer16->Add( m_scopePads, 0, wxALL, 5 );
	
	
	m_scopeTracks = new wxCheckBox( this, wxID_ANY, wxT("Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
	m_scopeTracks = new wxCheckBox( this, wxID_ANY, wxT("Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
	m_scopeTracks->Enable( false );
	m_scopeTracks->Enable( false );
	m_scopeTracks->Hide();
	m_scopeTracks->Hide();
	
	
	sbSizer16->Add( m_scopeTracks, 0, wxALL, 5 );
	sbSizer16->Add( m_scopeTracks, 0, 0, 5 );
	
	
	m_scopeSizer->Add( sbSizer16, 1, wxEXPAND, 5 );
	m_scopeSizer->Add( sbSizer16, 1, wxEXPAND, 5 );
	
	
@@ -131,6 +129,7 @@ DIALOG_TEARDROPS_BASE::DIALOG_TEARDROPS_BASE( wxWindow* parent, wxWindowID id, c
	m_checkClear->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnClearSelection ), NULL, this );
	m_checkClear->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnClearSelection ), NULL, this );
	m_choiceStyle->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnStyleChanged ), NULL, this );
	m_choiceStyle->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnStyleChanged ), NULL, this );
	m_scopeVias->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnScopeVias ), NULL, this );
	m_scopeVias->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnScopeVias ), NULL, this );
	m_scopePads->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnScopePads ), NULL, this );
}
}


DIALOG_TEARDROPS_BASE::~DIALOG_TEARDROPS_BASE()
DIALOG_TEARDROPS_BASE::~DIALOG_TEARDROPS_BASE()
@@ -144,4 +143,5 @@ DIALOG_TEARDROPS_BASE::~DIALOG_TEARDROPS_BASE()
	m_checkClear->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnClearSelection ), NULL, this );
	m_checkClear->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnClearSelection ), NULL, this );
	m_choiceStyle->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnStyleChanged ), NULL, this );
	m_choiceStyle->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnStyleChanged ), NULL, this );
	m_scopeVias->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnScopeVias ), NULL, this );
	m_scopeVias->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnScopeVias ), NULL, this );
	m_scopePads->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnScopePads ), NULL, this );
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -682,12 +682,12 @@
                                            <property name="proportion">0</property>
                                            <property name="proportion">0</property>
                                            <object class="wxCheckBox" expanded="1">
                                            <object class="wxCheckBox" expanded="1">
                                                <property name="bg"></property>
                                                <property name="bg"></property>
                                                <property name="checked">0</property>
                                                <property name="checked">1</property>
                                                <property name="context_help"></property>
                                                <property name="context_help"></property>
                                                <property name="enabled">0</property>
                                                <property name="enabled">1</property>
                                                <property name="fg"></property>
                                                <property name="fg"></property>
                                                <property name="font"></property>
                                                <property name="font"></property>
                                                <property name="hidden">1</property>
                                                <property name="hidden">0</property>
                                                <property name="id">wxID_ANY</property>
                                                <property name="id">wxID_ANY</property>
                                                <property name="label">Pads</property>
                                                <property name="label">Pads</property>
                                                <property name="maximum_size"></property>
                                                <property name="maximum_size"></property>
@@ -707,7 +707,7 @@
                                                <property name="window_name"></property>
                                                <property name="window_name"></property>
                                                <property name="window_style"></property>
                                                <property name="window_style"></property>
                                                <event name="OnChar"></event>
                                                <event name="OnChar"></event>
                                                <event name="OnCheckBox"></event>
                                                <event name="OnCheckBox">OnScopePads</event>
                                                <event name="OnEnterWindow"></event>
                                                <event name="OnEnterWindow"></event>
                                                <event name="OnEraseBackground"></event>
                                                <event name="OnEraseBackground"></event>
                                                <event name="OnKeyDown"></event>
                                                <event name="OnKeyDown"></event>
Loading