37 #include <wx/stattext.h>
38 #include <wx/statline.h>
39 #include <wx/listbook.h>
40 #include <wx/checkbox.h>
41 #include <wx/checklst.h>
43 #include <wx/textctrl.h>
44 #include <wx/button.h>
77 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
78 wxFrame::Create( parent,
id, caption, pos,
size, style );
83 GetSizer()->SetSizeHints(
this);
85 Centre(wxBOTH|wxCENTRE_ON_SCREEN);
109 wxBoxSizer* itemBoxSizer1 =
new wxBoxSizer(wxVERTICAL);
110 SetSizer(itemBoxSizer1);
112 wxPanel* itemCBulkCmdDlg1 =
new wxPanel(
this,
wxID_ANY);
113 itemBoxSizer1->Add(itemCBulkCmdDlg1, 1, wxGROW, 0);
115 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
116 itemCBulkCmdDlg1->SetSizer(itemBoxSizer2);
118 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
119 itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
121 wxStaticText* itemStaticText5 =
new wxStaticText( itemCBulkCmdDlg1, wxID_STATIC,
_(
"Pattern Word"), wxDefaultPosition, wxDefaultSize, 0 );
122 itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_LEFT|wxALL, 5);
124 m_Pattern =
new wxTextCtrl(itemCBulkCmdDlg1,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, -1), 0);
125 itemBoxSizer4->Add(
m_Pattern, 0, wxALIGN_LEFT|wxALL, 5);
127 m_Subst =
new wxTextCtrl( itemCBulkCmdDlg1,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, 90), wxTE_MULTILINE );
128 itemBoxSizer2->Add(
m_Subst, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
130 wxBoxSizer* itemBoxSizer12 =
new wxBoxSizer(wxHORIZONTAL);
131 itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
133 m_IgnoreCase =
new wxCheckBox( itemCBulkCmdDlg1,
wxID_ANY,
_(
"Ignore Case"), wxDefaultPosition, wxDefaultSize, 0 );
135 itemBoxSizer12->Add(
m_IgnoreCase, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
137 m_WholeWord =
new wxCheckBox( itemCBulkCmdDlg1,
wxID_ANY,
_(
"Whole Word"), wxDefaultPosition, wxDefaultSize, 0 );
139 itemBoxSizer12->Add(
m_WholeWord, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
141 wxButton* itemButton13 =
new wxButton( itemCBulkCmdDlg1,
ID_WORDSUBST_ADD,
_(
"Add Word Substitution"), wxDefaultPosition, wxDefaultSize, 0 );
142 itemBoxSizer2->Add(itemButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
144 wxStaticLine *
line1 =
new wxStaticLine (itemCBulkCmdDlg1,
wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
145 itemBoxSizer2->Add(
line1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxSHAPED, 5);
150 wxButton* itemButton14 =
new wxButton( itemCBulkCmdDlg1,
ID_WORDSUBST_REMOVE,
_(
"Remove Word Substitution"), wxDefaultPosition, wxDefaultSize, 0 );
151 itemBoxSizer2->Add(itemButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
153 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
154 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL, 0);
156 wxButton* itemButton15 =
new wxButton( itemCBulkCmdDlg1, wxID_OK,
_(
"Accept"), wxDefaultPosition, wxDefaultSize, 0 );
157 itemBoxSizer3->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
159 wxButton* itemButton16 =
new wxButton( itemCBulkCmdDlg1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
160 itemBoxSizer3->Add(itemButton16, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
196 word_subst->Set().push_back(ws);
199 wxWindow* parent = GetParent();
209 if (pattern.empty() || syn.empty())
213 ws->SetWord(pattern);
215 vector<string> lines;
218 for (
auto& l : lines)
223 ws->SetSynonyms().push_back(
str);
241 wxArrayInt checked_items;
244 for (
size_t i = 0;
i < checked_items.GetCount();
i++)
246 int j = checked_items.Item(
i);
251 for (
auto rit=to_delete.rbegin(); rit != to_delete.rend(); ++rit)
262 if (ws && ws->IsSetWord() && ws->IsSetSynonyms() && !ws->GetSynonyms().empty())
264 str =
"allow " + ws->GetWord() +
" to be replaced by " +
NStr::Join(ws->GetSynonyms(),
", ");
266 if (ws->IsSetCase_sensitive() && ws->GetCase_sensitive())
267 str +=
", case-sensitive";
268 if (ws->IsSetWhole_word() && ws->GetWhole_word())
269 str +=
", whole word";
276 if (word_subst && word_subst->IsSet())
278 for (
auto ws : word_subst->Set())
User-defined methods of the data storage class.
void OnRemove(wxCommandEvent &event)
map< string, CRef< objects::CWord_substitution > > m_label_to_subst
wxCheckListBox * m_CheckListBox
void InitSubstitutions(CRef< objects::CWord_substitution_set > word_subst)
static string GetDescription(CRef< objects::CWord_substitution > ws)
void OnCancel(wxCommandEvent &event)
wxBitmap GetBitmapResource(const wxString &name)
wxIcon GetIconResource(const wxString &name)
wxCheckBox * m_IgnoreCase
void OnAccept(wxCommandEvent &event)
static bool ShowToolTips()
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Word Substitution List"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
void OnAdd(wxCommandEvent &event)
virtual void AddWordSubstSet(CRef< objects::CWord_substitution_set > word_subst)=0
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
static const char label[]
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char * str(char *buf, int n)
static char line1[1024 *16]
#define ID_WORDSUBST_REMOVE