Loading Doxyfile +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1142,7 +1142,7 @@ DISABLE_INDEX = NO # Since the tree basically has the same information as the tab index you # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = YES GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # (range [0,1..20]) that doxygen will group on one line in the generated HTML Loading pcbnew/dialogs/dialog_teardrops.cpp +22 −0 Original line number Original line Diff line number Diff line Loading @@ -46,13 +46,16 @@ void DIALOG_TEARDROPS::OnModeAdd(wxCommandEvent &event) { { if (m_settings != NULL) { if (m_settings != NULL) { m_settings->m_mode = TEARDROPS_MODE_ADD; m_settings->m_mode = TEARDROPS_MODE_ADD; LockOptionsControls(false); } } } } void DIALOG_TEARDROPS::OnModeRemove(wxCommandEvent &event) void DIALOG_TEARDROPS::OnModeRemove(wxCommandEvent &event) { { event.Skip(); if (m_settings != NULL) { if (m_settings != NULL) { m_settings->m_mode = TEARDROPS_MODE_REMOVE; m_settings->m_mode = TEARDROPS_MODE_REMOVE; LockOptionsControls(true); } } } } Loading Loading @@ -115,3 +118,22 @@ void DIALOG_TEARDROPS::OnIgnoreDrc(wxCommandEvent &event) m_settings->m_ignoreDrc = m_checkIgnore->IsChecked(); m_settings->m_ignoreDrc = m_checkIgnore->IsChecked(); } } } } void DIALOG_TEARDROPS::LockOptionsControls(bool state) { if (state == true) { if (m_tracksSelected->GetValue() == false) { m_checkClear->Enable(false); } m_checkIgnore->Enable(false); m_choiceStyle->Enable(false); } else { if (m_tracksSelected->GetValue() == true) { m_checkClear->Enable(true); } // The line below is intentionally commented out unless DRC is taken into consideration //m_checkIgnore->Enable(true); m_choiceStyle->Enable(true); } } pcbnew/dialogs/dialog_teardrops.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,7 @@ private: TEARDROPS_SETTINGS *m_settings; TEARDROPS_SETTINGS *m_settings; void InitDialogSettings(); void InitDialogSettings(); void LockOptionsControls(bool state); }; }; #endif // DIALOG_TEARDROPS_H #endif // DIALOG_TEARDROPS_H pcbnew/edit_teardrops.cpp +60 −2 Original line number Original line Diff line number Diff line #include "edit_teardrops.h" #include "edit_teardrops.h" #include "class_board.h" #include "class_board.h" #include "class_module.h" #include "class_module.h" #include "ratsnest_data.h" #include "view/view.h" TEARDROPS_EDITOR::TEARDROPS_EDITOR(PCB_EDIT_FRAME *frame, KIGFX::VIEW *view) TEARDROPS_EDITOR::TEARDROPS_EDITOR(PCB_EDIT_FRAME *frame, KIGFX::VIEW *view) { { Loading Loading @@ -41,7 +43,13 @@ bool TEARDROPS_EDITOR::EditTeardrops(SELECTION &selection, const DIALOG_TEARDROP } } } } else if (settings.m_mode == DIALOG_TEARDROPS::TEARDROPS_MODE_REMOVE) { else if (settings.m_mode == DIALOG_TEARDROPS::TEARDROPS_MODE_REMOVE) { // TODO: consider using TRACKS_CLEARNER to remove teardrops if (settings.m_track == DIALOG_TEARDROPS::TEARDROPS_TRACKS_SELECTED) { RemoveSelected(selection); } else if (settings.m_track == DIALOG_TEARDROPS::TEARDROPS_TRACKS_ALL) { RemoveAll(); } retVal = true; } } return retVal; return retVal; } } Loading Loading @@ -114,9 +122,57 @@ bool TEARDROPS_EDITOR::AddToSelected(SELECTION &selection, const DIALOG_TEARDROP return added; return added; } } void TEARDROPS_EDITOR::RemoveAll() { TRACK *nextTrack = NULL; for (TRACK *track = m_frame->GetBoard()->m_Track.begin(); track != NULL; ) { nextTrack = track->Next(); if (track->GetState(FLAG1) == FLAG1) { m_view->Remove(track); m_frame->GetBoard()->Remove(track); } track = nextTrack; } m_frame->GetBoard()->GetRatsnest()->Recalculate(); } void TEARDROPS_EDITOR::RemoveSelected(SELECTION &selection) { EDA_ITEM *selectedItem = NULL; for (size_t i = 0; i < selection.items.GetCount(); i++) { selectedItem = selection.items.GetPickedItem(i); std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> result; EDA_RECT rect = selectedItem->GetBoundingBox(); VECTOR2I vect = VECTOR2I(rect.GetX(), rect.GetY()); VECTOR2I sz = VECTOR2I(rect.GetWidth(), rect.GetHeight()); BOX2I bbox = BOX2I(vect, sz); printf("Bounding box origin: %d, %d\n", bbox.GetX(), bbox.GetY()); printf("bounding box dimentions: %d, %d\n", bbox.GetWidth(), bbox.GetHeight()); m_view->Query(bbox, result); std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR>::iterator iter; BOX2I container; for (iter = result.begin(); iter != result.end(); ++iter) { BOARD_ITEM *item = static_cast<BOARD_ITEM *>(iter->first); if (item->GetState(FLAG1) == FLAG1) { rect = item->GetBoundingBox(); vect = VECTOR2I(rect.GetX(), rect.GetY()); sz = VECTOR2I(rect.GetWidth(), rect.GetHeight()); BOX2I nearBBox = BOX2I(vect, sz); container.Merge(nearBox); // m_view->Remove(item); // m_frame->GetBoard()->Remove(item); } } } m_frame->GetBoard()->GetRatsnest()->Recalculate(); } void TEARDROPS_EDITOR::DrawSegments(TEARDROP &teardrop, TRACK &aTrack) void TEARDROPS_EDITOR::DrawSegments(TEARDROP &teardrop, TRACK &aTrack) { { PICKED_ITEMS_LIST undoListPicker; ITEM_PICKER picker(NULL, UR_NEW); ITEM_PICKER picker(NULL, UR_NEW); std::vector<VECTOR2I> coordinates; std::vector<VECTOR2I> coordinates; Loading @@ -126,6 +182,7 @@ void TEARDROPS_EDITOR::DrawSegments(TEARDROP &teardrop, TRACK &aTrack) wxPoint prevPoint(coordinates[0].x, coordinates[0].y); wxPoint prevPoint(coordinates[0].x, coordinates[0].y); for (size_t i = 1; i < coordinates.size(); i++) { for (size_t i = 1; i < coordinates.size(); i++) { TRACK *track = new TRACK(aTrack); TRACK *track = new TRACK(aTrack); // TRACK *track = static_cast<TRACK *>(aTrack.Clone()); track->SetWidth(aTrack.GetWidth()); track->SetWidth(aTrack.GetWidth()); track->SetLayer(aTrack.GetLayer()); track->SetLayer(aTrack.GetLayer()); track->SetNetCode(aTrack.GetNetCode()); track->SetNetCode(aTrack.GetNetCode()); Loading @@ -134,6 +191,7 @@ void TEARDROPS_EDITOR::DrawSegments(TEARDROP &teardrop, TRACK &aTrack) track->SetStart(prevPoint); track->SetStart(prevPoint); track->SetEnd(currentPoint); track->SetEnd(currentPoint); track->ClearFlags(); track->ClearFlags(); track->SetState(FLAG1, true); board->Add(track); board->Add(track); m_view->Add(track); m_view->Add(track); prevPoint = currentPoint; prevPoint = currentPoint; Loading pcbnew/edit_teardrops.h +11 −0 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,17 @@ private: void FilterSelection(SELECTION &selection); void FilterSelection(SELECTION &selection); bool AddToAll(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &settings); bool AddToAll(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &settings); bool AddToSelected(SELECTION &selection, const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &settings); bool AddToSelected(SELECTION &selection, const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &settings); /** * @brief RemoveAll removes all teardrops form board. */ void RemoveAll(); /** * @brief RemoveSelected removes teardrops from selected tracks * @param selection contains a list of track to work on */ void RemoveSelected(SELECTION &selection); void DrawSegments(TEARDROP &teardrop, TRACK &track); void DrawSegments(TEARDROP &teardrop, TRACK &track); }; }; Loading Loading
Doxyfile +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1142,7 +1142,7 @@ DISABLE_INDEX = NO # Since the tree basically has the same information as the tab index you # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = YES GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # (range [0,1..20]) that doxygen will group on one line in the generated HTML Loading
pcbnew/dialogs/dialog_teardrops.cpp +22 −0 Original line number Original line Diff line number Diff line Loading @@ -46,13 +46,16 @@ void DIALOG_TEARDROPS::OnModeAdd(wxCommandEvent &event) { { if (m_settings != NULL) { if (m_settings != NULL) { m_settings->m_mode = TEARDROPS_MODE_ADD; m_settings->m_mode = TEARDROPS_MODE_ADD; LockOptionsControls(false); } } } } void DIALOG_TEARDROPS::OnModeRemove(wxCommandEvent &event) void DIALOG_TEARDROPS::OnModeRemove(wxCommandEvent &event) { { event.Skip(); if (m_settings != NULL) { if (m_settings != NULL) { m_settings->m_mode = TEARDROPS_MODE_REMOVE; m_settings->m_mode = TEARDROPS_MODE_REMOVE; LockOptionsControls(true); } } } } Loading Loading @@ -115,3 +118,22 @@ void DIALOG_TEARDROPS::OnIgnoreDrc(wxCommandEvent &event) m_settings->m_ignoreDrc = m_checkIgnore->IsChecked(); m_settings->m_ignoreDrc = m_checkIgnore->IsChecked(); } } } } void DIALOG_TEARDROPS::LockOptionsControls(bool state) { if (state == true) { if (m_tracksSelected->GetValue() == false) { m_checkClear->Enable(false); } m_checkIgnore->Enable(false); m_choiceStyle->Enable(false); } else { if (m_tracksSelected->GetValue() == true) { m_checkClear->Enable(true); } // The line below is intentionally commented out unless DRC is taken into consideration //m_checkIgnore->Enable(true); m_choiceStyle->Enable(true); } }
pcbnew/dialogs/dialog_teardrops.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -51,6 +51,7 @@ private: TEARDROPS_SETTINGS *m_settings; TEARDROPS_SETTINGS *m_settings; void InitDialogSettings(); void InitDialogSettings(); void LockOptionsControls(bool state); }; }; #endif // DIALOG_TEARDROPS_H #endif // DIALOG_TEARDROPS_H
pcbnew/edit_teardrops.cpp +60 −2 Original line number Original line Diff line number Diff line #include "edit_teardrops.h" #include "edit_teardrops.h" #include "class_board.h" #include "class_board.h" #include "class_module.h" #include "class_module.h" #include "ratsnest_data.h" #include "view/view.h" TEARDROPS_EDITOR::TEARDROPS_EDITOR(PCB_EDIT_FRAME *frame, KIGFX::VIEW *view) TEARDROPS_EDITOR::TEARDROPS_EDITOR(PCB_EDIT_FRAME *frame, KIGFX::VIEW *view) { { Loading Loading @@ -41,7 +43,13 @@ bool TEARDROPS_EDITOR::EditTeardrops(SELECTION &selection, const DIALOG_TEARDROP } } } } else if (settings.m_mode == DIALOG_TEARDROPS::TEARDROPS_MODE_REMOVE) { else if (settings.m_mode == DIALOG_TEARDROPS::TEARDROPS_MODE_REMOVE) { // TODO: consider using TRACKS_CLEARNER to remove teardrops if (settings.m_track == DIALOG_TEARDROPS::TEARDROPS_TRACKS_SELECTED) { RemoveSelected(selection); } else if (settings.m_track == DIALOG_TEARDROPS::TEARDROPS_TRACKS_ALL) { RemoveAll(); } retVal = true; } } return retVal; return retVal; } } Loading Loading @@ -114,9 +122,57 @@ bool TEARDROPS_EDITOR::AddToSelected(SELECTION &selection, const DIALOG_TEARDROP return added; return added; } } void TEARDROPS_EDITOR::RemoveAll() { TRACK *nextTrack = NULL; for (TRACK *track = m_frame->GetBoard()->m_Track.begin(); track != NULL; ) { nextTrack = track->Next(); if (track->GetState(FLAG1) == FLAG1) { m_view->Remove(track); m_frame->GetBoard()->Remove(track); } track = nextTrack; } m_frame->GetBoard()->GetRatsnest()->Recalculate(); } void TEARDROPS_EDITOR::RemoveSelected(SELECTION &selection) { EDA_ITEM *selectedItem = NULL; for (size_t i = 0; i < selection.items.GetCount(); i++) { selectedItem = selection.items.GetPickedItem(i); std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> result; EDA_RECT rect = selectedItem->GetBoundingBox(); VECTOR2I vect = VECTOR2I(rect.GetX(), rect.GetY()); VECTOR2I sz = VECTOR2I(rect.GetWidth(), rect.GetHeight()); BOX2I bbox = BOX2I(vect, sz); printf("Bounding box origin: %d, %d\n", bbox.GetX(), bbox.GetY()); printf("bounding box dimentions: %d, %d\n", bbox.GetWidth(), bbox.GetHeight()); m_view->Query(bbox, result); std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR>::iterator iter; BOX2I container; for (iter = result.begin(); iter != result.end(); ++iter) { BOARD_ITEM *item = static_cast<BOARD_ITEM *>(iter->first); if (item->GetState(FLAG1) == FLAG1) { rect = item->GetBoundingBox(); vect = VECTOR2I(rect.GetX(), rect.GetY()); sz = VECTOR2I(rect.GetWidth(), rect.GetHeight()); BOX2I nearBBox = BOX2I(vect, sz); container.Merge(nearBox); // m_view->Remove(item); // m_frame->GetBoard()->Remove(item); } } } m_frame->GetBoard()->GetRatsnest()->Recalculate(); } void TEARDROPS_EDITOR::DrawSegments(TEARDROP &teardrop, TRACK &aTrack) void TEARDROPS_EDITOR::DrawSegments(TEARDROP &teardrop, TRACK &aTrack) { { PICKED_ITEMS_LIST undoListPicker; ITEM_PICKER picker(NULL, UR_NEW); ITEM_PICKER picker(NULL, UR_NEW); std::vector<VECTOR2I> coordinates; std::vector<VECTOR2I> coordinates; Loading @@ -126,6 +182,7 @@ void TEARDROPS_EDITOR::DrawSegments(TEARDROP &teardrop, TRACK &aTrack) wxPoint prevPoint(coordinates[0].x, coordinates[0].y); wxPoint prevPoint(coordinates[0].x, coordinates[0].y); for (size_t i = 1; i < coordinates.size(); i++) { for (size_t i = 1; i < coordinates.size(); i++) { TRACK *track = new TRACK(aTrack); TRACK *track = new TRACK(aTrack); // TRACK *track = static_cast<TRACK *>(aTrack.Clone()); track->SetWidth(aTrack.GetWidth()); track->SetWidth(aTrack.GetWidth()); track->SetLayer(aTrack.GetLayer()); track->SetLayer(aTrack.GetLayer()); track->SetNetCode(aTrack.GetNetCode()); track->SetNetCode(aTrack.GetNetCode()); Loading @@ -134,6 +191,7 @@ void TEARDROPS_EDITOR::DrawSegments(TEARDROP &teardrop, TRACK &aTrack) track->SetStart(prevPoint); track->SetStart(prevPoint); track->SetEnd(currentPoint); track->SetEnd(currentPoint); track->ClearFlags(); track->ClearFlags(); track->SetState(FLAG1, true); board->Add(track); board->Add(track); m_view->Add(track); m_view->Add(track); prevPoint = currentPoint; prevPoint = currentPoint; Loading
pcbnew/edit_teardrops.h +11 −0 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,17 @@ private: void FilterSelection(SELECTION &selection); void FilterSelection(SELECTION &selection); bool AddToAll(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &settings); bool AddToAll(const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &settings); bool AddToSelected(SELECTION &selection, const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &settings); bool AddToSelected(SELECTION &selection, const DIALOG_TEARDROPS::TEARDROPS_SETTINGS &settings); /** * @brief RemoveAll removes all teardrops form board. */ void RemoveAll(); /** * @brief RemoveSelected removes teardrops from selected tracks * @param selection contains a list of track to work on */ void RemoveSelected(SELECTION &selection); void DrawSegments(TEARDROP &teardrop, TRACK &track); void DrawSegments(TEARDROP &teardrop, TRACK &track); }; }; Loading