Commit 86923ed6 authored by Mikhail Karpenko's avatar Mikhail Karpenko

WIP: add teardrops dialog

parent 19908464
...@@ -636,7 +636,11 @@ public: ...@@ -636,7 +636,11 @@ public:
*/ */
void ShowDesignRulesEditor( wxCommandEvent& event ); void ShowDesignRulesEditor( wxCommandEvent& event );
void ShowTeardropsWnd( wxCommandEvent& event ); /**
* @brief ShowTeardropsEditor displays the teardrops editor window.
* @param [in] event contains information about command events
*/
void ShowTeardropsEditor( wxCommandEvent& event );
/* toolbars update UI functions: */ /* toolbars update UI functions: */
......
...@@ -139,6 +139,8 @@ set( PCBNEW_DIALOGS ...@@ -139,6 +139,8 @@ set( PCBNEW_DIALOGS
footprint_wizard_frame.cpp footprint_wizard_frame.cpp
dialogs/dialog_footprint_wizard_list_base.cpp dialogs/dialog_footprint_wizard_list_base.cpp
dialogs/dialog_footprint_wizard_list.cpp dialogs/dialog_footprint_wizard_list.cpp
dialogs/dialog_teardrops_base.cpp
dialogs/dialog_teardrops.cpp
dialogs/wizard_add_fplib_base.cpp dialogs/wizard_add_fplib_base.cpp
dialogs/wizard_add_fplib.cpp dialogs/wizard_add_fplib.cpp
) )
......
#include "class_teardrop.h" #include "class_teardrop.h"
#include "class_board.h" #include "class_board.h"
#include "class_board_item.h" #include "class_board_item.h"
#include "class_undoredo_container.h"
TEARDROP::TEARDROP(BOARD_ITEM *aParent) : TEARDROP::TEARDROP(BOARD_ITEM *aParent) :
TRACK(aParent, PCB_TRACE_T) TRACK(aParent, PCB_TRACE_T)
...@@ -26,7 +27,8 @@ bool TEARDROP::Create(TRACK &aTrack, ENDPOINT_T endPoint, TEARDROP_TYPE type = T ...@@ -26,7 +27,8 @@ bool TEARDROP::Create(TRACK &aTrack, ENDPOINT_T endPoint, TEARDROP_TYPE type = T
result = CurvedSegments(aTrack, *aVia, upperSegment, lowerSegment); result = CurvedSegments(aTrack, *aVia, upperSegment, lowerSegment);
} }
if (result == true) { if (result == true) {
result = BuildTracks(aTrack, upperSegment, lowerSegment); result = BuildTracks(aTrack, upperSegment, m_upperSegment);
result = BuildTracks(aTrack, lowerSegment, m_lowerSegment);
} }
return result; return result;
...@@ -151,37 +153,22 @@ VIA *TEARDROP::GetViaOnEnd(TRACK &aTrack, ENDPOINT_T endPoint) ...@@ -151,37 +153,22 @@ VIA *TEARDROP::GetViaOnEnd(TRACK &aTrack, ENDPOINT_T endPoint)
return NULL; return NULL;
} }
bool TEARDROP::BuildTracks(TRACK &aTrack, std::vector<VECTOR2I> upperSegments, std::vector<VECTOR2I> lowerSegments) bool TEARDROP::BuildTracks(TRACK &aTrack, std::vector<VECTOR2I> points, std::vector<TRACK *> tracks)
{ {
BOARD *board = aTrack.GetBoard(); BOARD *board = aTrack.GetBoard();
wxPoint currentPoint(0, 0); wxPoint currentPoint(0, 0);
wxPoint prevPoint(upperSegments[0].x, upperSegments[0].y); wxPoint prevPoint(points[0].x, points[0].y);
for (size_t i = 0; i < upperSegments.size(); i++) { for (size_t i = 1; i < points.size(); i++) {
TRACK *track = new TRACK(board); TRACK *track = new TRACK(aTrack);
track->SetWidth(aTrack.GetWidth()); track->SetWidth(aTrack.GetWidth());
track->SetLayer(aTrack.GetLayer()); track->SetLayer(aTrack.GetLayer());
track->SetNetCode(aTrack.GetNetCode()); track->SetNetCode(aTrack.GetNetCode());
currentPoint.x = upperSegments[i].x; currentPoint.x = points[i].x;
currentPoint.y = upperSegments[i].y; currentPoint.y = points[i].y;
track->SetStart(prevPoint); track->SetStart(prevPoint);
track->SetEnd(currentPoint); track->SetEnd(currentPoint);
board->Add(track); board->Add(track);
m_upperSegment.push_back(track); tracks.push_back(track);
prevPoint = currentPoint;
}
currentPoint = wxPoint(0, 0);
prevPoint = wxPoint(lowerSegments[0].x, lowerSegments[0].y);
for (size_t i = 0; i < lowerSegments.size(); i++) {
TRACK *track = new TRACK(board);
track->SetWidth(aTrack.GetWidth());
track->SetLayer(aTrack.GetLayer());
track->SetNetCode(aTrack.GetNetCode());
currentPoint.x = lowerSegments[i].x;
currentPoint.y = lowerSegments[i].y;
track->SetStart(prevPoint);
track->SetEnd(currentPoint);
board->Add(track);
m_lowerSegment.push_back(track);
prevPoint = currentPoint; prevPoint = currentPoint;
} }
......
...@@ -98,7 +98,7 @@ private: ...@@ -98,7 +98,7 @@ private:
bool SetVector(TRACK &aTrack, const VIA &aVia, VECTOR2I &startPoint, VECTOR2I &endPoint); bool SetVector(TRACK &aTrack, const VIA &aVia, VECTOR2I &startPoint, VECTOR2I &endPoint);
VIA* GetViaOnEnd(TRACK &aTrack, ENDPOINT_T endPoint); VIA* GetViaOnEnd(TRACK &aTrack, ENDPOINT_T endPoint);
bool BuildTracks(TRACK &aTrack, std::vector<VECTOR2I> upperSegments, std::vector<VECTOR2I> lowerSegments); bool BuildTracks(TRACK &aTrack, const std::vector<VECTOR2I> points, std::vector<TRACK *> tracks);
}; };
#endif // CLASS_TEARDROP_H #endif // CLASS_TEARDROP_H
#include "dialog_teardrops.h"
DIALOG_TEARDROPS::DIALOG_TEARDROPS(PCB_EDIT_FRAME *aParent, TEARDROPS_SETTINGS *settings):
DIALOG_TEARDROPS_BASE(aParent)
{
m_parent = aParent;
m_settings = settings;
if (m_settings != NULL) {
InitDialogSettings();
}
}
void DIALOG_TEARDROPS::InitDialogSettings()
{
wxASSERT(m_settings != NULL);
if (m_modeRemove->GetValue() == true) {
m_settings->m_mode = TEARDROPS_MODE_REMOVE;
}
else {
m_settings->m_mode = TEARDROPS_MODE_ADD;
}
if (m_tracksAll->GetValue() == true) {
m_settings->m_track = TEARDROPS_TRACKS_ALL;
}
else {
m_settings->m_track = TEARDROPS_TRACKS_SELECTED;
}
m_settings->m_type = static_cast<TEARDROPS_TYPE>(m_choiceStyle->GetSelection());
m_settings->m_scope = TEARDROPS_SCOPE_NONE;
if (m_scopeVias->IsChecked() == true) {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_VIAS);
}
if (m_scopePads->IsChecked() == true) {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_PADS);
}
if (m_scopeTracks->IsChecked() == true) {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_TRACKS);
}
}
void DIALOG_TEARDROPS::OnModeAdd(wxCommandEvent &event)
{
if (m_settings != NULL) {
m_settings->m_mode = TEARDROPS_MODE_ADD;
}
}
void DIALOG_TEARDROPS::OnModeRemove(wxCommandEvent &event)
{
if (m_settings != NULL) {
m_settings->m_mode = TEARDROPS_MODE_REMOVE;
}
}
void DIALOG_TEARDROPS::OnTracksAll(wxCommandEvent &event)
{
if (m_settings != NULL) {
m_settings->m_track = TEARDROPS_TRACKS_ALL;
}
}
void DIALOG_TEARDROPS::OnTracksSelected(wxCommandEvent &event)
{
if (m_settings != NULL) {
m_settings->m_track = TEARDROPS_TRACKS_SELECTED;
}
}
void DIALOG_TEARDROPS::OnScopeVias(wxCommandEvent &event)
{
if (m_settings != NULL) {
if (m_scopeVias->IsChecked()) {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope | TEARDROPS_SCOPE_VIAS);
}
else {
m_settings->m_scope = static_cast<TEARDROPS_SCOPE>(m_settings->m_scope & (~TEARDROPS_SCOPE_VIAS));
}
}
}
void DIALOG_TEARDROPS::OnStyleChanged(wxCommandEvent &event)
{
if (m_settings != NULL) {
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;
// }
}
}
#ifndef DIALOG_TEARDROPS_H
#define DIALOG_TEARDROPS_H
#include "dialog_shim.h"
#include "dialog_teardrops_base.h"
#include "wxPcbStruct.h"
class DIALOG_TEARDROPS : public DIALOG_TEARDROPS_BASE
{
public:
typedef enum {
TEARDROPS_MODE_ADD,
TEARDROPS_MODE_REMOVE
} TEARDROPS_MODE;
typedef enum {
TEARDROPS_TRACKS_ALL,
TEARDROPS_TRACKS_SELECTED
} TEARDROPS_TRACKS;
typedef enum {
TEARDROPS_TYPE_NONE = -1,
TEARDROPS_TYPE_STRAIGHT,
TEARDROPS_TYPE_CURVED
} TEARDROPS_TYPE;
typedef enum {
TEARDROPS_SCOPE_NONE,
TEARDROPS_SCOPE_VIAS = 1,
TEARDROPS_SCOPE_PADS = 2,
TEARDROPS_SCOPE_TRACKS = 4
} TEARDROPS_SCOPE;
typedef struct {
TEARDROPS_MODE m_mode;
TEARDROPS_TRACKS m_track;
TEARDROPS_SCOPE m_scope;
TEARDROPS_TYPE m_type;
} TEARDROPS_SETTINGS;
DIALOG_TEARDROPS(PCB_EDIT_FRAME *aParent, TEARDROPS_SETTINGS *settings);
void OnModeAdd(wxCommandEvent &event);
void OnModeRemove(wxCommandEvent &event);
void OnTracksAll(wxCommandEvent &event);
void OnTracksSelected(wxCommandEvent &event);
void OnStyleChanged(wxCommandEvent &event);
void OnScopeVias(wxCommandEvent &event);
private:
PCB_EDIT_FRAME *m_parent;
TEARDROPS_SETTINGS *m_settings;
void InitDialogSettings();
};
#endif // DIALOG_TEARDROPS_H
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 29 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_teardrops_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_TEARDROPS_BASE::DIALOG_TEARDROPS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* m_settingsSizer;
m_settingsSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* m_modeSizer;
m_modeSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Mode") ), wxVERTICAL );
m_modeAdd = new wxRadioButton( this, wxID_ANY, wxT("Add teardrops"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_modeSizer->Add( m_modeAdd, 0, 0, 5 );
m_modeRemove = new wxRadioButton( this, wxID_ANY, wxT("Remove teardrops"), wxDefaultPosition, wxDefaultSize, 0 );
m_modeSizer->Add( m_modeRemove, 0, 0, 5 );
m_settingsSizer->Add( m_modeSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* m_tracksSizer;
m_tracksSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Tracks") ), wxVERTICAL );
m_tracksAll = new wxRadioButton( this, wxID_ANY, wxT("All tracks"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_tracksSizer->Add( m_tracksAll, 0, 0, 5 );
m_tracksSelected = new wxRadioButton( this, wxID_ANY, wxT("Selected tracks only"), wxDefaultPosition, wxDefaultSize, 0 );
m_tracksSizer->Add( m_tracksSelected, 0, 0, 5 );
m_settingsSizer->Add( m_tracksSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* m_optionsSizer;
m_optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Options") ), wxVERTICAL );
m_checkIgnore = new wxCheckBox( this, wxID_ANY, wxT("Ignore DRC"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkIgnore->SetValue(true);
m_checkIgnore->Hide();
m_optionsSizer->Add( m_checkIgnore, 0, 0, 5 );
wxBoxSizer* m_styleSizer;
m_styleSizer = new wxBoxSizer( wxHORIZONTAL );
m_staticStyle = new wxStaticText( this, wxID_ANY, wxT("Teardrop style"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticStyle->Wrap( -1 );
m_styleSizer->Add( m_staticStyle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
wxString m_choiceStyleChoices[] = { wxT("Straight"), wxT("Curved") };
int m_choiceStyleNChoices = sizeof( m_choiceStyleChoices ) / sizeof( wxString );
m_choiceStyle = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceStyleNChoices, m_choiceStyleChoices, 0 );
m_choiceStyle->SetSelection( 0 );
m_styleSizer->Add( m_choiceStyle, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxTOP, 5 );
m_optionsSizer->Add( m_styleSizer, 1, wxEXPAND, 5 );
m_settingsSizer->Add( m_optionsSizer, 1, wxEXPAND, 5 );
bSizer13->Add( m_settingsSizer, 1, wxEXPAND, 5 );
wxBoxSizer* m_scopeSizer;
m_scopeSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer16;
sbSizer16 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Scope") ), wxVERTICAL );
m_scopeVias = new wxCheckBox( this, wxID_ANY, wxT("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
m_scopeVias->SetValue(true);
sbSizer16->Add( m_scopeVias, 0, wxALL, 5 );
m_scopePads = new wxCheckBox( this, wxID_ANY, wxT("Pads"), wxDefaultPosition, wxDefaultSize, 0 );
m_scopePads->Enable( false );
m_scopePads->Hide();
sbSizer16->Add( m_scopePads, 0, wxALL, 5 );
m_scopeTracks = new wxCheckBox( this, wxID_ANY, wxT("Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_scopeTracks->Enable( false );
m_scopeTracks->Hide();
sbSizer16->Add( m_scopeTracks, 0, wxALL, 5 );
m_scopeSizer->Add( sbSizer16, 1, wxEXPAND, 5 );
bSizer13->Add( m_scopeSizer, 1, wxEXPAND, 5 );
bSizer7->Add( bSizer13, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer7->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizer7->Add( m_sdbSizer, 0, wxEXPAND, 5 );
this->SetSizer( bSizer7 );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_modeAdd->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnModeAdd ), NULL, this );
m_modeRemove->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnModeRemove ), NULL, this );
m_tracksAll->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnTracksAll ), NULL, this );
m_tracksSelected->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnTracksSelected ), 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 );
}
DIALOG_TEARDROPS_BASE::~DIALOG_TEARDROPS_BASE()
{
// Disconnect Events
m_modeAdd->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnModeAdd ), NULL, this );
m_modeRemove->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnModeRemove ), NULL, this );
m_tracksAll->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnTracksAll ), NULL, this );
m_tracksSelected->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_TEARDROPS_BASE::OnTracksSelected ), 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 );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 29 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_teardrops_base__
#define __dialog_teardrops_base__
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobut.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_TEARDROPS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_TEARDROPS_BASE : public DIALOG_SHIM
{
private:
protected:
wxRadioButton* m_modeAdd;
wxRadioButton* m_modeRemove;
wxRadioButton* m_tracksAll;
wxRadioButton* m_tracksSelected;
wxCheckBox* m_checkIgnore;
wxStaticText* m_staticStyle;
wxChoice* m_choiceStyle;
wxCheckBox* m_scopeVias;
wxCheckBox* m_scopePads;
wxCheckBox* m_scopeTracks;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnModeAdd( wxCommandEvent& event ) { event.Skip(); }
virtual void OnModeRemove( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTracksAll( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTracksSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnStyleChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnScopeVias( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_TEARDROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Teardrops"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 615,329 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_TEARDROPS_BASE();
};
#endif //__dialog_teardrops_base__
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
#include <class_track.h> #include <class_track.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <class_teardrop.h> //#include <class_teardrop.h>
#include <worksheet_viewitem.h> #include <worksheet_viewitem.h>
#include <ratsnest_data.h> #include <ratsnest_data.h>
#include <ratsnest_viewitem.h> #include <ratsnest_viewitem.h>
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
#include <scripting/python_console_frame.h> #include <scripting/python_console_frame.h>
#include "dialog_teardrops.h"
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
#include <python_scripting.h> #include <python_scripting.h>
#endif #endif
...@@ -207,7 +209,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -207,7 +209,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode )
EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode )
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool ) EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool )
EVT_TOOL( ID_TEARDROPS_WINDOW, PCB_EDIT_FRAME::ShowTeardropsWnd ) EVT_TOOL( ID_TEARDROPS_WINDOW, PCB_EDIT_FRAME::ShowTeardropsEditor )
// has meaning only with KICAD_SCRIPTING_WXPYTHON enabled // has meaning only with KICAD_SCRIPTING_WXPYTHON enabled
...@@ -722,16 +724,24 @@ void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event ) ...@@ -722,16 +724,24 @@ void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event )
OnModify(); OnModify();
} }
} }
void PCB_EDIT_FRAME::ShowTeardropsWnd( wxCommandEvent& event ) void PCB_EDIT_FRAME::ShowTeardropsEditor( wxCommandEvent& event )
{ {
BOARD_ITEM *item = GetScreen()->GetCurItem(); DIALOG_TEARDROPS::TEARDROPS_SETTINGS settings;
if ((item != NULL) && (item->Type() == PCB_TRACE_T)) { DIALOG_TEARDROPS *dlg_teardrops = new DIALOG_TEARDROPS(this, &settings);
TEARDROP *td = new TEARDROP(item); int retVal = dlg_teardrops->ShowModal();
TRACK *track = static_cast<TRACK *>(item);
td->Create(*track, ENDPOINT_START, TEARDROP::TEARDROP_CURVED); if (retVal == wxID_OK) {
td->Create(*track, ENDPOINT_END, TEARDROP::TEARDROP_CURVED);
} }
m_canvas->Refresh();
// BOARD_ITEM *item = GetScreen()->GetCurItem();
// if ((item != NULL) && (item->Type() == PCB_TRACE_T)) {
// TEARDROP *td = new TEARDROP(item);
// TRACK *track = static_cast<TRACK *>(item);
// td->Create(*track, ENDPOINT_START, TEARDROP::TEARDROP_CURVED);
// td->Create(*track, ENDPOINT_END, TEARDROP::TEARDROP_CURVED);
// }
// m_canvas->Refresh();
} }
void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment