59 #include <wx/button.h>
60 #include <wx/stattext.h>
61 #include <wx/msgdlg.h>
62 #include <wx/display.h>
106 bool CEditPubDlg::Create( wxWindow* parent, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
109 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
115 GetSizer()->SetSizeHints(
this);
170 if (width >= 0 && height >= 0)
171 SetSize(wxSize(width,height));
176 if (pos_x >= 0 && pos_y >= 0)
179 for (
auto i = 0;
i < wxDisplay::GetCount();
i++)
181 wxDisplay display(
i);
182 max_x += display.GetGeometry().GetWidth();
184 if (pos_x + width > max_x) pos_x = wxGetDisplaySize().GetWidth()-width-5;
185 if (pos_y + height > wxGetDisplaySize().GetHeight()) pos_y = wxGetDisplaySize().GetHeight()-height-5;
187 SetPosition(wxPoint(pos_x,pos_y));
215 wxBoxSizer* itemBoxSizer1 =
new wxBoxSizer(wxVERTICAL);
216 SetSizer(itemBoxSizer1);
218 wxPanel* itemCBulkCmdDlg1 =
new wxPanel(
this,
wxID_ANY);
219 itemBoxSizer1->Add(itemCBulkCmdDlg1, 1, wxGROW, 0);
221 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
222 itemCBulkCmdDlg1->SetSizer(itemBoxSizer2);
224 m_Notebook =
new wxNotebook(itemCBulkCmdDlg1,
wxID_ANY,wxDefaultPosition,wxDefaultSize);
225 itemBoxSizer2->Add(
m_Notebook, 1, wxGROW|wxALL, 5);
231 m_Notebook->AddPage(panel2,
_(
"Replace entire pub"));
234 m_Notebook->AddPage(panel3,
_(
"Replace single field"));
245 authors->
Assign(*auth_list);
250 m_Notebook->AddPage(panel4,
_(
"Global author replace"));
252 wxStaticBox* constraintDetails =
new wxStaticBox(itemCBulkCmdDlg1,
wxID_ANY,
_(
"Constraint"));
253 wxStaticBoxSizer* itemStaticBoxSizer9 =
new wxStaticBoxSizer(constraintDetails, wxVERTICAL);
254 itemBoxSizer2->Add(itemStaticBoxSizer9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
256 wxBoxSizer* itemBoxSizer10 =
new wxBoxSizer(wxHORIZONTAL);
257 itemStaticBoxSizer9->Add(itemBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
261 itemBoxSizer10->Add(
m_Fieldhandler, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
266 wxBoxSizer* itemBoxSizer13 =
new wxBoxSizer(wxHORIZONTAL);
267 itemStaticBoxSizer9->Add(itemBoxSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
269 wxStaticText* itemStaticText14 =
new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), wxID_STATIC,
_(
"Publication Status"), wxDefaultPosition, wxDefaultSize, 0 );
270 itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
272 wxArrayString m_PubStatusConstraintStrings;
273 m_PubStatusConstraintStrings.Add(
_(
"Any"));
274 m_PubStatusConstraintStrings.Add(
_(
"Published"));
275 m_PubStatusConstraintStrings.Add(
_(
"Unpublished"));
276 m_PubStatusConstraintStrings.Add(
_(
"In Press"));
277 m_PubStatusConstraintStrings.Add(
_(
"Submitter Block"));
283 itemBoxSizer2->Add(
m_OkCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
364 *constraint1 += constraint2;
366 vector<CSeq_entry_Handle> descr_ctxt;
377 bool any_change(
false);
386 wxMessageBox(
wxT(
"No effect!"),
wxT(
"Error"), wxOK | wxICON_ERROR,
NULL);
397 sel_srv->GetCurrentSelection(
objects);
400 const CObject* ptr = it->object.GetPointer();
406 if (seqdesc && seqdesc->
IsPub()) {
412 }
else if (pubdesc) {
414 }
else if (block && block->
IsSetCit()) {
445 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
446 itemPanel1->SetSizer(itemBoxSizer2);
448 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxVERTICAL);
449 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL, 0);
451 m_AuthorListSection =
new wxCheckBox(
this,
wxID_ANY,
wxT(
"Replace author list with selected author list"), wxDefaultPosition, wxDefaultSize, 0 );
452 itemBoxSizer3->Add(m_AuthorListSection, 0, wxALIGN_LEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
453 m_TitleSection =
new wxCheckBox(
this,
wxID_ANY,
wxT(
"Replace title with selected title"), wxDefaultPosition, wxDefaultSize, 0 );
454 itemBoxSizer3->Add(m_TitleSection, 0, wxALIGN_LEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
455 m_AffiliationSection =
new wxCheckBox(
this,
wxID_ANY,
wxT(
"Replace affiliation with selected affiliation"), wxDefaultPosition, wxDefaultSize, 0 );
456 itemBoxSizer3->Add(m_AffiliationSection, 0, wxALIGN_LEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
472 bool any_change =
false;
473 auto obj_it = objs.begin();
474 auto seh_it = descr_ctxt.begin();
475 _ASSERT(objs.size() == descr_ctxt.size());
476 for ( ; obj_it != objs.end() && seh_it != descr_ctxt.end(); ++obj_it, ++seh_it)
479 if (d && d->
IsPub()) {
480 bool this_change =
false;
490 new_auth->
Assign(*this_auth);
495 bool skip_cit_sub =
true;
501 cmd->AddCommand (*ecmd);
526 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
527 itemPanel1->SetSizer(itemBoxSizer2);
529 wxStaticText* instructions =
new wxStaticText(
this, wxID_STATIC,
wxT(
"Replace with selected publication or submitter block"), wxDefaultPosition, wxDefaultSize, 0 );
530 itemBoxSizer2->Add(instructions, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
547 bool any_change =
false;
551 auto obj_it = objs.begin();
552 auto seh_it = descr_ctxt.begin();
553 _ASSERT(objs.size() == descr_ctxt.size());
554 for (; obj_it != objs.end() && seh_it != descr_ctxt.end(); ++obj_it, ++seh_it)
556 if (obj_it->GetPointer() == sel_pub.
GetPointer()) {
568 if (d && d->
IsPub() && pubdesc != &(d->
GetPub())) {
570 bool this_change =
false;
572 new_desc->
Assign(*orig_desc);
574 }
else if (orig_feat) {
585 }
else if (pubdesc) {
592 cmd->AddCommand (*ecmd);
617 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
618 itemPanel1->SetSizer(itemBoxSizer2);
622 itemBoxSizer2->Add(m_PubField, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
623 m_FieldText =
new wxTextCtrl(
this,
wxID_ANY);
624 itemBoxSizer2->Add(m_FieldText, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
650 *constraint1 += constraint2;
651 action->SetConstraint(constraint1);
673 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
674 itemPanel1->SetSizer(itemBoxSizer2);
681 itemBoxSizer2->Add(m_AuthorsPanel, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
682 m_AuthorsPanel->TransferDataToWindow();
707 bool any_modified =
false;
709 auto obj_it = objs.begin();
710 auto seh_it = descr_ctxt.begin();
711 _ASSERT(objs.size() == descr_ctxt.size());
712 for (; obj_it != objs.end() && seh_it != descr_ctxt.end(); ++obj_it, ++seh_it)
714 if (
const CSeqdesc* desc =
dynamic_cast<const CSeqdesc*
>(obj_it->GetPointer())) {
717 replacement->
Assign(*desc);
718 bool modified =
false;
721 switch ((*pub)->Which())
724 (*pub)->SetGen().SetAuthors().SetNames(edited_names);
727 (*pub)->SetArticle().SetAuthors().SetNames(edited_names);
730 (*pub)->SetBook().SetAuthors().SetNames(edited_names);
733 (*pub)->SetProc().SetBook().SetAuthors().SetNames(edited_names);
736 (*pub)->SetSub().SetAuthors().SetNames(edited_names);
739 (*pub)->SetPatent().SetAuthors().SetNames(edited_names);
742 (*pub)->SetMan().SetCit().SetAuthors().SetNames(edited_names);
745 (*pub)->SetGen().SetAuthors().SetNames(edited_names);
760 new_submit_block->
Assign(*block);
@Auth_list.hpp User-defined methods of the data storage class.
size_t GetNameCount() const
void PopulateAuthors(objects::CAuth_list &auth_list)
virtual CRef< CCmdComposite > GetCommand(const vector< CConstRef< CObject >> &objs, const vector< CSeq_entry_Handle > &descr_ctxt)
CRef< CAuth_list > m_Authors
CAuthorNamesPanel * m_AuthorsPanel
CConstRef< objects::CSeq_submit > m_SeqSubmit
objects::CSeq_entry_Handle m_TopSeqEntry
bool Create(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
bool GetTopLevelSeqEntryAndProcessor()
void AddCommand(IEditCommand &command)
virtual CRef< CCmdComposite > GetCommand(const vector< CConstRef< CObject >> &objs, const vector< CSeq_entry_Handle > &descr_ctxt)=0
~CEditPubDlg()
Destructor.
virtual CRef< CCmdComposite > GetCommand()
static bool ShowToolTips()
Should we show tooltips?
wxChoice * m_PubStatusConstraint
virtual void LoadSettings()
virtual string GetErrorMessage()
CFieldHandlerNamePanel * m_Fieldhandler
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
string GetFieldName(const bool subfield)
void Init()
Initialises member variables.
CSeq_entry_Handle GetTopSeqEntry()
string GetStatusConstraint()
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Edit Publications"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(800, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
CConstRef< CObject > GetSelectedPub()
void AppendToErrorMsg(const string &msg)
CEditPubDlg()
Constructors.
CRef< edit::CStringConstraint > GetStringConstraint()
void CreateControls()
Creates the controls and sizers.
CStringConstraintPanel * m_StrConstraintPanel
virtual void SetRegistryPath(const string ®_path)
CConstRef< objects::CSeq_submit > GetSeqSubmit()
virtual void SaveSettings() const
COkCancelPanel * m_OkCancel
virtual string GetFieldName(const bool subfield=false)
Returns the name of the field as selected in the panel.
void SetFieldNames(const vector< string > &field_names)
wxString GetWorkDir() const
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
CProjectService - a service providing API for operations with Workspaces and Projects.
static vector< string > GetFieldNames(bool extended=false)
static string GetStatus(const CObject &obj)
static bool SetPubTitle(CPubdesc &pdesc, const string &title, objects::edit::EExistingText existing_text, bool skip_sub=false)
@Pubdesc.hpp User-defined methods of the data storage class.
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
void Set(const string &key, int val)
access a named key at this level, with no recursion
virtual CRef< CCmdComposite > GetCommand(const vector< CConstRef< CObject >> &objs, const vector< CSeq_entry_Handle > &descr_ctxt)
wxCheckBox * m_AuthorListSection
wxCheckBox * m_TitleSection
virtual CRef< CCmdComposite > GetCommand(const vector< CConstRef< CObject >> &objs, const vector< CSeq_entry_Handle > &descr_ctxt)
wxCheckBox * m_AffiliationSection
virtual CRef< CCmdComposite > GetCommand(const vector< CConstRef< CObject >> &objs, const vector< CSeq_entry_Handle > &descr_ctxt)
CFieldHandlerNamePanel * m_PubField
namespace ncbi::objects::
CRef< edit::CStringConstraint > GetStringConstraint()
IWorkbench is the central interface in the application framework.
CChangeUnindexedObjectCommand< objects::CSubmit_block > CChangeSubmitBlockCommand
static const char * kFramePosX
const string kUnknownError
static const char * kFrameHeight
static const char * kFramePosY
static const char * kFrameWidth
#define ID_PUB_STATUS_CONSTRAINT
CRef< CEditingActionConstraint > CreateEditingActionConstraint(const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, string &const_ncRNA_class, CRef< CConstraintMatcher >constraint)
CIRef< IEditingAction > CreateAction(CSeq_entry_Handle seh, const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class=kEmptyStr, CConstRef< objects::CSeq_submit > submit=CConstRef< objects::CSeq_submit >(NULL))
vector< CConstRef< CObject > > GetObjects(CSeq_entry_Handle seh, const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, CConstRef< objects::CSeq_submit > submit, CRef< CEditingActionConstraint > constraint, vector< CSeq_entry_Handle > *descr_context=nullptr)
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
vector< SConstScopedObject > TConstScopedObjects
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
bool IsSetAffil(void) const
author affiliation Check if a value has been assigned to Affil data member.
const TAffil & GetAffil(void) const
Get the Affil member data.
void SetAffil(TAffil &value)
Assign a value to Affil data member.
bool IsSetNames(void) const
Check if a value has been assigned to Names data member.
void SetNames(TNames &value)
Assign a value to Names data member.
list< CRef< CPub > > Tdata
TSub & SetSub(void)
Select the variant.
@ e_Gen
general or generic unparsed
@ e_Proc
proceedings of a meeting
@ e_Man
manuscript, thesis, or letter
const TPub & GetPub(void) const
Get the variant data.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
const TData & GetData(void) const
Get the Data member data.
bool IsPub(void) const
Check if variant Pub is selected.
void SetPub(TPub &value)
Assign a value to Pub data member.
TPub & SetPub(void)
Select the variant.
const TPub & GetPub(void) const
Get the variant data.
void ResetPub(void)
Reset Pub data member.
bool IsPub(void) const
Check if variant Pub is selected.
void SetCit(TCit &value)
Assign a value to Cit data member.
bool IsSetCit(void) const
citation for this submission Check if a value has been assigned to Cit data member.
const struct ncbi::grid::netcache::search::fields::SIZE size
bool SetAuthorNames(CPubdesc &pdesc, const CAuth_list &auth_list)
bool SetAuthList(CPubdesc &pdesc, const CAuth_list &auth_list)
CConstRef< CAuth_list > GetAuthList(const CPubdesc &pubdesc)
string GetPubTitle(CConstRef< CObject > sel_pub)
@ eExistingText_replace_old
void SetWorkDir(wxWindow *wnd, const wxString &workDir)
string ToStdString(const wxString &s)
wxRect GetScreenRect(const wxWindow &win)