kicad/eeschema/dialog_find.cpp

246 lines
6.8 KiB
C++
Raw Normal View History

2007-05-06 16:03:28 +00:00
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_find.cpp
2008-03-11 01:18:17 +00:00
// Purpose:
2007-05-06 16:03:28 +00:00
// Author: jean-pierre Charras
2008-03-11 01:18:17 +00:00
// Modified by:
2007-05-06 16:03:28 +00:00
// Created: 16/02/2006 20:18:11
2008-03-11 01:18:17 +00:00
// RCS-ID:
2007-05-06 16:03:28 +00:00
// Copyright: License GNU
2008-03-11 01:18:17 +00:00
// Licence:
2007-05-06 16:03:28 +00:00
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 16/02/2006 20:18:11
////@begin includes
////@end includes
#include "dialog_find.h"
////@begin XPM images
////@end XPM images
/*!
* WinEDA_FindFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_FindFrame, wxDialog )
/*!
* WinEDA_FindFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_FindFrame, wxDialog )
////@begin WinEDA_FindFrame event table entries
EVT_BUTTON( FIND_SHEET, WinEDA_FindFrame::OnFindSheetClick )
EVT_BUTTON( FIND_HIERARCHY, WinEDA_FindFrame::OnFindHierarchyClick )
EVT_BUTTON( FIND_NEXT, WinEDA_FindFrame::OnFindNextClick )
EVT_BUTTON( FIND_MARKERS, WinEDA_FindFrame::OnFindMarkersClick )
EVT_BUTTON( FIND_NEXT_MARKER, WinEDA_FindFrame::OnFindNextMarkerClick )
EVT_BUTTON( LOCATE_IN_LIBRARIES, WinEDA_FindFrame::OnLocateInLibrariesClick )
2007-05-06 16:03:28 +00:00
////@end WinEDA_FindFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_FindFrame constructors
*/
WinEDA_FindFrame::WinEDA_FindFrame( )
{
}
WinEDA_FindFrame::WinEDA_FindFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
2008-03-11 01:18:17 +00:00
m_Parent = parent;
2007-05-06 16:03:28 +00:00
Create(parent, id, caption, pos, size, style);
}
/*!
* WinEDA_FindFrame creator
*/
bool WinEDA_FindFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin WinEDA_FindFrame member initialisation
m_NewTextCtrl = NULL;
2007-05-06 16:03:28 +00:00
////@end WinEDA_FindFrame member initialisation
////@begin WinEDA_FindFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
2007-05-06 16:03:28 +00:00
////@end WinEDA_FindFrame creation
2008-03-11 01:18:17 +00:00
m_NewTextCtrl->SetFocus();
/* does not work here, might work if moved elsewhere,
see void DrcDialog::OnInitDialog( wxInitDialogEvent& event )
// deselect the existing text, seems SetFocus() wants to emulate
// Microsoft and select all text, which is not desireable here.
m_NewTextCtrl->SetSelection(0,0);
*/
2007-05-06 16:03:28 +00:00
return true;
}
/*!
* Control creation for WinEDA_FindFrame
*/
void WinEDA_FindFrame::CreateControls()
2008-03-11 01:18:17 +00:00
{
2007-05-06 16:03:28 +00:00
////@begin WinEDA_FindFrame content construction
// Generated by DialogBlocks, 24/04/2009 14:23:21 (unregistered)
WinEDA_FindFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxLEFT|wxRIGHT, 5);
wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Item to find:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_NewTextCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer3->Add(m_NewTextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer6->Add(itemBoxSizer7, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
wxButton* itemButton8 = new wxButton( itemDialog1, FIND_SHEET, _("Item in &Sheet"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer7->Add(itemButton8, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1);
wxButton* itemButton9 = new wxButton( itemDialog1, FIND_HIERARCHY, _("Item in &Hierarchy"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer7->Add(itemButton9, 0, wxGROW|wxLEFT|wxRIGHT, 1);
wxButton* itemButton10 = new wxButton( itemDialog1, FIND_NEXT, _("Find &Next Item (F5)"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer7->Add(itemButton10, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1);
wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer6->Add(itemBoxSizer11, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxFIXED_MINSIZE, 5);
wxButton* itemButton12 = new wxButton( itemDialog1, FIND_MARKERS, _("Find Markers"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer11->Add(itemButton12, 0, wxGROW|wxLEFT|wxRIGHT, 1);
wxButton* itemButton13 = new wxButton( itemDialog1, FIND_NEXT_MARKER, _("Next Marker (F5)"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer11->Add(itemButton13, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1);
wxButton* itemButton14 = new wxButton( itemDialog1, LOCATE_IN_LIBRARIES, _("Find Cmp in &Lib"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer11->Add(itemButton14, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1);
// Set validators
m_NewTextCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, & s_OldStringFound) );
2007-05-06 16:03:28 +00:00
////@end WinEDA_FindFrame content construction
}
/*!
* Should we show tooltips?
*/
bool WinEDA_FindFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_FindFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_FindFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
2007-05-06 16:03:28 +00:00
////@end WinEDA_FindFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_FindFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_FindFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
2007-05-06 16:03:28 +00:00
////@end WinEDA_FindFrame icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
*/
void WinEDA_FindFrame::OnFindSheetClick( wxCommandEvent& event )
{
2008-03-11 01:18:17 +00:00
FindSchematicItem(event);
2007-05-06 16:03:28 +00:00
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
*/
void WinEDA_FindFrame::OnFindHierarchyClick( wxCommandEvent& event )
{
2008-03-11 01:18:17 +00:00
FindSchematicItem(event);
2007-05-06 16:03:28 +00:00
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3
*/
void WinEDA_FindFrame::OnLocateInLibrariesClick( wxCommandEvent& event )
{
2008-03-11 01:18:17 +00:00
LocatePartInLibs(event);
2007-05-06 16:03:28 +00:00
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON5
*/
void WinEDA_FindFrame::OnFindNextMarkerClick( wxCommandEvent& event )
{
2008-03-11 01:18:17 +00:00
FindMarker(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_MARKERS
*/
void WinEDA_FindFrame::OnFindMarkersClick( wxCommandEvent& event )
{
2008-03-11 01:18:17 +00:00
FindMarker(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT
*/
void WinEDA_FindFrame::OnFindNextClick( wxCommandEvent& event )
{
2008-03-11 01:18:17 +00:00
FindSchematicItem(event);
2007-05-06 16:03:28 +00:00
}