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

Go to the SVN repository for this file.

1 /* $Id: suspect_product_rule_editor.cpp 47479 2023-05-02 13:24:02Z ucko $
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>
41 #include <serial/objistr.hpp>
46 #include <objmgr/feat_ci.hpp>
48 #include <gui/objutils/utils.hpp>
52 // For compilers that support precompilation, includes "wx/wx.h".
53 #include "wx/wxprec.h"
54 
55 #ifdef __BORLANDC__
56 #pragma hdrstop
57 #endif
58 
59 #ifndef WX_PRECOMP
60 #include "wx/wx.h"
61 #endif
62 
63 #include <wx/filename.h>
64 
66 
67 
68 
70 
71 
72 IMPLEMENT_DYNAMIC_CLASS( CSuspectProductRulesEditor, wxFrame )
73 
74 
75 /*!
76  * CSuspectProductRulesEditor event table definition
77  */
78 
79 
80 BEGIN_EVENT_TABLE( CSuspectProductRulesEditor, wxFrame )
100 
101 
102 /*!
103  * CSuspectProductRulesEditor constructors
104  */
105 
107 {
108  Init();
109 }
110 
111 
113  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
114  : m_Workbench(workbench)
115 {
116  Init();
117  Create(parent, id, caption, pos, size, style);
119 }
120 
121 
122 bool CSuspectProductRulesEditor::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
123 {
124 ////@begin CSuspectProductRulesEditor creation
125 // SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
126  wxFrame::Create( parent, id, caption, pos, size, style );
127 
128  CreateControls();
129  if (GetSizer())
130  {
131  GetSizer()->SetSizeHints(this);
132  }
133 
134  Centre(wxBOTH|wxCENTRE_ON_SCREEN);
135 ////@end CSuspectProductRulesEditor creation
136 
137  return true;
138 }
139 
140 
141 /*!
142  * CSuspectProductRulesEditor destructor
143  */
144 
146 {
147 ////@begin CSuspectProductRulesEditor destruction
148 ////@end CSuspectProductRulesEditor destruction
149 }
150 
151 
152 /*!
153  * Member initialisation
154  */
155 
157 {
158  m_Panel = NULL;
160 }
161 
162 
163 /*!
164  * Control creation for CSuspectProductRulesEditor
165  */
166 
168 {
169  wxMenuBar *menubar = new wxMenuBar();
170  wxMenu *file_menu = new wxMenu();
171  menubar->Append(file_menu, wxT("&File"));
172 
173  wxMenuItem *load_item = new wxMenuItem(file_menu, ID_LOAD_RULE_LIST_MENU, _("Load Rule List"));
174  file_menu->Append(load_item);
175 
176  wxMenuItem *add_item = new wxMenuItem(file_menu, ID_ADD_RULE_LIST_MENU, _("Add Rules from File to List"));
177  file_menu->Append(add_item);
178 
179  wxMenuItem *save_item = new wxMenuItem(file_menu, ID_SAVE_RULE_LIST_MENU, _("Save Rule List"));
180  file_menu->Append(save_item);
181 
182  wxMenuItem *save_as_item = new wxMenuItem(file_menu, ID_SAVE_AS_RULE_LIST_MENU, _("Save As"));
183  file_menu->Append(save_as_item);
184 
185  wxMenuItem *separator = new wxMenuItem(file_menu);
186  file_menu->Append(separator);
187 
188  wxMenuItem *quit_item = new wxMenuItem(file_menu, ID_QUIT_RULE_LIST_MENU, _("Quit"));
189  file_menu->Append(quit_item);
190 
191  wxMenu *sort_menu = new wxMenu();
192  menubar->Append(sort_menu, wxT("&Sort"));
193 
194  wxMenuItem *by_find_item = new wxMenuItem(sort_menu, ID_SORT_FIND_RULE_LIST_MENU, _("By Find"));
195  sort_menu->Append(by_find_item);
196 
197  wxMenuItem *by_cat_item = new wxMenuItem(sort_menu, ID_SORT_CAT_RULE_LIST_MENU, _("By Category, then Find"));
198  sort_menu->Append(by_cat_item);
199 
200  SetMenuBar(menubar);
201 
202  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxVERTICAL);
203  SetSizer(itemBoxSizer1);
204 
205  wxPanel *Dialog1 = new wxPanel(this, wxID_ANY);
206  itemBoxSizer1->Add(Dialog1, 1, wxGROW, 0);
207 
208  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
209  Dialog1->SetSizer(itemBoxSizer2);
210 
211  wxArrayInt order;
212  wxArrayString items;
213 
214  wxBoxSizer *BoxSizer = new wxBoxSizer(wxHORIZONTAL);
215  itemBoxSizer2->Add(BoxSizer, 1, wxGROW|wxALL, 5);
216  m_Panel = new CRearrangeCtrl(Dialog1, wxID_ANY, wxDefaultPosition, wxSize(-1, 350), order, items);
217  BoxSizer->Add(m_Panel, 1, wxGROW|wxALL, 5);
220 
221  wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL);
222  itemBoxSizer2->Add(itemBoxSizer11, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
223 
224  wxButton *button7 = new wxButton( Dialog1, ID_ADD_BEFORE_RULE_LIST_BUTTON, _("Add Before"), wxDefaultPosition, wxDefaultSize, 0 );
225  itemBoxSizer11->Add(button7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
226 
227  wxButton *button8 = new wxButton( Dialog1, ID_ADD_AFTER_RULE_LIST_BUTTON, _("Add After"), wxDefaultPosition, wxDefaultSize, 0 );
228  itemBoxSizer11->Add(button8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
229 
230  m_DeleteButton = new wxButton( Dialog1, ID_DELETE_SELECTED_RULE_LIST_BUTTON, _("Delete Selected"), wxDefaultPosition, wxDefaultSize, 0 );
231  itemBoxSizer11->Add(m_DeleteButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
232  m_DeleteButton->Disable();
233 
234  wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
235  itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
236 
237  wxButton *button1 = new wxButton( Dialog1, ID_LIST_MATCHES_RULE_LIST_BUTTON, _("List current matches"), wxDefaultPosition, wxDefaultSize, 0 );
238  itemBoxSizer12->Add(button1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
239 
240  wxButton *button2 = new wxButton( Dialog1, ID_APPLY_FIXES_RULE_LIST_BUTTON, _("Apply fixes"), wxDefaultPosition, wxDefaultSize, 0 );
241  itemBoxSizer12->Add(button2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
242 
243  wxButton *button5 = new wxButton( Dialog1, ID_SHOW_DIFFS_RULE_LIST_BUTTON, _("Show diffs with other file"), wxDefaultPosition, wxDefaultSize, 0 );
244  itemBoxSizer12->Add(button5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
245 
246  wxButton *button6 = new wxButton( Dialog1, ID_DISPLAY_TEXT_RULE_LIST_BUTTON, _("Display Rule Text"), wxDefaultPosition, wxDefaultSize, 0 );
247  itemBoxSizer12->Add(button6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
248 }
249 
250 
251 /*!
252  * Should we show tooltips?
253  */
254 
256 {
257  return true;
258 }
259 
260 /*!
261  * Get bitmap resources
262  */
263 
264 wxBitmap CSuspectProductRulesEditor::GetBitmapResource( const wxString& name )
265 {
266  // Bitmap retrieval
267  wxUnusedVar(name);
268  return wxNullBitmap;
269 }
270 
271 /*!
272  * Get icon resources
273  */
274 
275 wxIcon CSuspectProductRulesEditor::GetIconResource( const wxString& name )
276 {
277  // Icon retrieval
278  wxUnusedVar(name);
279  return wxNullIcon;
280 }
281 
282 void CSuspectProductRulesEditor::OnFileLoad( wxCommandEvent& event )
283 {
284  wxFileDialog file(this, wxT("Load Rule List"), m_DefaultDir, wxEmptyString, CFileExtensions::GetDialogFilter(CFileExtensions::kAllFiles), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
285  if (file.ShowModal() != wxID_OK)
286  return;
287 
288  m_File = file.GetPath();
289  if (m_File.IsEmpty())
290  return;
291  wxFileName filename(m_File);
292  m_DefaultDir = filename.GetPath();
293 
295  unique_ptr<CObjectIStream> obj_str(CObjectIStream::Open(eSerial_AsnText, m_File.ToStdString()));
296  obj_str->Read(ObjectInfo(*rule_set));
297  obj_str->Close();
298 
299  if (!rule_set->IsSet())
300  return;
301 
302  m_Rules.clear();
303  wxArrayInt order;
304  wxArrayString items;
305  int i = 0;
306  for (const auto &rule : rule_set->Get())
307  {
308  items.Add(wxString(rule->SummarizeRule()));
309  order.Add(~i);
310  m_Rules.push_back(rule);
311  i++;
312  }
313  CRearrangeList *list = m_Panel->GetList();
314  list->Set(order, items);
315  m_DeleteButton->Disable();
316 }
317 
318 void CSuspectProductRulesEditor::OnFileAdd( wxCommandEvent& event )
319 {
320  wxFileDialog file(this, wxT("Add Rule List"), m_DefaultDir, wxEmptyString, CFileExtensions::GetDialogFilter(CFileExtensions::kAllFiles), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
321  if (file.ShowModal() != wxID_OK)
322  return;
323 
324  wxString filepath = file.GetPath();
325  if (filepath.IsEmpty())
326  return;
327  wxFileName filename(filepath);
328  m_DefaultDir = filename.GetPath();
329 
331  unique_ptr<CObjectIStream> obj_str(CObjectIStream::Open(eSerial_AsnText, filepath.ToStdString()));
332  obj_str->Read(ObjectInfo(*rule_set));
333  obj_str->Close();
334 
335  if (!rule_set->IsSet())
336  return;
337 
338  CRearrangeList *list = m_Panel->GetList();
339 
340  wxArrayInt order = list->GetCurrentOrder();
341  wxArrayString items;
342  for (auto i : order)
343  {
344  if ( i < 0 )
345  i = -i - 1;
346  const auto rule = m_Rules[i];
347  items.Add(rule->SummarizeRule());
348  }
349  int i = static_cast<int>(order.size());
350  for (const auto rule : rule_set->Get())
351  {
352  items.Add(wxString(rule->SummarizeRule()));
353  order.Add(~i);
354  m_Rules.push_back(rule);
355  i++;
356  }
357  list->Set(order, items);
358 }
359 
360 void CSuspectProductRulesEditor::CanFileSave(wxUpdateUIEvent &event)
361 {
362  event.Enable(!m_File.IsEmpty() && !m_Rules.empty());
363 }
364 
365 void CSuspectProductRulesEditor::OnFileSave( wxCommandEvent& event )
366 {
367  if (m_File.IsEmpty() || m_Rules.empty())
368  return;
369 
371  CRearrangeList *list = m_Panel->GetList();
372  wxArrayInt order = list->GetCurrentOrder();
373  for (auto i : order)
374  {
375  if ( i < 0 )
376  i = -i - 1;
377  const auto rule = m_Rules[i];
378  rule_set->Set().push_back(rule);
379  }
380  CNcbiOfstream os(m_File.fn_str(), ios::out);
381  os << MSerial_AsnText << *rule_set;
382 }
383 
384 void CSuspectProductRulesEditor::CanFileSaveAs(wxUpdateUIEvent &event)
385 {
386  event.Enable(!m_Rules.empty());
387 }
388 
389 void CSuspectProductRulesEditor::OnFileSaveAs( wxCommandEvent& event )
390 {
391  if (m_Rules.empty())
392  return;
393 
394  wxFileDialog file(this, wxT("Save As"), m_DefaultDir, wxEmptyString, CFileExtensions::GetDialogFilter(CFileExtensions::kAllFiles), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
395  if (file.ShowModal() != wxID_OK)
396  return;
397 
398  m_File = file.GetPath();
399  if (m_File.IsEmpty())
400  return;
401  wxFileName filename(m_File);
402  m_DefaultDir = filename.GetPath();
403 
405  CRearrangeList *list = m_Panel->GetList();
406  wxArrayInt order = list->GetCurrentOrder();
407  for (auto i : order)
408  {
409  if ( i < 0 )
410  i = -i - 1;
411  const auto rule = m_Rules[i];
412  rule_set->Set().push_back(rule);
413  }
414  CNcbiOfstream os(m_File.fn_str(), ios::out);
415  os << MSerial_AsnText << *rule_set;
416 }
417 
418 void CSuspectProductRulesEditor::OnQuit( wxCommandEvent& event )
419 {
420  Close();
421 }
422 
423 void CSuspectProductRulesEditor::CanSort(wxUpdateUIEvent &event)
424 {
425  event.Enable(!m_Rules.empty());
426 }
427 
428 static string s_GetFind( CRef<CSuspect_rule> rule)
429 {
430  string str;
431  if (rule->IsSetFind())
432  {
434  {
436  }
437  if (rule->GetFind().IsPrefix_and_numbers())
438  {
439  str = rule->GetFind().GetPrefix_and_numbers();
440  }
441  if (rule->GetFind().IsHas_term())
442  {
443  str = rule->GetFind().GetHas_term();
444  }
445  }
446 
447  return NStr::ToLower(str);
448 }
449 
451 {
452 public:
453  CCompareByFind(const vector< CRef<CSuspect_rule> > &rules) : m_Rules(rules) {}
454  bool operator()(const int &a, const int& b)
455  {
456  int i = a;
457  int j = b;
458  if ( i < 0 )
459  i = -i - 1;
460  const auto rule1 = m_Rules[i];
461  if ( j < 0 )
462  j = -j - 1;
463  const auto rule2 = m_Rules[j];
464  string str1 = s_GetFind(rule1);
465  string str2 = s_GetFind(rule2);
466  return str1 < str2;
467  }
468 private:
469  const vector< CRef<CSuspect_rule> > &m_Rules;
470 };
471 
472 void CSuspectProductRulesEditor::OnSortByFind( wxCommandEvent& event )
473 {
474  if (m_Rules.empty())
475  return;
476  CRearrangeList *list = m_Panel->GetList();
477  wxArrayInt order = list->GetCurrentOrder();
478  stable_sort(order.begin(), order.end(), CCompareByFind(m_Rules));
479  wxArrayString items;
480  for (const auto &rule : m_Rules)
481  {
482  items.Add(wxString(rule->SummarizeRule()));
483  }
484  list->Set(order, items);
485 }
486 
488 {
489 public:
490  CCompareByCat(const vector< CRef<CSuspect_rule> > &rules) : m_Rules(rules) {}
491  bool operator()(const int &a, const int& b)
492  {
493  int i = a;
494  int j = b;
495  if ( i < 0 )
496  i = -i - 1;
497  const auto rule1 = m_Rules[i];
498  if ( j < 0 )
499  j = -j - 1;
500  const auto rule2 = m_Rules[j];
501  pair<string, string> pair1 = make_pair(rule1->GetRuleTypeName(), s_GetFind(rule1));
502  pair<string, string> pair2 = make_pair(rule2->GetRuleTypeName(), s_GetFind(rule2));
503  return pair1 < pair2;
504  }
505 private:
506  const vector< CRef<CSuspect_rule> > &m_Rules;
507 };
508 
509 void CSuspectProductRulesEditor::OnSortByCat( wxCommandEvent& event )
510 {
511  if (m_Rules.empty())
512  return;
513  CRearrangeList *list = m_Panel->GetList();
514  wxArrayInt order = list->GetCurrentOrder();
515  stable_sort(order.begin(), order.end(), CCompareByCat(m_Rules));
516  wxArrayString items;
517  for (const auto &rule : m_Rules)
518  {
519  items.Add(wxString(rule->SummarizeRule()));
520  }
521  list->Set(order, items);
522 }
523 
524 void CSuspectProductRulesEditor::OnDisplay( wxCommandEvent& event )
525 {
526  if (m_Rules.empty())
527  return;
528  CRearrangeList *list = m_Panel->GetList();
529  wxArrayInt order = list->GetCurrentOrder();
530  wxString msg;
531  for (auto i : order)
532  {
533  if ( i < 0 )
534  i = -i - 1;
535  const auto rule = m_Rules[i];
536  string summary = rule->SummarizeRule();
537  msg << summary << "\n";
538  }
539  if (msg.IsEmpty())
540  return;
541  CGenericReportDlg* report = new CGenericReportDlg(this);
542  report->SetTitle(wxT("Suspect Rule Descriptions"));
543  report->SetText(msg);
544  report->Show(true);
545 }
546 
547 
548 void CSuspectProductRulesEditor::OnShowDiffs( wxCommandEvent& event )
549 {
550  CRearrangeList *list = m_Panel->GetList();
551  wxArrayInt order = list->GetCurrentOrder();
552  set<string> current;
553  for (auto i : order)
554  {
555  if ( i < 0 )
556  i = -i - 1;
557  const auto rule = m_Rules[i];
558  current.insert(rule->SummarizeRule());
559  }
560 
561  wxFileDialog file(this, wxT("Open Rule List"), m_DefaultDir, wxEmptyString, CFileExtensions::GetDialogFilter(CFileExtensions::kAllFiles), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
562  if (file.ShowModal() != wxID_OK)
563  return;
564 
565  wxString path = file.GetPath();
566  if (path.IsEmpty())
567  return;
568  wxFileName filename(path);
569  m_DefaultDir = filename.GetPath();
570 
572  unique_ptr<CObjectIStream> obj_str(CObjectIStream::Open(eSerial_AsnText, path.ToStdString()));
573  obj_str->Read(ObjectInfo(*rule_set));
574  obj_str->Close();
575 
576  if (!rule_set->IsSet())
577  return;
578 
579  set<string> remote;
580  for (const auto &rule : rule_set->Get())
581  {
582  remote.insert(rule->SummarizeRule());
583  }
584  vector<string> current_minus_remote(current.size());
585  vector<string> remote_minus_current(remote.size());
586  set_difference(current.begin(), current.end(), remote.begin(), remote.end(), current_minus_remote.begin());
587  set_difference(remote.begin(), remote.end(), current.begin(), current.end(), remote_minus_current.begin());
588 
589  wxString msg1;
590  for (const auto &s : current_minus_remote)
591  {
592  msg1 << s << "\n";
593  }
594  wxString msg2;
595  for (const auto &s : remote_minus_current)
596  {
597  msg2 << s << "\n";
598  }
599 
600  CGenericReportDlg* report1 = new CGenericReportDlg(this);
601  report1->SetTitle(_("Found in current list but not ") + path);
602  report1->SetText(msg1);
603  report1->Show(true);
604 
605  CGenericReportDlg* report2 = new CGenericReportDlg(this);
606  report2->SetTitle(_("Found in ") + path + _(" but not in current list"));
607  report2->SetText(msg2);
608  report2->Show(true);
609 
610 }
611 
613 {
614  if (!rule->IsSetFeat_constraint())
615  return true;
616  if (!rule->GetFeat_constraint().IsSet())
617  return true;
618  if (rule->GetFeat_constraint().Get().empty())
619  return true;
620  for (auto c : rule->GetFeat_constraint().Get())
621  {
622  if (!c->IsString())
623  continue;
624  if (!c->GetString().Match(str))
625  return false;
626  }
627  return true;
628 }
629 
630 void CSuspectProductRulesEditor::OnApplyFixes( wxCommandEvent& event )
631 {
633 
634  if (!m_TopSeqEntry || !m_CmdProcessor)
635  return;
636  wxBusyCursor wait;
637  CRef<CCmdComposite> composite( new CCmdComposite("Fix Product Names") );
638  bool any_modified = false;
639  for (CFeat_CI feat_ci(m_TopSeqEntry); feat_ci; ++feat_ci)
640  {
641  const CSeq_feat& orig = feat_ci->GetOriginalFeature();
642  CRef<CSeq_feat> new_feat(new CSeq_feat());
643  new_feat->Assign(orig);
644  bool modified = false;
645  if (new_feat->IsSetData() && new_feat->GetData().IsProt() && new_feat->GetData().GetProt().IsSetName())
646  {
647  EDIT_EACH_NAME_ON_PROTREF(name, new_feat->SetData().SetProt())
648  {
649  string new_name = *name;
650  for (auto rule : m_Rules)
651  {
652  if (MatchConstraint(rule, new_name))
653  rule->ApplyToString(new_name);
654  }
655 
656  modified |= new_name != *name;
657  *name = new_name;
658  }
659  }
660 
661  if (new_feat->IsSetData() && new_feat->GetData().IsRna() && new_feat->GetData().GetRna().IsSetExt() && new_feat->GetData().GetRna().GetExt().IsName() &&
662  new_feat->GetData().GetRna().IsSetType() && new_feat->GetData().GetRna().GetType() == CRNA_ref::eType_mRNA)
663  {
664  string new_name = new_feat->GetData().GetRna().GetExt().GetName();
665  for (auto rule : m_Rules)
666  {
667  if (MatchConstraint(rule, new_name))
668  rule->ApplyToString(new_name);
669  }
670  modified |= new_name != new_feat->GetData().GetRna().GetExt().GetName();
671  new_feat->SetData().SetRna().SetExt().SetName() = new_name;
672  }
673  /*
674  if (new_feat->IsSetData() && new_feat->GetData().IsRna() && new_feat->GetData().GetRna().IsSetExt() && new_feat->GetData().GetRna().GetExt().IsGen() && new_feat->GetData().GetRna().GetExt().GetGen().IsSetProduct())
675  {
676  string new_name = new_feat->GetData().GetRna().GetExt().GetGen().GetProduct();
677  for (auto rule : m_Rules)
678  {
679  if (MatchConstraint(rule, new_name))
680  rule->ApplyToString(new_name);
681  }
682  modified |= new_name != new_feat->GetData().GetRna().GetExt().GetGen().GetProduct();
683  new_feat->SetData().SetRna().SetExt().SetGen().SetProduct() = new_name;
684  }
685  */
686  if (modified)
687  {
688  composite->AddCommand(*CRef<CCmdChangeSeq_feat>(new CCmdChangeSeq_feat(feat_ci->GetSeq_feat_Handle(), *new_feat)));
689  any_modified = true;
690  }
691  }
692 
693  if (any_modified)
694  m_CmdProcessor->Execute(composite);
695 }
696 
697 void CSuspectProductRulesEditor::OnListMatches( wxCommandEvent& event )
698 {
700 
701  if (!m_TopSeqEntry)
702  return;
703  CScope &scope = m_TopSeqEntry.GetScope();
704  wxBusyCursor wait;
705  map<string, vector<string> > affected;
706  for (CFeat_CI feat_ci(m_TopSeqEntry); feat_ci; ++feat_ci)
707  {
708  const CSeq_feat& feat = feat_ci->GetOriginalFeature();
709  if (feat.IsSetData() && feat.GetData().IsProt() && feat.GetData().GetProt().IsSetName())
710  {
712  {
713  for (auto rule : m_Rules)
714  {
715  if (rule->StringMatchesSuspectProductRule(*name) && MatchConstraint(rule, *name))
716  {
717  affected[rule->SummarizeRule()].push_back(edit::GetTextObjectDescription(feat, scope));
718  }
719  }
720  }
721  }
722 
723  if (feat.IsSetData() && feat.GetData().IsRna() && feat.GetData().GetRna().IsSetExt() && feat.GetData().GetRna().GetExt().IsName() &&
724  feat.GetData().GetRna().IsSetType() && feat.GetData().GetRna().GetType() == CRNA_ref::eType_mRNA)
725  {
726  const string &name = feat.GetData().GetRna().GetExt().GetName();
727  for (auto rule : m_Rules)
728  {
729  if (rule->StringMatchesSuspectProductRule(name) && MatchConstraint(rule, name))
730  {
731  affected[rule->SummarizeRule()].push_back(edit::GetTextObjectDescription(feat, scope));
732  }
733  }
734  }
735  /*
736  if (feat.IsSetData() && feat.GetData().IsRna() && feat.GetData().GetRna().IsSetExt() && feat.GetData().GetRna().GetExt().IsGen() && feat.GetData().GetRna().GetExt().GetGen().IsSetProduct())
737  {
738  const string &name = feat.GetData().GetRna().GetExt().GetGen().GetProduct();
739  for (auto rule : m_Rules)
740  {
741  if (rule->StringMatchesSuspectProductRule(name) && MatchConstraint(rule, name))
742  {
743  affected[rule->SummarizeRule()].push_back(NDiscrepancy::CReportObj::GetTextObjectDescription(feat, scope));
744  }
745  }
746  }
747  */
748  }
749 
750  wxString msg;
751  CRearrangeList *list = m_Panel->GetList();
752  wxArrayInt order = list->GetCurrentOrder();
753  for (auto i : order)
754  {
755  if ( i < 0 )
756  i = -i - 1;
757  const auto rule = m_Rules[i];
758  const auto it = affected.find(rule->SummarizeRule());
759  if (it != affected.end() && !it->second.empty())
760  {
761  msg << it->first << ":" << it->second.size() << "\n";
762  for (const auto &s : it->second)
763  {
764  msg << "\t" << s << "\n";
765  }
766  }
767  }
768 
769  CGenericReportDlg* report = new CGenericReportDlg(this);
770  report->SetTitle(wxT("Suspect Rule Matches"));
771  report->SetText(msg);
772  report->Show(true);
773 }
774 
776 {
777  m_TopSeqEntry.Reset();
779  if (!m_Workbench)
780  return;
781 
783  if (!service)
784  return;
785 
787  service->GetActiveObjects(objects);
788  if (objects.empty())
789  {
791  }
792 
793  if (objects.empty())
794  return;
795 
797  {
798  if (!m_TopSeqEntry)
799  {
801  if (seh)
802  {
803  m_TopSeqEntry = seh;
804  break;
805  }
806  }
807  }
808 
809  if (!m_TopSeqEntry)
810  return;
812  if (!srv)
813  return;
814 
815  CRef<CGBWorkspace> ws = srv->GetGBWorkspace();
816  if (!ws)
817  return;
818 
819  CGBDocument* doc = dynamic_cast<CGBDocument*>(ws->GetProjectFromScope(m_TopSeqEntry.GetScope()));
820  if (doc)
821  m_CmdProcessor = &doc->GetUndoManager();
822 }
823 
824 void CSuspectProductRulesEditor::OnDeleteRules( wxCommandEvent& event )
825 {
826  CRearrangeList *list = m_Panel->GetList();
827  wxArrayInt order = list->GetCurrentOrder();
828  set<int> to_delete;
829  vector<size_t> rule_to_order(order.size());
830  for (size_t i = 0; i < order.size(); i++)
831  {
832  int j = order[i];
833  if ( j >= 0 )
834  {
835  to_delete.insert(j);
836  }
837  else
838  {
839  j = -j - 1;
840  }
841  rule_to_order[j] = i;
842  }
843  if (to_delete.empty())
844  return;
845 
846  vector< CRef<CSuspect_rule> > rules;
847  for (size_t i = 0; i < m_Rules.size(); i++)
848  {
849  if (to_delete.find(static_cast<int>(i)) == to_delete.end())
850  {
851  size_t j = rule_to_order[i];
852  int k = static_cast<int>(rules.size());
853  order[j] = ~k;
854  rules.push_back(m_Rules[i]);
855  }
856  }
857  swap(rules, m_Rules);
858 
859  wxArrayInt new_order;
860  for (size_t i = 0; i < order.size(); i++)
861  {
862  if (order[i] < 0)
863  new_order.Add(order[i]);
864  }
865  swap(order, new_order);
866 
867  wxArrayString items;
868  for (const auto &rule : m_Rules)
869  {
870  items.Add(wxString(rule->SummarizeRule()));
871  }
872  list->Set(order, items);
873  m_DeleteButton->Disable();
874 }
875 
877 {
878  if (checked > 0)
879  m_DeleteButton->Enable();
880  else
881  m_DeleteButton->Disable();
882 }
883 
884 void CSuspectProductRulesEditor::OnAddRuleBefore( wxCommandEvent& event )
885 {
888  dlg->Show(true);
889 }
890 
891 void CSuspectProductRulesEditor::OnAddRuleAfter( wxCommandEvent& event )
892 {
895  dlg->Show(true);
896 }
897 
899 {
900  m_Rules.push_back(rule);
901  CRearrangeList *list = m_Panel->GetList();
902  wxArrayInt order = list->GetCurrentOrder();
903  int sel = list->GetSelection();
904  if (sel == wxNOT_FOUND)
905  {
906  sel = 0;
907  if (!before && !order.empty())
908  sel = static_cast<int>(order.size() - 1);
909  }
910  wxArrayInt new_order;
911  for (size_t i = 0; i < sel; i++)
912  new_order.Add(order[i]);
913  if (before)
914  {
915  new_order.Add(~(static_cast<int>(m_Rules.size() - 1)));
916  if (!order.empty())
917  new_order.Add(order[sel]);
918  }
919  else
920  {
921  if (!order.empty())
922  new_order.Add(order[sel]);
923  new_order.Add(~(static_cast<int>(m_Rules.size() - 1)));
924  }
925  for (size_t i = sel + 1; i < order.size(); i++)
926  new_order.Add(order[i]);
927 
928  wxArrayString items;
929  for (const auto &rule : m_Rules)
930  {
931  items.Add(wxString(rule->SummarizeRule()));
932  }
933  list->Set(new_order, items);
934  list->EnsureVisible(sel);
935 }
936 
938 {
939  vector< CRef<CSuspect_rule> > new_rules;
940  for (size_t i = 0; i < n; i++)
941  new_rules.push_back(m_Rules[i]);
942  new_rules.push_back(rule);
943  for (size_t i = n + 1; i < m_Rules.size(); i++)
944  new_rules.push_back(m_Rules[i]);
945  swap(m_Rules, new_rules);
946 
947  CRearrangeList *list = m_Panel->GetList();
948  wxArrayInt order = list->GetCurrentOrder();
949 
950  wxArrayString items;
951  for (const auto &rule : m_Rules)
952  {
953  items.Add(wxString(rule->SummarizeRule()));
954  }
955  list->Set(order, items);
956  list-> EnsureVisible(n);
957 }
958 
960 {
962  CRearrangeList *list = m_Panel->GetList();
963  wxArrayInt order = list->GetCurrentOrder();
964  int i = order[n];
965  if ( i < 0 )
966  i = -i - 1;
967  CRef<CSuspect_rule> rule = m_Rules[i];
969  dlg->SetRule(rule, i);
970  dlg->Show(true);
971 }
972 
973 
974 IMPLEMENT_DYNAMIC_CLASS( CAddSuspectProductRule, wxFrame )
975 
976 BEGIN_EVENT_TABLE( CAddSuspectProductRule, wxFrame )
977 
978 ////@begin CAddSuspectProductRule event table entries
979  EVT_BUTTON( wxID_OK, CAddSuspectProductRule::OnAccept )
980  EVT_BUTTON( wxID_CANCEL, CAddSuspectProductRule::OnCancel )
981 ////@end CAddSuspectProductRule event table entries
982 
984 
986 {
987  Init();
988 }
989 
990 CAddSuspectProductRule::CAddSuspectProductRule( wxWindow* parent, bool before, objects::CSeq_entry_Handle seh, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
991  : m_before(before), m_replace(false), m_TopSeqEntry(seh)
992 {
993  Init();
994  Create(parent, id, caption, pos, size, style);
995 }
996 
997 bool CAddSuspectProductRule::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
998 {
999 ////@begin CAddSuspectProductRule creation
1000  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1001  wxFrame::Create( parent, id, caption, pos, size, style );
1002 
1003  CreateControls();
1004  if (GetSizer())
1005  {
1006  GetSizer()->SetSizeHints(this);
1007  }
1008  Centre(wxBOTH|wxCENTRE_ON_SCREEN);
1009 ////@end CAddSuspectProductRule creation
1010  return true;
1011 }
1012 
1014 {
1015 ////@begin CAddSuspectProductRule destruction
1016 ////@end CAddSuspectProductRule destruction
1017 }
1018 
1020 {
1021 ////@begin CAddSuspectProductRule member initialisation
1022 ////@end CAddSuspectProductRule member initialisation
1023 }
1024 
1026 {
1027  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxVERTICAL);
1028  SetSizer(itemBoxSizer1);
1029 
1030  wxPanel* itemDialog1 = new wxPanel(this, wxID_ANY);
1031  itemBoxSizer1->Add(itemDialog1, 1, wxGROW, 0);
1032 
1033  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
1034  itemDialog1->SetSizer(itemBoxSizer2);
1035 
1037  wxArrayString type_str;
1038  for (CEnumeratedTypeValues::TValues::const_iterator i = type_values.begin(); i != type_values.end(); ++i)
1039  {
1040  type_str.Add(wxString(i->first));
1041  }
1042  m_Type = new wxChoice(itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, type_str, 0,wxDefaultValidator);
1043  itemBoxSizer2->Add(m_Type, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1044  m_Type->SetSelection(0);
1045 
1046  wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Where Product Matches"));
1047  wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL);
1048  itemBoxSizer2->Add(itemStaticBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1049 
1050  m_Matches = new wxChoicebook(itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCHB_TOP);
1051  itemStaticBoxSizer4->Add(m_Matches, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1052 
1054  m_Matches->AddPage(panel1_1,_("String constraint"));
1055 
1056  CRef<CSearch_func> search_func;
1057 
1058  search_func.Reset(new CSearch_func);
1059  search_func->SetContains_plural();
1060  CMacroBlankConstraintPanel* panel1_2 = new CMacroBlankConstraintPanel(m_Matches, search_func);
1061  m_Matches->AddPage(panel1_2,_("Contains Plural"));
1062 
1063  search_func.Reset(new CSearch_func);
1064  search_func->SetN_or_more_brackets_or_parentheses();
1066  m_Matches->AddPage(panel1_3,_("N or more brackets or parenthesis"));
1067 
1068  search_func.Reset(new CSearch_func);
1069  search_func->SetThree_numbers();
1070  CMacroBlankConstraintPanel* panel1_4 = new CMacroBlankConstraintPanel(m_Matches, search_func);
1071  m_Matches->AddPage(panel1_4,_("Three numbers"));
1072 
1073  search_func.Reset(new CSearch_func);
1074  search_func->SetUnderscore();
1075  CMacroBlankConstraintPanel* panel1_5 = new CMacroBlankConstraintPanel(m_Matches, search_func);
1076  m_Matches->AddPage(panel1_5,_("Contains underscore"));
1077 
1078  search_func.Reset(new CSearch_func);
1079  search_func->SetPrefix_and_numbers();
1080  CMacroStrConstraintPanel* panel1_6 = new CMacroStrConstraintPanel(m_Matches, search_func, &search_func->SetPrefix_and_numbers());
1081  m_Matches->AddPage(panel1_6,_("Is prefix and numbers"));
1082 
1083  search_func.Reset(new CSearch_func);
1084  search_func->SetAll_caps();
1085  CMacroBlankConstraintPanel* panel1_7 = new CMacroBlankConstraintPanel(m_Matches, search_func);
1086  m_Matches->AddPage(panel1_7,_("Is all caps"));
1087 
1088  search_func.Reset(new CSearch_func);
1089  search_func->SetUnbalanced_paren();
1090  CMacroBlankConstraintPanel* panel1_8 = new CMacroBlankConstraintPanel(m_Matches, search_func);
1091  m_Matches->AddPage(panel1_8,_("Contains unbalanced parenthesis"));
1092 
1093  search_func.Reset(new CSearch_func);
1094  search_func->SetToo_long();
1095  CMacroIntConstraintPanel* panel1_9 = new CMacroIntConstraintPanel(m_Matches, search_func, &search_func->SetToo_long());
1096  m_Matches->AddPage(panel1_9,_("Is too long"));
1097 
1098  search_func.Reset(new CSearch_func);
1099  search_func->SetHas_term();
1100  CMacroStrConstraintPanel* panel1_10 = new CMacroStrConstraintPanel(m_Matches, search_func, &search_func->SetHas_term());
1101  m_Matches->AddPage(panel1_10,_("Contains special term"));
1102 
1103  wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemDialog1, wxID_ANY, _("But Product does not Match"));
1104  wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL);
1105  itemBoxSizer2->Add(itemStaticBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1106 
1107  m_DoesNotMatch = new wxChoicebook(itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCHB_TOP);
1108  itemStaticBoxSizer5->Add(m_DoesNotMatch, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1109 
1111  m_DoesNotMatch->AddPage(panel2_1,_("String constraint"));
1112 
1113  search_func.Reset(new CSearch_func);
1114  search_func->SetContains_plural();
1116  m_DoesNotMatch->AddPage(panel2_2,_("Contains Plural"));
1117 
1118  search_func.Reset(new CSearch_func);
1119  search_func->SetN_or_more_brackets_or_parentheses();
1121  m_DoesNotMatch->AddPage(panel2_3,_("N or more brackets or parenthesis"));
1122 
1123  search_func.Reset(new CSearch_func);
1124  search_func->SetThree_numbers();
1126  m_DoesNotMatch->AddPage(panel2_4,_("Three numbers"));
1127 
1128  search_func.Reset(new CSearch_func);
1129  search_func->SetUnderscore();
1131  m_DoesNotMatch->AddPage(panel2_5,_("Contains underscore"));
1132 
1133  search_func.Reset(new CSearch_func);
1134  search_func->SetPrefix_and_numbers();
1135  CMacroStrConstraintPanel* panel2_6 = new CMacroStrConstraintPanel(m_DoesNotMatch, search_func, &search_func->SetPrefix_and_numbers());
1136  m_DoesNotMatch->AddPage(panel2_6,_("Is prefix and numbers"));
1137 
1138  search_func.Reset(new CSearch_func);
1139  search_func->SetAll_caps();
1141  m_DoesNotMatch->AddPage(panel2_7,_("Is all caps"));
1142 
1143  search_func.Reset(new CSearch_func);
1144  search_func->SetUnbalanced_paren();
1146  m_DoesNotMatch->AddPage(panel2_8,_("Contains unbalanced parenthesis"));
1147 
1148  search_func.Reset(new CSearch_func);
1149  search_func->SetToo_long();
1150  CMacroIntConstraintPanel* panel2_9 = new CMacroIntConstraintPanel(m_DoesNotMatch, search_func, &search_func->SetToo_long());
1151  m_DoesNotMatch->AddPage(panel2_9,_("Is too long"));
1152 
1153  search_func.Reset(new CSearch_func);
1154  search_func->SetHas_term();
1155  CMacroStrConstraintPanel* panel2_10 = new CMacroStrConstraintPanel(m_DoesNotMatch, search_func, &search_func->SetHas_term());
1156  m_DoesNotMatch->AddPage(panel2_10,_("Contains special term"));
1157 
1158  wxStaticBox* itemStaticBoxSizer6Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Replacement Action"));
1159  wxStaticBoxSizer* itemStaticBoxSizer6 = new wxStaticBoxSizer(itemStaticBoxSizer6Static, wxVERTICAL);
1160  itemBoxSizer2->Add(itemStaticBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1161 
1162  m_Action = new wxChoicebook(itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCHB_TOP);
1163  itemStaticBoxSizer6->Add(m_Action, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1164 
1166  m_Action->AddPage(panel3_1,_("None"));
1167 
1169  m_Action->AddPage(panel3_2,_("Simple"));
1170 
1172  m_Action->AddPage(panel3_3,_("Haem"));
1173 
1175  m_Action->AddPage(panel3_4,_("Hypothetical"));
1176 
1177  m_OriginalToNote = new wxCheckBox( itemDialog1, wxID_ANY, _("Move original to note"), wxDefaultPosition, wxDefaultSize, 0 );
1178  m_OriginalToNote->SetValue(false);
1179  itemStaticBoxSizer6->Add(m_OriginalToNote, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1180 
1181  m_Fatal = new wxCheckBox( itemDialog1, wxID_ANY, _("Fatal"), wxDefaultPosition, wxDefaultSize, 0 );
1182  m_Fatal->SetValue(false);
1183  itemBoxSizer2->Add(m_Fatal, 0, wxALIGN_LEFT|wxALL, 2);
1184 
1185  wxStaticText* itemStaticText0 = new wxStaticText( itemDialog1, wxID_STATIC, _("Constraint List"), wxDefaultPosition, wxDefaultSize, 0 );
1186  itemBoxSizer2->Add(itemStaticText0, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1187 
1188  m_CompoundConstraintPanel = new CSuspectCompoundConstraintPanel( itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize);
1189  itemBoxSizer2->Add(m_CompoundConstraintPanel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1190 
1191  wxStaticText* itemStaticText1 = new wxStaticText( itemDialog1, wxID_STATIC, _("Description"), wxDefaultPosition, wxDefaultSize, 0 );
1192  itemBoxSizer2->Add(itemStaticText1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1193 
1194  m_Description = new wxTextCtrl( itemDialog1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), wxTE_MULTILINE );
1195  itemBoxSizer2->Add(m_Description, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1196 
1197  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
1198  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL, 0);
1199 
1200  wxButton* itemButton13 = new wxButton( itemDialog1, wxID_OK, _("Accept"), wxDefaultPosition, wxDefaultSize, 0 );
1201  itemBoxSizer3->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1202 
1203  wxButton* itemButton14 = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
1204  itemBoxSizer3->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1205 
1206 }
1207 
1209 {
1210  return true;
1211 }
1212 wxBitmap CAddSuspectProductRule::GetBitmapResource( const wxString& name )
1213 {
1214  // Bitmap retrieval
1215 ////@begin CAddSuspectProductRule bitmap retrieval
1216  wxUnusedVar(name);
1217  return wxNullBitmap;
1218 ////@end CAddSuspectProductRule bitmap retrieval
1219 }
1220 wxIcon CAddSuspectProductRule::GetIconResource( const wxString& name )
1221 {
1222  // Icon retrieval
1223 ////@begin CAddSuspectProductRule icon retrieval
1224  wxUnusedVar(name);
1225  return wxNullIcon;
1226 ////@end CAddSuspectProductRule icon retrieval
1227 }
1228 
1229 void CAddSuspectProductRule::OnCancel( wxCommandEvent& event )
1230 {
1231  Close();
1232 }
1233 
1234 void CAddSuspectProductRule::OnAccept( wxCommandEvent& event )
1235 {
1236  if (!m_rule)
1237  m_rule.Reset(new CSuspect_rule);
1238  m_rule->SetRule_type(static_cast<EFix_type>(m_Type->GetSelection()));
1239  wxWindow* win = m_Matches->GetCurrentPage();
1240  CSearch_func_provider *match = dynamic_cast<CSearch_func_provider*>(win);
1241  CRef<CSearch_func> find = match->GetSearchFunc();
1242  if (!find)
1243  return;
1244  m_rule->SetFind(*find);
1245  win = m_DoesNotMatch->GetCurrentPage();
1246  CSearch_func_provider *doesnotmatch = dynamic_cast<CSearch_func_provider*>(win);
1247  CRef<CSearch_func> except = doesnotmatch->GetSearchFunc();
1248  if (except)
1249  m_rule->SetExcept(*except);
1250  else
1251  m_rule->ResetExcept();
1252  win = m_Action->GetCurrentPage();
1253  CReplace_rule_provider *replace_provider = dynamic_cast<CReplace_rule_provider*>(win);
1254  CRef<CReplace_rule> replace = replace_provider->GetReplace();
1255  if (replace)
1256  {
1257  m_rule->SetReplace(*replace);
1258  m_rule->SetReplace().SetMove_to_note(m_OriginalToNote->GetValue());
1259  }
1260  else
1261  m_rule->ResetReplace();
1262  m_rule->SetFatal(m_Fatal->GetValue());
1263 
1266  {
1268  for (auto c : constraints->Set())
1269  {
1270  m_rule->SetFeat_constraint().Set().push_back(c);
1271  }
1272  }
1273 
1274  if (!m_Description->GetValue().IsEmpty())
1275  m_rule->SetDescription(NStr::TruncateSpaces(m_Description->GetValue().ToStdString()));
1276  else
1278 
1279  wxWindow* parent = GetParent();
1280  CSuspectProductRulesEditor* editor = dynamic_cast<CSuspectProductRulesEditor*>(parent);
1281  if (m_replace)
1282  editor->ReplaceRule(m_rule, m_pos);
1283  else
1284  editor->AddRule(m_rule, m_before);
1285  Close();
1286 }
1287 
1289 {
1290  if (!rule)
1291  return;
1292  m_replace = true;
1293  m_before = false;
1294  m_rule = rule;
1295  m_pos = pos;
1296 
1297  if (rule->IsSetRule_type())
1298  m_Type->SetSelection(rule->GetRule_type());
1299  if (rule->IsSetFind())
1300  {
1301  m_Matches->ChangeSelection(rule->GetFind().Which() - 1);
1302  wxWindow* win = m_Matches->GetCurrentPage();
1303  CSearch_func_provider *match = dynamic_cast<CSearch_func_provider*>(win);
1304  match->SetSearchFunc(rule->GetFind());
1305  }
1306  if (rule->IsSetExcept())
1307  {
1308  m_DoesNotMatch->ChangeSelection(rule->GetExcept().Which() - 1);
1309  wxWindow* win = m_DoesNotMatch->GetCurrentPage();
1310  CSearch_func_provider *except = dynamic_cast<CSearch_func_provider*>(win);
1311  except->SetSearchFunc(rule->GetExcept());
1312  }
1313  m_Action->ChangeSelection(0);
1314  if (rule->IsSetReplace())
1315  {
1316  if (rule->GetReplace().IsSetReplace_func())
1317  {
1318  if (rule->GetReplace().GetReplace_func().IsHaem_replace())
1319  {
1320  m_Action->ChangeSelection(2);
1321  }
1323  {
1324  if (rule->GetReplace().GetReplace_func().GetSimple_replace().IsSetReplace() && rule->GetReplace().GetReplace_func().GetSimple_replace().GetReplace() == "hypothetical protein" &&
1327  m_Action->ChangeSelection(3);
1328  else
1329  m_Action->ChangeSelection(1);
1330  }
1331  wxWindow *win = m_Action->GetCurrentPage();
1332  CReplace_rule_provider *replace_provider = dynamic_cast<CReplace_rule_provider*>(win);
1333  replace_provider->SetReplace(rule->GetReplace());
1334  }
1335 
1336  m_OriginalToNote->SetValue(rule->GetReplace().IsSetMove_to_note() && rule->GetReplace().GetMove_to_note());
1337  }
1338  m_Fatal->SetValue(rule->IsSetFatal() && rule->GetFatal());
1339 
1342 
1343  if (rule->IsSetDescription())
1344  m_Description->SetValue(wxString(rule->GetDescription()));
1345 }
1346 
1347 IMPLEMENT_DYNAMIC_CLASS( CMacroStringConstraintPanel, wxPanel )
1348 
1349 BEGIN_EVENT_TABLE( CMacroStringConstraintPanel, wxPanel )
1353 
1354 /*!
1355  * CMacroStringConstraintPanel constructors
1356  */
1358 {
1359  Init();
1360 }
1361 
1362 CMacroStringConstraintPanel::CMacroStringConstraintPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
1363 {
1364  Init();
1365  Create(parent, id, pos, size, style);
1366 }
1367 
1368 
1369 /*!
1370  * CMacroStringConstraintPanel creator
1371  */
1372 bool CMacroStringConstraintPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
1373 {
1374 ////@begin CMacroStringConstraintPanel creation
1375  wxPanel::Create( parent, id, pos, size, style );
1376 
1377  CreateControls();
1378  if (GetSizer())
1379  {
1380  GetSizer()->SetSizeHints(this);
1381  }
1382  Centre();
1383 ////@end CMacroStringConstraintPanel creation
1384  ShowChoiceOrText();
1385 
1386  return true;
1387 }
1388 
1389 
1390 /*!
1391  * CMacroStringConstraintPanel destructor
1392  */
1394 {
1395 ////@begin CMacroStringConstraintPanel destruction
1396 ////@end CMacroStringConstraintPanel destruction
1397 }
1398 
1399 
1400 /*!
1401  * Member initialisation
1402  */
1404 {
1405 ////@begin CMacroStringConstraintPanel member initialisation
1406  m_MatchType = NULL;
1407  m_MatchText = NULL;
1408  m_IgnoreCase = NULL;
1409  m_IgnoreSpace = NULL;
1410  m_WholeWord = NULL;
1411  m_IgnorePunct = NULL;
1412  m_IgnoreSyn = NULL;
1413  m_AnyLetters = NULL;
1414  m_AllUpper = NULL;
1415  m_AllLower = NULL;
1416  m_AllPunct = NULL;
1417  m_MatchChoice = NULL;
1418  m_TextSizer = NULL;
1419  m_ClearButton = NULL;
1420  m_WordSubst = NULL;
1421  m_is_choice = false;
1422 ////@end CMacroStringConstraintPanel member initialisation
1423 }
1424 
1425 
1426 /*!
1427  * Control creation for CMacroStringConstraintPanel
1428  */
1430 {
1431 ////@begin CMacroStringConstraintPanel content construction
1432  //CMacroStringConstraintPanel* itemPanel1 = this;
1433  wxPanel* parentPanel = this;
1434  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
1435  parentPanel->SetSizer(itemBoxSizer1);
1436 
1437  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
1438  itemBoxSizer1->Add(itemBoxSizer2, 0, wxALIGN_TOP|wxALL, 2);
1439 
1440  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
1441  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1442 
1443  wxArrayString m_MatchTypeStrings;
1444  m_MatchTypeStrings.Add(_("Contains"));
1445  m_MatchTypeStrings.Add(_("Does not contain"));
1446  m_MatchTypeStrings.Add(_("Equals"));
1447  m_MatchTypeStrings.Add(_("Does not equal"));
1448  m_MatchTypeStrings.Add(_("Starts with"));
1449  m_MatchTypeStrings.Add(_("Ends with"));
1450  m_MatchTypeStrings.Add(_("Is one of"));
1451  m_MatchTypeStrings.Add(_("Is not one of"));
1452  m_MatchTypeStrings.Add(_("Does not start with"));
1453  m_MatchTypeStrings.Add(_("Does not end with"));
1454 
1455  m_MatchType = new wxChoice( parentPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_MatchTypeStrings, 0 );
1456  m_MatchType->SetStringSelection(_("Contains"));
1457  itemBoxSizer3->Add(m_MatchType, 0, wxALIGN_TOP|wxLEFT|wxRIGHT|wxBOTTOM, 2);
1459 
1460  m_TextSizer = new wxBoxSizer(wxVERTICAL);
1461  itemBoxSizer3->Add(m_TextSizer, 0, wxALIGN_TOP, 0);
1462 
1463  m_MatchText = new wxTextCtrl( parentPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), wxTE_MULTILINE );
1464  m_TextSizer->Add(m_MatchText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 2);
1465  wxArrayString choice_strings;
1466  m_MatchChoice = new wxComboBox(parentPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1), choice_strings, 0 );
1467  m_MatchChoice->Hide();
1468 
1469 
1470  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
1471  itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1472 
1473  m_IgnoreCase = new wxCheckBox( parentPanel, wxID_ANY, _("Ignore Case"), wxDefaultPosition, wxDefaultSize, 0 );
1474  m_IgnoreCase->SetValue(true);
1475  itemBoxSizer6->Add(m_IgnoreCase, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1476 
1477  m_IgnoreSpace = new wxCheckBox( parentPanel, wxID_ANY, _("Ignore Space"), wxDefaultPosition, wxDefaultSize, 0 );
1478  m_IgnoreSpace->SetValue(false);
1479  itemBoxSizer6->Add(m_IgnoreSpace, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1480 
1481  m_IgnorePunct = new wxCheckBox( parentPanel, wxID_ANY, _("Ignore Punctuation"), wxDefaultPosition, wxDefaultSize, 0 );
1482  m_IgnorePunct->SetValue(false);
1483  itemBoxSizer6->Add(m_IgnorePunct, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1484 
1485  wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
1486  itemBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1487 
1488  m_WholeWord = new wxCheckBox( parentPanel, wxID_ANY, _("Whole Word"), wxDefaultPosition, wxDefaultSize, 0 );
1489  m_WholeWord->SetValue(false);
1490  itemBoxSizer7->Add(m_WholeWord, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1491 
1492  m_IgnoreSyn = new wxCheckBox( parentPanel, wxID_ANY, _("Ignore 'putative' synonyms"), wxDefaultPosition, wxDefaultSize, 0 );
1493  m_IgnoreSyn->SetValue(false);
1494  itemBoxSizer7->Add(m_IgnoreSyn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1495 
1496  wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
1497  itemBoxSizer2->Add(itemBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1498 
1499  m_AnyLetters = new wxRadioButton( parentPanel, wxID_ANY, _("Any letters"), wxDefaultPosition, wxDefaultSize, 0 );
1500  m_AnyLetters->SetValue(true);
1501  itemBoxSizer8->Add(m_AnyLetters, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1502 
1503  m_AllUpper = new wxRadioButton( parentPanel, wxID_ANY, _("All letters are upper case"), wxDefaultPosition, wxDefaultSize, 0 );
1504  m_AllUpper->SetValue(false);
1505  itemBoxSizer8->Add(m_AllUpper, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1506 
1507  m_AllLower = new wxRadioButton( parentPanel, wxID_ANY, _("All letters are lower case"), wxDefaultPosition, wxDefaultSize, 0 );
1508  m_AllLower->SetValue(false);
1509  itemBoxSizer8->Add(m_AllLower, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1510 
1511  m_AllPunct = new wxRadioButton( parentPanel, wxID_ANY, _("All characters are punctuation"), wxDefaultPosition, wxDefaultSize, 0 );
1512  m_AllPunct->SetValue(false);
1513  itemBoxSizer8->Add(m_AllPunct, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1514 
1515  wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
1516  itemBoxSizer2->Add(itemBoxSizer9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
1517 
1518  m_ClearButton = new wxButton( parentPanel, SYMBOL_CMACROSTRINGCONSTRAINTPANEL_CLEAR_ID, _("Clear Constraint"), wxDefaultPosition, wxDefaultSize, 0 );
1519  itemBoxSizer9->Add(m_ClearButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1520 
1521  m_WordSubst = new wxButton( parentPanel, SYMBOL_CMACROSTRINGCONSTRAINTPANEL_WORD_SUBST_ID, _("Word Substitutions"), wxDefaultPosition, wxDefaultSize, 0 );
1522  itemBoxSizer9->Add(m_WordSubst, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1523 
1524  ////@end CMacroStringConstraintPanel content construction
1525 }
1526 
1527 void CMacroStringConstraintPanel::OnClear( wxCommandEvent& event )
1528 {
1529  ClearValues();
1530 }
1531 
1533 {
1534  if (m_is_choice)
1535  {
1536  m_MatchChoice->Hide();
1538  m_MatchText->Show();
1539  m_is_choice = false;
1540  Layout();
1541  Fit();
1542  }
1543  m_MatchType->SetStringSelection(_("Contains"));
1544  m_MatchText->SetValue(wxEmptyString);
1545  m_IgnoreCase->SetValue(true);
1546  m_IgnoreSpace->SetValue(false);
1547  m_WholeWord->SetValue(false);
1548  m_IgnorePunct->SetValue(false);
1549  m_IgnoreSyn->SetValue(false);
1550  m_AnyLetters->SetValue(true);
1551  m_AllUpper->SetValue(false);
1552  m_AllLower->SetValue(false);
1553  m_AllPunct->SetValue(false);
1554  m_word_subst.Reset();
1555 }
1556 
1557 void CMacroStringConstraintPanel::SetChoices(const vector<string> &choices)
1558 {
1559  wxArrayString choice_strings;
1560  ITERATE(vector<string>, it, choices)
1561  {
1562  choice_strings.Add(ToWxString(*it));
1563  }
1564  m_MatchChoice->Set(choice_strings);
1565  ShowChoiceOrText();
1566 }
1567 
1569 {
1570  if (!m_MatchChoice->IsListEmpty() && (m_MatchType->GetSelection() == eMatchType_Equals || m_MatchType->GetSelection() == eMatchType_DoesNotEqual) )
1571  {
1572  if (!m_is_choice)
1573  {
1574  m_MatchText->Hide();
1576  m_MatchChoice->Show();
1577  }
1578  m_is_choice = true;
1579  }
1580  else
1581  {
1582  if (m_is_choice)
1583  {
1584  m_MatchChoice->Hide();
1586  m_MatchText->Show();
1587  }
1588  m_is_choice = false;
1589  }
1590  Layout();
1591  Fit();
1592 
1593 }
1594 
1596 {
1597  ShowChoiceOrText();
1598  event.Skip();
1599 }
1600 
1601 /*!
1602  * Should we show tooltips?
1603  */
1605 {
1606  return true;
1607 }
1608 
1609 /*!
1610  * Get bitmap resources
1611  */
1612 wxBitmap CMacroStringConstraintPanel::GetBitmapResource( const wxString& name )
1613 {
1614  // Bitmap retrieval
1615 ////@begin CMacroStringConstraintPanel bitmap retrieval
1616  wxUnusedVar(name);
1617  return wxNullBitmap;
1618 ////@end CMacroStringConstraintPanel bitmap retrieval
1619 }
1620 
1621 /*!
1622  * Get icon resources
1623  */
1624 wxIcon CMacroStringConstraintPanel::GetIconResource( const wxString& name )
1625 {
1626  // Icon retrieval
1627 ////@begin CMacroStringConstraintPanel icon retrieval
1628  wxUnusedVar(name);
1629  return wxNullIcon;
1630 ////@end CMacroStringConstraintPanel icon retrieval
1631 }
1632 
1634 {
1635  string match_text;
1636  if (!m_is_choice)
1637  match_text = NStr::Replace(NStr::Replace(ToStdString(m_MatchText->GetValue()),"\r"," "),"\n"," ");
1638  else
1639  match_text = NStr::Replace(NStr::Replace(ToStdString(m_MatchChoice->GetValue()),"\r"," "),"\n"," ");
1640 
1642  c->SetMatch_text(NStr::TruncateSpaces(match_text));
1643  c->SetCase_sensitive(!m_IgnoreCase->GetValue());
1644  c->SetIgnore_space(m_IgnoreSpace->GetValue());
1645  c->SetIgnore_punct(m_IgnorePunct->GetValue());
1646  c->SetWhole_word(m_WholeWord->GetValue());
1647  c->SetIs_all_caps(m_AllUpper->GetValue());
1648  c->SetIs_all_lower(m_AllLower->GetValue());
1649  c->SetIs_all_punct(m_AllPunct->GetValue());
1650  c->SetIgnore_weasel(m_IgnoreSyn->GetValue());
1651 
1652  if (m_word_subst && m_word_subst->IsSet() && !m_word_subst->Get().empty())
1653  {
1655  }
1656 
1657  switch(m_MatchType->GetSelection()) {
1658  case eMatchType_Contains:
1660  break;
1663  c->SetNot_present(true);
1664  break;
1665  case eMatchType_Equals:
1667  break;
1670  c->SetNot_present(true);
1671  break;
1672  case eMatchType_StartsWith:
1674  break;
1675  case eMatchType_EndsWith:
1677  break;
1678  case eMatchType_IsOneOf:
1680  break;
1681  case eMatchType_IsNotOneOf:
1683  c->SetNot_present(true);
1684  break;
1687  c->SetNot_present(true);
1688  break;
1691  c->SetNot_present(true);
1692  break;
1693  default: c.Reset(); break;
1694  }
1695 
1696  return c;
1697 }
1698 
1700 {
1701  CRef<CSearch_func> search_func(new CSearch_func);
1703  if (str_constr && !str_constr->Empty())
1704  search_func->SetString_constraint(*str_constr);
1705  else
1706  search_func.Reset();
1707  return search_func;
1708 }
1709 
1711 {
1712  if (!search_func.IsString_constraint())
1713  return;
1714  m_is_choice = false;
1715  const CString_constraint &c = search_func.GetString_constraint();
1716  if (c.IsSetMatch_text())
1717  m_MatchText->SetValue(wxString(c.GetMatch_text()));
1718 
1719  m_IgnoreCase->SetValue(!(c.IsSetCase_sensitive() && c.GetCase_sensitive()));
1720  m_IgnoreSpace->SetValue(c.IsSetIgnore_space() && c.GetIgnore_space());
1721  m_IgnorePunct->SetValue(c.IsSetIgnore_punct() && c.GetIgnore_punct());
1722  m_WholeWord->SetValue(c.IsSetWhole_word() && c.GetWhole_word());
1723  m_AllUpper->SetValue(c.IsSetIs_all_caps() && c.GetIs_all_caps());
1724  m_AllLower->SetValue(c.IsSetIs_all_lower() && c.GetIs_all_lower());
1725  m_AllPunct->SetValue(c.IsSetIs_all_punct() && c.GetIs_all_punct());
1726  m_IgnoreSyn->SetValue(c.IsSetIgnore_weasel() && c.GetIgnore_weasel());
1727 
1728  if (c.IsSetIgnore_words())
1729  {
1731  m_word_subst->Assign(c.GetIgnore_words());
1732  }
1733 
1734  if (c.IsSetMatch_location())
1735  {
1736  if (c.IsSetNot_present() && c.GetNot_present())
1737  {
1738  switch(c.GetMatch_location())
1739  {
1741  case eString_location_equals: m_MatchType->SetSelection(eMatchType_DoesNotEqual); break;
1743  case eString_location_ends: m_MatchType->SetSelection(eMatchType_DoesNotEndWith); break;
1744  case eString_location_inlist: m_MatchType->SetSelection(eMatchType_IsNotOneOf); break;
1745  }
1746  }
1747  else
1748  {
1749  switch(c.GetMatch_location())
1750  {
1751  case eString_location_contains: m_MatchType->SetSelection(eMatchType_Contains); break;
1752  case eString_location_equals: m_MatchType->SetSelection(eMatchType_Equals); break;
1753  case eString_location_starts: m_MatchType->SetSelection(eMatchType_StartsWith); break;
1754  case eString_location_ends: m_MatchType->SetSelection(eMatchType_EndsWith); break;
1755  case eString_location_inlist: m_MatchType->SetSelection(eMatchType_IsOneOf); break;
1756  }
1757  }
1758  }
1759 }
1760 
1762 {
1764  dlg->Show(true);
1765 }
1766 
1768 {
1769  m_word_subst = word_subst;
1770 }
1771 
1772 
1773 
1774 IMPLEMENT_DYNAMIC_CLASS( CReplacementActionNone, wxPanel )
1775 
1776 BEGIN_EVENT_TABLE( CReplacementActionNone, wxPanel )
1778 
1780 {
1781  Init();
1782 }
1783 
1784 CReplacementActionNone::CReplacementActionNone( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
1785 {
1786  Init();
1787  Create(parent, id, pos, size, style);
1788 }
1789 
1790 bool CReplacementActionNone::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
1791 {
1792  wxPanel::Create( parent, id, pos, size, style );
1793 
1794  CreateControls();
1795  if (GetSizer())
1796  {
1797  GetSizer()->SetSizeHints(this);
1798  }
1799  Centre();
1800  return true;
1801 }
1802 
1804 {
1805 }
1806 
1808 {
1809 }
1810 
1812 {
1813  wxPanel* parentPanel = this;
1814  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
1815  parentPanel->SetSizer(itemBoxSizer1);
1816 }
1817 
1819 {
1820  return true;
1821 }
1822 
1823 wxBitmap CReplacementActionNone::GetBitmapResource( const wxString& name )
1824 {
1825  wxUnusedVar(name);
1826  return wxNullBitmap;
1827 }
1828 
1829 wxIcon CReplacementActionNone::GetIconResource( const wxString& name )
1830 {
1831  wxUnusedVar(name);
1832  return wxNullIcon;
1833 }
1834 
1836 {
1837  CRef<CReplace_rule> replace;
1838  return replace;
1839 }
1840 
1841 IMPLEMENT_DYNAMIC_CLASS( CReplacementActionSimple, wxPanel )
1842 
1843 BEGIN_EVENT_TABLE( CReplacementActionSimple, wxPanel )
1845 
1847 {
1848  Init();
1849 }
1850 
1851 CReplacementActionSimple::CReplacementActionSimple( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
1852 {
1853  Init();
1854  Create(parent, id, pos, size, style);
1855 }
1856 
1857 bool CReplacementActionSimple::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
1858 {
1859  wxPanel::Create( parent, id, pos, size, style );
1860 
1861  CreateControls();
1862  if (GetSizer())
1863  {
1864  GetSizer()->SetSizeHints(this);
1865  }
1866  Centre();
1867  return true;
1868 }
1869 
1871 {
1872 }
1873 
1875 {
1876 }
1877 
1879 {
1880  wxPanel* parentPanel = this;
1881  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
1882  parentPanel->SetSizer(itemBoxSizer1);
1883 
1884  m_Text = new wxTextCtrl( parentPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(120, -1), 0 );
1885  itemBoxSizer1->Add(m_Text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1886 
1887  m_Replace = new wxCheckBox( parentPanel, wxID_ANY, _("Replace entire string"), wxDefaultPosition, wxDefaultSize, 0 );
1888  m_Replace->SetValue(false);
1889  itemBoxSizer1->Add(m_Replace, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1890 
1891  m_Retain = new wxCheckBox( parentPanel, wxID_ANY, _("Retain and normalize 'putative' synonym"), wxDefaultPosition, wxDefaultSize, 0 );
1892  m_Retain->SetValue(false);
1893  itemBoxSizer1->Add(m_Retain, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1894 }
1895 
1897 {
1898  return true;
1899 }
1900 
1901 wxBitmap CReplacementActionSimple::GetBitmapResource( const wxString& name )
1902 {
1903  wxUnusedVar(name);
1904  return wxNullBitmap;
1905 }
1906 
1907 wxIcon CReplacementActionSimple::GetIconResource( const wxString& name )
1908 {
1909  wxUnusedVar(name);
1910  return wxNullIcon;
1911 }
1912 
1914 {
1915  CRef<CReplace_rule> replace(new CReplace_rule);
1916  replace->SetReplace_func().SetSimple_replace().SetReplace(NStr::TruncateSpaces(m_Text->GetValue().ToStdString()));
1917  replace->SetReplace_func().SetSimple_replace().SetWhole_string(m_Replace->GetValue());
1918  replace->SetReplace_func().SetSimple_replace().SetWeasel_to_putative(m_Retain->GetValue());
1919  return replace;
1920 }
1921 
1923 {
1924  if (replace.GetReplace_func().IsSimple_replace())
1925  {
1927  m_Text->SetValue(wxString(replace.GetReplace_func().GetSimple_replace().GetReplace()));
1930  }
1931 }
1932 
1933 IMPLEMENT_DYNAMIC_CLASS( CReplacementActionHaem, wxPanel )
1934 
1935 BEGIN_EVENT_TABLE( CReplacementActionHaem, wxPanel )
1937 
1939 {
1940  Init();
1941 }
1942 
1943 CReplacementActionHaem::CReplacementActionHaem( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
1944 {
1945  Init();
1946  Create(parent, id, pos, size, style);
1947 }
1948 
1949 bool CReplacementActionHaem::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
1950 {
1951  wxPanel::Create( parent, id, pos, size, style );
1952 
1953  CreateControls();
1954  if (GetSizer())
1955  {
1956  GetSizer()->SetSizeHints(this);
1957  }
1958  Centre();
1959  return true;
1960 }
1961 
1963 {
1964 }
1965 
1967 {
1968 }
1969 
1971 {
1972  wxPanel* parentPanel = this;
1973  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
1974  parentPanel->SetSizer(itemBoxSizer1);
1975 
1976  m_Text = new wxTextCtrl( parentPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0 );
1977  itemBoxSizer1->Add(m_Text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
1978 }
1979 
1981 {
1982  return true;
1983 }
1984 
1985 wxBitmap CReplacementActionHaem::GetBitmapResource( const wxString& name )
1986 {
1987  wxUnusedVar(name);
1988  return wxNullBitmap;
1989 }
1990 
1991 wxIcon CReplacementActionHaem::GetIconResource( const wxString& name )
1992 {
1993  wxUnusedVar(name);
1994  return wxNullIcon;
1995 }
1996 
1998 {
1999  CRef<CReplace_rule> replace(new CReplace_rule);
2000  replace->SetReplace_func().SetHaem_replace(NStr::TruncateSpaces(m_Text->GetValue().ToStdString()));
2001  return replace;
2002 }
2003 
2005 {
2006  if (replace.GetReplace_func().IsHaem_replace())
2007  m_Text->SetValue(wxString(replace.GetReplace_func().GetHaem_replace()));
2008 }
2009 
2010 IMPLEMENT_DYNAMIC_CLASS( CReplacementActionHypothetical, wxPanel )
2011 
2012 BEGIN_EVENT_TABLE( CReplacementActionHypothetical, wxPanel )
2014 
2016 {
2017  Init();
2018 }
2019 
2020 CReplacementActionHypothetical::CReplacementActionHypothetical( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
2021 {
2022  Init();
2023  Create(parent, id, pos, size, style);
2024 }
2025 
2026 bool CReplacementActionHypothetical::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
2027 {
2028  wxPanel::Create( parent, id, pos, size, style );
2029 
2030  CreateControls();
2031  if (GetSizer())
2032  {
2033  GetSizer()->SetSizeHints(this);
2034  }
2035  Centre();
2036  return true;
2037 }
2038 
2040 {
2041 }
2042 
2044 {
2045 }
2046 
2048 {
2049  wxPanel* parentPanel = this;
2050  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
2051  parentPanel->SetSizer(itemBoxSizer1);
2052 }
2053 
2055 {
2056  return true;
2057 }
2058 
2060 {
2061  wxUnusedVar(name);
2062  return wxNullBitmap;
2063 }
2064 
2066 {
2067  wxUnusedVar(name);
2068  return wxNullIcon;
2069 }
2070 
2072 {
2073  CRef<CReplace_rule> replace(new CReplace_rule);
2074  replace->SetReplace_func().SetSimple_replace().SetReplace("hypothetical protein");
2075  replace->SetReplace_func().SetSimple_replace().SetWhole_string(true);
2076  replace->SetReplace_func().SetSimple_replace().SetWeasel_to_putative(false);
2077  return replace;
2078 }
2079 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
EVT_UPDATE_UI(eCmdAlnShowMethodsDlg, CAlnMultiWidget::OnUpdateShowMethodDlg) EVT_UPDATE_UI(eCmdMethodProperties
wxBitmap GetBitmapResource(const wxString &name)
void SetRule(CRef< CSuspect_rule > rule, int pos)
wxIcon GetIconResource(const wxString &name)
CSuspectCompoundConstraintPanel * m_CompoundConstraintPanel
void OnAccept(wxCommandEvent &event)
void OnCancel(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Suspect Rule"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
void AddCommand(IEditCommand &command)
CCompareByCat(const vector< CRef< CSuspect_rule > > &rules)
const vector< CRef< CSuspect_rule > > & m_Rules
bool operator()(const int &a, const int &b)
CCompareByFind(const vector< CRef< CSuspect_rule > > &rules)
bool operator()(const int &a, const int &b)
const vector< CRef< CSuspect_rule > > & m_Rules
CFeat_CI –.
Definition: feat_ci.hpp:64
static wxString GetDialogFilter(EFileType fileType)
CGBDocument.
Definition: document.hpp:113
CUndoManager & GetUndoManager()
Definition: document.hpp:158
void SetText(const wxString &text)
CRef< objects::CWord_substitution_set > m_word_subst
void SetChoices(const vector< string > &choices)
virtual CRef< CSearch_func > GetSearchFunc()
CRef< objects::CString_constraint > GetStringConstraint()
void CreateControls()
Creates the controls and sizers.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void Init()
Initialises member variables.
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Creation.
virtual void AddWordSubstSet(CRef< objects::CWord_substitution_set > word_subst)
static bool ShowToolTips()
Should we show tooltips?
void OnWordSubstitution(wxCommandEvent &event)
void OnMatchTypeSelected(wxCommandEvent &event)
virtual void SetSearchFunc(const CSearch_func &search_func)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
CProjectService - a service providing API for operations with Workspaces and Projects.
CRearrangeList * GetList() const
virtual void Set(const wxArrayInt &order, const wxArrayString &items)
void SetCheckListListener(CCheckListBoxListener *win)
const wxArrayInt & GetCurrentOrder() const
void SetDoubleClickConsumer(CDoubleClickConsumer *win)
CRef –.
Definition: ncbiobj.hpp:618
virtual void SetReplace(const CReplace_rule &replace)=0
virtual CRef< CReplace_rule > GetReplace()=0
wxBitmap GetBitmapResource(const wxString &name)
virtual void SetReplace(const CReplace_rule &replace)
wxIcon GetIconResource(const wxString &name)
virtual CRef< CReplace_rule > GetReplace()
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
wxIcon GetIconResource(const wxString &name)
wxBitmap GetBitmapResource(const wxString &name)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
virtual CRef< CReplace_rule > GetReplace()
wxBitmap GetBitmapResource(const wxString &name)
virtual CRef< CReplace_rule > GetReplace()
wxIcon GetIconResource(const wxString &name)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
wxIcon GetIconResource(const wxString &name)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
virtual void SetReplace(const CReplace_rule &replace)
virtual CRef< CReplace_rule > GetReplace()
wxBitmap GetBitmapResource(const wxString &name)
CScope –.
Definition: scope.hpp:92
virtual CRef< CSearch_func > GetSearchFunc()=0
virtual void SetSearchFunc(const CSearch_func &search_func)=0
virtual void GetActiveObjects(TConstScopedObjects &sel)
returns objects currently active in the application, this function should be used for obtaining argum...
CSeq_entry_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
void SetMatch_text(const TMatch_text &value)
CRef< objects::CConstraint_choice_set > GetConstraints()
void SetConstraints(const objects::CConstraint_choice_set &constraints)
void OnAddRuleAfter(wxCommandEvent &event)
objects::CSeq_entry_Handle m_TopSeqEntry
virtual ~CSuspectProductRulesEditor()
Destructor.
void OnListMatches(wxCommandEvent &event)
virtual void UpdateCheckedState(size_t checked)
void OnSortByCat(wxCommandEvent &event)
void ReplaceRule(CRef< CSuspect_rule > rule, int n)
void AddRule(CRef< CSuspect_rule > rule, bool before)
void OnFileAdd(wxCommandEvent &event)
void CreateControls()
Creates the controls and sizers.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnApplyFixes(wxCommandEvent &event)
void OnAddRuleBefore(wxCommandEvent &event)
vector< CRef< CSuspect_rule > > m_Rules
void OnDeleteRules(wxCommandEvent &event)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void CanFileSaveAs(wxUpdateUIEvent &event)
void OnDisplay(wxCommandEvent &event)
void OnShowDiffs(wxCommandEvent &event)
void OnFileSaveAs(wxCommandEvent &event)
bool MatchConstraint(CRef< CSuspect_rule > rule, const string &str)
void OnQuit(wxCommandEvent &event)
void OnFileSave(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Suspect Product Rule Editor"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(704, 504), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void OnFileLoad(wxCommandEvent &event)
void OnSortByFind(wxCommandEvent &event)
void CanSort(wxUpdateUIEvent &event)
void Init()
Initialises member variables.
static bool ShowToolTips()
Should we show tooltips?
void CanFileSave(wxUpdateUIEvent &event)
string SummarizeRule(void) const
CWord_substitution_set –.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: map.hpp:338
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const_iterator begin() const
Definition: set.hpp:135
size_type size() const
Definition: set.hpp:132
bool empty() const
Definition: set.hpp:133
const_iterator find(const key_type &key) const
Definition: set.hpp:137
const_iterator end() const
Definition: set.hpp:136
#define _(proto)
Definition: ct_nlmzip_i.h:78
std::ofstream out("events_result.xml")
main entry point for tests
#define false
Definition: bool.h:36
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 NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
Definition: ncbimisc.hpp:1508
#define NULL
Definition: ncbistd.hpp:225
list< pair< string, TEnumValueType > > TValues
Definition: enumvalues.hpp:54
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
Definition: service.hpp:91
objects::CSeq_entry_Handle GetTopSeqEntryFromScopedObject(SConstScopedObject &obj)
Definition: utils.cpp:2542
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:696
@ eSerial_AsnText
ASN.1 text.
Definition: serialdef.hpp:73
pair< TObjectPtr, TTypeInfo > ObjectInfo(C &obj)
Definition: objectinfo.hpp:762
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
Definition: objistr.cpp:195
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
Definition: ncbistre.hpp:500
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.
Definition: ncbistr.cpp:3314
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
Definition: ncbistr.cpp:3186
static string & ToLower(string &str)
Convert string to lower case – string& version.
Definition: ncbistr.cpp:405
bool IsSetReplace_func(void) const
Check if a value has been assigned to Replace_func data member.
TCase_sensitive GetCase_sensitive(void) const
Get the Case_sensitive member data.
bool IsSetReplace(void) const
Check if a value has been assigned to Replace data member.
bool IsSetIgnore_weasel(void) const
Check if a value has been assigned to Ignore_weasel data member.
void SetDescription(const TDescription &value)
Assign a value to Description data member.
bool IsPrefix_and_numbers(void) const
Check if variant Prefix_and_numbers is selected.
bool IsSetIs_all_lower(void) const
Check if a value has been assigned to Is_all_lower data member.
THas_term & SetHas_term(void)
Select the variant.
bool IsSetIs_all_punct(void) const
Check if a value has been assigned to Is_all_punct data member.
void SetThree_numbers(void)
Select the variant.
const TIgnore_words & GetIgnore_words(void) const
Get the Ignore_words member data.
bool IsSetMatch_location(void) const
Check if a value has been assigned to Match_location data member.
void SetIs_all_lower(TIs_all_lower value)
Assign a value to Is_all_lower data member.
void SetExcept(TExcept &value)
Assign a value to Except data member.
bool IsString_constraint(void) const
Check if variant String_constraint is selected.
TIgnore_space GetIgnore_space(void) const
Get the Ignore_space member data.
bool IsSetRule_type(void) const
Check if a value has been assigned to Rule_type data member.
bool IsSetFeat_constraint(void) const
Check if a value has been assigned to Feat_constraint data member.
EFix_type
Access to EFix_type's attributes (values, names) as defined in spec.
Definition: Fix_type_.hpp:63
const TSimple_replace & GetSimple_replace(void) const
Get the variant data.
bool IsSetWeasel_to_putative(void) const
Check if a value has been assigned to Weasel_to_putative data member.
void SetUnbalanced_paren(void)
Select the variant.
TMatch_location GetMatch_location(void) const
Get the Match_location member data.
const TPrefix_and_numbers & GetPrefix_and_numbers(void) const
Get the variant data.
const TReplace & GetReplace(void) const
Get the Replace member data.
bool IsSet(void) const
Check if a value has been assigned to data member.
bool IsSetCase_sensitive(void) const
Check if a value has been assigned to Case_sensitive data member.
const THaem_replace & GetHaem_replace(void) const
Get the variant data.
void SetRule_type(TRule_type value)
Assign a value to Rule_type data member.
TIs_all_caps GetIs_all_caps(void) const
Get the Is_all_caps member data.
bool IsSetIgnore_punct(void) const
Check if a value has been assigned to Ignore_punct data member.
bool IsSetDescription(void) const
Check if a value has been assigned to Description data member.
TWhole_string GetWhole_string(void) const
Get the Whole_string member data.
void SetFind(TFind &value)
Assign a value to Find data member.
void SetIs_all_punct(TIs_all_punct value)
Assign a value to Is_all_punct data member.
bool IsSetNot_present(void) const
Check if a value has been assigned to Not_present data member.
TWhole_word GetWhole_word(void) const
Get the Whole_word member data.
bool IsHaem_replace(void) const
Check if variant Haem_replace is selected.
TRule_type GetRule_type(void) const
Get the Rule_type member data.
const TDescription & GetDescription(void) const
Get the Description member data.
TIgnore_weasel GetIgnore_weasel(void) const
Get the Ignore_weasel member data.
bool IsSetWhole_word(void) const
Check if a value has been assigned to Whole_word data member.
TMove_to_note GetMove_to_note(void) const
Get the Move_to_note member data.
bool IsHas_term(void) const
Check if variant Has_term is selected.
const TExcept & GetExcept(void) const
Get the Except member data.
bool IsSetWhole_string(void) const
Check if a value has been assigned to Whole_string data member.
void SetIgnore_punct(TIgnore_punct value)
Assign a value to Ignore_punct data member.
void ResetExcept(void)
Reset Except data member.
TIgnore_punct GetIgnore_punct(void) const
Get the Ignore_punct member data.
void SetIgnore_words(TIgnore_words &value)
Assign a value to Ignore_words data member.
void SetUnderscore(void)
Select the variant.
const TFind & GetFind(void) const
Get the Find member data.
TPrefix_and_numbers & SetPrefix_and_numbers(void)
Select the variant.
const TFeat_constraint & GetFeat_constraint(void) const
Get the Feat_constraint member data.
void SetMatch_location(TMatch_location value)
Assign a value to Match_location data member.
void SetAll_caps(void)
Select the variant.
const TMatch_text & GetMatch_text(void) const
Get the Match_text member data.
TN_or_more_brackets_or_parentheses & SetN_or_more_brackets_or_parentheses(void)
Select the variant.
void SetFeat_constraint(TFeat_constraint &value)
Assign a value to Feat_constraint data member.
bool IsSimple_replace(void) const
Check if variant Simple_replace is selected.
void SetFatal(TFatal value)
Assign a value to Fatal data member.
TNot_present GetNot_present(void) const
Get the Not_present member data.
bool IsSetMove_to_note(void) const
Check if a value has been assigned to Move_to_note data member.
TFatal GetFatal(void) const
Get the Fatal member data.
void SetIs_all_caps(TIs_all_caps value)
Assign a value to Is_all_caps data member.
void ResetDescription(void)
Reset Description data member.
bool IsSetFind(void) const
Check if a value has been assigned to Find data member.
void ResetReplace(void)
Reset Replace data member.
const THas_term & GetHas_term(void) const
Get the variant data.
bool IsSetFatal(void) const
Check if a value has been assigned to Fatal data member.
TIs_all_punct GetIs_all_punct(void) const
Get the Is_all_punct member data.
TIs_all_lower GetIs_all_lower(void) const
Get the Is_all_lower member data.
TWeasel_to_putative GetWeasel_to_putative(void) const
Get the Weasel_to_putative member data.
TToo_long & SetToo_long(void)
Select the variant.
const TReplace & GetReplace(void) const
Get the Replace member data.
void SetCase_sensitive(TCase_sensitive value)
Assign a value to Case_sensitive data member.
const TReplace_func & GetReplace_func(void) const
Get the Replace_func member data.
bool IsSetIgnore_space(void) const
Check if a value has been assigned to Ignore_space data member.
void SetContains_plural(void)
Select the variant.
bool IsSetIs_all_caps(void) const
Check if a value has been assigned to Is_all_caps data member.
bool IsSetReplace(void) const
Check if a value has been assigned to Replace data member.
TString_constraint & SetString_constraint(void)
Select the variant.
void SetIgnore_space(TIgnore_space value)
Assign a value to Ignore_space data member.
void SetReplace_func(TReplace_func &value)
Assign a value to Replace_func data member.
const TString_constraint & GetString_constraint(void) const
Get the variant data.
void SetWhole_word(TWhole_word value)
Assign a value to Whole_word data member.
void SetIgnore_weasel(TIgnore_weasel value)
Assign a value to Ignore_weasel data member.
E_Choice Which(void) const
Which variant is currently selected.
void SetNot_present(TNot_present value)
Assign a value to Not_present data member.
bool IsSetMatch_text(void) const
Check if a value has been assigned to Match_text data member.
const Tdata & Get(void) const
Get the member data.
void SetReplace(TReplace &value)
Assign a value to Replace data member.
bool IsSetExcept(void) const
Check if a value has been assigned to Except data member.
void ResetFeat_constraint(void)
Reset Feat_constraint data member.
bool IsSetIgnore_words(void) const
Check if a value has been assigned to Ignore_words data member.
@ eString_location_inlist
@ eString_location_equals
@ eString_location_contains
@ eString_location_starts
@ eString_location_ends
bool IsSetName(void) const
protein name Check if a value has been assigned to Name data member.
Definition: Prot_ref_.hpp:366
TType GetType(void) const
Get the Type member data.
Definition: RNA_ref_.hpp:529
bool IsSetExt(void) const
generic fields for ncRNA, tmRNA, miscRNA Check if a value has been assigned to Ext data member.
Definition: RNA_ref_.hpp:604
bool IsSetType(void) const
Check if a value has been assigned to Type data member.
Definition: RNA_ref_.hpp:510
const TName & GetName(void) const
Get the variant data.
Definition: RNA_ref_.hpp:484
const TExt & GetExt(void) const
Get the Ext member data.
Definition: RNA_ref_.hpp:616
bool IsName(void) const
Check if variant Name is selected.
Definition: RNA_ref_.hpp:478
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:913
bool IsProt(void) const
Check if variant Prot is selected.
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
const TProt & GetProt(void) const
Get the variant data.
const TRna & GetRna(void) const
Get the variant data.
bool IsRna(void) const
Check if variant Rna is selected.
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()
FILE * file
int i
yy_size_t n
void GetViewObjects(IWorkbench *workbench, TConstScopedObjects &objects)
#define wxT(x)
Definition: muParser.cpp:41
void ReportUsage(const wxString &dialog_name)
Report opening & accepting events in the editing package.
constexpr auto add_item(T item, list< Ts... > l) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
unsigned int a
Definition: ncbi_localip.c:102
static int match(register const pcre_uchar *eptr, register const pcre_uchar *ecode, const pcre_uchar *mstart, int offset_top, match_data *md, eptrblock *eptrb, unsigned int rdepth)
Definition: pcre_exec.c:513
Utility macros and typedefs for exploring NCBI objects from seqfeat.asn.
#define EDIT_EACH_NAME_ON_PROTREF(Itr, Var)
#define FOR_EACH_NAME_ON_PROTREF(Itr, Var)
FOR_EACH_NAME_ON_PROTREF EDIT_EACH_NAME_ON_PROTREF.
static static static wxID_ANY
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
static string s_GetFind(CRef< CSuspect_rule > rule)
#define ID_SHOW_DIFFS_RULE_LIST_BUTTON
#define ID_SAVE_AS_RULE_LIST_MENU
#define ID_LOAD_RULE_LIST_MENU
#define ID_ADD_BEFORE_RULE_LIST_BUTTON
#define ID_SAVE_RULE_LIST_MENU
#define ID_QUIT_RULE_LIST_MENU
#define ID_APPLY_FIXES_RULE_LIST_BUTTON
#define ID_DELETE_SELECTED_RULE_LIST_BUTTON
#define SYMBOL_CMACROSTRINGCONSTRAINTPANEL_WORD_SUBST_ID
#define ID_LIST_MATCHES_RULE_LIST_BUTTON
#define SYMBOL_CMACROSTRINGCONSTRAINTPANEL_CLEAR_ID
#define ID_SORT_CAT_RULE_LIST_MENU
#define ID_ADD_RULE_LIST_MENU
#define ID_SORT_FIND_RULE_LIST_MENU
#define ID_ADD_AFTER_RULE_LIST_BUTTON
#define ID_DISPLAY_TEXT_RULE_LIST_BUTTON
string GetTextObjectDescription(const CSeq_feat &sf, CScope &scope)
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Mon May 27 04:38:00 2024 by modify_doxy.py rev. 669887