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

Go to the SVN repository for this file.

1 /* $Id: edit_project_item_extension.cpp 41157 2018-06-02 21:27:27Z kachalos $
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: Roman Katargin
27  *
28  */
29 
30 #include <ncbi_pch.hpp>
31 
33 
35 
43 
46 
47 ///////////////////////////////////////////////////////////////////////////////
48 /// CSmartProjectItemExtension
49 
51 {
52  static string sid("edit_project_item_extension");
53  return sid;
54 }
55 
57 {
58  static string slabel("Package Sequence Edit Project item extension");
59  return slabel;
60 }
61 
63 {
64  if (item.HasTag("open_discrepancy_dlg")) {
65  if (m_DiscrepancyOpen) {
66  CAppTaskService* taskService = service_locator->GetServiceByType<CAppTaskService>();
67  COpenDiscrepancyTask* task = new COpenDiscrepancyTask(CDiscrepancyDlg::eNormal, dynamic_cast<CGBProjectHandle&>(doc), dynamic_cast<CWorkbench&>(*service_locator));
68  taskService->AddTask(*task);
69  }
70  if (m_MegareportOpen) {
71  CAppTaskService* taskService = service_locator->GetServiceByType<CAppTaskService>();
72  COpenDiscrepancyTask* task = new COpenDiscrepancyTask(CDiscrepancyDlg::eMega, dynamic_cast<CGBProjectHandle&>(doc), dynamic_cast<CWorkbench&>(*service_locator));
73  taskService->AddTask(*task);
74  }
75  if (m_OnCallerOpen) {
76  CAppTaskService* taskService = service_locator->GetServiceByType<CAppTaskService>();
77  COpenDiscrepancyTask* task = new COpenDiscrepancyTask(CDiscrepancyDlg::eOncaller, dynamic_cast<CGBProjectHandle&>(doc), dynamic_cast<CWorkbench&>(*service_locator));
78  taskService->AddTask(*task);
79  }
80  if (m_SubmitterOpen) {
81  CAppTaskService* taskService = service_locator->GetServiceByType<CAppTaskService>();
82  COpenDiscrepancyTask* task = new COpenDiscrepancyTask(CDiscrepancyDlg::eSubmitter, dynamic_cast<CGBProjectHandle&>(doc), dynamic_cast<CWorkbench&>(*service_locator));
83  taskService->AddTask(*task);
84  }
85  }
86  if (item.HasTag("open_editing_buttons")) {
87  wxWindow* main_window = NULL;
88  CWorkbench* wb_frame = dynamic_cast<CWorkbench*>(service_locator);
89  if (wb_frame)
90  main_window = wb_frame->GetMainWindow();
91  CEditingBtnsPanel::GetInstance(main_window, wb_frame);
92  }
93 }
94 
96 {
97  if (item.HasTag("open_discrepancy_dlg")) {
98  m_DiscrepancyOpen = false;
99  m_MegareportOpen = false;
100  m_OnCallerOpen = false;
101  m_SubmitterOpen = false;
102  wxWindowList children = wxTheApp->GetTopWindow()->GetChildren();
103  for (wxWindowList::compatibility_iterator it = children.GetFirst(); it; it = it->GetNext()) {
104  wxWindow *current = (wxWindow*)it->GetData();
105  CDiscrepancyDlg* dlg = dynamic_cast<CDiscrepancyDlg*>(current);
106  if (dlg) {
107  switch (dlg->GetType()) {
110  break;
113  break;
115  m_OnCallerOpen = dlg->NeedToReopen();
116  break;
118  m_SubmitterOpen = dlg->NeedToReopen();
119  break;
120  }
121  }
122  }
123  }
124  if (!item.HasTag("open_editing_buttons")) {
125  return;
126  }
127 }
128 
130 
User-defined methods of the data storage class.
CAppTaskService - Application Task Service.
bool NeedToReopen() const
EReportType GetType() const
virtual void ProjectItemDetached(objects::CProjectItem &item, CGBDocument &doc, IServiceLocator *service_locator)
virtual string GetExtensionIdentifier() const
CSmartProjectItemExtension.
virtual void ProjectItemAttached(objects::CProjectItem &item, CGBDocument &doc, IServiceLocator *service_locator)
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
static void GetInstance(wxWindow *parent, IWorkbench *workbench, bool autostart=false, wxWindowID id=10020, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(600, 400), long style=wxDEFAULT_FRAME_STYLE)
CGBDocument.
Definition: document.hpp:113
bool HasTag(const string &tag) const
Definition: ProjectItem.hpp:95
CWorkbench - default implementation of IWorkbench.
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
USING_SCOPE(objects)
#define NULL
Definition: ncbistd.hpp:225
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 wxFrame * GetMainWindow()
returns a pointer to the main application frame window
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Mon Jul 22 05:05:45 2024 by modify_doxy.py rev. 669887