36 const wxPoint& aPosition,
const wxSize& aSize ) :
40 m_htmlWindow->SetLayoutDirection( wxLayout_LeftToRight );
44 wxBoxSizer* searchSizer =
new wxBoxSizer( wxHORIZONTAL );
46 m_searchCtrl =
new wxTextCtrl(
m_searchPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
47 m_prevBtn =
new wxButton(
m_searchPanel, wxID_ANY, wxS(
"∧" ), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
48 m_nextBtn =
new wxButton(
m_searchPanel, wxID_ANY, wxS(
"∨" ), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
51 m_prevBtn->SetMinSize( wxSize( 25, -1 ) );
52 m_nextBtn->SetMinSize( wxSize( 25, -1 ) );
57 searchSizer->Add(
m_matchCount, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
58 searchSizer->Add(
m_searchCtrl, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
59 searchSizer->Add(
m_prevBtn, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2 );
60 searchSizer->Add(
m_nextBtn, 0, wxALIGN_CENTER_VERTICAL );
63 GetSizer()->Insert( 0,
m_searchPanel, 0, wxALIGN_RIGHT|wxTOP|wxRIGHT, 5 );
71 if( aSize != wxDefaultSize )
80 Bind( wxEVT_SYS_COLOUR_CHANGED,
196 if( aEvent.GetKeyCode() == WXK_ESCAPE )
201 else if( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
207 else if( aEvent.GetKeyCode() == WXK_BACK )
219 else if( !aEvent.HasModifiers() && wxIsprint( aEvent.GetUnicodeKey() ) )
221 m_searchCtrl->AppendText( wxString( (wxChar) aEvent.GetUnicodeKey() ) );
225 else if( !aEvent.HasModifiers() && wxIsprint( aEvent.GetUnicodeKey() ) )
228 m_searchCtrl->SetValue( wxString( (wxChar) aEvent.GetUnicodeKey() ) );
234 if( aEvent.GetKeyCode() == WXK_ESCAPE )
236 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
239 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() ==
'A' )
244 else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() ==
'C' )
248 if( wxTheClipboard->Open() )
250 wxTheClipboard->SetData(
new wxTextDataObject(
m_htmlWindow->SelectionToText() ) );
251 wxTheClipboard->Flush();
252 wxTheClipboard->Close();
326 wxString termLower = term.Lower();
328 bool insideTag =
false;
351 wxString candidate =
m_originalSource.Mid( pos, termLower.length() ).Lower();
352 if( candidate == termLower )
355 bool validMatch =
true;
356 for(
size_t i = 0; i < termLower.length(); i++ )
390 for(
size_t i = 0; i <
m_matchPos.size(); ++i )
397 wxString escapedMatchStr = matchStr;
398 escapedMatchStr.Replace( wxS(
"&" ), wxS(
"&" ) );
399 escapedMatchStr.Replace( wxS(
"<" ), wxS(
"<" ) );
400 escapedMatchStr.Replace( wxS(
">" ), wxS(
">" ) );
401 escapedMatchStr.Replace( wxS(
"\"" ), wxS(
""" ) );
406 wxString anchorName = wxString::Format( wxS(
"kicad_search_%d" ),
m_currentMatch );
407 out += wxString::Format( wxS(
"<a name=\"%s\"></a><span style=\"background-color:#DDAAFF;\">%s</span>" ),
408 anchorName, escapedMatchStr );
412 out += wxString::Format( wxS(
"<span style=\"background-color:#FFFFAA;\">%s</span>" ), escapedMatchStr );
415 start = idx + term.length();
429 wxString anchorName = wxString::Format( wxS(
"kicad_search_%d" ),
m_currentMatch );
438 if( totalLength > 0 )
441 double ratio = (double)matchPos / (
double)totalLength;
442 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.