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.

248 lines
7.0 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(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
  55. wxDialog::Create( parent, id, caption, pos, size, style );
  56. CreateControls();
  57. GetSizer()->Fit(this);
  58. GetSizer()->SetSizeHints(this);
  59. Centre();
  60. ////@end WinEDA_FindFrame creation
  61. m_NewTextCtrl->SetFocus();
  62. /* does not work here, might work if moved elsewhere,
  63. see void DrcDialog::OnInitDialog( wxInitDialogEvent& event )
  64. // deselect the existing text, seems SetFocus() wants to emulate
  65. // Microsoft and select all text, which is not desireable here.
  66. m_NewTextCtrl->SetSelection(0,0);
  67. */
  68. return true;
  69. }
  70. /*!
  71. * Control creation for WinEDA_FindFrame
  72. */
  73. void WinEDA_FindFrame::CreateControls()
  74. {
  75. SetFont(*g_DialogFont);
  76. ////@begin WinEDA_FindFrame content construction
  77. // Generated by DialogBlocks, 03/03/2006 08:14:51 (unregistered)
  78. WinEDA_FindFrame* itemDialog1 = this;
  79. wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
  80. itemDialog1->SetSizer(itemBoxSizer2);
  81. wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
  82. itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxLEFT|wxRIGHT, 5);
  83. wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Item to find:"), wxDefaultPosition, wxDefaultSize, 0 );
  84. itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
  85. m_NewTextCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
  86. itemBoxSizer3->Add(m_NewTextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  87. wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
  88. itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  89. wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
  90. itemBoxSizer6->Add(itemBoxSizer7, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
  91. wxButton* itemButton8 = new wxButton( itemDialog1, FIND_SHEET, _("Item in &Sheet"), wxDefaultPosition, wxDefaultSize, 0 );
  92. itemBoxSizer7->Add(itemButton8, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1);
  93. wxButton* itemButton9 = new wxButton( itemDialog1, FIND_HIERARCHY, _("Item in &Hierarchy"), wxDefaultPosition, wxDefaultSize, 0 );
  94. itemBoxSizer7->Add(itemButton9, 0, wxGROW|wxLEFT|wxRIGHT, 1);
  95. wxButton* itemButton10 = new wxButton( itemDialog1, FIND_NEXT, _("Find &Next Item (F5)"), wxDefaultPosition, wxDefaultSize, 0 );
  96. itemBoxSizer7->Add(itemButton10, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1);
  97. wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
  98. itemBoxSizer6->Add(itemBoxSizer11, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxFIXED_MINSIZE, 5);
  99. wxButton* itemButton12 = new wxButton( itemDialog1, FIND_MARKERS, _("Find Markers"), wxDefaultPosition, wxDefaultSize, 0 );
  100. itemButton12->SetForegroundColour(wxColour(41, 84, 84));
  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. itemButton13->SetForegroundColour(wxColour(0, 0, 213));
  104. itemBoxSizer11->Add(itemButton13, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1);
  105. wxButton* itemButton14 = new wxButton( itemDialog1, LOCATE_IN_LIBRARIES, _("Find Cmp in &Lib"), wxDefaultPosition, wxDefaultSize, 0 );
  106. itemButton14->SetForegroundColour(wxColour(170, 0, 0));
  107. itemBoxSizer11->Add(itemButton14, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1);
  108. // Set validators
  109. m_NewTextCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, & s_OldStringFound) );
  110. ////@end WinEDA_FindFrame content construction
  111. }
  112. /*!
  113. * Should we show tooltips?
  114. */
  115. bool WinEDA_FindFrame::ShowToolTips()
  116. {
  117. return true;
  118. }
  119. /*!
  120. * Get bitmap resources
  121. */
  122. wxBitmap WinEDA_FindFrame::GetBitmapResource( const wxString& name )
  123. {
  124. // Bitmap retrieval
  125. ////@begin WinEDA_FindFrame bitmap retrieval
  126. wxUnusedVar(name);
  127. return wxNullBitmap;
  128. ////@end WinEDA_FindFrame bitmap retrieval
  129. }
  130. /*!
  131. * Get icon resources
  132. */
  133. wxIcon WinEDA_FindFrame::GetIconResource( const wxString& name )
  134. {
  135. // Icon retrieval
  136. ////@begin WinEDA_FindFrame icon retrieval
  137. wxUnusedVar(name);
  138. return wxNullIcon;
  139. ////@end WinEDA_FindFrame icon retrieval
  140. }
  141. /*!
  142. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
  143. */
  144. void WinEDA_FindFrame::OnFindSheetClick( wxCommandEvent& event )
  145. {
  146. FindSchematicItem(event);
  147. }
  148. /*!
  149. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
  150. */
  151. void WinEDA_FindFrame::OnFindHierarchyClick( wxCommandEvent& event )
  152. {
  153. FindSchematicItem(event);
  154. }
  155. /*!
  156. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3
  157. */
  158. void WinEDA_FindFrame::OnLocateInLibrariesClick( wxCommandEvent& event )
  159. {
  160. LocatePartInLibs(event);
  161. }
  162. /*!
  163. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON5
  164. */
  165. void WinEDA_FindFrame::OnFindNextMarkerClick( wxCommandEvent& event )
  166. {
  167. FindMarker(event);
  168. }
  169. /*!
  170. * wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_MARKERS
  171. */
  172. void WinEDA_FindFrame::OnFindMarkersClick( wxCommandEvent& event )
  173. {
  174. FindMarker(event);
  175. }
  176. /*!
  177. * wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT
  178. */
  179. void WinEDA_FindFrame::OnFindNextClick( wxCommandEvent& event )
  180. {
  181. FindSchematicItem(event);
  182. }