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

Go to the SVN repository for this file.

1 /* $Id: edit_object_submit_block.cpp 42099 2018-12-19 18:25:33Z asztalos $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Colleen Bollin, based on a file by Roman Katargin
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
39 
44 #include <objects/biblio/Affil.hpp>
46 
47 #include <objmgr/util/sequence.hpp>
48 #include <objmgr/seqdesc_ci.hpp>
49 #include <objmgr/bioseq_ci.hpp>
50 
51 #include <wx/panel.h>
52 #include <wx/treebook.h>
53 #include <wx/toplevel.h>
54 
55 #ifdef _DEBUG
56 #include <serial/objostr.hpp>
57 #include <serial/serial.hpp>
58 #endif
59 
60 #include "submit_remarks_panel.hpp"
61 
64 
65 
66 wxWindow* CEditObjectSubmit_block::CreateWindow(wxWindow* parent)
67 {
68  if (m_Window) {
70  "CEditObjectSubmit_block::CreateWindow - Window already created!");
71  }
72  wxTopLevelWindow* gui_widget = dynamic_cast<wxTopLevelWindow*>(parent);
73  const CSubmit_block& submit_block = dynamic_cast<const CSubmit_block&>(*m_Object);
74 
75  m_EditedSubmitBlock.Reset((CSerialObject*)CSubmit_block::GetTypeInfo()->Create());
76  m_EditedSubmitBlock->Assign(submit_block);
77 
78  CSubmit_block& edited_submit_block = dynamic_cast<CSubmit_block&>(*m_EditedSubmitBlock);
79 
80  m_Window = new wxPanel(parent);
81 
82  wxBoxSizer* main_sizer = new wxBoxSizer(wxHORIZONTAL);
83  m_Window->SetSizer(main_sizer);
84 
85  m_Treebook = new wxTreebook(m_Window, wxID_ANY, wxDefaultPosition, wxSize(-1, 400), wxBK_DEFAULT );
86  main_sizer->Add(m_Treebook, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
87 
88  m_SubmitBlockPanel = new CSubmitBlockPanel(m_Treebook, Ref(&edited_submit_block));
89  m_Treebook->AddPage(m_SubmitBlockPanel, wxT("Submission"));
90 
91  m_ContactPanel = new CContactPanel (m_Treebook, edited_submit_block.SetContact());
92  m_Treebook->AddPage(m_ContactPanel, wxT("Contact"));
93 
94  CAuth_list& auth_list = edited_submit_block.SetCit().SetAuthors();
95  m_AuthorsPanel = new CAuthorNamesPanel(m_Treebook, auth_list, false);
96  m_Treebook->AddPage (m_AuthorsPanel, wxT("Authors"));
97 
99  m_Treebook->AddPage (m_AffilPanel, wxT("Affiliation"));
100 
101  m_Remarks = new CSubmitRemarksPanel (m_Treebook, edited_submit_block);
102  m_Treebook->AddPage (m_Remarks, wxT("Remarks"));
103 
105  if (gui_widget)
106  gui_widget->SetTitle(_("Submit block"));
107  return m_Window;
108 }
109 
111 {
118 
119 }
120 
121 
123 {
124  if (!m_Window)
125  return 0;
126 
127  if (!m_EditAction) {
128  CSubmit_block& edited_submit_block = dynamic_cast<CSubmit_block&>(*m_EditedSubmitBlock);
132  CAuth_list& auth_list = edited_submit_block.SetCit().SetAuthors();
133  m_AuthorsPanel->PopulateAuthors(auth_list);
136 
138  if (affil)
139  auth_list.SetAffil(*affil);
140  else
141  auth_list.ResetAffil();
142 
143 
144  try {
145  if (m_CreateMode) {
146 #if 0
148  dynamic_cast<const CSeqdesc&>(m_EditedDescriptor.GetObject())));
149 #endif
150  } else {
152  CObject* actual = (CObject*) m_Object.GetPointer();
155  }
156  } catch (CException& e) {
157  LOG_POST(Error << "CEditObjectSeq_desc::GetEditAction(): " << e.GetMsg());
158  }
159  }
160 
161  return m_EditAction.GetPointer();
162 }
163 
164 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
CRef< objects::CAffil > GetAffil()
void PopulateAuthors(objects::CAuth_list &auth_list)
virtual bool TransferDataToWindow()
virtual bool TransferDataFromWindow()
virtual bool TransferDataFromWindow()
virtual bool TransferDataToWindow()
CRef< CSerialObject > m_EditedSubmitBlock
CAuthorAffiliationPanel * m_AffilPanel
CSubmitBlockPanel * m_SubmitBlockPanel
virtual wxWindow * CreateWindow(wxWindow *parent)
creates a child (not top level) windows that can contain whatever controls/subwindows etc.
CIRef< IEditCommand > m_EditAction
virtual IEditCommand * GetEditCommand()
After placing the window in the Edit Object Dialog ShowModal() method of the dialog is called.
CObject –.
Definition: ncbiobj.hpp:180
Base class for all serializable objects.
Definition: serialbase.hpp:150
virtual bool TransferDataFromWindow()
virtual bool TransferDataToWindow()
virtual bool TransferDataFromWindow()
virtual bool TransferDataToWindow()
CSubmit_block –.
Interface (functor) for object editing.
#define _(proto)
Definition: ct_nlmzip_i.h:78
CChangeUnindexedObjectCommand< objects::CSubmit_block > CChangeSubmitBlockCommand
USING_SCOPE(objects)
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
#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 void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1684
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
Definition: ncbiobj.hpp:2015
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
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
void SetAffil(TAffil &value)
Assign a value to Affil data member.
Definition: Auth_list_.cpp:160
void ResetAffil(void)
Reset Affil data member.
Definition: Auth_list_.cpp:155
void SetCit(TCit &value)
Assign a value to Cit data member.
void SetContact(TContact &value)
Assign a value to Contact data member.
#define wxT(x)
Definition: muParser.cpp:41
static static static wxID_ANY
Modified on Wed Apr 17 13:09:08 2024 by modify_doxy.py rev. 669887