You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

255 lines
7.3 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: cleaningoptions_dialog.cpp
  3. // Purpose:
  4. // Author: jean-pierre Charras
  5. // Modified by:
  6. // Created: 25/05/2007 14:24:54
  7. // RCS-ID:
  8. // Copyright: GNU License
  9. // Licence:
  10. /////////////////////////////////////////////////////////////////////////////
  11. // Generated by DialogBlocks (unregistered), 25/05/2007 14:24:54
  12. #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
  13. #pragma implementation "cleaningoptions_dialog.h"
  14. #endif
  15. // For compilers that support precompilation, includes "wx/wx.h".
  16. #include "wx/wxprec.h"
  17. #ifdef __BORLANDC__
  18. #pragma hdrstop
  19. #endif
  20. #ifndef WX_PRECOMP
  21. #include "wx/wx.h"
  22. #endif
  23. ////@begin includes
  24. ////@end includes
  25. #include "cleaningoptions_dialog.h"
  26. ////@begin XPM images
  27. ////@end XPM images
  28. /*!
  29. * WinEDA_CleaningOptionsFrame type definition
  30. */
  31. IMPLEMENT_DYNAMIC_CLASS( WinEDA_CleaningOptionsFrame, wxDialog )
  32. /*!
  33. * WinEDA_CleaningOptionsFrame event table definition
  34. */
  35. BEGIN_EVENT_TABLE( WinEDA_CleaningOptionsFrame, wxDialog )
  36. ////@begin WinEDA_CleaningOptionsFrame event table entries
  37. EVT_CLOSE( WinEDA_CleaningOptionsFrame::OnCloseWindow )
  38. EVT_BUTTON( ID_BUTTON_EXECUTE, WinEDA_CleaningOptionsFrame::OnButtonExecuteClick )
  39. ////@end WinEDA_CleaningOptionsFrame event table entries
  40. END_EVENT_TABLE()
  41. /*!
  42. * WinEDA_CleaningOptionsFrame constructors
  43. */
  44. WinEDA_CleaningOptionsFrame::WinEDA_CleaningOptionsFrame()
  45. {
  46. Init();
  47. }
  48. WinEDA_CleaningOptionsFrame::WinEDA_CleaningOptionsFrame( WinEDA_PcbFrame* parent, wxDC * DC, wxWindowID id,
  49. const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  50. {
  51. Init();
  52. m_Parent = parent;
  53. m_DC = DC;
  54. Create(parent, id, caption, pos, size, style);
  55. }
  56. /*!
  57. * WinEDA_CleaningOptionsFrame creator
  58. */
  59. bool WinEDA_CleaningOptionsFrame::Create( wxWindow * parent, wxWindowID id,
  60. const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  61. {
  62. ////@begin WinEDA_CleaningOptionsFrame creation
  63. SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
  64. wxDialog::Create( parent, id, caption, pos, size, style );
  65. CreateControls();
  66. if (GetSizer())
  67. {
  68. GetSizer()->SetSizeHints(this);
  69. }
  70. Centre();
  71. ////@end WinEDA_CleaningOptionsFrame creation
  72. return true;
  73. }
  74. /*!
  75. * WinEDA_CleaningOptionsFrame destructor
  76. */
  77. WinEDA_CleaningOptionsFrame::~WinEDA_CleaningOptionsFrame()
  78. {
  79. ////@begin WinEDA_CleaningOptionsFrame destruction
  80. ////@end WinEDA_CleaningOptionsFrame destruction
  81. }
  82. /*!
  83. * Member initialisation
  84. */
  85. void WinEDA_CleaningOptionsFrame::Init()
  86. {
  87. m_Parent = NULL;
  88. ////@begin WinEDA_CleaningOptionsFrame member initialisation
  89. m_CleanViasOpt = NULL;
  90. m_MergetSegmOpt = NULL;
  91. m_DeleteunconnectedOpt = NULL;
  92. m_ConnectToPadsOpt = NULL;
  93. ////@end WinEDA_CleaningOptionsFrame member initialisation
  94. }
  95. /*!
  96. * Control creation for WinEDA_CleaningOptionsFrame
  97. */
  98. void WinEDA_CleaningOptionsFrame::CreateControls()
  99. {
  100. ////@begin WinEDA_CleaningOptionsFrame content construction
  101. // Generated by DialogBlocks, 21/10/2007 19:42:47 (unregistered)
  102. WinEDA_CleaningOptionsFrame* itemDialog1 = this;
  103. wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
  104. itemDialog1->SetSizer(itemBoxSizer2);
  105. wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
  106. itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  107. wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Static"));
  108. wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL);
  109. itemBoxSizer3->Add(itemStaticBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
  110. m_CleanViasOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_CLEAN_VIAS, _("Delete redundant vias"), wxDefaultPosition, wxDefaultSize, 0 );
  111. m_CleanViasOpt->SetValue(false);
  112. if (ShowToolTips())
  113. m_CleanViasOpt->SetToolTip(_("remove vias on pads with a through hole"));
  114. itemStaticBoxSizer4->Add(m_CleanViasOpt, 0, wxALIGN_LEFT|wxALL, 5);
  115. m_MergetSegmOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_MERGE_SEGMENTS, _("Merge segments"), wxDefaultPosition, wxDefaultSize, 0 );
  116. m_MergetSegmOpt->SetValue(false);
  117. if (ShowToolTips())
  118. m_MergetSegmOpt->SetToolTip(_("merge aligned track segments, and remove null segments"));
  119. itemStaticBoxSizer4->Add(m_MergetSegmOpt, 0, wxALIGN_LEFT|wxALL, 5);
  120. m_DeleteunconnectedOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Delete unconnected tracks"), wxDefaultPosition, wxDefaultSize, 0 );
  121. m_DeleteunconnectedOpt->SetValue(false);
  122. if (ShowToolTips())
  123. m_DeleteunconnectedOpt->SetToolTip(_("delete track segment having a dangling end"));
  124. itemStaticBoxSizer4->Add(m_DeleteunconnectedOpt, 0, wxALIGN_LEFT|wxALL, 5);
  125. m_ConnectToPadsOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Connect to Pads"), wxDefaultPosition, wxDefaultSize, 0 );
  126. m_ConnectToPadsOpt->SetValue(false);
  127. if (ShowToolTips())
  128. m_ConnectToPadsOpt->SetToolTip(_("Extend dangling tracks which partially cover a pad or via, all the way to pad or via center"));
  129. itemStaticBoxSizer4->Add(m_ConnectToPadsOpt, 0, wxALIGN_LEFT|wxALL, 5);
  130. wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL);
  131. itemBoxSizer3->Add(itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
  132. wxButton* itemButton10 = new wxButton( itemDialog1, ID_BUTTON_EXECUTE, _("Clean pcb"), wxDefaultPosition, wxDefaultSize, 0 );
  133. itemButton10->SetDefault();
  134. itemBoxSizer9->Add(itemButton10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  135. // Set validators
  136. m_CleanViasOpt->SetValidator( wxGenericValidator(& s_CleanVias ) );
  137. m_MergetSegmOpt->SetValidator( wxGenericValidator(& s_MergeSegments) );
  138. m_DeleteunconnectedOpt->SetValidator( wxGenericValidator(& s_DeleteUnconnectedSegm) );
  139. ////@end WinEDA_CleaningOptionsFrame content construction
  140. }
  141. /*!
  142. * Should we show tooltips?
  143. */
  144. bool WinEDA_CleaningOptionsFrame::ShowToolTips()
  145. {
  146. return true;
  147. }
  148. /*!
  149. * Get bitmap resources
  150. */
  151. wxBitmap WinEDA_CleaningOptionsFrame::GetBitmapResource( const wxString& name )
  152. {
  153. // Bitmap retrieval
  154. ////@begin WinEDA_CleaningOptionsFrame bitmap retrieval
  155. wxUnusedVar(name);
  156. return wxNullBitmap;
  157. ////@end WinEDA_CleaningOptionsFrame bitmap retrieval
  158. }
  159. /*!
  160. * Get icon resources
  161. */
  162. wxIcon WinEDA_CleaningOptionsFrame::GetIconResource( const wxString& name )
  163. {
  164. // Icon retrieval
  165. ////@begin WinEDA_CleaningOptionsFrame icon retrieval
  166. wxUnusedVar(name);
  167. return wxNullIcon;
  168. ////@end WinEDA_CleaningOptionsFrame icon retrieval
  169. }
  170. /*!
  171. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_EXECUTE
  172. */
  173. void WinEDA_CleaningOptionsFrame::OnButtonExecuteClick( wxCommandEvent& event )
  174. {
  175. s_CleanVias = m_CleanViasOpt->GetValue();
  176. s_MergeSegments = m_MergetSegmOpt->GetValue();
  177. s_DeleteUnconnectedSegm = m_DeleteunconnectedOpt->GetValue();
  178. s_ConnectToPads = m_ConnectToPadsOpt->GetValue();
  179. Clean_Pcb_Items(m_Parent, m_DC );
  180. Close(TRUE);
  181. }
  182. /*!
  183. * wxEVT_CLOSE_WINDOW event handler for ID_WIN_EDA_CLEANINGOPTIONSFRAME
  184. */
  185. void WinEDA_CleaningOptionsFrame::OnCloseWindow( wxCloseEvent& event )
  186. {
  187. s_CleanVias = m_CleanViasOpt->GetValue();
  188. s_MergeSegments = m_MergetSegmOpt->GetValue();
  189. s_DeleteUnconnectedSegm = m_DeleteunconnectedOpt->GetValue();
  190. s_ConnectToPads = m_ConnectToPadsOpt->GetValue();
  191. event.Skip();
  192. }