37 #include <wx/button.h>
69 : m_ParentAECRDlg(parentAECRDlg), m_CapConstraints(cap_constraints)
83 wxPanel::Create( parent,
id, pos,
size, style );
88 GetSizer()->SetSizeHints(
this);
135 wxPanel* parentPanel =
this;
137 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
138 parentPanel->SetSizer(itemBoxSizer2);
140 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
141 itemBoxSizer2->Add(itemBoxSizer3, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
143 wxArrayString m_MatchTypeStrings;
144 m_MatchTypeStrings.Add(
_(
"Contains"));
145 m_MatchTypeStrings.Add(
_(
"Does not contain"));
146 m_MatchTypeStrings.Add(
_(
"Equals"));
147 m_MatchTypeStrings.Add(
_(
"Does not equal"));
148 m_MatchTypeStrings.Add(
_(
"Starts with"));
149 m_MatchTypeStrings.Add(
_(
"Ends with"));
150 m_MatchTypeStrings.Add(
_(
"Is one of"));
151 m_MatchTypeStrings.Add(
_(
"Is not one of"));
152 m_MatchTypeStrings.Add(
_(
"Does not start with"));
153 m_MatchTypeStrings.Add(
_(
"Does not end with"));
156 m_MatchTypeStrings.Add(
_(
"All caps"));
157 m_MatchTypeStrings.Add(
_(
"First letter of each word"));
158 m_MatchTypeStrings.Add(
_(
"First letter of first word"));
163 itemBoxSizer3->Add(
m_MatchType, 0, wxALIGN_TOP|wxLEFT|wxRIGHT|wxBOTTOM, 5);
166 itemBoxSizer3->Add(
m_TextSizer, 0, wxALIGN_TOP, 0);
174 wxArrayString choice_strings;
175 m_MatchChoice =
new wxComboBox(parentPanel,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), choice_strings, 0 );
179 wxBoxSizer* itemBoxSizer6 =
new wxBoxSizer(wxHORIZONTAL);
180 itemBoxSizer2->Add(itemBoxSizer6, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
184 itemBoxSizer6->Add(
m_IgnoreCase, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
188 itemBoxSizer6->Add(
m_IgnoreSpace, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
191 itemBoxSizer6->Add(itemButton4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
221 wxArrayString choice_strings;
222 ITERATE(vector<string>, it, choices)
228 _ASSERT(values.empty() || choices.size() == values.size());
230 for (
size_t i = 0;
i < values.size();
i++)
314 edit::CStringConstraint::EMatchType match_type = edit::CStringConstraint::eMatchType_Contains;
316 bool not_present =
false;
320 match_type = edit::CStringConstraint::eMatchType_Contains;
324 match_type = edit::CStringConstraint::eMatchType_Contains;
328 match_type = edit::CStringConstraint::eMatchType_Equals;
332 match_type = edit::CStringConstraint::eMatchType_Equals;
336 match_type = edit::CStringConstraint::eMatchType_StartsWith;
340 match_type = edit::CStringConstraint::eMatchType_EndsWith;
344 match_type = edit::CStringConstraint::eMatchType_IsOneOf;
348 match_type = edit::CStringConstraint::eMatchType_IsOneOf;
352 match_type = edit::CStringConstraint::eMatchType_StartsWith;
356 match_type = edit::CStringConstraint::eMatchType_EndsWith;
364 if (match_text.size() > 0 || (match_type == edit::CStringConstraint::eMatchType_Equals && not_present)) {
365 sc.
Reset(
new edit::CStringConstraint(match_text, match_type,
390 const string not_string =
"NOT ";
393 function = macro::CMacroFunction_StringConstraints::sm_Contain;
396 function = not_string +
CTempString(macro::CMacroFunction_StringConstraints::sm_Contain);
399 function = macro::CMacroFunction_StringConstraints::sm_Equal;
402 function = not_string +
CTempString(macro::CMacroFunction_StringConstraints::sm_Equal);
405 function = macro::CMacroFunction_StringConstraints::sm_Start;
408 function = macro::CMacroFunction_StringConstraints::sm_End;
411 function = macro::CMacroFunction_StringConstraints::sm_InList;
414 function = not_string +
CTempString(macro::CMacroFunction_StringConstraints::sm_InList);
417 function = not_string +
CTempString(macro::CMacroFunction_StringConstraints::sm_Start);
420 function = not_string +
CTempString(macro::CMacroFunction_StringConstraints::sm_End);
426 if (
function.
empty())
429 string case_sensitive = (
m_IgnoreCase->IsChecked()) ?
"false" :
"true";
430 string ignore_space = (
m_IgnoreSpace->IsChecked()) ?
"true" :
"false";
432 function +=
"(" + field_name +
", \"" + match_text +
"\", " + case_sensitive +
", " + ignore_space +
")";
449 return constraint->DoesTextMatch(
str);
@ eMatchType_DoesNotContain
@ eMatchType_DoesNotStartWith
@ eMatchType_DoesNotEqual
@ eMatchType_Is_first_each_cap
@ eMatchType_DoesNotEndWith
wxCheckBox * m_IgnoreSpace
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
wxComboBox * m_MatchChoice
void OnMatchTypeSelected(wxCommandEvent &event)
~CStringConstraintPanel()
Destructor.
void OnClear(wxCommandEvent &event)
CRef< edit::CStringConstraint > GetStringConstraint()
CStringConstraintPanel()
Constructors.
void ShowChoiceOrText(void)
void SetChoices(const vector< string > &choices, const vector< string > &values)
string GetMacroStringConstraint(const string &field_name)
@ ID_STRING_CONSTRAINT_CLEAR_BUTTON
@ ID_STRING_CONSTRAINT_CHECKBOX6
@ ID_STRING_CONSTRAINT_MATCH_CHOICE
@ ID_STRING_CONSTRAINT_MATCH_TEXT
@ ID_STRING_CONSTRAINT_CHECKBOX5
wxCheckBox * m_IgnoreCase
void Init()
Initialises member variables.
map< string, string > m_ChoiceToValue
bool Match(const string &str)
string x_ReplaceChoices(const string &orig)
static bool ShowToolTips()
Should we show tooltips?
bool Create(wxWindow *parent, wxWindowID id=ID_CSTRINGCONSTRAINTPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
bool m_ParentAECRDlg
flag is set if parent is the AECRDlg, for having specific features
void CreateControls()
Creates the controls and sizers.
bool Match(const CMatchString &str) const
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
const_iterator end() const
const_iterator find(const key_type &key) const
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
void SetIs_first_cap(TIs_first_cap value)
Assign a value to Is_first_cap data member.
void SetIs_first_each_cap(TIs_first_each_cap value)
Assign a value to Is_first_each_cap data member.
void SetIs_all_caps(TIs_all_caps value)
Assign a value to Is_all_caps data member.
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char * str(char *buf, int n)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)