39 #include <wx/checklst.h>
40 #include <wx/button.h>
84 wxPanel::Create( parent,
id, pos,
size, style );
89 GetSizer()->SetSizeHints(
this);
128 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
129 itemPanel1->SetSizer(itemBoxSizer2);
134 wxBoxSizer* itemBoxSizer12 =
new wxBoxSizer(wxHORIZONTAL);
135 itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
137 m_Add =
new wxButton( itemPanel1,
ID_CONSTRAINT_ADD,
_(
"Add Constraint"), wxDefaultPosition, wxDefaultSize, 0 );
138 itemBoxSizer12->Add(
m_Add, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
142 itemBoxSizer12->Add(
m_Clear, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
153 m_Add->Enable(enable_add);
197 if (target.first.empty())
207 wxArrayInt checked_items;
209 if (checked_items.IsEmpty()) {
211 if (answer ==
eYes) {
217 for (
size_t i = 0;
i < checked_items.GetCount();
i++) {
218 int j = checked_items.Item(
i);
222 [&
label](
const auto& elem) { return (elem.m_Label == label); });
230 for (
size_t index = 0; index <
m_Constraints.size(); ++index) {
234 for (
auto rit = to_delete.rbegin(); rit != to_delete.rend(); ++rit) {
249 int id,
const vector<string> &vars,
const string &qual_name,
EMMatcherPanelType panel_type,
267 [&
label](
const auto& elem) { return (elem.m_Label == label); });
277 for (
auto index = 0; index <
m_CheckListBox->GetCount(); ++index) {
300 if (target.first.empty())
303 const string&
label =
event.GetString().ToStdString();
335 vector<size_t> not_viewed;
337 for (
size_t index = 0; index <
func_info.size(); ++index) {
342 switch (
func_info[index].m_FieldTypeFrom) {
378 if (find_if(qualifier_list.begin(), qualifier_list.end(),
379 [&field_it](
const string& elem) { return NStr::EqualNocase(elem, field_it->second); }) != qualifier_list.end()) {
394 not_viewed.push_back(index);
398 panel_to_constraints[match_type].push_back(
func_info[index]);
403 auto count = not_viewed.size();
405 NcbiWarningBox(
"There is one constraint that cannot be viewed in the editor");
407 else if (
count > 1) {
419 for (
const auto& it : panel_to_constraints) {
433 for (
const auto& constr_it : it.second) {
441 if (field_it != fn.m_FArgs.end()) {
442 field_it->second =
"genome";
447 if (field_it != fn.m_FArgs.end() && field_it->second ==
"org.db") {
481 if (!constraint.empty())
482 constraints.emplace_back(qual_name, constraint);
489 vector<string> constraints;
495 constraints.push_back(
label);
void SetNumConstraints(size_t num)
void SetAndUpdateConstraint(SMacroConstraint &constr)
void SetConstraint(const SMacroConstraint &constr)
wxIcon GetIconResource(const wxString &name)
~CMacroCompoundConstraintPanel()
vector< SMacroConstraint > m_Constraints
void AddConstraint(pair< string, string > item, int id, const vector< string > &vars=vector< string >(), const string &qual_name=kEmptyStr, EMMatcherPanelType panel_type=EMMatcherPanelType::eMMatcher_NotSet, const vector< CFuncWithArgs > &func_info=vector< CFuncWithArgs >())
map< string, unsigned > m_ConstraintMap
void OnAddConstraint(wxCommandEvent &event)
static bool ShowToolTips()
TStringPairsVector GetConstraints()
void OnRemoveConstraint(wxCommandEvent &event)
CMacroCompoundConstraintPanel()
wxCheckListBox * m_CheckListBox
void OnUpdateClearButton(wxUpdateUIEvent &event)
void ClearValues(bool enable_add)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
void SetConstraints(const vector< CFuncWithArgs > &)
When setting constraints from a macro that's edited 1.
vector< string > GetDescription()
void x_PrintState() const
wxBitmap GetBitmapResource(const wxString &name)
void OnEditConstraint(wxCommandEvent &event)
Called when a constraint is edited It should work both when a macro is created and when a macro is ed...
pair< string, string > GetForTarget()
const vector< string > & GetKeywords(EMacroFieldType type) const
static CMacroEditorContext & GetInstance()
static const EMMatcherPanelType s_GetMatcherPanels(const CFuncWithArgs &func_info)
iterator_bool insert(const value_type &val)
#define ID_CONSTRAINT_LIST
#define ID_CONSTRAINT_ADD
#define ID_CONSTRAINT_REMOVE
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
void Info(CExceptionArgs_Base &args)
void NcbiWarningBox(const string &message, const string &title="Warning")
specialized Message Box function for reporting non-critical errors
void NcbiErrorBox(const string &message, const string &title="Error")
specialized Message Box function for reporting critical errors
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
vector< pair< string, string > > TStringPairsVector
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static const char label[]
EMMatcherPanelType
Denotes the type of panel that is used to create macro constraint.
const struct ncbi::grid::netcache::search::fields::SIZE size
vector< CFuncWithArgs > m_FuncInfo
interpreted functions with their arguments
string m_Fieldname
fieldname referred in the constraint
vector< string > m_Variables
variables used in the constraint
string m_Constraint
constraint expression, e.g., Strand() = "plus"
string m_Label
description of the constraint as it is listed in the macro editor