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

Go to the SVN repository for this file.

1 /* $Id: data_mining_panel.cpp 47464 2023-04-20 00:19:10Z evgeniev $
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 m_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: Andrey Yazhuk, Vladimir Tereshkov
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
40 
44 
45 #include <gui/utils/view_event.hpp>
47 #include <gui/utils/menu_item.hpp>
48 
49 //TODO - remove
54 #include <gui/objutils/utils.hpp>
55 #include <gui/objutils/label.hpp>
57 #include <gui/objutils/snp_gui.hpp>
58 
65 
68 
72 
76 
77 #include <objmgr/seq_vector.hpp>
78 #include <objmgr/util/sequence.hpp>
80 //TODO
81 
82 #include <wx/app.h>
83 #include <wx/sizer.h>
84 #include <wx/panel.h>
85 #include <wx/menu.h>
86 #include <wx/button.h>
87 
88 #include <wx/animate.h>
89 #include <wx/collpane.h>
90 #include <wx/statline.h>
91 #include <wx/tglbtn.h>
92 #include <wx/stattext.h>
93 #include <wx/toolbar.h>
94 #include <wx/hyperlink.h>
95 #include <wx/srchctrl.h>
96 #include <wx/choice.h>
97 
98 #include <algorithm>
99 
102 
103 #define ID_TABLE 10001
104 #define ID_TOOLBAR 10002
105 #define ID_COMBOBOX 10003
106 #define ID_TEXT 11414
107 #define ID_BUTTON 10005
108 #define ID_DB 10006
109 #define ID_ANIMATIONCTRL1 10007
110 #define ID_COMBOBOX1 10008
111 #define ID_BUTTON1 10009
112 #define ID_COMBOBOX_UPDATE 10111
113 
114 #define ID_HYPERLINKCTRL 10999
115 
116 #define TIMER_ID -1
117 
118 
119 
120 BEGIN_EVENT_TABLE( CDataMiningPanel, wxPanel )
121  EVT_CONTEXT_MENU( CDataMiningPanel::OnContextMenu )
124 
126 
129 
131  EVT_MENU_RANGE(eCmdCopy1, eCmdCopy10, CDataMiningPanel::OnCustomCopy)
133 
135 
137 
138  EVT_TOOL_RANGE(scm_ModeCmd + eCmdAddToNew, scm_ModeCmd + eCmdNoMoreCommands, CDataMiningPanel::HandleTool)
139 
140  EVT_LIST_ITEM_SELECTED(wxID_ANY, CDataMiningPanel::OnSelectionChanged)
141  EVT_LIST_ITEM_DESELECTED(wxID_ANY, CDataMiningPanel::OnSelectionChanged)
142 
145 
146  EVT_LIST_COL_END_DRAG(wxID_ANY, CDataMiningPanel::OnColumnEndDrag)
147  EVT_LIST_ITEM_ACTIVATED(wxID_ANY, CDataMiningPanel::OnListItemActivate)
148 
150 
152 
153 
154 
156 : m_View(view),
157  m_bInitialized(false),
158  m_ParentPanel(NULL),
159  m_Timer(this, TIMER_ID),
160  mf_Reentry(false),
161  m_SearchInProgress(false),
162  m_NeedUpdate(true)
163 {
164  Init();
165 }
166 
167 
169 {
170 }
171 
172 
174 {
175  if (m_CurrToolName.empty())
176  return;
177 
178  string toolID = m_CurrToolName;
179  replace(toolID.begin(), toolID.end(), ' ', '-');
180 
181  vector <string> subsections;
182  subsections.push_back(toolID);
183 
184 
185  if( ! m_RegPath.empty() && m_ListWidget && m_ListWidget->GetItemCount() > 0) {
186  if (bWrite) {
189  }
190  else {
192  }
193  }
194 
195 }
196 
197 void CDataMiningPanel::OnColumnEndDrag( wxListEvent &anEvt )
198 {
199  x_SyncTableSettings(true);
200 }
201 
202 // will handle row dbl-click and enter
203 void CDataMiningPanel::OnListItemActivate(wxListEvent &anEvt)
204 {
205  TConstScopedObjects objs;
206  GetSelection(objs);
207  x_AddToProject(objs);
208 }
209 
210 //TODO this function should be here
211 void CDataMiningPanel::OnHyperlinkctrlClicked( wxHyperlinkEvent& event )
212 {
214  m_Form->Update();
215 }
216 
217 
218 void CDataMiningPanel::OnUpdateNeeded(wxCommandEvent& event)
219 {
220  m_Form->Update();
221 }
222 
223 
224 void CDataMiningPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size )
225 {
226  #ifdef __WXMAC__
227  // Without this search view (especially NCBI Net Blast) becomes messed up
228  // when you open the 'open view dialog'. Also, the area below the search bar
229  // turns black when you un-dock the search view from the application. GB-6515
230  SetBackgroundStyle(wxBG_STYLE_COLOUR);
231  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));
232  #endif
233 
234  wxPanel::Create(parent, id, pos, size);
235  CreateControls();
236 
237  #ifndef __WXMAC__
238  PushEventHandler( new CCommandToFocusHandler( this ) );
239  #endif
240 }
241 
243 {
244  #ifndef __WXMAC__
245  PopEventHandler( true );
246  #endif
247 
248  return wxPanel::Destroy();
249 }
250 
252 {
253  m_Service = NULL;
254  m_Workbench = NULL;
255 
256  m_CurrToolName = "";
257  m_MainValue = "";
258 
260  m_ListWidget = NULL;
261  m_FormSizer = NULL;
262  m_Text = NULL;
263 
264  m_FormSizer = NULL;
265  m_ToolBar = NULL;
266 
267  m_Dict.clear();
268 
269  if( ! m_bInitialized ){
271 
272  provider->RegisterFileAlias(wxT("menu::dm_start"), wxT("playhs.png"));
273  provider->RegisterFileAlias(wxT("menu::dm_stop"), wxT("stophs.png"));
274  provider->RegisterFileAlias(wxT("menu::dm_query"), wxT("expandspacehs.png"));
275  provider->RegisterFileAlias(wxT("menu::dm_range"), wxT("range.png"));
276  provider->RegisterFileAlias(wxT("menu::dm_filter"), wxT("filter.png"));
277  provider->RegisterFileAlias(wxT("menu::dm_open"), wxT("openselecteditemhs.png"));
278 
279  m_bInitialized = true;
280  }
281 }
282 
283 
284 void CDataMiningPanel::OnSelectionChanged(wxListEvent& event)
285 {
287  Send(&evt, ePool_Parent);
288 
289  //CEvent range(CEvent::eEvent_Message, CViewEvent::eWidgetRangeChanged);
290  // Send(&range, ePool_Parent);
291 }
292 
294 {
295  // main sizer
296  m_ParentPanel = new wxPanel(this);
297 
298  wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
299  m_ParentPanel->SetSizer(main_sizer);
300 
301  // toolbar
302  long styles = wxTB_FLAT | wxTB_HORIZONTAL | wxTB_TEXT | wxTB_HORZ_LAYOUT;
303  m_ToolBar = new wxToolBar(m_ParentPanel, ID_TOOLBAR,
304  wxDefaultPosition, wxSize(-1, -1), styles);
305 
306  // label
307  wxStaticText* tool_text = new wxStaticText( m_ToolBar, wxID_STATIC,
308  wxT(" Search Tool: "));
309  m_ToolBar->AddControl(tool_text);
310 
311  // combo
312  m_TargetChoice = new wxChoice(m_ToolBar, ID_COMBOBOX1,
313  wxDefaultPosition, wxSize(180,-1),
314  0, (const wxString*)NULL);
315  m_ToolBar->AddControl(m_TargetChoice);
316 
317 
318  // buttons
319  wxBitmap bmp_start = wxArtProvider::GetBitmap(wxT("menu::dm_start"));
320  m_ToolBar->AddTool(scm_ModeCmd + eCmdStart, wxT("Start"), bmp_start, wxT("Start Search"));
321 
322  wxBitmap bmp_stop = wxArtProvider::GetBitmap(wxT("menu::dm_stop"));
323  m_ToolBar->AddTool(scm_ModeCmd + eCmdStop, wxT("Stop"), bmp_stop, wxT("Stop Search"));
324  m_ToolBar->EnableTool(scm_ModeCmd + eCmdStop, false);
325 
326  m_Animation = new wxAnimationCtrl(m_ToolBar, ID_ANIMATIONCTRL1, wxAnimation(),
327  wxDefaultPosition, wxSize(22, 22));
328 // m_Animation->SetInactiveBitmap(wxNullBitmap);
329 
330  wxString path = CSysPath::ResolvePath(wxT("<res>\\status_anim.gif"));
331  m_Animation->LoadFile(path);
332  m_ToolBar->AddControl(m_Animation);
333 
334  m_ToolBar->AddSeparator();
335 
336  wxBitmap bmp_range = wxArtProvider::GetBitmap(wxT("menu::dm_range"));
337  m_ToolBar->AddCheckTool(scm_ModeCmd + eCmdRangeLimit, wxT("Range"), bmp_range,
338  wxNullBitmap, wxT("Limit searches by selected range when possible"));
339  m_ToolBar->ToggleTool(scm_ModeCmd + eCmdRangeLimit, false);
340 
341  wxBitmap bmp_filter = wxArtProvider::GetBitmap(wxT("menu::dm_filter"));
342  m_ToolBar->AddCheckTool(scm_ModeCmd + eCmdFilter, wxT("Filter"), bmp_filter,
343  wxNullBitmap, wxT("Filter search results"));
344  m_ToolBar->ToggleTool(scm_ModeCmd + eCmdFilter, false);
345 
346  m_ToolBar->AddSeparator();
347 
348  wxBitmap bmp_query = wxArtProvider::GetBitmap(wxT("menu::dm_query"));
349  m_ToolBar->AddCheckTool(scm_ModeCmd + eCmdShowPanel, wxT("Form"), bmp_query,
350  wxNullBitmap, wxT("Show / Hide query pane"));
351  m_ToolBar->ToggleTool(scm_ModeCmd + eCmdShowPanel, true);
352 
353  m_ToolBar->Realize();
354  main_sizer->Add( m_ToolBar, 0, wxEXPAND );
355 
356  // form pane
357  m_FormSizer = new wxBoxSizer(wxVERTICAL);
358  main_sizer->Add(m_FormSizer, 0, wxGROW|wxALL, 0);
359 
360 
361  // wxStatusBar
362  m_Status = new wxStatusBar(m_ParentPanel, wxID_ANY, 0);
363  main_sizer->Add(m_Status, 0, wxEXPAND);
364 
365 
366  // separation line before the table
367  wxStaticLine* line = new wxStaticLine(m_ParentPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
368  main_sizer->Add(line, 0, wxEXPAND);
369 
370 
371  m_ListWidget = new CObjectListWidget(m_ParentPanel, ID_TABLE, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
374 
375  main_sizer->Add(m_ListWidget, 1, wxEXPAND);
376 
377  wxBoxSizer* frame_sizer = new wxBoxSizer(wxHORIZONTAL);
378  frame_sizer->Add(m_ParentPanel, 1, wxALL|wxGROW, 0);
379  SetSizerAndFit(frame_sizer);
380 
382 }
383 
384 
385 void CDataMiningPanel::OnButtonClicked(wxCommandEvent& event)
386 {
387  if (m_ToolBar->GetToolEnabled(scm_ModeCmd + eCmdStart)) {
388  x_ExecuteSearch();
389  x_SearchInProgress(true);
390  }
391  event.Skip();
392 }
393 
394 
396 {
397  if (m_Service) {
398  x_SyncTableSettings(true);
399 
400  string tool_name = ToStdString(m_TargetChoice->GetStringSelection());
401  CIRef<IDMSearchTool> tool = m_Service->GetToolByName(tool_name);
402 
403  CIRef<IDMSearchQuery> query = m_Form->ConstructQuery();
404 
405  string query_str = query->ToString();
406  if (query_str.empty()) {
407  LOG_POST(Info << "DataMining Filter for " << tool_name);
408  } else {
409  LOG_POST(Info << "DataMining Search Execute for " << tool_name
410  << "\n QUERY: " << query_str );
411  }
412 
413  tool->StartSearch(*query, *this);
414  m_Form->Push();
415  }
416 }
417 
418 
420 {
421  if (m_Service) {
422  string tool_name = ToStdString(m_TargetChoice->GetStringSelection());
423  CIRef<IDMSearchTool> tool = m_Service->GetToolByName(tool_name);
424  if( tool ){
425  tool->CancelSearch(*this);
426  }
427  }
428 }
429 
430 
431 void CDataMiningPanel::HandleTool(wxCommandEvent& event)
432 {
433  switch(event.GetId() - scm_ModeCmd){
434  case eCmdShowPanel:
435  if ( ! m_FormSizer->GetChildren().empty()) {
436  if (event.IsChecked()) {
437  m_FormSizer->Show(size_t(0));
438  } else {
439  m_FormSizer->Hide(size_t(0));
440  }
441  m_ParentPanel->Layout();
442  m_ListWidget->Refresh();
443  }
444  break;
445  case eCmdRangeLimit:
446  if (m_Form) {
447  m_Form->SetRangeLimit(event.IsChecked());
448  }
449  break;
450  case eCmdFilter:
451  if (m_Form) {
452  string tool_name = ToStdString(m_TargetChoice->GetStringSelection());
453  CIRef<IDMSearchTool> tool = m_Service->GetToolByName(tool_name);
454 
455  CFilterDialog dlg(NULL);
456  dlg.GetFilters() = tool->GetFilters();
457 
458  m_ToolBar->ToggleTool(scm_ModeCmd + eCmdFilter, !event.IsChecked());
459 
460  if (dlg.ShowModal() == wxID_OK) {
461  tool->SetFilters() = dlg.GetFilters();
462  m_ToolBar->ToggleTool(scm_ModeCmd + eCmdFilter, !dlg.GetFilters().selected.empty());
463 
464  // if restart possible, do it
465  if (m_ToolBar->GetToolEnabled(scm_ModeCmd + eCmdStart)) {
466  x_RestartSearch();
467  }
468  }
469  }
470  break;
471  case eCmdStart:
472  x_CancelSearch();
473  x_ExecuteSearch();
474  x_SearchInProgress(true);
475  break;
476 
477  case eCmdStop:
478  x_CancelSearch();
479  x_SearchInProgress(false);
480  break;
481  };
482 }
483 
484 void CDataMiningPanel::OnCustomCopy(wxCommandEvent& event)
485 {
486  int column = event.GetId() - eCmdCopy1;
487  wxString clip_str;
488 
489  if (m_ListWidget->GetItemCount() && m_ListWidget->GetSelectedItemCount()) {
490  long sel = m_ListWidget->GetFirstSelected();
491  if (sel!=-1) {
492  clip_str = m_ListWidget->GetValueVisibleAt(static_cast<int>(sel), column).GetString();
493  }
494  }
495 
496  if( !clip_str.IsEmpty() ){
497  CSimpleClipboard::Instance().Set( clip_str );
498  }
499 }
500 
501 
503 {
504  return m_Service;
505 }
506 
507 
509 {
510  x_SearchInProgress(false);
511 
512  string strMsg = "Search is completed at ";
513 
514  try {
515  CObjectListTableModel* oltm = result.DetachOLTModel();
516  CObjectList * ol = result.GetObjectList();
517 
518  if (ol) {
519  if (oltm == NULL){
520  m_ListWidget->Init(*ol);
521  } else {
522  m_ListWidget->Init(*ol, oltm);
523  }
524 
525  x_SyncTableSettings(false);
526 
527  strMsg += (NStr::IntToString(ol->GetNumRows()) + " items.");
528  if (result.IsIncomplete()) {
529  strMsg += " Total found: " + NStr::NumericToString(result.GetMaxSearchResult());
530  strMsg += ".";
531  }
532  }
533  }
534  catch (CException& e) {
535  LOG_POST(Error << "CDataMiningPanel::OnSearchFinished(): OLW Error: " << e.GetMsg());
536  }
537  catch (std::exception& e) {
538  LOG_POST(Error << "CDataMiningPanel::OnSearchFinished(): Unexpected OLW Error" << e.what());
539  }
540 
541  m_Status->SetStatusText(ToWxString(strMsg));
542 }
543 
545 {
546  m_Status->SetStatusText(ToWxString(prg_text));
547  m_Workbench->GetMainWindow()->SendSizeEvent();
548 }
549 
550 
552 {
553  m_Status->SetStatusText(wxT("Search has been cancelled"));
554  x_SearchInProgress(false);
555 }
556 
557 
559 {
560  m_Status->SetStatusText(ToWxString(error));
561  x_SearchInProgress(false);
562 }
563 
564 
566 {
567  if (!m_SearchInProgress)
568  m_ToolBar->EnableTool(scm_ModeCmd + eCmdStart, benable);
569 }
570 
571 
573 {
574  if (bYes) {
575  m_Animation->Play();
576  m_ToolBar->EnableTool(scm_ModeCmd + eCmdStart, false);
577  m_ToolBar->EnableTool(scm_ModeCmd + eCmdStop, true);
578  m_Status->SetStatusText(wxT("Please wait, search is in progress..."));
579 
580  } else {
581  m_Animation->Stop();
582  m_ToolBar->EnableTool(scm_ModeCmd + eCmdStart, true);
583  m_ToolBar->EnableTool(scm_ModeCmd + eCmdStop, false);
584  m_Status->SetStatusText(wxT("Ready"));
585  }
586 
587  m_SearchInProgress = bYes;
588 
589  // This forces a window update (otherwise widgets look bad on mac)
590  if (m_Workbench)
591  m_Workbench->GetMainWindow()->SendSizeEvent();
592 }
593 
594 
596 {
597  if (service == NULL) {
598  // this is part of PreDetach, at this point we should cancel ongoing background search job
599  x_CancelSearch();
600  }
601 
602  m_Service = service;
603 
604  if(m_CurrToolName.empty()) {
605  // select the first tool
606  vector<string> names;
608  if( ! names.empty()) {
609  m_CurrToolName = names[0];
610  }
611  }
612 }
613 
614 
615 void CDataMiningPanel::SetRegistryPath(const string& reg_path)
616 {
617  m_RegPath = reg_path; // store for later use
618 }
619 
620 
621 static const char * kSelectedTool = "SelectedTool";
622 static const char * kAutocomplete = "Autocomplete";
623 
624 
626 {
627  if( ! m_RegPath.empty() ){
629  CRegistryWriteView view = gui_reg.GetWriteView(m_RegPath);
630 
632  view.Set(kAutocomplete, m_Dict);
633 
634  if (m_Form) {
635  m_Form->SaveSettings();
636  }
637 
638  x_SyncTableSettings(true);
639  }
640 }
641 
642 
644 {
645  if( ! m_RegPath.empty() ){
647  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
648 
651 
652  if (m_Form) {
653  m_Form->LoadSettings();
654  }
655 
656  x_SyncTableSettings(false);
657  }
658 }
659 
660 
662 {
664 
665  /*
666  wxArrayInt objIxs = m_ListWidget->GetDataRowsSelected();
667 
668  for( int i = 0; i < (int)objIxs.size(); ++i ){
669  int ix = objIxs[i];
670  CObject* obj = ((CObjectListTableModel*)m_ListWidget->GetModel())->GetObject(ix);
671  CScope* sc = ((CObjectListTableModel*)m_ListWidget->GetModel())->GetScope(ix);
672  buf.push_back( SConstScopedObject(*obj, *sc) );
673  }
674  */
675 }
676 
678 {
679  aMenu.Append( wxID_SEPARATOR, wxT("Actions") );
680 
681  aMenu.Append(eCmdAddToNew, wxT("Add to Project..."));
682  aMenu.Append(eCmdCreateFeature, wxT("Create Feature..."));
683 }
684 
685 
686 
687 WX_DEFINE_MENU(kContextMenu)
688  WX_MENU_SEPARATOR_L("Top Actions")
689  WX_MENU_SEPARATOR_L("Actions")
690 WX_END_MENU()
691 
692 
693 void CDataMiningPanel::OnContextMenu( wxContextMenuEvent& anEvent )
694 {
695  SetFocus();
696 
697  CUICommandRegistry& cmd_reg = m_Workbench->GetUICommandRegistry();
698 
699  //wxMenu* menu;
700 
701  // custom copy submenu
702  wxMenu* ccMenu = NULL;
703 
704 
705  //void* data = anEvent.GetClientData();
706  //menu = data ? (wxMenu*)data : new wxMenu();
707  wxMenu* menu = cmd_reg.CreateMenu(kContextMenu);
708 
709  // adding custom copy menu
710  if (m_ListWidget->GetItemCount() && m_ListWidget->GetSelectedItemCount()) {
711  ccMenu = new wxMenu();
712 
713  int cols = m_ListWidget->GetColumnCount();
714  wxListItem col;
715  for (int i=0; i<cols && i<10; i++) {
716  const int mod_ix = m_ListWidget->ColumnIndexToModel(i);
717  ccMenu->Append(eCmdCopy1 + mod_ix, m_ListWidget->GetColumnNameByModel(mod_ix));
718  }
719  menu->Append( wxID_ANY, wxT("Copy Column"), ccMenu);
720  }
721 
722 
723  AppendMenuItems( *menu );
724 
725  if( /*ShouldPropagate()*/ false ){
726  anEvent.SetClientData( menu );
727  anEvent.Skip();
728  return;
729  }
730 
731  anEvent.SetClientData( NULL );
732 
733 
734  unique_ptr<wxMenu> main_menu( CreateContextMenuBackbone() );
735  Merge( *main_menu.get(), *menu );
736 
737  // check for contributors menues
739  m_Service->GetContributors();
740 
741  if (!contrib.empty()) {
742  for( size_t i = 0; i < contrib.size(); i++ ) {
743  IDMContextMenuContributor& contributor = *contrib[i];
744  unique_ptr<wxMenu> c_menu(contributor.GetContextMenu());
745  Merge(*main_menu.get(), *c_menu);
746  }
747  }
748 
749  CleanupSeparators( *main_menu );
750  PopupMenu( main_menu.get() );
751 
752 
753  if (menu) {
754  delete menu;
755  }
756 }
757 
758 void CDataMiningPanel::OnMenuEvent(wxCommandEvent& event)
759 {
760  if( mf_Reentry ){
761  event.Skip();
762  return;
763  }
764  CBoolGuard _guard( mf_Reentry );
765 
766  if (!GetEventHandler()->ProcessEvent(event)) {
767  // forward contributors if necessary
770 
771  if (!contrib.empty()) {
772  for( size_t i = 0; i < contrib.size(); i++ ) {
773  IDMContextMenuContributor* contributor = contrib[i];
774  wxMenuItem * menu_item =
775  contributor->GetContextMenu()->FindItem(event.GetId());
776 
777  if (menu_item) {
778  // check whether contributor is a handler
779  wxEvtHandler * contrib_handler =
780  dynamic_cast<wxEvtHandler *>(contributor);
781 
782  IWMClient * contrib_win =
783  dynamic_cast<IWMClient *>(contributor);
784 
785  bool bHandled = false;
786 
787  if (contrib_handler) {
788  bHandled = contrib_handler->ProcessEvent(event);
789  }
790  else if (contrib_win) {
791  wxWindow* window = contrib_win->GetWindow();
792  _ASSERT(window);
793  bHandled = window->GetEventHandler()->ProcessEvent(event);
794  }
795  else {
796  bHandled = wxTheApp->GetTopWindow()->GetEventHandler()->ProcessEvent(event);
797  }
798 
799  if (!bHandled) {
800  event.Skip();
801  }
802  }
803  }
804  }
805  }
806 }
807 
808 
809 //TODO this a hack, this operation needs to be redesigned
810 void CDataMiningPanel::OnAddToNew(wxCommandEvent& event)
811 {
812  if (m_Workbench) {
813  TConstScopedObjects objs;
814  GetSelection(objs);
815  x_AddToProject(objs);
816  }
817 }
818 
819 void CDataMiningPanel::OnCreateFeature(wxCommandEvent& event)
820 {
821  if (m_Workbench) {
822  x_CreateFeature();
823  }
824 }
825 
826 void CDataMiningPanel::OnUpdateCreateFeature(wxUpdateUIEvent& event)
827 {
828  if (!m_ListWidget || m_ListWidget->GetItemCount() == 0 ||
829  m_ListWidget->GetSelectedItemCount() == 0) {
830  event.Enable(false);
831  return;
832  }
833 
835  IDMSearchTool::TConversions& conv = tool->GetConversions();
836  event.Enable(!conv.options.empty());
837 }
838 
839 
840 void CDataMiningPanel::OnEnableCmdRclick(wxUpdateUIEvent& event)
841 {
842  event.Enable(m_ListWidget &&
843  m_ListWidget->GetItemCount() && m_ListWidget->GetSelectedItemCount());
844 }
845 
846 
847 
849 {
852  GetSelection(in);
853 
855  IDMSearchTool::TConversions & conv = tool->GetConversions();
856  string label = tool->GetName() + " tool results";
857  string comments = "";
858 
859  dlg.SetIO(in, out);
860  dlg.SetConstraints(conv.options, conv.selected);
861  dlg.SetLbl(ToWxString(label));
862  if (dlg.ShowModal() == wxID_OK) {
864  ToStdString(dlg.GetLbl()),
865  ToStdString(dlg.GetComments()));
866  }
867 }
868 
869 
870 void CDataMiningPanel::x_AddToProject(TConstScopedObjects & objs, string label, string comment)
871 {
873 
874  CGBankLoadingJob* job = new CGBankLoadingJob(objs, label, comment);
875 
876  CSelectProjectOptions options;
877  options.Set_CreateNewProject("Search Results");
878  options.Set_DecideLater();
879 
880  CDataLoadingAppTask* task = new CDataLoadingAppTask(prjService, options, *job, "Add to Project");
882 }
883 
884 
885 void CDataMiningPanel::OnSearchButton(wxCommandEvent& event)
886 {
887  x_RestartSearch();
888 }
889 
890 
891 void CDataMiningPanel::OnTargetChanged(wxCommandEvent& event)
892 {
893  x_TargetChanged();
894 }
895 
897 {
898  x_SyncTableSettings(true);
900 }
901 
903 {
904  m_Workbench = workbench;
905 }
906 
907 
908 void CDataMiningPanel::SelectToolByName(const string& tool_name)
909 {
910  vector<string> names;
912 
913  for( size_t i = 0; i < names.size(); i++ ) {
914  if(names[i] == tool_name) {
915  m_TargetChoice->SetStringSelection(ToWxString(tool_name));
916  x_TargetChanged();
917  return;
918  }
919  }
920  LOG_POST(Error << "CDataMiningPanel::SelectTool() - invalid tool name " << tool_name);
921 }
922 
923 
925 {
926  return EDisplayMode(cmd - scm_ModeCmd);
927 }
928 
929 
931 {
932  // register icons only once
933  /*
934  if( ! m_bInitialized ){
935  wxFileArtProvider* provider = GetDefaultFileArtProvider();
936 
937  provider->RegisterFileAlias("menu::insp_table_mode", "insp_table_mode.png");
938  provider->RegisterFileAlias("menu::insp_brief_text_mode", "insp_brief_text_mode.png");
939  provider->RegisterFileAlias("menu::insp_text_mode", "insp_text_mode.png");
940 
941  m_bInitialized = true;
942  }
943  */
944 }
945 
947 {
948  //if( m_DisplayMode == eTable ){
949  // m_ListWidget->Init( m_SelObjects );
950 
951  //} else {
952  // m_TextWidget->Init(m_SelObjects, m_DisplayMode == eBriefText);
953  //}
954  LoadSettings();
955 }
956 
957 
959 {
960  m_NeedUpdate = true;
961  if (!m_Timer.IsRunning())
962  m_Timer.Start(500, wxTIMER_ONE_SHOT);
963 }
964 
965 
966 void CDataMiningPanel::OnAutorun(wxTimerEvent& event)
967 {
968  if (m_NeedUpdate) {
969  m_NeedUpdate = false;
970 
971  m_TargetChoice->Clear();
972  if(m_Service) {
973  // fill the list
974  vector<string> names;
976 
977  ITERATE(vector<string>, name, names){
978  m_TargetChoice->Append(ToWxString(*name));
979  }
980  m_TargetChoice->SetStringSelection(ToWxString(m_CurrToolName));
981  }
983  }
984  else
985  x_ExecuteSearch();
986 }
987 
989 {
990  if (m_Service) {
991  string tmp = ToStdString(m_TargetChoice->GetStringSelection());
992  if (m_CurrToolName != tmp) {
993 
994  if( !tmp.empty() ){
996  }
997 
999 
1000  m_ListWidget->Clear();
1001 
1002  // check whether try looking into cache
1003  if( !tool.IsNull() ){
1004  x_UpdateWidget();
1005 
1006  if( tool->GetFlags() & IDMSearchTool::eCache ){
1007  // autorun and cache are not compatible
1008  if( tool->GetFlags() & IDMSearchTool::eAutorun ){
1009  LOG_POST(Error << "CDataMiningPanel - Autorun ignored for tool: " << m_CurrToolName);
1010  }
1011  else {
1012  try {
1013  CIRef<IDMSearchQuery> query = m_Form->ConstructQuery();
1014  tool->PullSearch( *query, *this );
1015  }
1016  catch( std::exception& e ){
1017  LOG_POST(Error << "CDataMiningPanel - Attempt to retreive cached results for a tool failed." << e.what());
1018  x_CancelSearch();
1019  }
1020  }
1021  }
1022 
1023  // check for autorun flag and launch tool as needed
1024  if ((tool->GetFlags() & IDMSearchTool::eAutorun) &&
1025  !m_Timer.IsRunning()) {
1026  m_Timer.Start(1000, wxTIMER_ONE_SHOT);
1027  }
1028  }
1029  }
1030 
1031  }
1032  x_UpdateWidget();
1033 }
1034 
1035 
1037 {
1038 #ifndef __WXMAC__
1039  Freeze();
1040 #endif
1041 
1042  bool bShown = true;
1043 
1044  if ( ! m_FormSizer->GetChildren().empty()) {
1045  bShown = m_FormSizer->IsShown(size_t(0));
1046  }
1047 
1048  if (m_Form) {
1049  m_Form->SaveSettings();
1050  string mvalue = m_Form->GetMainValue();
1051  if (mvalue!="#empty#") {
1052  m_MainValue = mvalue;
1053  }
1054  }
1055 
1056  m_FormSizer->Clear(true);
1057 
1059  m_Form = tool->CreateSearchForm();
1060  m_Form->SetController(this);
1061  m_Form->SetRegistryPath(m_RegPath);
1062  m_Form->Init();
1063 
1064  // reset buttons
1065  if ( ! m_Animation->IsPlaying()) {
1066  x_SearchInProgress(false);
1067  }
1068 
1069  // refresh contexts
1070  m_Form->UpdateContexts();
1071 
1072  m_Form->LoadSettings();
1073 
1074  wxSizer * dynamicForm = m_Form->GetWidget(m_ParentPanel);
1075  if (m_Form && dynamicForm) {
1076  m_FormSizer->Add(dynamicForm, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
1077  if ( ! bShown) {
1078  m_FormSizer->Hide(size_t(0));
1079  }
1080  }
1081 
1082  // enable auto-complete
1083  m_Form->SetDictionary(&m_Dict);
1084 
1085  // post-process form
1086  m_Form->Update();
1087 
1088  // preserve main search value
1089  m_Form->SetMainValue(m_MainValue);
1090 
1091  // enable/disable filter
1092  m_ToolBar->EnableTool(scm_ModeCmd + eCmdFilter,
1093  (tool->GetFlags() & IDMSearchTool::eFilter));
1094 
1095  // layout
1096  m_ParentPanel->Layout();
1097 
1098 #ifndef __WXMAC__
1099  Thaw();
1100 #endif
1101 }
1102 
1103 
1105 {
1106  x_CancelSearch();
1107  x_ExecuteSearch();
1108  x_SearchInProgress(true);
1109 }
1110 
1112 {
1113  m_Range = range;
1114  //m_ToolBar->GetToolState(scm_ModeCmd + eCmdRangeLimit)
1115 
1116  string status_text = "Ready";
1117  if (m_Range.GetLength()) {
1118  status_text = "Visible range selected: [" + NStr::IntToString(m_Range.GetFrom()) +
1119  " - " + NStr::IntToString(m_Range.GetTo()) + "]";
1120  }
1121  m_Status->SetStatusText(ToWxString(status_text));
1122 }
1123 
1124 
1125 ///////////////////////////////////////////////////////////////////////////////
1126 /// CGBankLoadingJob
1128  string label, string comment)
1129 : m_Objs(ids),
1130  m_Label(label),
1131  m_Comment(comment)
1132 {
1133 }
1134 
1136 {
1137  CRef<CSeq_annot> annot;
1138  CRef<CProjectItem> item;
1139  CRef<CProjectItem> sl_item;
1140 
1141 
1142  // possible case
1143 // CRef<CSeq_annot> annot(new CSeq_annot());
1144 
1145  // iterate by ids and create items
1146  for ( size_t i = 0; i < m_Objs.size(); i++ ) {
1147  // create a Project Item
1148  //CRef<CProjectItem> item(new CProjectItem());
1149  // TODO: do we need support for multiple scopes here?
1150  if (!m_Scope) {
1151  m_Scope = m_Objs[i].scope;
1152  }
1153 
1154  const CXmlNodeObject * docsum =
1155  dynamic_cast<const CXmlNodeObject*>(m_Objs[i].object.GetPointer());
1156 
1157  const objects::CSeq_loc * seq_loc =
1158  dynamic_cast<const objects::CSeq_loc*>(m_Objs[i].object.GetPointer());
1159 
1160  const objects::CSeq_feat * seq_feat =
1161  dynamic_cast<const objects::CSeq_feat*>(m_Objs[i].object.GetPointer());
1162 
1163  const objects::CVariation * snp_search =
1164  dynamic_cast<const objects::CVariation*>(m_Objs[i].object.GetPointer());
1165 
1166  const objects::CVcfVariant * vcf_search =
1167  dynamic_cast<const objects::CVcfVariant*>(m_Objs[i].object.GetPointer());
1168 
1169  if (docsum) {
1170  // creating project item for each docsum
1171  string label;
1172  item.Reset(new CProjectItem());
1173  CRef<CSerialObject> obj(x_Convert(docsum->GetNode(),docsum->GetDBName()));
1174 
1176  scope.AddDefaults();
1177  CLabel::GetLabel(*obj, &label, CLabel::eDefault, &scope);
1178  item->SetLabel(label);
1179  item->SetObject(*obj);
1180 
1181  // add item to a list
1182  AddProjectItem(*item);
1183  }
1184  else if (snp_search) {
1185  item.Reset(new CProjectItem());
1186 
1187  // CVariation used as a search result can have one and only one placement
1188  NCBI_ASSERT(snp_search->CanGetPlacements(), "Unexpected absence of placements in SNP Search Result!");
1189  const objects::CVariation::TPlacements& Placements(snp_search->GetPlacements());
1190  NCBI_ASSERT(Placements.size(), "Unexpected number of placements in SNP Search Result!");
1191  CRef<CVariantPlacement> pPlacement(Placements.front());
1192 
1193  item->SetObject(pPlacement->SetLoc());
1195 
1196  // add item to a list
1197  AddProjectItem(*item);
1198  LOG_POST(Info << "Added SNP search project object " << "\n" << MSerial_AsnText << *item->GetObject());
1199  }
1200  else if (vcf_search) {
1201  item.Reset(new CProjectItem());
1202  CRef<CSeq_loc> seq_loc(new CSeq_loc);
1203  seq_loc->Assign(vcf_search->GetLocation());
1204  item->SetObject(*seq_loc);
1206  // add item to a list
1207  AddProjectItem(*item);
1208  LOG_POST(Info << "Added VCF search project object " << "\n" << MSerial_AsnText << *item->GetObject());
1209  }
1210  else if (seq_loc) {
1211  if (sl_item.Empty()) {
1212  annot.Reset(new CSeq_annot());
1213  annot->SetName(m_Label);
1214 
1215  CRef<CAnnotdesc> descr(new CAnnotdesc());
1216  descr->SetName(m_Label);
1217  descr->SetComment(m_Comment);
1218  annot->SetDesc().Set().push_back(descr);
1219 
1220  sl_item.Reset(new CProjectItem());
1221  }
1222 
1223  CRef<CSeq_feat> feat(new CSeq_feat());
1224  /*
1225  CSeq_loc& floc = feat->SetLocation();
1226  floc.SetInt().SetFrom(seq_loc->GetStart(eExtreme_Positional));
1227  floc.SetInt().SetTo(seq_loc->GetStop(eExtreme_Positional));
1228  // assume plus strand for now
1229  floc.SetInt().SetStrand(eNa_strand_plus);
1230  floc.SetId(sequence::GetId(*seq_loc, m_Objs[i].scope));
1231 
1232  CRef<CSeq_loc> new_loc =
1233  CSeqUtils::RemapChildToParent(*seq_loc, floc);
1234 
1235  feat->SetLocation(*new_loc);
1236  */
1237 
1238  feat->SetLocation(*const_cast<CSeq_loc*>(seq_loc));
1239 
1240 
1241  // set feature data
1242  feat->SetData().SetRegion() = "region";
1243 
1244  // save in annot
1245  annot->SetData().SetFtable().push_back(feat);
1246 
1247  }
1248  else if (seq_feat) {
1249  if (sl_item.Empty()) {
1250  annot.Reset(new CSeq_annot());
1251  annot->SetName(m_Label);
1252 
1253  CRef<CAnnotdesc> descr(new CAnnotdesc());
1254  descr->SetName(m_Label);
1255  descr->SetComment(m_Comment);
1256  annot->SetDesc().Set().push_back(descr);
1257 
1258  sl_item.Reset(new CProjectItem());
1259  }
1260  CRef<CSeq_feat> feat(new CSeq_feat());
1261  feat->Assign(*seq_feat);
1262  annot->SetData().SetFtable().push_back(feat);
1263  }
1264  }
1265 
1266  // if we created a an special item with seq annot, add it
1267  if (!sl_item.Empty()) {
1268  string label;
1270  sl_item->SetLabel(label);
1271  //sl_item->SetLabel("CSeq_annot");
1272 
1273  sl_item->SetObject(*annot);
1274  AddProjectItem(*sl_item);
1275  }
1276 }
1277 
1278 
1279 CRef<CSerialObject> CGBankLoadingJob::x_Convert(const xml::node &doc_sum, const string& db_name)
1280 {
1281  CRef<CSerialObject> obj;
1282 
1283  if(db_name == "nucleotide" || db_name == "protein") {
1284  /// Nucleotide and Protein - load as Seq-ids
1286  obj.Reset(id.GetPointer());
1287  } else if(db_name == "assembly") {
1288  xml::node::const_iterator a_acc = doc_sum.find("AssemblyAccession");
1289  string id_str;
1290  if (a_acc != doc_sum.end())
1291  id_str = a_acc->get_content();
1292 
1293  if (!id_str.empty()) {
1294  //!! used when an assembly found in the search view is put into the project in its serialized form
1295  //!! consequence in requested information reduction: less sequences are suggested when clicked upon
1296  //!! from project view (maybe less alignments too). suggestion: use the reduced assembly by default,
1297  //!! but give the user an option to request a full one (giving a warning that it will take much more
1298  //!! time and space to handle)
1299  // using the seqconfig service here is safe b/c data mining view/panel are not ever used from SViewer
1300  CRef<CGC_Assembly> gc_assm = CGencollSvc::GetInstance()->GetGCAssembly(id_str, true, "Gbench", nullptr, true);
1301  if (!gc_assm) {
1302  string msg = "Failed to retrieve gencoll assembly for ";
1303  msg += id_str;
1305  }
1306  obj.Reset(gc_assm.GetPointer());
1307  } else {
1308  string msg = "The object doesn't contain assembly information.";
1310  }
1311  } else if(db_name == "gene") {
1312  /// Entrez Gene
1314  obj.Reset(gene.GetPointer());
1315  }
1316 
1317  return obj;
1318 }
1319 
1321 {
1322  return "Add search results to project...";
1323 }
1324 
1325 
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
CLocalRange< TOffset > TRange
define for the fundamental building block of sequence ranges
Definition: base.hpp:115
CAnnotdesc –.
Definition: Annotdesc.hpp:66
CDMSearchResult - result object delivered using job progress object.
void AddProjectItem(objects::CProjectItem &item)
CRef< objects::CScope > m_Scope
CDataLoadingAppTask - a task that executes CDataLoadingAppJob.
CDataMiningPanel.
CFixGenericListCtrl m_FixGenericListCtrl
wxBoxSizer * m_FormSizer
virtual void OnSearchFinished(CDMSearchResult &result)
static const int scm_ModeCmd
virtual void OnSearchCanceled()
virtual void SetWorkbench(IWorkbench *workbench)
virtual void AppendMenuItems(wxMenu &aMenu)
virtual void LoadSettings()
virtual void SaveSettings() const
list< string > m_Dict
void OnMenuEvent(wxCommandEvent &event)
void OnButtonClicked(wxCommandEvent &event)
virtual void OnSearchFailed(const string &error)
virtual void OnSearchProgress(CDMSearchResult &result, const string &prg_text)
void OnSelectionChanged(wxListEvent &event)
virtual CDataMiningService * GetDataMiningService()
void GetSelection(TConstScopedObjects &buf) const
CObjectListWidget * m_ListWidget
void OnListItemActivate(wxListEvent &event)
wxAnimationCtrl * m_Animation
void OnTargetChanged(wxCommandEvent &event)
void SetRange(objects::CSeq_loc::TRange &range)
void OnSearchButton(wxCommandEvent &event)
void OnCreateFeature(wxCommandEvent &event)
IWorkbench * m_Workbench
virtual void OnSearchEnabled(bool benable)
void OnCustomCopy(wxCommandEvent &event)
wxStatusBar * m_Status
void SetService(CDataMiningService *service)
void Init()
Initialises member variables.
EDisplayMode x_GetModeByCommand(TCmdID cmd)
void x_AddToProject(TConstScopedObjects &obj, string label="", string comment="")
void OnContextMenu(wxContextMenuEvent &event)
void x_SyncTableSettings(bool bWrite) const
void OnColumnEndDrag(wxListEvent &event)
void OnUpdateNeeded(wxCommandEvent &event)
virtual void SelectToolByName(const string &tool_name)
CIRef< IDMSearchForm > m_Form
void OnAutorun(wxTimerEvent &event)
void OnAddToNew(wxCommandEvent &event)
void HandleTool(wxCommandEvent &event)
virtual void Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
void OnUpdateCreateFeature(wxUpdateUIEvent &event)
void OnEnableCmdRclick(wxUpdateUIEvent &event)
void CreateControls()
Creates the controls and sizers.
virtual bool Destroy()
void x_SearchInProgress(bool bYes=true)
CDataMiningService * m_Service
virtual void SetRegistryPath(const string &reg_path)
objects::CSeq_loc::TRange m_Range
void OnHyperlinkctrlClicked(wxHyperlinkEvent &event)
CDataMiningService.
vector< IDMContextMenuContributor * > TContributors
virtual void GetToolNames(vector< string > &names) const
virtual CIRef< IDMSearchTool > GetToolByName(const string &name)
TContributors & GetContributors()
CDataMiningView.
static CRef< objects::CEntrezgene > CreateGene_Gene(const xml::node &ds)
static CRef< objects::CSeq_id > CreateId_Nuc_Prot(const xml::node &ds)
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
wxString GetComments() const
void SetLbl(wxString value)
void SetIO(TConstScopedObjects &in, TConstScopedObjects &out)
void SetConstraints(vector< objects::CSeqFeatData::ESubtype > &options, objects::CSeqFeatData::ESubtype selected)
IDMSearchTool::TFilters & GetFilters()
void ConnectToControl(wxListCtrl &listCtrl)
Definition: wx_utils.cpp:1167
CRef< CSerialObject > x_Convert(const xml::node &doc_sum, const string &db_name)
TConstScopedObjects m_Objs
virtual void x_CreateProjectItems()
override this function in derived classes and populate m_Items.
CGBankLoadingJob(TConstScopedObjects &objs, string label="", string comment="")
CGBankLoadingJob.
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
static CRef< CGencollSvc > GetInstance(void)
Definition: gencoll_svc.cpp:54
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
CObjectListTableModel.
CObjectListWidget - mediator widget.
void Init(CObjectList &list, CObjectListTableModel *model=new CObjectListTableModel())
Inits widget with object list and optional model.
void GetSelection(TConstScopedObjects &objects)
ISelection-style API.
CObjectList Data structure representing a list of CObjects with associated Scopes and other optional ...
Definition: object_list.hpp:63
int GetNumRows() const
const CSerialObject * GetObject() const
retrieve the object pointed to as a CObject*
void SetObject(CSerialObject &object)
wrapper for setting the object pointed to by this item
CProjectService - a service providing API for operations with Workspaces and Projects.
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
string GetString(const string &key, const string &default_val=kEmptyStr) const
Definition: reg_view.cpp:246
void GetStringList(const string &key, list< string > &val) const
Definition: reg_view.cpp:268
void Set(const string &key, int val)
access a named key at this level, with no recursion
Definition: reg_view.cpp:533
CScope –.
Definition: scope.hpp:92
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
void Set_CreateNewProject(const string &folder=kEmptyStr)
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
void Set(const T &val)
static CSimpleClipboard & Instance()
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
Definition: sys_path.cpp:106
CUICommandRegistry is a centralized registry where all application commands should be registered.
Definition: ui_command.hpp:146
wxMenu * CreateMenu(const SwxMenuItemRec *items)
create a menu from a static definition (see WX_*_MENU macros)
Definition: ui_command.cpp:349
@ eWidgetSelectionChanged
a view has been destroyed
Definition: view_event.hpp:55
const std::string & GetDBName() const
const xml::node & GetNode() const
void SetContextMenuEventPropagation(bool flag)
void AssignModel(IwxTableModel *data_model)
void LoadTableSettings(const CRegistryReadView &view, bool byName=false)
void SaveTableSettings(CRegistryWriteView &view, bool saveSorting=true) const
wxVariant GetValueVisibleAt(int row, int col) const
IDMContextMenuContributor - contributes menu to Data Mining Service.
virtual wxMenu * GetContextMenu()=0
returns a menu (must be deleted by the caller)
IWClient - abstract Window Manager client.
Definition: wm_client.hpp:50
virtual wxWindow * GetWindow()=0
returns a pointer to the wxWindow representing the client
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
The xml::node::const_iterator provides a way to access children nodes similar to a standard C++ conta...
Definition: node.hpp:746
The xml::node class is used to hold information about one XML node.
Definition: node.hpp:106
iterator end(void)
Get an iterator that points one past the last child for this node.
Definition: node.hpp:835
iterator find(const char *name, const ns *nspace=NULL)
Find the first child node that has the given name and namespace.
Definition: node.cpp:1258
const char * get_content(void) const
Get the content for this text node.
Definition: node.cpp:797
@ eCmdCreateFeature
Definition: commands.hpp:108
static const char * kAutocomplete
USING_SCOPE(objects)
static const char * kSelectedTool
#define ID_ANIMATIONCTRL1
#define ID_HYPERLINKCTRL
#define ID_COMBOBOX_UPDATE
#define ID_COMBOBOX1
#define ID_TABLE
#define ID_TOOLBAR
#define TIMER_ID
std::ofstream out("events_result.xml")
main entry point for tests
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static const struct name_t names[]
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
static void Init(void)
Definition: cursor6.c:76
static const char * column
Definition: stats.c:23
static char tmp[3200]
Definition: utf8.c:42
static TDSICONV * conv
Definition: charconv.c:168
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NULL
Definition: ncbistd.hpp:225
#define NCBI_ASSERT(expr, mess)
Definition: ncbidbg.hpp:130
#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 Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
Definition: ncbiexpt.cpp:342
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
virtual wxFrame * GetMainWindow()=0
returns a pointer to the main application frame window
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
void AddTask(IAppTask &task)
Add a task to the queue.
virtual CAppTaskService * GetAppTaskService()=0
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
Definition: label.cpp:140
static void SetLabelByData(objects::CProjectItem &item, objects::CScope *scope=NULL)
Definition: label.cpp:121
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Sends an event synchronously.
int TCmdID
@ eEvent_Message
message from one class to another
Definition: event.hpp:99
@ eDefault
Definition: label.hpp:73
@ eContent
Definition: label.hpp:62
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:696
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
Definition: Seq_loc.cpp:337
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
Definition: scope.cpp:504
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:735
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:719
#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 string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5078
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
static const char label[]
void SetLabel(const TLabel &value)
Assign a value to Label data member.
void SetLocation(TLocation &value)
Assign a value to Location data member.
Definition: Seq_feat_.cpp:131
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_annot_.cpp:244
void SetName(const TName &value)
Assign a value to Name data member.
Definition: Seq_annot_.hpp:814
void SetDesc(TDesc &value)
Assign a value to Desc data member.
Definition: Seq_annot_.cpp:223
TName & SetName(void)
Select the variant.
Definition: Annotdesc_.hpp:508
TComment & SetComment(void)
Select the variant.
Definition: Annotdesc_.hpp:548
void SetLoc(TLoc &value)
Assign a value to Loc data member.
END_EVENT_TABLE()
char * buf
int i
CMinPanelContainer::OnRestoreWindow EVT_UPDATE_UI_RANGE(eCmdCloseDockPanel, eCmdWindowRestore, CMinPanelContainer::OnUpdateWindowCommand) CMinPanelContainer
#define wxT(x)
Definition: muParser.cpp:41
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
std::istream & in(std::istream &in_, double &x_)
wxMenu * CreateContextMenuBackbone()
The Object manager core.
static static static wxID_ANY
EVT_MENU_RANGE(MID_SHOW_TITLES, MID_HIDE_TITLES, ViewerWindowBase::OnTitleView) EVT_MENU_RANGE(MID_ENABLE_EDIT
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static string query
#define _ASSERT
else result
Definition: token2.c:20
#define WX_DEFINE_MENU(name)
New macros for defining menus for use with CUICommandRegistry.
Definition: ui_command.hpp:266
#define WX_END_MENU()
Definition: ui_command.hpp:294
#define WX_MENU_SEPARATOR_L(label)
Definition: ui_command.hpp:285
void SetFocus(CRef< objects::CSeq_entry > entry)
wxFileArtProvider * GetDefaultFileArtProvider()
Definition: wx_utils.cpp:334
void Merge(wxMenu &menu_1, const wxMenu &menu_2)
merges all items form menu_2 into menu_1, preserving the structure if possible
Definition: wx_utils.cpp:579
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
void CleanupSeparators(wxMenu &menu)
Removes extra separators (in the begining or at the end of the menu, ot those that precede other sepa...
Definition: wx_utils.cpp:668
Modified on Fri Sep 20 14:57:57 2024 by modify_doxy.py rev. 669887