NCBI C++ ToolKit
macro_add_constraint_panel.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: macro_add_constraint_panel.cpp 46876 2021-11-19 22:09:57Z asztalos $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Igor Filippov
27  *
28  * File Description:
29  *
30  */
31 #include <ncbi_pch.hpp>
32 
40 
44 
64 
65 #include <wx/sizer.h>
66 #include <wx/statline.h>
67 #include <wx/textctrl.h>
68 #include <wx/stattext.h>
69 #include <wx/valnum.h>
70 #include <wx/filedlg.h>
71 #include <wx/choicebk.h>
72 #include <wx/panel.h>
73 #include <wx/artprov.h>
74 #include <wx/bmpbuttn.h>
75 #include <wx/radiobox.h>
76 #include <wx/radiobut.h>
77 #include <wx/combobox.h>
78 #include <wx/checkbox.h>
79 
82 
83 
84 /*!
85  * Control identifiers
86  */
87 
88 ////@begin control identifiers
89 #define SYMBOL_CADVSTRINGCONSTRAINTPANEL_STYLE wxTAB_TRAVERSAL
90 #define SYMBOL_CADVSTRINGCONSTRAINTPANEL_TITLE _("StringConstraintPanel")
91 #define SYMBOL_CADVSTRINGCONSTRAINTPANEL_IDNAME ID_CADVSTRINGCONSTRAINTPANEL
92 #define SYMBOL_CADVSTRINGCONSTRAINTPANEL_SIZE wxDefaultSize
93 #define SYMBOL_CADVSTRINGCONSTRAINTPANEL_POSITION wxDefaultPosition
94 ////@end control identifiers
95 
96 
97 /*!
98  * CMacroAdvStringConstraintPanel class declaration
99  */
100 template<typename T>
102  public wxPanel, public CFieldNamePanelParent, public CMacroWordSubstitutionSetConsumer
103 {
105 public:
106  /// Constructors
108  CMacroAdvStringConstraintPanel(wxWindow* parent,
110  const wxPoint& pos = SYMBOL_CADVSTRINGCONSTRAINTPANEL_POSITION,
113 
114  /// Creation
115  bool Create( wxWindow* parent,
117  const wxPoint& pos = SYMBOL_CADVSTRINGCONSTRAINTPANEL_POSITION,
120 
121  /// Destructor
123 
124  /// Initialises member variables
125  void Init();
126 
127  /// Creates the controls and sizers
128  void CreateControls();
129 
130 ////@begin CMacroAdvStringConstraintPanel event handler declarations
131  void OnClear( wxCommandEvent& event );
132  void OnMatchTypeSelected( wxCommandEvent& event );
133  void OnWordSubstitution( wxCommandEvent& event );
134  void OnConstraintType( wxCommandEvent& event );
135  void OnOpenFile(wxCommandEvent& event);
136  void OnUpdateWordSubstButton(wxUpdateUIEvent& event);
137 ////@end CMacroAdvStringConstraintPanel event handler declarations
138 
139 ////@begin CMacroAdvStringConstraintPanel member function declarations
140 
141  enum EMatchType {
152  };
153 
154 
155  void ClearValues(void);
156  void SetChoices(const vector<string> &choices, const vector<string> &values);
157  void ShowChoiceOrText(void);
158  /// Retrieves bitmap resources
159  wxBitmap GetBitmapResource( const wxString& name );
160 
161  /// Retrieves icon resources
162  wxIcon GetIconResource( const wxString& name );
163 ////@end CMacroAdvStringConstraintPanel member function declarations
164 
165  /// Should we show tooltips?
166  static bool ShowToolTips();
167 
168  virtual pair<string, string> GetMatcher(const pair<string, string>& target, size_t num);
169  virtual vector<CFuncWithArgs> GetFuncWithArgs(const pair<string, string>& target, size_t num) const;
170 
171  virtual void GetVars(vector<string> &vars, size_t num);
172  virtual string GetQualName(const pair<string, string>& target);
173 
174  virtual void SetMatcher(const vector<CFuncWithArgs>& func_info);
175 
176  // inherited from CFieldNamePanelParent
177  virtual void UpdateEditor(void);
178 
179  string GetDescription(const string& field);
180  string GetTextConstraint(const string& field, size_t num);
181 
182  virtual void AddWordSubstSet(const string& filename, CRef<CWord_substitution_set> word_subst);
183  virtual void SetFieldName(const string& field);
184  virtual void PopulateFeatureListbox(CSeq_entry_Handle seh);
185  virtual void SetFieldNames(const vector<string>& field_names);
186  void SetMacroFieldNames(const vector<string>& field_names);
187  void SetMacroSelf(const string& self);
188 
189 private:
190  void EnableStringConstraint(bool enable);
191  string ReplaceChoices(const string &orig);
192 
193  string x_GetMatchText() const;
194  string x_GetVariable() const;
196 
198 
199  wxChoice* m_MatchType;
200  wxTextCtrl* m_MatchText;
201  wxCheckBox* m_IgnoreCase;
202  wxCheckBox* m_IgnoreSpace;
203  wxCheckBox* m_WholeWord;
204  wxCheckBox* m_IgnorePunct;
205  wxCheckBox* m_IgnoreSyn;
206  wxRadioButton* m_AnyLetters;
207  wxRadioButton* m_AllUpper;
208  wxRadioButton* m_AllLower;
209  wxRadioButton* m_AllPunct;
210  wxComboBox* m_MatchChoice;
211  wxButton* m_ClearButton;
212  wxButton* m_WordSubstBtn;
213  wxRadioBox* m_ConstraintType;
214  wxTextCtrl* m_Tablename;
215  wxTextCtrl* m_Column;
216  wxBoxSizer* m_TextSizer;
217  wxFlexGridSizer* m_TableSizer;
218 
219  enum {
238  };
239 
244 };
245 
246 IMPLEMENT_DYNAMIC_CLASS( CMacroAddConstraint, wxFrame )
247 
248 BEGIN_EVENT_TABLE( CMacroAddConstraint, wxFrame )
249 
250 ////@begin CMacroAddConstraint event table entries
251  EVT_BUTTON( wxID_OK, CMacroAddConstraint::OnAccept )
252  EVT_BUTTON( wxID_CANCEL, CMacroAddConstraint::OnCancel )
253 ////@end CMacroAddConstraint event table entries
254 
256 
258 {
259  Init();
260 }
261 
262 CMacroAddConstraint::CMacroAddConstraint( wxWindow* parent, const pair<string, string>& target, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
263  : m_target(target), m_id(-1), m_num(0)
264 {
265  Init();
266  Create(parent, id, caption, pos, size, style);
267 }
268 
269 bool CMacroAddConstraint::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
270 {
271 ////@begin CMacroAddConstraint creation
272  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
273  wxFrame::Create( parent, id, caption, pos, size, style );
274 
275  CreateControls();
276  if (GetSizer())
277  {
278  GetSizer()->SetSizeHints(this);
279  }
280  Centre(wxBOTH|wxCENTRE_ON_SCREEN);
281 ////@end CMacroAddConstraint creation
282  return true;
283 }
284 
286 {
287 ////@begin CMacroAddConstraint destruction
288 ////@end CMacroAddConstraint destruction
289 }
290 
292 {
293 ////@begin CMacroAddConstraint member initialisation
294  m_Notebook = NULL;
295 ////@end CMacroAddConstraint member initialisation
296 }
297 
299 {
300  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxVERTICAL);
301  SetSizer(itemBoxSizer1);
302 
303  wxPanel* itemCBulkCmdDlg1 = new wxPanel(this, wxID_ANY);
304  itemBoxSizer1->Add(itemCBulkCmdDlg1, 1, wxGROW, 0);
305 
306  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
307  itemCBulkCmdDlg1->SetSizer(itemBoxSizer2);
308 
309  m_Notebook = new wxChoicebook( itemCBulkCmdDlg1, ID_MACROADDCONSTRAINTCHOICEBK, wxDefaultPosition, wxDefaultSize, wxCHB_TOP );
310  itemBoxSizer2->Add(m_Notebook, 1, wxGROW|wxALL, 5);
311 
312  m_MatchingTypes.clear();
313  const CTempString target = m_target.first;
314  bool special_target = (target == macro::CMacroBioData::sm_SeqAlign
315  || target == macro::CMacroBioData::sm_TSEntry
316  || target == macro::CMacroBioData::sm_SeqSet);
317 
318  if (!special_target) {
320  m_Notebook->AddPage(panel1,_("Taxname"));
321  panel1->SetFieldName("taxname");
323 
325  m_Notebook->AddPage(panel2,_("Source"));
327 
329  m_Notebook->AddPage(panel3, _("Feature"));
331 
332  CSeq_entry_Handle seh;
333  panel3->PopulateFeatureListbox(seh);
334  if (CFieldNamePanel::IsFeature(target)) {
335  SetStringSelection("Feature");
336  panel3->SetFieldName(target);
337  }
338 
340  m_Notebook->AddPage(panel4, _("CDS-Gene-Prot-mRNA"));
341  panel4->SetFieldName("protein name");
343 
345  m_Notebook->AddPage(panel5, _("RNA"));
346  panel5->SetFieldName("product");
348  }
349 
350  bool molinfo_target = (target == macro::CMacroBioData::sm_MolInfo
351  || target == macro::CMacroBioData::sm_BioSource
352  || NStr::StartsWith(target, macro::CMacroBioData::sm_Seq)
353  || CFieldNamePanel::IsFeature(target));
354 
355  if (molinfo_target) {
359  panel6->SetMacroSelf(macro::CMacroBioData::sm_MolInfo);
360  m_Notebook->AddPage(panel6,_("MolInfo"));
361  panel6->SetFieldName("molecule");
363  }
364 
365  if (target == macro::CMacroBioData::sm_Pubdesc) {
367  bool extended = true;
368  panel7->SetFieldNames(CPubFieldType::GetFieldNames(extended));
370  panel7->SetMacroSelf(macro::CMacroBioData::sm_Pubdesc);
371  m_Notebook->AddPage(panel7,_("Pub"));
372  panel7->SetFieldName("title");
374  }
375 
376  if (target == macro::CMacroBioData::sm_StrComm
377  || target == macro::CMacroBioData::sm_SeqNa) {
379  m_Notebook->AddPage(panel8,_("Structured Comment"));
381  }
382 
383  if (target == macro::CMacroBioData::sm_DBLink
384  || NStr::StartsWith(target, macro::CMacroBioData::sm_Seq)
385  || target == macro::CMacroBioData::sm_StrComm
386  || target == macro::CMacroBioData::sm_BioSource
387  || target == macro::CMacroBioData::sm_MolInfo) {
391  panel9->SetMacroSelf(macro::CMacroBioData::sm_DBLink);
392  m_Notebook->AddPage(panel9,_("DBLink"));
393  panel9->SetFieldName("title");
395  }
396 
397  if (target == macro::CMacroBioData::sm_SeqNa
398  || target == macro::CMacroBioData::sm_Seq
399  || target == macro::CMacroBioData::sm_Seqdesc
400  || target == macro::CMacroBioData::sm_UserObject)
401  {
405  panel10->SetMacroSelf("Misc");
406  m_Notebook->AddPage(panel10,_("Misc"));
409  }
410 
411  if (CFieldNamePanel::IsFeature(target))
412  {
414  m_Notebook->AddPage(panel11,_("Location"));
416  }
417 
419  m_Notebook->AddPage(panel12,_("Sequence and Features"));
421 
423  m_Notebook->AddPage(panel14,_("Seq-Id"));
425 
426  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
427  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL, 0);
428 
429  wxButton* itemButton13 = new wxButton( itemCBulkCmdDlg1, wxID_OK, _("Accept"), wxDefaultPosition, wxDefaultSize, 0 );
430  itemBoxSizer3->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
431 
432  wxButton* itemButton14 = new wxButton( itemCBulkCmdDlg1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
433  itemBoxSizer3->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
434 
435  if (target == macro::CMacroBioData::sm_RNA ||
436  target == macro::CMacroBioData::sm_rRNA ||
437  target == macro::CMacroBioData::sm_mRNA ||
438  target == macro::CMacroBioData::sm_miscRNA) {
439  SetStringSelection("RNA");
440  }
441  if (target == macro::CMacroBioData::sm_BioSource)
442  {
443  SetStringSelection("Source");
444  }
445  if (target == macro::CMacroBioData::sm_MolInfo || NStr::StartsWith(target, macro::CMacroBioData::sm_Seq))
446  {
447  SetStringSelection("MolInfo");
448  }
449  if (target == macro::CMacroBioData::sm_Pubdesc)
450  {
451  SetStringSelection("Pub");
452  }
453  if (target == macro::CMacroBioData::sm_StrComm)
454  {
455  SetStringSelection("Structured Comment");
456  }
457  if (target == macro::CMacroBioData::sm_DBLink)
458  {
459  SetStringSelection("DBLink");
460  }
461  if (target == macro::CMacroBioData::sm_SeqNa)
462  {
463  SetStringSelection("Seq-Id");
464  }
465 }
466 
468 {
469  for (size_t i = 0; i < m_Notebook->GetPageCount(); i++) {
470  string label = m_Notebook->GetPageText(i).ToStdString();
471  if (label == sel) {
472  m_Notebook->SetSelection(i);
473  break;
474  }
475  }
476 }
477 
479 {
480  return true;
481 }
482 
483 wxBitmap CMacroAddConstraint::GetBitmapResource( const wxString& name )
484 {
485  wxUnusedVar(name);
486  return wxNullBitmap;
487 }
488 wxIcon CMacroAddConstraint::GetIconResource( const wxString& name )
489 {
490  wxUnusedVar(name);
491  return wxNullIcon;
492 }
493 
494 void CMacroAddConstraint::OnCancel( wxCommandEvent& event )
495 {
496  Close();
497 }
498 
499 void CMacroAddConstraint::OnAccept( wxCommandEvent& event )
500 {
501  wxWindow* win = m_Notebook->GetCurrentPage();
502  CMacroMatcherPanelBase* panel = dynamic_cast<CMacroMatcherPanelBase*>(win);
503 
504  pair<string, string> item = panel->GetMatcher(m_target, m_num);
505 #ifdef _DEBUG
506  LOG_POST(Info << "***Matching: " << item.first << ", constraint: " << item.second);
507 #endif
508  if (item.first.empty() || item.second.empty()) {
509  event.Skip();
510  return;
511  }
512 
513 
514  vector<string> vars;
515  panel->GetVars(vars, m_num);
516 
517  string qual_name = panel->GetQualName(m_target);
518 
519  int sel = m_Notebook->GetSelection();
520  wxWindow* parent = GetParent();
521  CMacroCompoundConstraintPanel* compound_panel = dynamic_cast<CMacroCompoundConstraintPanel*>(parent);
522  compound_panel->AddConstraint(item, m_id, vars, qual_name, m_MatchingTypes[sel], panel->GetFuncWithArgs(m_target, m_num));
523 
524  NMacroStats::ReportUsage(this->GetLabel(), "add constraint");
525  Close();
526 }
527 
529 {
530  auto it = find(m_MatchingTypes.begin(), m_MatchingTypes.end(), constr.m_MatcherType);
531  if (it == m_MatchingTypes.end()) {
532  return;
533  }
534 
535  m_Notebook->ChangeSelection(it - m_MatchingTypes.begin());
536  wxWindow* win = m_Notebook->GetCurrentPage();
537  CMacroMatcherPanelBase* panel = dynamic_cast<CMacroMatcherPanelBase*>(win);
538  panel->SetMatcher(constr.m_FuncInfo);
539 }
540 
542 {
543  auto it = find(m_MatchingTypes.begin(), m_MatchingTypes.end(), constr.m_MatcherType);
544  if (it == m_MatchingTypes.end()) {
545  return;
546  }
547 
548  m_Notebook->ChangeSelection(it - m_MatchingTypes.begin());
549  wxWindow* win = m_Notebook->GetCurrentPage();
550  CMacroMatcherPanelBase* panel = dynamic_cast<CMacroMatcherPanelBase*>(win);
551  panel->SetMatcher(constr.m_FuncInfo);
552 
553  pair<string, string> item = panel->GetMatcher(m_target, m_num);
554  vector<string> vars;
555  panel->GetVars(vars, m_num);
556 
557  string qual_name = panel->GetQualName(m_target);
558 
559  constr.m_Label = item.first;
560  constr.m_Constraint = item.second;
561  constr.m_Variables = vars;
562  constr.m_Fieldname = qual_name;
563 }
564 
565 
566 //////////////// CMacroAdvStringConstraintPanel ///////////////////
567 /*!
568  * CMacroAdvStringConstraintPanel constructors
569  */
570 template<typename T>
572 {
573  Init();
574 }
575 
576 template<typename T>
578  wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
579 {
580  Init();
581  Create(parent, id, pos, size, style);
582 }
583 
584 
585 /*!
586  * CMacroAdvStringConstraintPanel creator
587  */
588 template<typename T>
590  wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
591 {
592 ////@begin CMacroAdvStringConstraintPanel creation
593  wxPanel::Create( parent, id, pos, size, style );
594 
595  CreateControls();
596  if (GetSizer())
597  {
598  GetSizer()->SetSizeHints(this);
599  }
600  Centre();
601 ////@end CMacroAdvStringConstraintPanel creation
602  ShowChoiceOrText();
603 
604  return true;
605 }
606 
607 /*!
608  * Member initialisation
609  */
610 template<typename T>
612 {
613  m_panel = NULL;
614  m_MatchType = NULL;
615  m_MatchText = NULL;
616  m_IgnoreCase = NULL;
617  m_IgnoreSpace = NULL;
618  m_WholeWord = NULL;
619  m_IgnorePunct = NULL;
620  m_IgnoreSyn = NULL;
621  m_AnyLetters = NULL;
622  m_AllUpper = NULL;
623  m_AllLower = NULL;
624  m_AllPunct = NULL;
625  m_MatchChoice = NULL;
626  m_TextSizer = NULL;
627  m_ClearButton = NULL;
628  m_WordSubstBtn = NULL;
629  m_ConstraintType = NULL;
630  m_is_choice = false;
631  m_Tablename = NULL;
632  m_Column = NULL;
633 }
634 
635 template<typename T>
637 {
638  wxPanel* parentPanel = this;
639 
640  wxBoxSizer* itemBoxSizer0 = new wxBoxSizer(wxVERTICAL);
641  parentPanel->SetSizer(itemBoxSizer0);
642 
643  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
644  itemBoxSizer0->Add(itemBoxSizer1, 0, wxGROW|wxALL, 0);
645 
646  m_panel = new T(parentPanel);
647  itemBoxSizer1->Add(m_panel, 0, wxALIGN_TOP|wxALL, 5);
648 
649  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
650  itemBoxSizer1->Add(itemBoxSizer2, 0, wxALIGN_TOP|wxALL, 5);
651 
652  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
653  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
654 
655  wxArrayString m_MatchTypeStrings;
656  m_MatchTypeStrings.Add(_("Contains"));
657  m_MatchTypeStrings.Add(_("Does not contain"));
658  m_MatchTypeStrings.Add(_("Equals"));
659  m_MatchTypeStrings.Add(_("Does not equal"));
660  m_MatchTypeStrings.Add(_("Starts with"));
661  m_MatchTypeStrings.Add(_("Ends with"));
662  m_MatchTypeStrings.Add(_("Is one of"));
663  m_MatchTypeStrings.Add(_("Is not one of"));
664  m_MatchTypeStrings.Add(_("Does not start with"));
665  m_MatchTypeStrings.Add(_("Does not end with"));
666 
667  m_MatchType = new wxChoice( parentPanel, ID_STRING_CONSTRAINT_MATCH_CHOICE, wxDefaultPosition, wxDefaultSize, m_MatchTypeStrings, 0 );
668  m_MatchType->SetStringSelection(_("Contains"));
669  itemBoxSizer3->Add(m_MatchType, 0, wxALIGN_TOP|wxLEFT|wxRIGHT|wxBOTTOM, 5);
670  m_MatchType->Bind(wxEVT_CHOICE, &CMacroAdvStringConstraintPanel<T>::OnMatchTypeSelected, this);
671 
672  m_TextSizer = new wxBoxSizer(wxVERTICAL);
673  itemBoxSizer3->Add(m_TextSizer, 0, wxALIGN_TOP, 0);
674 
675  m_MatchText = new wxTextCtrl( parentPanel, ID_STRING_CONSTRAINT_MATCH_TEXT, wxEmptyString, wxDefaultPosition, wxSize(300, -1), wxTE_MULTILINE );
676  m_TextSizer->Add(m_MatchText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
677  wxArrayString choice_strings;
678  m_MatchChoice = new wxComboBox(parentPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), choice_strings, 0 );
679  m_MatchChoice->Hide();
680 
681  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
682  itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
683 
684  wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
685  itemBoxSizer6->Add(itemBoxSizer7, 0, wxALIGN_TOP|wxALL, 5);
686 
687  m_AnyLetters = new wxRadioButton( parentPanel, ID_STRING_CONSTRAINT_RADIO0, _("Any letters"), wxDefaultPosition, wxDefaultSize, 0 );
688  m_AnyLetters->SetValue(true);
689  itemBoxSizer7->Add(m_AnyLetters, 0, wxALIGN_LEFT|wxALL, 5);
690 
691  m_AllUpper = new wxRadioButton( parentPanel, ID_STRING_CONSTRAINT_RADIO1, _("All letters are upper case"), wxDefaultPosition, wxDefaultSize, 0 );
692  m_AllUpper->SetValue(false);
693  itemBoxSizer7->Add(m_AllUpper, 0, wxALIGN_LEFT|wxALL, 5);
694 
695  m_AllLower = new wxRadioButton( parentPanel, ID_STRING_CONSTRAINT_RADIO2, _("All letters are lower case"), wxDefaultPosition, wxDefaultSize, 0 );
696  m_AllLower->SetValue(false);
697  itemBoxSizer7->Add(m_AllLower, 0, wxALIGN_LEFT|wxALL, 5);
698 
699  m_AllPunct = new wxRadioButton( parentPanel, ID_STRING_CONSTRAINT_RADIO3, _("All characters are punctuation"), wxDefaultPosition, wxDefaultSize, 0 );
700  m_AllPunct->SetValue(false);
701  itemBoxSizer7->Add(m_AllPunct, 0, wxALIGN_LEFT|wxALL, 5);
702 
703 
704  wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL);
705  itemBoxSizer6->Add(itemBoxSizer8, 0, wxALIGN_TOP|wxALL, 5);
706 
707  m_IgnoreCase = new wxCheckBox( parentPanel, ID_STRING_CONSTRAINT_CHECKBOX5, _("Ignore Case"), wxDefaultPosition, wxDefaultSize, 0 );
708  m_IgnoreCase->SetValue(false);
709  itemBoxSizer8->Add(m_IgnoreCase, 0, wxALIGN_LEFT|wxALL, 5);
710 
711  m_IgnoreSpace = new wxCheckBox( parentPanel, ID_STRING_CONSTRAINT_CHECKBOX6, _("Ignore Space"), wxDefaultPosition, wxDefaultSize, 0 );
712  m_IgnoreSpace->SetValue(false);
713  itemBoxSizer8->Add(m_IgnoreSpace, 0, wxALIGN_LEFT|wxALL, 5);
714 
715  m_IgnorePunct = new wxCheckBox( parentPanel, ID_STRING_CONSTRAINT_CHECKBOX8, _("Ignore Punctuation"), wxDefaultPosition, wxDefaultSize, 0 );
716  m_IgnorePunct->SetValue(false);
717  itemBoxSizer8->Add(m_IgnorePunct, 0, wxALIGN_LEFT|wxALL, 5);
718 
719  m_WholeWord = new wxCheckBox( parentPanel, ID_STRING_CONSTRAINT_CHECKBOX7, _("Whole Word"), wxDefaultPosition, wxDefaultSize, 0 );
720  m_WholeWord->SetValue(false);
721  itemBoxSizer8->Add(m_WholeWord, 0, wxALIGN_LEFT|wxALL, 5);
722 
723  m_IgnoreSyn = new wxCheckBox( parentPanel, ID_STRING_CONSTRAINT_CHECKBOX9, _("Ignore 'putative' synonyms"), wxDefaultPosition, wxDefaultSize, 0 );
724  m_IgnoreSyn->SetValue(false);
725  itemBoxSizer8->Add(m_IgnoreSyn, 0, wxALIGN_LEFT|wxALL, 5);
726 
727  wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
728  itemBoxSizer2->Add(itemBoxSizer9, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0);
729 
730  m_ClearButton = new wxButton( parentPanel, ID_STRING_CONSTRAINT_CLEAR_BUTTON, _("Clear Constraint"), wxDefaultPosition, wxDefaultSize, 0 );
731  itemBoxSizer9->Add(m_ClearButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
732  m_ClearButton->Connect(ID_STRING_CONSTRAINT_CLEAR_BUTTON, wxEVT_BUTTON, wxCommandEventHandler(CMacroAdvStringConstraintPanel<T>::OnClear), NULL, this);
733 
734  m_WordSubstBtn = new wxButton( parentPanel, ID_STRING_CONSTRAINT_WORDSUBST_BUTTON, _("Word Substitutions"), wxDefaultPosition, wxDefaultSize, 0 );
735  itemBoxSizer9->Add(m_WordSubstBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
736  m_WordSubstBtn->Connect(ID_STRING_CONSTRAINT_WORDSUBST_BUTTON, wxEVT_BUTTON, wxCommandEventHandler(CMacroAdvStringConstraintPanel<T>::OnWordSubstitution), NULL, this);
737  m_WordSubstBtn->Bind(wxEVT_UPDATE_UI, &CMacroAdvStringConstraintPanel::OnUpdateWordSubstButton, this);
738 
739  wxBoxSizer* hor_sizer = new wxBoxSizer(wxHORIZONTAL);
740  itemBoxSizer0->Add(hor_sizer, 0, wxALIGN_LEFT | wxALL, 0);
741 
742  wxArrayString present_not_present;
743  present_not_present.Add(_("Match value"));
744  present_not_present.Add(_("Present"));
745  present_not_present.Add(_("Not present"));
746  present_not_present.Add(_("From table"));
747  m_ConstraintType = new wxRadioBox(parentPanel, ID_CONSTRAINT_TYPE, wxEmptyString, wxDefaultPosition, wxDefaultSize, present_not_present, 1, wxRA_SPECIFY_ROWS);
748  m_ConstraintType->SetSelection(0);
749  hor_sizer->Add(m_ConstraintType, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT, 5);
750  m_ConstraintType->Connect(ID_CONSTRAINT_TYPE, wxEVT_RADIOBOX, wxCommandEventHandler(CMacroAdvStringConstraintPanel<T>::OnConstraintType), NULL, this);
751 
752  m_TableSizer = new wxFlexGridSizer(0, 2, 0, 0);
753  hor_sizer->Add(m_TableSizer, 0, wxALIGN_BOTTOM | wxRESERVE_SPACE_EVEN_IF_HIDDEN | wxALL, 0);
754 
755  wxStaticText* itemStaticText10 = new wxStaticText(parentPanel, wxID_STATIC, _("File name"), wxDefaultPosition, wxDefaultSize, 0);
756  m_TableSizer->Add(itemStaticText10, 0, wxALIGN_LEFT | wxRESERVE_SPACE_EVEN_IF_HIDDEN | wxLEFT, 5);
757 
758  wxStaticText* itemStaticText11 = new wxStaticText(parentPanel, wxID_STATIC, _("Column"), wxDefaultPosition, wxDefaultSize, 0);
759  m_TableSizer->Add(itemStaticText11, 0, wxALIGN_LEFT | wxRESERVE_SPACE_EVEN_IF_HIDDEN | wxLEFT, 5);
760 
761  wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL);
762  m_TableSizer->Add(itemBoxSizer11, 0, wxALIGN_LEFT | wxRESERVE_SPACE_EVEN_IF_HIDDEN | wxALL, 0);
763 
764  m_Tablename = new wxTextCtrl(parentPanel, ID_CONSTRAINT_TABLENAME, wxEmptyString, wxDefaultPosition, wxSize(270,-1));
765  itemBoxSizer11->Add(m_Tablename, 0, wxALIGN_CENTER_VERTICAL | wxRESERVE_SPACE_EVEN_IF_HIDDEN | wxALL, 5);
766 
767  wxButton* itemButton12 = new wxBitmapButton(parentPanel, ID_OPENFILEBTMBTN, wxArtProvider::GetBitmap(wxT("menu::open")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW);
768  itemButton12->SetToolTip(wxT("Choose a table file..."));
769  itemBoxSizer11->Add(itemButton12, 0, wxALIGN_CENTER_VERTICAL | wxRESERVE_SPACE_EVEN_IF_HIDDEN| wxALL, 2);
770  itemButton12->Bind(wxEVT_BUTTON, &CMacroAdvStringConstraintPanel<T>::OnOpenFile, this);
771 
772  wxIntegerValidator<unsigned> validator;
773  validator.SetMin(1);
774  m_Column = new wxTextCtrl(parentPanel, ID_CONSTRAINT_TABLECOL, wxEmptyString, wxDefaultPosition, wxSize(30, -1), 0, validator);
775  m_TableSizer->Add(m_Column, 0, wxALIGN_LEFT | wxRESERVE_SPACE_EVEN_IF_HIDDEN | wxALL, 5);
776 
777  hor_sizer->Hide(m_TableSizer, true);
778 
779 
780  CFieldNamePanel* panel = dynamic_cast<CFieldNamePanel*>(m_panel);
781  if (panel) {
782  bool allow_other = true;
783  vector<string> choices = panel->GetChoices(allow_other);
784  vector<string> values = panel->GetMacroValues();
785  SetChoices(choices, values);
786  }
787  CSourceFieldNamePanel* src_panel = dynamic_cast<CSourceFieldNamePanel*>(m_panel);
788  if (src_panel) {
789  src_panel->HideSourceType();
790  }
791 }
792 
793 template<typename T>
794 void CMacroAdvStringConstraintPanel<T>::OnClear( wxCommandEvent& event )
795 {
796  ClearValues();
797 }
798 
799 template<typename T>
801 {
802  if (m_is_choice)
803  {
804  m_MatchChoice->Hide();
805  m_TextSizer->Replace(m_MatchChoice, m_MatchText);
806  m_MatchText->Show();
807  m_is_choice = false;
808  Layout();
809  Fit();
810  }
811  m_MatchType->SetStringSelection(_("Contains"));
812  m_MatchText->SetValue(wxEmptyString);
813  m_IgnoreCase->SetValue(false);
814  m_IgnoreSpace->SetValue(false);
815  m_WholeWord->SetValue(false);
816  m_IgnorePunct->SetValue(false);
817  m_IgnoreSyn->SetValue(false);
818  m_AnyLetters->SetValue(true);
819  m_AllUpper->SetValue(false);
820  m_AllLower->SetValue(false);
821  m_AllPunct->SetValue(false);
822  m_SynonymFile.clear();
823  m_SynonymList.Reset();
824 }
825 
826 template<typename T>
828 {
829  string match_text = x_GetMatchText();
830  event.Enable(m_ConstraintType->GetSelection() == 0 && !match_text.empty());
831 }
832 
833 template<typename T>
835 {
836  int sel = m_ConstraintType->GetSelection();
837  bool enable = (sel == 0);
838  EnableStringConstraint(enable);
839 
840  enable = (sel == 3);
841  m_TableSizer->ShowItems(enable);
842 }
843 
844 template<typename T>
846 {
847  if (m_MatchChoice->IsShown())
848  m_MatchChoice->Enable(enable);
849  else
850  m_MatchText->Enable(enable);
851 
852  m_MatchType->Enable(enable);
853  m_MatchText->Enable(enable);
854  m_IgnoreCase->Enable(enable);
855  m_IgnoreSpace->Enable(enable);
856  m_WholeWord->Enable(enable);
857  m_IgnorePunct->Enable(enable);
858  m_IgnoreSyn->Enable(enable);
859  m_AnyLetters->Enable(enable);
860  m_AllUpper->Enable(enable);
861  m_AllLower->Enable(enable);
862  m_AllPunct->Enable(enable);
863  m_ClearButton->Enable(enable);
864  if (m_WordSubstBtn)
865  m_WordSubstBtn->Enable(enable);
866 }
867 
868 template<typename T>
869 void CMacroAdvStringConstraintPanel<T>::SetChoices(const vector<string> &choices, const vector<string> &values)
870 {
871  wxArrayString choice_strings;
872  ITERATE(vector<string>, it, choices) {
873  choice_strings.Add(ToWxString(*it));
874  }
875  m_MatchChoice->Set(choice_strings);
876 
877  _ASSERT(values.empty() || choices.size() == values.size());
878 
879  m_choice_to_value.clear();
880  for (size_t i = 0; i < values.size(); i++)
881  m_choice_to_value[choices[i]] = values[i];
882 
883  ShowChoiceOrText();
884 }
885 
886 template<typename T>
888 {
889  if (!m_MatchChoice->IsListEmpty() &&
890  (m_MatchType->GetSelection() == eMatchType_Equals || m_MatchType->GetSelection() == eMatchType_DoesNotEqual)) {
891  if (!m_is_choice) {
892  m_MatchText->Hide();
893  m_TextSizer->Replace(m_MatchText, m_MatchChoice);
894  m_MatchChoice->Show();
895  }
896  m_is_choice = true;
897  }
898  else {
899  if (m_is_choice) {
900  m_MatchChoice->Hide();
901  m_TextSizer->Replace(m_MatchChoice, m_MatchText);
902  m_MatchText->Show();
903  }
904  m_is_choice = false;
905  }
906  Layout();
907  Fit();
908 }
909 
910 template<typename T>
912 {
913  ShowChoiceOrText();
914  event.Skip();
915 }
916 
917 template<typename T>
919 {
920  if (event.GetId() != ID_OPENFILEBTMBTN)
921  return;
922 
923  wxFileDialog dlg(this, wxT("Select table file"), wxEmptyString, wxEmptyString, _("All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
924 
925  if (dlg.ShowModal() == wxID_OK) {
926  auto mapped_path = GetAbsolutePath(dlg.GetPath());
927  m_Tablename->SetValue(mapped_path);
928  m_Tablename->SetInsertionPoint(m_Tablename->GetLastPosition());
929  }
930 }
931 
932 /*!
933  * Should we show tooltips?
934  */
935 template<typename T>
937 {
938  return true;
939 }
940 
941 /*!
942  * Get bitmap resources
943  */
944 template<typename T>
946 {
947  // Bitmap retrieval
948 ////@begin CMacroAdvStringConstraintPanel bitmap retrieval
949  wxUnusedVar(name);
950  return wxNullBitmap;
951 ////@end CMacroAdvStringConstraintPanel bitmap retrieval
952 }
953 
954 /*!
955  * Get icon resources
956  */
957 template<typename T>
959 {
960  // Icon retrieval
961 ////@begin CMacroAdvStringConstraintPanel icon retrieval
962  wxUnusedVar(name);
963  return wxNullIcon;
964 ////@end CMacroAdvStringConstraintPanel icon retrieval
965 }
966 
967 template <typename T>
969 {
970  m_choice_to_value.clear();
971  CFieldNamePanel* panel = dynamic_cast<CFieldNamePanel*>(m_panel);
972  if (panel) {
973  bool allow_other = true;
974  vector<string> choices = panel->GetChoices(allow_other);
975  vector<string> values = panel->GetMacroValues();
976  SetChoices(choices, values);
977  }
978 }
979 
980 template <typename T>
981 pair<string, string> CMacroAdvStringConstraintPanel<T>::GetMatcher(const pair<string, string> &target, size_t num)
982 {
983  CFieldNamePanel* field_name_panel = dynamic_cast<CFieldNamePanel*>(m_panel);
984  if (field_name_panel)
985  {
986  string field = field_name_panel->GetMacroFieldName(target.first, target.second);
987  string label = field_name_panel->GetMacroFieldLabel(target.first, target.second);
988 
989  string field_name = field_name_panel->GetFieldName(false);
990  vector<string> text_constraint;
991  if (!label.empty())
992  text_constraint.push_back(label);
993 
994  text_constraint.push_back(GetTextConstraint(field, num));
995  return make_pair(GetDescription(field_name), NStr::Join(text_constraint, " AND "));
996  }
997  return make_pair(kEmptyStr, kEmptyStr);
998 }
999 
1000 template<typename T>
1001 vector<CFuncWithArgs> CMacroAdvStringConstraintPanel<T>::GetFuncWithArgs(const pair<string, string>& target, size_t num) const
1002 {
1003  vector<CFuncWithArgs> functions;
1004 
1005  CFieldNamePanel* field_name_panel = dynamic_cast<CFieldNamePanel*>(m_panel);
1006  if (!field_name_panel)
1007  return functions;
1008 
1009  string field = field_name_panel->GetFieldName();
1010  // this is the field as it appears in the panel
1011  string num_str = NStr::UIntToString((unsigned)(num) + 1);
1012  string match_text = x_GetMatchText();
1013 
1014 
1015  int sel = m_ConstraintType->GetSelection();
1016  if (sel == 0) {
1017  CFuncWithArgs fn;
1018  switch (m_MatchType->GetSelection()) {
1019  case eMatchType_Contains:
1020  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Contain;
1021  break;
1022  case eMatchType_DoesNotContain:
1023  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Contain;
1024  fn.m_Negate = true;
1025  break;
1026  case eMatchType_Equals:
1027  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Equal;
1028  break;
1029  case eMatchType_DoesNotEqual:
1030  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Equal;
1031  fn.m_Negate = true;
1032  break;
1033  case eMatchType_StartsWith:
1034  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Start;
1035  break;
1036  case eMatchType_DoesNotStartWith:
1037  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Start;
1038  fn.m_Negate = true;
1039  break;
1040  case eMatchType_EndsWith:
1041  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_End;
1042  break;
1043  case eMatchType_DoesNotEndWith:
1044  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_End;
1045  fn.m_Negate = true;
1046  break;
1047  case eMatchType_IsOneOf:
1048  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_InList;
1049  break;
1050  case eMatchType_IsNotOneOf:
1051  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_InList;
1052  fn.m_Negate = true;
1053  break;
1054 
1055  default:
1056  break;
1057  }
1058  if (!fn.m_FName.empty() && !match_text.empty()) {
1059  fn.m_FArgs.emplace(NMacroArgs::kField, field);
1060  fn.m_FArgs.emplace(NMacroArgs::kConstr_Match, match_text);
1061  fn.m_FArgs.emplace(NMacroArgs::kConstr_StrCaseSens, (!m_IgnoreCase->GetValue()) ? "true" : "false");
1062  fn.m_FArgs.emplace(NMacroArgs::kConstr_IgnoreSpace, (m_IgnoreSpace->GetValue()) ? "true" : "false");
1063  fn.m_FArgs.emplace(NMacroArgs::kConstr_IgnorePunct, (m_IgnorePunct->GetValue()) ? "true" : "false");
1064  fn.m_FArgs.emplace(NMacroArgs::kConstr_WholeWord, (m_WholeWord->GetValue()) ? "true" : "false");
1065  fn.m_FArgs.emplace(NMacroArgs::kConstr_IgnoreWeasel, (m_IgnoreSyn->GetValue()) ? "true" : "false");
1066 
1067  if (!m_SynonymFile.empty() && m_SynonymList && m_SynonymList->IsSet()) {
1068  fn.m_FArgs.emplace(NMacroArgs::kConstr_SynFile, m_SynonymFile);
1069  unsigned nr = 0;
1070  for (const auto& ws : m_SynonymList->Get()) {
1071  string str_nr = NStr::UIntToString(++nr);
1072  fn.m_FArgs.emplace(NMacroArgs::kConstr_SynMatch + str_nr, ws->GetWord());
1073  fn.m_FArgs.emplace(NMacroArgs::kConstr_SynCaseSens + str_nr, NStr::BoolToString(ws->GetCase_sensitive()));
1074  fn.m_FArgs.emplace(NMacroArgs::kConstr_SynWholeWord + str_nr, NStr::BoolToString(ws->GetWhole_word()));
1075  }
1076  }
1077  functions.push_back(fn);
1078  }
1079 
1080  if (m_AllUpper->GetValue()) {
1081  CFuncWithArgs fn;
1082  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Upper;
1083  fn.m_FArgs.emplace(NMacroArgs::kField, field);
1084  functions.push_back(fn);
1085  }
1086  if (m_AllLower->GetValue()) {
1087  CFuncWithArgs fn;
1088  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Lower;
1089  fn.m_FArgs.emplace(NMacroArgs::kField, field);
1090  functions.push_back(fn);
1091  }
1092  if (m_AllPunct->GetValue()) {
1093  CFuncWithArgs fn;
1094  fn.m_FName = macro::CMacroFunction_StringConstraints::sm_Punct;
1095  fn.m_FArgs.emplace(NMacroArgs::kField, field);
1096  functions.push_back(fn);
1097  }
1098  }
1099  else if (sel == 1 || sel == 2) {
1100  CFuncWithArgs fn;
1101  fn.m_FName = macro::CMacroFunction_IsPresent::GetFuncName();
1102  fn.m_FArgs.emplace(NMacroArgs::kField, field);
1103  if (sel == 2) {
1104  fn.m_Negate = true;
1105  }
1106  functions.push_back(fn);
1107  }
1108  else if (sel == 3) {
1109  CFuncWithArgs fn;
1110  fn.m_FName = macro::CMacroFunction_InTable::GetFuncName();
1111  fn.m_FArgs.emplace(NMacroArgs::kField, field);
1112  fn.m_FArgs.emplace(NMacroArgs::kTableName, ToStdString(m_Tablename->GetValue()));
1113  fn.m_FArgs.emplace(NMacroArgs::kNewValue, "col:" + ToStdString(m_Column->GetValue()));
1114  functions.push_back(fn);
1115  }
1116 
1117  return functions;
1118 }
1119 
1120 template <typename T>
1122 {
1123  string match_text;
1124  if (!m_is_choice) {
1125  match_text = ToStdString(m_MatchText->GetValue());
1126  }
1127  else {
1128  match_text = ToStdString(m_MatchChoice->GetValue());
1129  }
1130  NStr::ReplaceInPlace(match_text, "\r", " ");
1131  NStr::ReplaceInPlace(match_text, "\n", " ");
1132  return match_text;
1133 }
1134 
1135 template <typename T>
1136 string CMacroAdvStringConstraintPanel<T>::GetQualName(const pair<string, string> &target)
1137 {
1138  CFieldNamePanel* field_name_panel = dynamic_cast<CFieldNamePanel*>(m_panel);
1139  if (field_name_panel)
1140  {
1141  string field = field_name_panel->GetMacroFieldName(target.first, target.second);
1142  return field;
1143  }
1144  return kEmptyStr;
1145 }
1146 
1147 template <typename T>
1149 {
1150  int constraint_sel = m_ConstraintType->GetSelection();
1151  if (constraint_sel == 1)
1152  return field + " is present";
1153  if (constraint_sel == 2)
1154  return field + " is not present";
1155  if (constraint_sel == 3)
1156  return field + " is used as identifier";
1157 
1158  string str;
1159  string match_text = x_GetMatchText();
1160 
1161  if (!match_text.empty()) {
1162  switch(m_MatchType->GetSelection()) {
1163  case eMatchType_Contains:
1164  str = "contains ";
1165  break;
1166  case eMatchType_DoesNotContain:
1167  str = "does not contain ";
1168  break;
1169  case eMatchType_Equals:
1170  str = "equals ";
1171  break;
1172  case eMatchType_DoesNotEqual:
1173  str = "does not equal ";
1174  break;
1175  case eMatchType_StartsWith:
1176  str = "starts with ";
1177  break;
1178  case eMatchType_EndsWith:
1179  str = "ends with ";
1180  break;
1181  case eMatchType_IsOneOf:
1182  str = "is one of ";
1183  break;
1184  case eMatchType_IsNotOneOf:
1185  str = "is not one of ";
1186  break;
1187  case eMatchType_DoesNotStartWith:
1188  str = "does not start with ";
1189  break;
1190  case eMatchType_DoesNotEndWith:
1191  str = "does not ends with ";
1192  break;
1193  default: break;
1194  }
1195 
1196 
1197  str += "'" + match_text + "' ";
1198 
1199  vector<string> subs;
1200  if (!m_IgnoreCase->GetValue())
1201  subs.push_back("case-sensitive");
1202 
1203  if (m_IgnoreSpace->GetValue())
1204  subs.push_back("ignore spaces");
1205 
1206  if (m_IgnorePunct->GetValue())
1207  subs.push_back("ignore punctuation");
1208 
1209  if (m_WholeWord->GetValue())
1210  subs.push_back("whole word");
1211 
1212  if (m_IgnoreSyn->GetValue())
1213  subs.push_back("ignore 'putative' synonyms");
1214 
1215  if (!subs.empty()) {
1216  string sub = NStr::Join(subs, ", ");
1217  str += "(" + sub + ")";
1218  }
1219 
1220  if (m_SynonymList && m_SynonymList->IsSet()) {
1221  for (const auto& ws : m_SynonymList->Get()) {
1223  }
1224  }
1225  }
1226 
1227 
1228  string sub;
1229  if (m_AllUpper->GetValue())
1230  sub = "all letters are upper case";
1231 
1232  if (m_AllLower->GetValue())
1233  sub = "all letters are lower case";
1234 
1235  if (m_AllPunct->GetValue())
1236  sub = "all characters are punctiation";
1237 
1238  if (!sub.empty())
1239  {
1240  if (!str.empty())
1241  str += ", ";
1242  str += sub;
1243  }
1244 
1245  return field + " " + str;
1246 }
1247 
1248 template <typename T>
1249 string CMacroAdvStringConstraintPanel<T>::GetTextConstraint(const string& field, size_t num)
1250 {
1251  if (field.empty())
1252  return kEmptyStr;
1253 
1254  string num_str = NStr::UIntToString((unsigned)(num)+1);
1255 
1256  int constraint_sel = m_ConstraintType->GetSelection();
1257  if (constraint_sel == 1)
1258  return macro::CMacroFunction_IsPresent::GetFuncName() + "(" + field + ")";
1259  if (constraint_sel == 2)
1260  return "NOT " + macro::CMacroFunction_IsPresent::GetFuncName() + "(" + field + ")";
1261  if (constraint_sel == 3) {
1262  if (m_Tablename->IsShown() && !m_Tablename->IsEmpty()) {
1263  string filename = "\"" + ToStdString(m_Tablename->GetValue()) + "\"";
1264  string func = macro::CMacroFunction_InTable::GetFuncName();
1265  func += "(" + field + ", " + filename + ", " + ToStdString(m_Column->GetValue()) + ", \"\\t\")";
1266  return func;
1267  }
1268  }
1269 
1270 
1271  string str;
1272  string match_text = x_GetMatchText();
1273  auto selection = m_MatchType->GetSelection();
1274 
1275  if (!match_text.empty()) {
1276  switch(selection) {
1277  case eMatchType_Contains:
1278  str = macro::CMacroFunction_StringConstraints::sm_Contain;
1279  break;
1280  case eMatchType_DoesNotContain:
1281  str = "NOT " + CTempString(macro::CMacroFunction_StringConstraints::sm_Contain);
1282  break;
1283  case eMatchType_Equals:
1284  str = macro::CMacroFunction_StringConstraints::sm_Equal;
1285  break;
1286  case eMatchType_DoesNotEqual:
1287  str = "NOT " + CTempString(macro::CMacroFunction_StringConstraints::sm_Equal);
1288  break;
1289  case eMatchType_StartsWith:
1290  str = macro::CMacroFunction_StringConstraints::sm_Start;
1291  break;
1292  case eMatchType_EndsWith:
1293  str = macro::CMacroFunction_StringConstraints::sm_End;
1294  break;
1295  case eMatchType_DoesNotStartWith:
1296  str = "NOT " + CTempString(macro::CMacroFunction_StringConstraints::sm_Start);
1297  break;
1298  case eMatchType_DoesNotEndWith:
1299  str = "NOT " + CTempString(macro::CMacroFunction_StringConstraints::sm_End);
1300  break;
1301  default: break;
1302  }
1303 
1304  string case_sensitive = (!m_IgnoreCase->GetValue()) ? "true" : "false";
1305  string ignore_space = (m_IgnoreSpace->GetValue()) ? "true" : "false";
1306  string ignore_punctuation = (m_IgnorePunct->GetValue()) ? "true" : "false";
1307  string whole_word = (m_WholeWord->GetValue()) ? "true" : "false";
1308  string ignore_weasel = (m_IgnoreSyn->GetValue()) ? "true" : "false";
1309 
1310  if (!str.empty()) {
1311  string match_var = x_GetVariable();
1312  _ASSERT(!match_var.empty());
1313  str += "(" + field + "," + match_var + num_str + "," + case_sensitive + ",";
1314  str += ignore_space + "," + ignore_punctuation + "," + whole_word + "," + ignore_weasel;
1315 //#ifdef _DEBUG
1316  if (m_SynonymList && m_SynonymList->IsSet()) {
1317  str += ", \"" + m_SynonymFile + "\"";
1318  short index = 0;
1319  for (const auto& it : m_SynonymList->Get()) {
1320  const string& word = it->GetWord();
1321  if (NStr::EqualCase(word, match_text)) {
1322  str += ", " + match_var + num_str;
1323  }
1324  else {
1325  str += ", match" + NStr::IntToString(++index);
1326  }
1327  str += ", " + NStr::BoolToString(it->GetCase_sensitive());
1328  str += ", " + NStr::BoolToString(it->GetWhole_word());
1329  }
1330  }
1331 //#endif
1332  str += +")";
1333 
1334  }
1335 
1336  if (str.empty() &&
1337  (selection == eMatchType_IsOneOf || selection == eMatchType_IsNotOneOf)) {
1338  vector<string> tokens;
1339  NStr::Split(match_text, ",", tokens);
1340  if (tokens.size() > 1) {
1341  if (selection == eMatchType_IsOneOf) {
1342  str = field + " IN (";
1343  }
1344  else if (selection == eMatchType_IsNotOneOf) {
1345  str = field + " NOT IN (";
1346  }
1347 
1348  for (auto& it : tokens) {
1349  str += "\"" + it + "\", ";
1350  }
1351 
1352  str.pop_back();
1353  str.pop_back();
1354  str += ")";
1355  }
1356  }
1357  }
1358 
1359  string sub;
1360  if (m_AllUpper->GetValue())
1361  sub = CTempString(macro::CMacroFunction_StringConstraints::sm_Upper) + "(" + field + ")";
1362 
1363  if (m_AllLower->GetValue())
1364  sub = CTempString(macro::CMacroFunction_StringConstraints::sm_Lower) + "(" + field + ")";
1365 
1366  if (m_AllPunct->GetValue())
1367  sub = CTempString(macro::CMacroFunction_StringConstraints::sm_Punct) + "(" + field + ")";
1368 
1369  if (!sub.empty()) {
1370  if (!str.empty())
1371  str += " AND ";
1372  str += sub;
1373  }
1374 
1375  return str;
1376 }
1377 
1378 template <typename T>
1379 void CMacroAdvStringConstraintPanel<T>::GetVars(vector<string>& vars, size_t num)
1380 {
1381  vars.clear();
1382 
1383  string num_str = NStr::UIntToString((unsigned)num + 1);
1384 
1385  string match_text = x_GetMatchText();
1386  if (!match_text.empty()) {
1387  string match_var = x_GetVariable();
1388  if (!match_var.empty()) {
1389  vars.push_back(match_var + num_str + " = %" + match_text + "%");
1390  }
1391  if (m_SynonymList && m_SynonymList->IsSet()) {
1392  short index = 0;
1393  for (const auto& it : m_SynonymList->Get()) {
1394  const string& word = it->GetWord();
1395  if (NStr::EqualCase(word, match_text)) {
1396  // do nothing
1397  }
1398  else {
1399  vars.push_back("match" + NStr::IntToString(++index) + " = \"" + word + "\"");
1400  }
1401  }
1402  }
1403  }
1404 }
1405 
1406 template <typename T>
1408 {
1409  string match_var;
1410  switch (m_MatchType->GetSelection()) {
1411  case eMatchType_Contains:
1412  match_var = "contains";
1413  break;
1414  case eMatchType_DoesNotContain:
1415  match_var = "not_contains";
1416  break;
1417  case eMatchType_Equals:
1418  match_var = "equals";
1419  break;
1420  case eMatchType_DoesNotEqual:
1421  match_var = "not_equals";
1422  break;
1423  case eMatchType_StartsWith:
1424  match_var = "starts";
1425  break;
1426  case eMatchType_EndsWith:
1427  match_var = "ends";
1428  break;
1429  case eMatchType_DoesNotStartWith:
1430  match_var = "not_starts";
1431  break;
1432  case eMatchType_DoesNotEndWith:
1433  match_var = "not_ends";
1434  break;
1435  default:
1436  break;
1437  }
1438  return match_var;
1439 }
1440 
1441 template <typename T>
1443 {
1444  string result = orig;
1445  auto it = m_choice_to_value.find(orig);
1446  if (it != m_choice_to_value.end())
1447  result = it->second;
1448  return result;
1449 }
1450 
1451 template <typename T>
1453 {
1454  CMacroWordSubstitutionDlg* dlg = new CMacroWordSubstitutionDlg(this, m_SynonymFile);
1455  dlg->SetSubstitutionList(m_SynonymList);
1456  dlg->Show(true);
1457 }
1458 
1459 template <typename T>
1461 {
1462  m_SynonymFile = filename;
1463  m_SynonymList = word_subst;
1464 }
1465 
1466 template <typename T>
1468 {
1469  m_panel->SetFieldName(field);
1470 }
1471 
1472 template <typename T>
1474 {
1475  if (args.count(NMacroArgs::kField)) {
1476  SetFieldName(args.at(NMacroArgs::kField));
1477 
1478  auto match_it = args.find(NMacroArgs::kConstr_Match);
1479  if (match_it != args.end()) {
1480  if (!m_is_choice)
1481  m_MatchText->SetValue(wxString(match_it->second));
1482  else
1483  m_MatchChoice->SetValue(wxString(match_it->second));
1484  }
1485  if (args.count(NMacroArgs::kConstr_StrCaseSens)) {
1486  m_IgnoreCase->SetValue(!NStr::StringToBool(args.at(NMacroArgs::kConstr_StrCaseSens)));
1487  }
1488  if (args.count(NMacroArgs::kConstr_IgnoreSpace)) {
1489  m_IgnoreSpace->SetValue(NStr::StringToBool(args.at(NMacroArgs::kConstr_IgnoreSpace)));
1490  }
1491  if (args.count(NMacroArgs::kConstr_IgnorePunct)) {
1492  m_IgnorePunct->SetValue(NStr::StringToBool(args.at(NMacroArgs::kConstr_IgnorePunct)));
1493  }
1494  if (args.count(NMacroArgs::kConstr_WholeWord)) {
1495  m_WholeWord->SetValue(NStr::StringToBool(args.at(NMacroArgs::kConstr_WholeWord)));
1496  }
1497  if (args.count(NMacroArgs::kConstr_IgnoreWeasel)) {
1498  m_IgnoreSyn->SetValue(NStr::StringToBool(args.at(NMacroArgs::kConstr_IgnoreWeasel)));
1499  }
1500 
1501  if (args.count(NMacroArgs::kConstr_SynFile)) {
1502  m_SynonymFile = args.at(NMacroArgs::kConstr_SynFile);
1503 
1504  if (!NStr::EndsWith(m_SynonymFile, "/synonyms.txt") && m_SynonymFile != "synonyms.txt") {
1505  if (!wxFileExists(ToWxString(m_SynonymFile))) {
1506  NcbiErrorBox("Constraint using the word substitution file '" + m_SynonymFile +
1507  "' cannot be opened as the file does not exist.");
1508  ClearValues();
1509  return;
1510  }
1511  macro::CMacroLib::GetInstance().StoreSynonymList(m_SynonymFile);
1512  }
1513 
1514  m_SynonymList.Reset(new CWord_substitution_set);
1515 
1516  unsigned nr = 1;
1517  string str_nr = NStr::UIntToString(nr);
1518  string fieldname = NMacroArgs::kConstr_SynMatch + str_nr;
1519 
1520  while (args.count(fieldname) > 0) {
1522  ws->SetWord(args.at(fieldname));
1523 
1524  ws->SetSynonyms() = macro::CMacroLib::GetInstance().GetSynonymListForPhrase(m_SynonymFile, ws->GetWord());
1525 
1526  fieldname = NMacroArgs::kConstr_SynCaseSens + str_nr;
1527  if (args.count(fieldname)) {
1528  ws->SetCase_sensitive(NStr::StringToBool(args.at(fieldname)));
1529  }
1530  fieldname = NMacroArgs::kConstr_SynWholeWord + str_nr;
1531  if (args.count(fieldname)) {
1532  ws->SetWhole_word(NStr::StringToBool(args.at(fieldname)));
1533  }
1534 
1535  m_SynonymList->Set().push_back(ws);
1536 
1537  str_nr = NStr::UIntToString(++nr);
1538  fieldname = NMacroArgs::kConstr_SynMatch + str_nr;
1539  }
1540  }
1541  }
1542 }
1543 
1544 template <typename T>
1546 {
1547  for (const auto& fn_it : func_info) {
1548  const auto& args = fn_it.m_FArgs;
1549  const string& fn_name = fn_it.m_FName;
1550  if (NStr::EqualNocase(fn_name, macro::CMacroFunction_StringConstraints::sm_Contain)) {
1551  m_ConstraintType->SetSelection(0);
1552  EnableStringConstraint(true);
1553  if (fn_it.m_Negate) {
1554  m_MatchType->SetSelection(eMatchType_DoesNotContain);
1555  }
1556  else {
1557  m_MatchType->SetSelection(eMatchType_Contains);
1558  }
1559  x_SetControls(args);
1560  }
1561  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_StringConstraints::sm_Equal)) {
1562  m_ConstraintType->SetSelection(0);
1563  EnableStringConstraint(true);
1564  if (fn_it.m_Negate) {
1565  m_MatchType->SetSelection(eMatchType_DoesNotEqual);
1566  }
1567  else {
1568  m_MatchType->SetSelection(eMatchType_Equals);
1569  }
1570  x_SetControls(args);
1571  }
1572  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_StringConstraints::sm_Start)) {
1573  m_ConstraintType->SetSelection(0);
1574  EnableStringConstraint(true);
1575  if (fn_it.m_Negate) {
1576  m_MatchType->SetSelection(eMatchType_DoesNotStartWith);
1577  }
1578  else {
1579  m_MatchType->SetSelection(eMatchType_StartsWith);
1580  }
1581  x_SetControls(args);
1582  }
1583  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_StringConstraints::sm_End)) {
1584  m_ConstraintType->SetSelection(0);
1585  EnableStringConstraint(true);
1586  if (fn_it.m_Negate) {
1587  m_MatchType->SetSelection(eMatchType_DoesNotEndWith);
1588  }
1589  else {
1590  m_MatchType->SetSelection(eMatchType_EndsWith);
1591  }
1592  x_SetControls(args);
1593  }
1594  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_StringConstraints::sm_InList)) {
1595  m_ConstraintType->SetSelection(0);
1596  EnableStringConstraint(true);
1597  if (fn_it.m_Negate) {
1598  m_MatchType->SetSelection(eMatchType_IsNotOneOf);
1599  }
1600  else {
1601  m_MatchType->SetSelection(eMatchType_IsOneOf);
1602  }
1603  x_SetControls(args);
1604  }
1605  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_IsPresent::GetFuncName())) {
1606  SetFieldName(args.at(NMacroArgs::kField));
1607 
1608  int sel = (fn_it.m_Negate) ? 2 : 1;
1609  m_ConstraintType->SetSelection(sel);
1610  EnableStringConstraint(false);
1611  }
1612  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_StringConstraints::sm_Upper)) {
1613  m_ConstraintType->SetSelection(0);
1614  EnableStringConstraint(true);
1615  SetFieldName(args.at(NMacroArgs::kField));
1616  m_AllUpper->SetValue(true);
1617  }
1618  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_StringConstraints::sm_Lower)) {
1619  m_ConstraintType->SetSelection(0);
1620  EnableStringConstraint(true);
1621  SetFieldName(args.at(NMacroArgs::kField));
1622  m_AllLower->SetValue(true);
1623  }
1624  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_StringConstraints::sm_Punct)) {
1625  m_ConstraintType->SetSelection(0);
1626  EnableStringConstraint(true);
1627  SetFieldName(args.at(NMacroArgs::kField));
1628  m_AllPunct->SetValue(true);
1629  }
1630  else if (NStr::EqualNocase(fn_name, macro::CMacroFunction_InTable::GetFuncName())) {
1631  m_ConstraintType->SetSelection(3);
1632  EnableStringConstraint(false);
1633  m_TableSizer->ShowItems(true);
1634 
1635  SetFieldName(args.at(NMacroArgs::kField));
1636  m_Tablename->ChangeValue(ToWxString(args.at(NMacroArgs::kTableName)));
1637  string col = args.at(NMacroArgs::kNewValue);
1638  if (NStr::StartsWith(col, "col:")) {
1639  col = col.substr(CTempString("col:").length(), NPOS);
1640  m_Column->ChangeValue(ToWxString(col));
1641  }
1642  }
1643  else if (NStr::EqualNocase(fn_name, NMFncParse::kComparisonOp) &&
1644  NStr::EqualNocase(fn_it.m_ParentFnc, "in")) {
1645  m_ConstraintType->SetSelection(0);
1646  EnableStringConstraint(true);
1647  if (fn_it.m_Negate) {
1648  m_MatchType->SetSelection(eMatchType_IsNotOneOf);
1649  }
1650  else {
1651  m_MatchType->SetSelection(eMatchType_IsOneOf);
1652  }
1653 
1654  SetFieldName(args.at(NMacroArgs::kField));
1655 
1656  auto match_it = args.find(NMacroArgs::kConstr_Match);
1657  if (match_it != args.end()) {
1658  if (!m_is_choice)
1659  m_MatchText->SetValue(wxString(match_it->second));
1660  else
1661  m_MatchChoice->SetValue(wxString(match_it->second));
1662  }
1663  }
1664  }
1665 }
1666 
1667 template <typename T>
1669 {
1670  CFeatureFieldNamePanel *panel = dynamic_cast<CFeatureFieldNamePanel*>(m_panel);
1671  if (panel) {
1672  panel->ListPresentFeaturesFirst(seh);
1673  }
1674 }
1675 
1676 template <typename T>
1677 void CMacroAdvStringConstraintPanel<T>::SetFieldNames(const vector<string>& field_names)
1678 {
1679  CFieldHandlerNamePanel *panel = dynamic_cast<CFieldHandlerNamePanel*>(m_panel);
1680  if (panel)
1681  panel->SetFieldNames(field_names);
1682 }
1683 
1684 template <typename T>
1685 void CMacroAdvStringConstraintPanel<T>::SetMacroFieldNames(const vector<string>& field_names)
1686 {
1687  CFieldHandlerNamePanel *panel = dynamic_cast<CFieldHandlerNamePanel*>(m_panel);
1688  if (panel)
1689  panel->SetMacroFieldNames(field_names);
1690 }
1691 
1692 template <typename T>
1694 {
1695  CFieldHandlerNamePanel *panel = dynamic_cast<CFieldHandlerNamePanel*>(m_panel);
1696  if (panel)
1697  panel->SetMacroSelf(self);
1698 }
1699 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static vector< string > GetFieldNames()
void ListPresentFeaturesFirst(objects::CSeq_entry_Handle seh, vector< const objects::CFeatListItem * > *featlist=nullptr)
void SetMacroFieldNames(const vector< string > &field_names)
void SetMacroSelf(const string &self)
void SetFieldNames(const vector< string > &field_names)
virtual string GetFieldName(const bool subfield=false)=0
Returns the name of the field as selected in the panel.
virtual string GetMacroFieldName(const string &target, const string &selected_field=kEmptyStr)
virtual vector< string > GetChoices(bool &allow_other)
virtual string GetMacroFieldLabel(const string &target, const string &selected_field=kEmptyStr)
static bool IsFeature(const string &target)
virtual vector< string > GetMacroValues()
Class to store one function as it appears in the macro and its arguments (as GUI fieldnames)
unordered_map< string, string > TInterpretedArgs
Map of control names and corresponding values. It may contain more 'arguments' than the function has.
TInterpretedArgs m_FArgs
string m_FName
Function name as it appears in the macro.
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Add Macro Constraint"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX|wxTAB_TRAVERSAL)
wxBitmap GetBitmapResource(const wxString &name)
wxIcon GetIconResource(const wxString &name)
void OnAccept(wxCommandEvent &event)
vector< EMMatcherPanelType > m_MatchingTypes
pair< string, string > m_target
void SetAndUpdateConstraint(SMacroConstraint &constr)
void SetConstraint(const SMacroConstraint &constr)
void SetStringSelection(const string &sel)
void OnCancel(wxCommandEvent &event)
wxDECLARE_NO_COPY_CLASS(CMacroAdvStringConstraintPanel)
bool Create(wxWindow *parent, wxWindowID id=ID_CADVSTRINGCONSTRAINTPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Creation.
virtual void SetFieldName(const string &field)
virtual void PopulateFeatureListbox(CSeq_entry_Handle seh)
void OnUpdateWordSubstButton(wxUpdateUIEvent &event)
virtual vector< CFuncWithArgs > GetFuncWithArgs(const pair< string, string > &target, size_t num) const
virtual void SetMatcher(const vector< CFuncWithArgs > &func_info)
virtual void SetFieldNames(const vector< string > &field_names)
void CreateControls()
Creates the controls and sizers.
void Init()
Initialises member variables.
string GetTextConstraint(const string &field, size_t num)
CRef< CWord_substitution_set > m_SynonymList
virtual string GetQualName(const pair< string, string > &target)
void OnWordSubstitution(wxCommandEvent &event)
static bool ShowToolTips()
Should we show tooltips?
void SetMacroFieldNames(const vector< string > &field_names)
virtual void GetVars(vector< string > &vars, size_t num)
void OnConstraintType(wxCommandEvent &event)
void OnMatchTypeSelected(wxCommandEvent &event)
virtual void AddWordSubstSet(const string &filename, CRef< CWord_substitution_set > word_subst)
void SetChoices(const vector< string > &choices, const vector< string > &values)
virtual pair< string, string > GetMatcher(const pair< string, string > &target, size_t num)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void x_SetControls(const CFuncWithArgs::TInterpretedArgs &args)
string GetDescription(const string &field)
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 >())
virtual void GetVars(vector< string > &vars, size_t num)
virtual string GetQualName(const pair< string, string > &target)
virtual vector< CFuncWithArgs > GetFuncWithArgs(const pair< string, string > &target, size_t num) const
virtual pair< string, string > GetMatcher(const pair< string, string > &target, size_t num)=0
virtual void SetMatcher(const vector< CFuncWithArgs > &func_info)
static string GetDescription(const objects::CWord_substitution &ws)
void SetSubstitutionList(const CRef< objects::CWord_substitution_set > &subst_list)
static vector< string > GetStrings()
static vector< string > GetMacroFieldNames()
static vector< string > GetFieldNames()
static vector< string > GetMacroFieldNames()
static vector< string > GetMacroFieldNames(bool extended=false)
static vector< string > GetFieldNames(bool extended=false)
CSeq_entry_Handle –.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
CWord_substitution_set –.
#define _(proto)
Definition: ct_nlmzip_i.h:78
#define T(s)
Definition: common.h:230
const char * kDefinitionLineLabel
static void Init(void)
Definition: cursor6.c:76
static const char * str(char *buf, int n)
Definition: stats.c:84
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NULL
Definition: ncbistd.hpp:225
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
void NcbiErrorBox(const string &message, const string &title="Error")
specialized Message Box function for reporting critical errors
string GetLabel(const CSeq_id &id)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static bool StringToBool(const CTempString str)
Convert string to bool.
Definition: ncbistr.cpp:2821
#define kEmptyStr
Definition: ncbistr.hpp:123
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.
Definition: ncbistr.cpp:3461
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
#define NPOS
Definition: ncbistr.hpp:133
static const string BoolToString(bool value)
Convert bool to string.
Definition: ncbistr.cpp:2815
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
Definition: ncbistr.hpp:2697
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
Definition: ncbistr.hpp:5325
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
Definition: ncbistr.hpp:5109
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
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.
Definition: ncbistr.cpp:3405
static const char label[]
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
END_EVENT_TABLE()
int i
#define SYMBOL_CADVSTRINGCONSTRAINTPANEL_STYLE
USING_SCOPE(objects)
#define SYMBOL_CADVSTRINGCONSTRAINTPANEL_IDNAME
#define SYMBOL_CADVSTRINGCONSTRAINTPANEL_POSITION
#define SYMBOL_CADVSTRINGCONSTRAINTPANEL_SIZE
#define wxT(x)
Definition: muParser.cpp:41
const string kComparisonOp
const string kNewValue
const string kConstr_IgnorePunct
const string kConstr_IgnoreWeasel
const string kConstr_SynCaseSens
const string kConstr_StrCaseSens
const string kField
const string kTableName
const string kConstr_SynFile
const string kConstr_WholeWord
const string kConstr_SynWholeWord
const string kConstr_SynMatch
const string kConstr_Match
const string kConstr_IgnoreSpace
void ReportUsage(const wxString &dialog_name, const string &action_name)
Report events in the macro_flow_editor and in the macro_editor.
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
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
EMMatcherPanelType m_MatcherType
string m_Constraint
constraint expression, e.g., Strand() = "plus"
string m_Label
description of the constraint as it is listed in the macro editor
#define _ASSERT
else result
Definition: token2.c:20
wxString GetAbsolutePath(const wxString &localpath)
Definition: wx_utils.cpp:188
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Tue Apr 23 07:38:34 2024 by modify_doxy.py rev. 669887