40 const wxPoint& aPosition,
const wxSize& aSize ) :
43 m_htmlWindow->SetLayoutDirection( wxLayout_LeftToRight );
47 wxBoxSizer* searchSizer =
new wxBoxSizer( wxHORIZONTAL );
49 m_searchCtrl =
new wxTextCtrl(
m_searchPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
50 m_prevBtn =
new wxButton(
m_searchPanel, wxID_ANY, wxS(
"∧" ), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
51 m_nextBtn =
new wxButton(
m_searchPanel, wxID_ANY, wxS(
"∨" ), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
54 m_prevBtn->SetMinSize( wxSize( 25, -1 ) );
55 m_nextBtn->SetMinSize( wxSize( 25, -1 ) );
60 searchSizer->Add(
m_matchCount, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
61 searchSizer->Add(
m_searchCtrl, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
62 searchSizer->Add(
m_prevBtn, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2 );
63 searchSizer->Add(
m_nextBtn, 0, wxALIGN_CENTER_VERTICAL );
66 GetSizer()->Insert( 0,
m_searchPanel, 0, wxALIGN_RIGHT|wxTOP|wxRIGHT, 5 );
74 if( aSize != wxDefaultSize )
83 Bind( wxEVT_SYS_COLOUR_CHANGED,
199 if( aEvent.GetKeyCode() == WXK_ESCAPE )
204 else if( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
210 else if( aEvent.GetKeyCode() == WXK_BACK )
222 else if( !aEvent.HasModifiers() && wxIsprint( aEvent.GetUnicodeKey() ) )
224 m_searchCtrl->AppendText( wxString( (wxChar) aEvent.GetUnicodeKey() ) );
228 else if( !aEvent.HasModifiers() && wxIsprint( aEvent.GetUnicodeKey() ) )
231 m_searchCtrl->SetValue( wxString( (wxChar) aEvent.GetUnicodeKey() ) );
237 if( aEvent.GetKeyCode() == WXK_ESCAPE )
239 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
242 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() ==
'A' )
247 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() ==
'C' )
251 if( wxTheClipboard->Open() )
253 wxTheClipboard->SetData(
new wxTextDataObject(
m_htmlWindow->SelectionToText() ) );
254 wxTheClipboard->Flush();
255 wxTheClipboard->Close();
329 wxString termLower = term.Lower();
331 bool insideTag =
false;
354 wxString candidate =
m_originalSource.Mid( pos, termLower.length() ).Lower();
355 if( candidate == termLower )
358 bool validMatch =
true;
359 for(
size_t i = 0; i < termLower.length(); i++ )
393 for(
size_t i = 0; i <
m_matchPos.size(); ++i )
400 wxString escapedMatchStr = matchStr;
401 escapedMatchStr.Replace( wxS(
"&" ), wxS(
"&" ) );
402 escapedMatchStr.Replace( wxS(
"<" ), wxS(
"<" ) );
403 escapedMatchStr.Replace( wxS(
">" ), wxS(
">" ) );
404 escapedMatchStr.Replace( wxS(
"\"" ), wxS(
""" ) );
409 wxString anchorName = wxString::Format( wxS(
"kicad_search_%d" ),
m_currentMatch );
410 out += wxString::Format( wxS(
"<a name=\"%s\"></a><span style=\"background-color:#DDAAFF;\">%s</span>" ),
411 anchorName, escapedMatchStr );
415 out += wxString::Format( wxS(
"<span style=\"background-color:#FFFFAA;\">%s</span>" ), escapedMatchStr );
418 start = idx + term.length();
432 wxString anchorName = wxString::Format( wxS(
"kicad_search_%d" ),
m_currentMatch );
441 if( totalLength > 0 )
444 double ratio = (double)matchPos / (
double)totalLength;
445 int scrollPos = (int)(ratio *
m_htmlWindow->GetScrollRange( wxVERTICAL ));
HTML_WINDOW * m_htmlWindow
wxStdDialogButtonSizer * m_sdbSizer1
DIALOG_DISPLAY_HTML_TEXT_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.