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.

245 lines
6.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: dialog_find.cpp
  3. // Purpose:
  4. // Author: jean-pierre Charras
  5. // Modified by:
  6. // Created: 16/02/2006 20:18:11
  7. // RCS-ID:
  8. // Copyright: License GNU
  9. // Licence:
  10. /////////////////////////////////////////////////////////////////////////////
  11. // Generated by DialogBlocks (unregistered), 16/02/2006 20:18:11
  12. ////@begin includes
  13. ////@end includes
  14. #include "dialog_find.h"
  15. ////@begin XPM images
  16. ////@end XPM images
  17. /*!
  18. * WinEDA_FindFrame type definition
  19. */
  20. IMPLEMENT_DYNAMIC_CLASS( WinEDA_FindFrame, wxDialog )
  21. /*!
  22. * WinEDA_FindFrame event table definition
  23. */
  24. BEGIN_EVENT_TABLE( WinEDA_FindFrame, wxDialog )
  25. ////@begin WinEDA_FindFrame event table entries
  26. EVT_BUTTON( FIND_SHEET, WinEDA_FindFrame::OnFindSheetClick )
  27. EVT_BUTTON( FIND_HIERARCHY, WinEDA_FindFrame::OnFindHierarchyClick )
  28. EVT_BUTTON( FIND_NEXT, WinEDA_FindFrame::OnFindNextClick )
  29. EVT_BUTTON( FIND_MARKERS, WinEDA_FindFrame::OnFindMarkersClick )
  30. EVT_BUTTON( FIND_NEXT_MARKER, WinEDA_FindFrame::OnFindNextMarkerClick )
  31. EVT_BUTTON( LOCATE_IN_LIBRARIES, WinEDA_FindFrame::OnLocateInLibrariesClick )
  32. ////@end WinEDA_FindFrame event table entries
  33. END_EVENT_TABLE()
  34. /*!
  35. * WinEDA_FindFrame constructors
  36. */
  37. WinEDA_FindFrame::WinEDA_FindFrame( )
  38. {
  39. }
  40. WinEDA_FindFrame::WinEDA_FindFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  41. {
  42. m_Parent = parent;
  43. Create(parent, id, caption, pos, size, style);
  44. }
  45. /*!
  46. * WinEDA_FindFrame creator
  47. */
  48. bool WinEDA_FindFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  49. {
  50. ////@begin WinEDA_FindFrame member initialisation
  51. m_NewTextCtrl = NULL;
  52. ////@end WinEDA_FindFrame member initialisation
  53. ////@begin WinEDA_FindFrame creation
  54. SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
  55. wxDialog::Create( parent, id, caption, pos, size, style );
  56. CreateControls();
  57. if (GetSizer())
  58. {
  59. GetSizer()->SetSizeHints(this);
  60. }
  61. Centre();
  62. ////@end WinEDA_FindFrame creation
  63. m_NewTextCtrl->SetFocus();
  64. /* does not work here, might work if moved elsewhere,
  65. see void DrcDialog::OnInitDialog( wxInitDialogEvent& event )
  66. // deselect the existing text, seems SetFocus() wants to emulate
  67. // Microsoft and select all text, which is not desireable here.
  68. m_NewTextCtrl->SetSelection(0,0);
  69. */
  70. return true;
  71. }
  72. /*!
  73. * Control creation for WinEDA_FindFrame
  74. */
  75. void WinEDA_FindFrame::CreateControls()
  76. {
  77. ////@begin WinEDA_FindFrame content construction
  78. // Generated by DialogBlocks, 24/04/2009 14:23:21 (unregistered)
  79. WinEDA_FindFrame* itemDialog1 = this;
  80. wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
  81. itemDialog1->SetSizer(itemBoxSizer2);
  82. wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
  83. itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxLEFT|wxRIGHT, 5);
  84. wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Item to find:"), wxDefaultPosition, wxDefaultSize, 0 );
  85. itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
  86. m_NewTextCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
  87. itemBoxSizer3->Add(m_NewTextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  88. wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
  89. itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  90. wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
  91. itemBoxSizer6->Add(itemBoxSizer7, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
  92. wxButton* itemButton8 = new wxButton( itemDialog1, FIND_SHEET, _("Item in &Sheet"), wxDefaultPosition, wxDefaultSize, 0 );
  93. itemBoxSizer7->Add(itemButton8, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1);
  94. wxButton* itemButton9 = new wxButton( itemDialog1, FIND_HIERARCHY, _("Item in &Hierarchy"), wxDefaultPosition, wxDefaultSize, 0 );
  95. itemBoxSizer7->Add(itemButton9, 0, wxGROW|wxLEFT|wxRIGHT, 1);
  96. wxButton* itemButton10 = new wxButton( itemDialog1, FIND_NEXT, _("Find &Next Item (F5)"), wxDefaultPosition, wxDefaultSize, 0 );
  97. itemBoxSizer7->Add(itemButton10, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1);
  98. wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
  99. itemBoxSizer6->Add(itemBoxSizer11, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxFIXED_MINSIZE, 5);
  100. wxButton* itemButton12 = new wxButton( itemDialog1, FIND_MARKERS, _("Find Markers"), wxDefaultPosition, wxDefaultSize, 0 );
  101. itemBoxSizer11->Add(itemButton12, 0, wxGROW|wxLEFT|wxRIGHT, 1);
  102. wxButton* itemButton13 = new wxButton( itemDialog1, FIND_NEXT_MARKER, _("Next Marker (F5)"), wxDefaultPosition, wxDefaultSize, 0 );
  103. itemBoxSizer11->Add(itemButton13, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1);
  104. wxButton* itemButton14 = new wxButton( itemDialog1, LOCATE_IN_LIBRARIES, _("Find Cmp in &Lib"), wxDefaultPosition, wxDefaultSize, 0 );
  105. itemBoxSizer11->Add(itemButton14, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1);
  106. // Set validators
  107. m_NewTextCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, & s_OldStringFound) );
  108. ////@end WinEDA_FindFrame content construction
  109. }
  110. /*!
  111. * Should we show tooltips?
  112. */
  113. bool WinEDA_FindFrame::ShowToolTips()
  114. {
  115. return true;
  116. }
  117. /*!
  118. * Get bitmap resources
  119. */
  120. wxBitmap WinEDA_FindFrame::GetBitmapResource( const wxString& name )
  121. {
  122. // Bitmap retrieval
  123. ////@begin WinEDA_FindFrame bitmap retrieval
  124. wxUnusedVar(name);
  125. return wxNullBitmap;
  126. ////@end WinEDA_FindFrame bitmap retrieval
  127. }
  128. /*!
  129. * Get icon resources
  130. */
  131. wxIcon WinEDA_FindFrame::GetIconResource( const wxString& name )
  132. {
  133. // Icon retrieval
  134. ////@begin WinEDA_FindFrame icon retrieval
  135. wxUnusedVar(name);
  136. return wxNullIcon;
  137. ////@end WinEDA_FindFrame icon retrieval
  138. }
  139. /*!
  140. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
  141. */
  142. void WinEDA_FindFrame::OnFindSheetClick( wxCommandEvent& event )
  143. {
  144. FindSchematicItem(event);
  145. }
  146. /*!
  147. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
  148. */
  149. void WinEDA_FindFrame::OnFindHierarchyClick( wxCommandEvent& event )
  150. {
  151. FindSchematicItem(event);
  152. }
  153. /*!
  154. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3
  155. */
  156. void WinEDA_FindFrame::OnLocateInLibrariesClick( wxCommandEvent& event )
  157. {
  158. LocatePartInLibs(event);
  159. }
  160. /*!
  161. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON5
  162. */
  163. void WinEDA_FindFrame::OnFindNextMarkerClick( wxCommandEvent& event )
  164. {
  165. FindMarker(event);
  166. }
  167. /*!
  168. * wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_MARKERS
  169. */
  170. void WinEDA_FindFrame::OnFindMarkersClick( wxCommandEvent& event )
  171. {
  172. FindMarker(event);
  173. }
  174. /*!
  175. * wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT
  176. */
  177. void WinEDA_FindFrame::OnFindNextClick( wxCommandEvent& event )
  178. {
  179. FindSchematicItem(event);
  180. }