20#include "../globals.hpp"
21#include "../../kernel/core/ui/language.hpp"
52 m_FindReplaceData =
nullptr;
59 m_chkCaseRepl =
nullptr;
62 m_radioDirRepl =
nullptr;
70 m_skipFocusing =
false;
74 wxFindReplaceData *data,
75 const wxString& title,
78 parent = GetParentForModalDialog(parent, style);
80 if ( !wxDialog::Create(parent, wxID_ANY, title,
82 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
90 wxCHECK_MSG( m_FindReplaceData,
false,
91 wxT(
"can't create dialog without data") );
93 bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
99 wxBoxSizer *leftsizer_find =
new wxBoxSizer( wxVERTICAL );
100 wxBoxSizer *leftsizer_replace =
new wxBoxSizer( wxVERTICAL );
103 wxFlexGridSizer *sizer2Col_find =
new wxFlexGridSizer(3);
104 wxFlexGridSizer *sizer2Col_replace =
new wxFlexGridSizer(3);
105 sizer2Col_find->AddGrowableCol(2);
106 sizer2Col_replace->AddGrowableCol(2);
108 sizer2Col_find->Add(
new wxStaticText(findpage, wxID_ANY,
_guilang.
get(
"GUI_DLG_FNDRPLC_SEARCHFOR"),
109 wxDefaultPosition, wxSize(80, wxDefaultCoord)),
111 wxALIGN_CENTRE_VERTICAL | wxALIGN_RIGHT);
113 sizer2Col_replace->Add(
new wxStaticText(replacepage, wxID_ANY,
_guilang.
get(
"GUI_DLG_FNDRPLC_SEARCHFOR"),
114 wxDefaultPosition, wxSize(80, wxDefaultCoord)),
116 wxALIGN_CENTRE_VERTICAL | wxALIGN_RIGHT);
118 sizer2Col_find->Add(10, 0);
119 sizer2Col_replace->Add(10, 0);
121 m_textFind =
new wxTextCtrl(findpage, wxID_ANY, m_FindReplaceData->GetFindString());
122 sizer2Col_find->Add(
m_textFind, 1, wxALIGN_CENTRE_VERTICAL | wxEXPAND);
123 m_textFindRepl =
new wxTextCtrl(replacepage, wxID_ANY, m_FindReplaceData->GetFindString());
124 sizer2Col_replace->Add(
m_textFindRepl, 1, wxALIGN_CENTRE_VERTICAL | wxEXPAND);
128 sizer2Col_replace->Add(
new wxStaticText(replacepage, wxID_ANY,
_guilang.
get(
"GUI_DLG_FNDRPLC_REPLACEWITH"),
129 wxDefaultPosition, wxSize(80, wxDefaultCoord)),
131 wxALIGN_CENTRE_VERTICAL |
132 wxALIGN_RIGHT | wxTOP, 5);
134 sizer2Col_replace->Add(isPda ? 2 : 10, 0);
136 m_textRepl =
new wxTextCtrl(replacepage, wxID_ANY,
137 m_FindReplaceData->GetReplaceString());
139 wxALIGN_CENTRE_VERTICAL | wxEXPAND | wxTOP, 5);
142 leftsizer_find->Add(sizer2Col_find, 0, wxEXPAND | wxALL, 5);
143 leftsizer_replace->Add(sizer2Col_replace, 0, wxEXPAND | wxALL, 5);
145 wxBoxSizer *optsizer_find =
new wxBoxSizer( isPda ? wxVERTICAL : wxHORIZONTAL );
146 wxBoxSizer *optsizer_replace =
new wxBoxSizer( isPda ? wxVERTICAL : wxHORIZONTAL );
148 wxBoxSizer *chksizer_find =
new wxBoxSizer( wxVERTICAL);
149 wxBoxSizer *chksizer_replace =
new wxBoxSizer( wxVERTICAL);
152 chksizer_find->Add(
m_chkWord, 0, wxALL, 3);
155 chksizer_find->Add(
m_chkCase, 0, wxALL, 3);
169 optsizer_find->Add(chksizer_find, 0, wxALL, 10);
170 optsizer_replace->Add(chksizer_replace, 0, wxALL, 10);
172 static const wxString searchDirections[] = {
_guilang.
get(
"GUI_DLG_FNDRPLC_DIR_UP"),
_guilang.
get(
"GUI_DLG_FNDRPLC_DIR_DOWN")};
173 int majorDimension = 0;
176 rbStyle = wxRA_SPECIFY_ROWS;
178 rbStyle = wxRA_SPECIFY_COLS;
181 wxDefaultPosition, wxDefaultSize,
182 WXSIZEOF(searchDirections), searchDirections,
183 majorDimension, rbStyle);
185 optsizer_find->Add(
m_radioDir, 0, wxALL, isPda ? 5 : 10);
188 wxDefaultPosition, wxDefaultSize,
189 WXSIZEOF(searchDirections), searchDirections,
190 majorDimension, rbStyle);
194 leftsizer_find->Add(optsizer_find);
195 leftsizer_replace->Add(optsizer_replace);
197 wxBoxSizer *bttnsizer_find =
new wxBoxSizer(wxVERTICAL);
198 wxBoxSizer *bttnsizer_replace =
new wxBoxSizer(wxVERTICAL);
200 wxButton* btn_find =
new wxButton(findpage, wxID_FIND,
_guilang.
get(
"GUI_DLG_FNDRPLC_BTN_FIND"));
201 wxButton* btn_replace =
new wxButton(replacepage, wxID_FIND,
_guilang.
get(
"GUI_DLG_FNDRPLC_BTN_FIND"));
202 btn_find->SetDefault();
204 bttnsizer_find->Add(btn_find, 0, wxALL, 3);
205 bttnsizer_replace->Add(btn_replace, 0, wxALL, 3);
207 bttnsizer_find->Add(
new wxButton(findpage, wxID_CANCEL,
_guilang.
get(
"GUI_DLG_FNDRPLC_BTN_CANCEL")), 0, wxALL, 3);
208 bttnsizer_replace->Add(
new wxButton(replacepage, wxID_CANCEL,
_guilang.
get(
"GUI_DLG_FNDRPLC_BTN_CANCEL")), 0, wxALL, 3);
212 bttnsizer_replace->Add(
new wxButton(replacepage, wxID_REPLACE,
_guilang.
get(
"GUI_DLG_FNDRPLC_BTN_REPLACE")),
215 bttnsizer_replace->Add(
new wxButton(replacepage, wxID_REPLACE_ALL,
_guilang.
get(
"GUI_DLG_FNDRPLC_BTN_REPLACEALL")),
219 wxBoxSizer *topsizer_find =
new wxBoxSizer( wxHORIZONTAL );
220 wxBoxSizer *topsizer_replace =
new wxBoxSizer( wxHORIZONTAL );
222 topsizer_find->Add(leftsizer_find, 1, wxALL, isPda ? 0 : 5);
223 topsizer_find->Add(bttnsizer_find, 0, wxALL, isPda ? 0 : 5);
224 topsizer_replace->Add(leftsizer_replace, 1, wxALL, isPda ? 0 : 5);
225 topsizer_replace->Add(bttnsizer_replace, 0, wxALL, isPda ? 0 : 5);
231 findpage->SetSizer(topsizer_find);
232 replacepage->SetSizer(topsizer_replace);
233 topsizer_find->SetSizeHints( findpage );
234 topsizer_find->Fit( findpage );
235 topsizer_replace->SetSizeHints( replacepage );
236 topsizer_replace->Fit( replacepage );
238 m_tabs->AddPage(findpage,
_guilang.
get(
"GUI_DLG_FIND"), (style & wxFR_REPLACEDIALOG) ?
false :
true);
239 m_tabs->AddPage(replacepage,
_guilang.
get(
"GUI_DLG_REPLACE"), (style & wxFR_REPLACEDIALOG) ?
true :
false);
252 m_textFind->SetValue(m_FindReplaceData->GetFindString());
254 m_textRepl->SetValue(m_FindReplaceData->GetReplaceString());
256 int flags = m_FindReplaceData->GetFlags();
258 if ( flags & wxFR_MATCHCASE )
263 if ( flags & wxFR_WHOLEWORD )
273 m_radioDir->SetSelection( flags & wxFR_DOWN );
290 wxDialog::SetTitle(
"NumeRe: " +
m_tabs->GetPageText(event.GetSelection()));
299 wxFindDialogEvent event(evtType, GetId());
300 event.SetEventObject(
this);
302 if (
m_tabs->GetSelection())
305 event.SetReplaceString(
m_textRepl->GetValue());
307 flags |= wxFR_MATCHCASE;
309 flags |= wxFR_WHOLEWORD;
321 flags |= wxFR_MATCHCASE;
323 flags |= wxFR_WHOLEWORD;
332 event.SetFlags(flags);
334 wxFindReplaceDialogBase::Send(event);
372 m_tabs->GetCurrentPage()->SetFocus();
373 if (
m_tabs->GetSelection())
386 this->SetTransparent(100);
403 m_tabs->GetCurrentPage()->SetFocus();
404 if (
m_tabs->GetSelection())
void OnReplaceAll(wxCommandEvent &event)
wxCheckBox * m_chkWrapAround
void OnCancel(wxCommandEvent &event)
void OnLoseFocus(wxFocusEvent &event)
void OnCloseWindow(wxCloseEvent &event)
void OnEnter(wxMouseEvent &event)
void OnUpdateFindUI(wxUpdateUIEvent &event)
void OnFind(wxCommandEvent &event)
bool Create(wxWindow *parent, wxFindReplaceData *data, const wxString &title, int style=0)
wxRadioBox * m_radioDirRepl
void OnPageChange(wxNotebookEvent &event)
wxCheckBox * m_chkWrapAroundRepl
wxCheckBox * m_chkCaseRepl
wxCheckBox * m_chkWordRepl
wxTextCtrl * m_textFindRepl
void OnReplace(wxCommandEvent &event)
void OnGainFocus(wxFocusEvent &event)
void SendEvent(const wxEventType &evtType)
This class handles the internal language system and returns the language strings of the selected lang...
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)