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) {
178 for (
unsigned i = 0;
i < wxDisplay::GetCount();
i++)
180 wxDisplay display(
i);
181 max_x += display.GetGeometry().GetWidth();
184 if (pos_x + width > max_x)
185 pos_x = wxGetDisplaySize().GetWidth()-width-5;
186 if (pos_y + height > wxGetDisplaySize().GetHeight())
187 pos_y = wxGetDisplaySize().GetHeight()-height-5;
189 SetPosition(wxPoint(pos_x,pos_y));
217 wxBoxSizer* itemBoxSizer1 =
new wxBoxSizer(wxVERTICAL);
218 SetSizer(itemBoxSizer1);
220 wxPanel* itemCBulkCmdDlg1 =
new wxPanel(
this,
wxID_ANY);
221 itemBoxSizer1->Add(itemCBulkCmdDlg1, 1, wxGROW, 0);
223 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
224 itemCBulkCmdDlg1->SetSizer(itemBoxSizer2);
226 m_Notebook =
new wxNotebook(itemCBulkCmdDlg1,
wxID_ANY,wxDefaultPosition,wxDefaultSize);
227 itemBoxSizer2->Add(
m_Notebook, 1, wxGROW|wxALL, 5);
233 m_Notebook->AddPage(panel2,
_(
"Replace entire pub"));
236 m_Notebook->AddPage(panel3,
_(
"Replace single field"));
247 authors->
Assign(*auth_list);
252 m_Notebook->AddPage(panel4,
_(
"Global author replace"));
254 wxStaticBox* constraintDetails =
new wxStaticBox(itemCBulkCmdDlg1,
wxID_ANY,
_(
"Constraint"));
255 wxStaticBoxSizer* itemStaticBoxSizer9 =
new wxStaticBoxSizer(constraintDetails, wxVERTICAL);
256 itemBoxSizer2->Add(itemStaticBoxSizer9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
258 wxBoxSizer* itemBoxSizer10 =
new wxBoxSizer(wxHORIZONTAL);
259 itemStaticBoxSizer9->Add(itemBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
263 itemBoxSizer10->Add(
m_Fieldhandler, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2);
268 wxBoxSizer* itemBoxSizer13 =
new wxBoxSizer(wxHORIZONTAL);
269 itemStaticBoxSizer9->Add(itemBoxSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
271 wxStaticText* itemStaticText14 =
new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), wxID_STATIC,
_(
"Publication Status"), wxDefaultPosition, wxDefaultSize, 0 );
272 itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
274 wxArrayString m_PubStatusConstraintStrings;
275 m_PubStatusConstraintStrings.Add(
_(
"Any"));
276 m_PubStatusConstraintStrings.Add(
_(
"Published"));
277 m_PubStatusConstraintStrings.Add(
_(
"Unpublished"));
278 m_PubStatusConstraintStrings.Add(
_(
"In Press"));
279 m_PubStatusConstraintStrings.Add(
_(
"Submitter Block"));
285 itemBoxSizer2->Add(
m_OkCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
366 *constraint1 += constraint2;
368 vector<CSeq_entry_Handle> descr_ctxt;
379 bool any_change(
false);
388 wxMessageBox(
wxT(
"No effect!"),
wxT(
"Error"), wxOK | wxICON_ERROR,
NULL);
399 sel_srv->GetCurrentSelection(
objects);
402 const CObject* ptr = it->object.GetPointer();
408 if (seqdesc && seqdesc->
IsPub()) {
414 }
else if (pubdesc) {
416 }
else if (block && block->
IsSetCit()) {
447 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
448 itemPanel1->SetSizer(itemBoxSizer2);
450 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxVERTICAL);
451 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL, 0);
453 m_AuthorListSection =
new wxCheckBox(
this,
wxID_ANY,
wxT(
"Replace author list with selected author list"), wxDefaultPosition, wxDefaultSize, 0 );
454 itemBoxSizer3->Add(m_AuthorListSection, 0, wxALIGN_LEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
455 m_TitleSection =
new wxCheckBox(
this,
wxID_ANY,
wxT(
"Replace title with selected title"), wxDefaultPosition, wxDefaultSize, 0 );
456 itemBoxSizer3->Add(m_TitleSection, 0, wxALIGN_LEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
457 m_AffiliationSection =
new wxCheckBox(
this,
wxID_ANY,
wxT(
"Replace affiliation with selected affiliation"), wxDefaultPosition, wxDefaultSize, 0 );
458 itemBoxSizer3->Add(m_AffiliationSection, 0, wxALIGN_LEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
474 bool any_change =
false;
475 auto obj_it = objs.begin();
476 auto seh_it = descr_ctxt.begin();
477 _ASSERT(objs.size() == descr_ctxt.size());
478 for ( ; obj_it != objs.end() && seh_it != descr_ctxt.end(); ++obj_it, ++seh_it)
481 if (d && d->
IsPub()) {
482 bool this_change =
false;
492 new_auth->
Assign(*this_auth);
497 bool skip_cit_sub =
true;
503 cmd->AddCommand (*ecmd);
528 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
529 itemPanel1->SetSizer(itemBoxSizer2);
531 wxStaticText* instructions =
new wxStaticText(
this, wxID_STATIC,
wxT(
"Replace with selected publication or submitter block"), wxDefaultPosition, wxDefaultSize, 0 );
532 itemBoxSizer2->Add(instructions, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
549 bool any_change =
false;
553 auto obj_it = objs.begin();
554 auto seh_it = descr_ctxt.begin();
555 _ASSERT(objs.size() == descr_ctxt.size());
556 for (; obj_it != objs.end() && seh_it != descr_ctxt.end(); ++obj_it, ++seh_it)
558 if (obj_it->GetPointer() == sel_pub.
GetPointer()) {
570 if (d && d->
IsPub() && pubdesc != &(d->
GetPub())) {
572 bool this_change =
false;
574 new_desc->
Assign(*orig_desc);
576 }
else if (orig_feat) {
587 }
else if (pubdesc) {
594 cmd->AddCommand (*ecmd);
619 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
620 itemPanel1->SetSizer(itemBoxSizer2);
624 itemBoxSizer2->Add(m_PubField, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
625 m_FieldText =
new wxTextCtrl(
this,
wxID_ANY);
626 itemBoxSizer2->Add(m_FieldText, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
652 *constraint1 += constraint2;
653 action->SetConstraint(constraint1);
675 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
676 itemPanel1->SetSizer(itemBoxSizer2);
683 itemBoxSizer2->Add(m_AuthorsPanel, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
684 m_AuthorsPanel->TransferDataToWindow();
709 bool any_modified =
false;
711 auto obj_it = objs.begin();
712 auto seh_it = descr_ctxt.begin();
713 _ASSERT(objs.size() == descr_ctxt.size());
714 for (; obj_it != objs.end() && seh_it != descr_ctxt.end(); ++obj_it, ++seh_it)
716 if (
const CSeqdesc* desc =
dynamic_cast<const CSeqdesc*
>(obj_it->GetPointer())) {
719 replacement->
Assign(*desc);
720 bool modified =
false;
723 switch ((*pub)->Which())
726 (*pub)->SetGen().SetAuthors().SetNames(edited_names);
729 (*pub)->SetArticle().SetAuthors().SetNames(edited_names);
732 (*pub)->SetBook().SetAuthors().SetNames(edited_names);
735 (*pub)->SetProc().SetBook().SetAuthors().SetNames(edited_names);
738 (*pub)->SetSub().SetAuthors().SetNames(edited_names);
741 (*pub)->SetPatent().SetAuthors().SetNames(edited_names);
744 (*pub)->SetMan().SetCit().SetAuthors().SetNames(edited_names);
747 (*pub)->SetGen().SetAuthors().SetNames(edited_names);
762 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)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
@ eExistingText_replace_old
void SetWorkDir(wxWindow *wnd, const wxString &workDir)
string ToStdString(const wxString &s)
wxRect GetScreenRect(const wxWindow &win)