<< id); \
111wxWindow* parent, wxWindowID
id,
constwxString& title,
constwxPoint& pos) :
112wxDialog(parent,
id, title, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE),
113sSet(structureSet), dialogHandle(handle), selectedItem(-1), editOn(
false), isNew(
false)
128 if(!structureSet || !(descrSet = structureSet->GetCDDDescrSet())) {
129 ERRORMSG(
"CDDBookRefDialog::CDDBookRefDialog() - error getting descr set data");
141topSizer->Fit(
this);
142topSizer->SetSizeHints(
this);
149 TRACEMSG(
"CDD book references dialog destroyed");
157 int option= wxYES_NO | wxYES_DEFAULT | wxICON_EXCLAMATION | wxCENTRE;
158 if(event.CanVeto())
option|= wxCANCEL;
159wxMessageDialog dialog(
NULL,
"Do you want to save your edited item?",
"",
option);
160 option= dialog.ShowModal();
161 if(
option== wxID_CANCEL) {
165 if(
option== wxID_YES) {
166wxCommandEvent fake(wxEVT_COMMAND_BUTTON_CLICKED,
ID_B_SAVE);
179paramWxStr.Printf(
"%s", paramStr.c_str());
195 ERRORMSG(
"MakeBrParameterString() failed - neither elementid nor celementid is set");
198 ERRORMSG(
"MakeBrParameterString() failed - both elementid and celementid are set");
201 ERRORMSG(
"MakeBrParameterString() failed - both subelementid and csubelementid are set");
205paramWxStr.Printf(
"%s", paramStr.c_str());
217CCdd_descr_set::Tdata::iterator d, de =
descrSet->Set().end();
218 for(d=
descrSet->Set().begin(); d!=de; ++d) {
219 if((*d)->IsBook_ref()) {
227 if(descrText.size() > 0)
228listbox->Append(descrText, &(*d));
231 if(selectedItem < 0 && listbox->GetCount() > 0)
251tAddress->SetValue(s);
259tSubaddress->SetValue(s);
262cType->SetSelection(1);
264tSubaddress->Clear();
268listbox->Enable(!
editOn);
271tAddress->Enable(
editOn);
272tSubaddress->Enable(
editOn);
284bDown->Enable(!readOnly && !
editOn&&
selectedItem< (
int) listbox->GetCount() - 1);
286bSave->Enable(!readOnly &&
editOn);
287bNew->Enable(
false);
289bLaunch->Enable(!
editOn&& (
int) listbox->GetCount() > 0);
290bPaste->Enable(!readOnly && !
editOn);
295 if(selectedItem < 0) {
300CCdd_descr_set::Tdata::iterator d, de = descrSet->
Set().end();
302 for(d=descrSet->
Set().begin(); d!=de; ++d) {
303 if((*d)->IsBook_ref()) {
304 if(s == selectedItem) {
312 ERRORMSG(
"InsertAfter() - selectedItem = "<< selectedItem <<
" but there aren't that many book refs");
321 stringbrBookUrl =
WX_TO_STD(
data.GetText().Strip(wxString::both));
324descr->SetBook_ref().Assign(*bookRef);
338 stringportalBookUrl =
WX_TO_STD(
data.GetText().Strip(wxString::both));
341descr->SetBook_ref().Assign(*bookRef);
352 inteventId =
event.GetId();
375url.Printf(
"https://www.ncbi.nlm.nih.gov/books/%s",
378url.Printf(
"https://www.ncbi.nlm.nih.gov/bookshelf/br.fcgi?book=%s",
394 WARNINGMSG(
"CDDBookRefDialog::OnClick() - invalid up/down request");
398*switchWith = *selDescr;
414 if(tAddress->GetValue().size() == 0) {
419 if(selDescr && !
isNew) {
432 longaddress, subaddress;
433 if(tAddress->GetValue().ToLong(&address)) {
440 if(tSubaddress->GetValue().size() > 0) {
441 if(tSubaddress->GetValue().ToLong(&subaddress)) {
456 else if(event.GetId() ==
ID_B_NEW) {
462 if(wxTheClipboard->Open()) {
463 if(wxTheClipboard->IsSupported(wxDF_TEXT)) {
465wxTextDataObject
data;
466wxTheClipboard->GetData(
data);
478 INFOMSG(
"Book reference could not be created from pasted URL:\n"<<
data.GetText());
482wxTheClipboard->Close();
487 if(selDescr && !
isNew) {
488CCdd_descr_set::Tdata::iterator d, de =
descrSet->Set().end();
489 for(d=
descrSet->Set().begin(); d!=de; ++d) {
490 if(&(*d) == selDescr) {
519wxBoxSizer *item0 =
newwxBoxSizer( wxVERTICAL );
521wxStaticBox *item2 =
newwxStaticBox( parent, -1,
wxT(
"Book References") );
522wxStaticBoxSizer *item1 =
newwxStaticBoxSizer( item2, wxVERTICAL );
524wxString *strs3 = (wxString*)
NULL;
525wxListBox *item3 =
newwxListBox( parent,
ID_LISTBOX, wxDefaultPosition, wxSize(80,100), 0, strs3, wxLB_SINGLE );
526item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
528wxGridSizer *item4 =
newwxGridSizer( 2, 0, 0, 0 );
530wxButton *item5 =
newwxButton( parent,
ID_B_UP,
wxT(
"Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
531item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 );
533wxButton *item6 =
newwxButton( parent,
ID_B_LAUNCH,
wxT(
"Launch"), wxDefaultPosition, wxDefaultSize, 0 );
534item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
536wxButton *item7 =
newwxButton( parent,
ID_B_NEW,
wxT(
"New"), wxDefaultPosition, wxDefaultSize, 0 );
537item4->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 );
539wxButton *item8 =
newwxButton( parent,
ID_B_SAVE,
wxT(
"Save"), wxDefaultPosition, wxDefaultSize, 0 );
540item4->Add( item8, 0, wxALIGN_CENTRE|wxALL, 5 );
542wxButton *item9 =
newwxButton( parent,
ID_B_DOWN,
wxT(
"Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
543item4->Add( item9, 0, wxALIGN_CENTRE|wxALL, 5 );
545wxButton *item10 =
newwxButton( parent,
ID_B_EDIT,
wxT(
"Edit"), wxDefaultPosition, wxDefaultSize, 0 );
546item4->Add( item10, 0, wxALIGN_CENTRE|wxALL, 5 );
548wxButton *item11 =
newwxButton( parent,
ID_B_PASTE,
wxT(
"Paste"), wxDefaultPosition, wxDefaultSize, 0 );
549item4->Add( item11, 0, wxALIGN_CENTRE|wxALL, 5 );
551wxButton *item12 =
newwxButton( parent,
ID_B_DELETE,
wxT(
"Delete"), wxDefaultPosition, wxDefaultSize, 0 );
552item4->Add( item12, 0, wxALIGN_CENTRE|wxALL, 5 );
554item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
556wxStaticLine *item13 =
newwxStaticLine( parent,
ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
557item1->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
559wxFlexGridSizer *item14 =
newwxFlexGridSizer( 1, 0, 0, 0 );
560item14->AddGrowableCol( 1 );
562wxStaticText *item15 =
newwxStaticText( parent,
ID_TEXT,
wxT(
"Name:"), wxDefaultPosition, wxDefaultSize, 0 );
563item14->Add( item15, 0, wxALIGN_CENTRE|wxALL, 5 );
565wxTextCtrl *item16 =
newwxTextCtrl( parent,
ID_T_NAME,
wxT(
""), wxDefaultPosition, wxSize(80,-1), 0 );
566item14->Add( item16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
568wxStaticText *item17 =
newwxStaticText( parent,
ID_TEXT,
wxT(
"Type:"), wxDefaultPosition, wxDefaultSize, 0 );
569item14->Add( item17, 0, wxALIGN_CENTRE|wxALL, 5 );
573 wxT(
"unassigned"),
584wxChoice *item18 =
newwxChoice( parent,
ID_C_TYPE, wxDefaultPosition, wxSize(100,-1), 10, strs18, 0 );
585item14->Add( item18, 0, wxALIGN_CENTRE|wxALL, 5 );
587item1->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
589wxFlexGridSizer *item19 =
newwxFlexGridSizer( 1, 0, 0, 0 );
590item19->AddGrowableCol(3);
592wxStaticText *item20 =
newwxStaticText( parent,
ID_TEXT,
wxT(
"Address:"), wxDefaultPosition, wxDefaultSize, 0 );
593item19->Add( item20, 0, wxALIGN_CENTRE|wxALL, 5 );
595wxTextCtrl *item21 =
newwxTextCtrl( parent,
ID_T_ADDRESS,
wxT(
""), wxDefaultPosition, wxSize(80,-1), 0 );
596item19->Add( item21, 0, wxALIGN_CENTRE|wxALL, 5 );
598wxStaticText *item22 =
newwxStaticText( parent,
ID_TEXT,
wxT(
"Sub-address:"), wxDefaultPosition, wxDefaultSize, 0 );
599item19->Add( item22, 0, wxALIGN_CENTRE|wxALL, 5 );
601wxTextCtrl *item23 =
newwxTextCtrl( parent,
ID_T_SUBADDRESS,
wxT(
""), wxDefaultPosition, wxSize(80,-1), 0 );
602item19->Add( item23, 0, wxGROW
|wxALL, 5 );
604item1->Add( item19, 0, wxGROW
|wxALL, 5 );
606item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
608wxButton *item24 =
newwxButton( parent,
ID_B_DONE,
wxT(
"Done"), wxDefaultPosition, wxDefaultSize, 0 );
609item24->SetDefault();
610item0->Add( item24, 0, wxALIGN_CENTRE|wxALL, 5 );
614parent->SetAutoLayout(
TRUE);
615parent->SetSizer( item0 );
618item0->Fit( parent );
619item0->SetSizeHints( parent );
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type)
bool BrURLToBookRef(wxTextDataObject &data, CRef< CCdd_descr > &descr)
static TypeStringAssociator< CCdd_book_ref::ETextelement > enum2str
static wxString MakePortalParameterString(const CCdd_book_ref &bref)
wxSizer * SetupBookRefDialog(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
static wxString MakeBrParameterString(const CCdd_book_ref &bref)
bool BookURLToBookRef(wxTextDataObject &data, CRef< CCdd_descr > &descr)
static void InsertAfter(int selectedItem, CCdd_descr_set *descrSet, CCdd_descr *descr)
CDDBookRefDialog ** dialogHandle
void SetWidgetStates(void)
ncbi::objects::CCdd_descr_set * descrSet
void OnCloseWindow(wxCloseEvent &event)
void OnClick(wxCommandEvent &event)
static const unsigned int eCDDData
void SetDataChanged(unsigned int what) const
Include a standard set of the NCBI C++ Toolkit most basic headers.
bool BrBookURLToCCddBookRef(const string &brBookUrl, CRef< CCdd_book_ref > &bookRef)
bool IsPortalDerivedBookRef(const CCdd_book_ref &bookRef)
bool PortalBookURLToCCddBookRef(const string &portalBookUrl, CRef< CCdd_book_ref > &bookRef)
string CCddBookRefToPortalString(const CCdd_book_ref &bookRef)
string CCddBookRefToBrString(const CCdd_book_ref &bookRef)
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty â pointing to an object and has a non-null value.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
const TBookname & GetBookname(void) const
Get the Bookname member data.
bool IsSetCsubelementid(void) const
exact address, if character string Check if a value has been assigned to Csubelementid data member.
bool IsSetCelementid(void) const
address of the text element, if character string Check if a value has been assigned to Celementid dat...
void ResetElementid(void)
Reset Elementid data member.
void SetTextelement(TTextelement value)
Assign a value to Textelement data member.
bool IsSetElementid(void) const
numerical address of the text-element Check if a value has been assigned to Elementid data member.
void ResetCsubelementid(void)
Reset Csubelementid data member.
const TCelementid & GetCelementid(void) const
Get the Celementid member data.
void SetElementid(TElementid value)
Assign a value to Elementid data member.
TTextelement GetTextelement(void) const
Get the Textelement member data.
bool IsSetSubelementid(void) const
exact address, used with section Check if a value has been assigned to Subelementid data member.
void SetSubelementid(TSubelementid value)
Assign a value to Subelementid data member.
void ResetSubelementid(void)
Reset Subelementid data member.
Tdata & Set(void)
Assign a value to data member.
void SetBookname(const TBookname &value)
Assign a value to Bookname data member.
void SetCelementid(const TCelementid &value)
Assign a value to Celementid data member.
TElementid GetElementid(void) const
Get the Elementid member data.
TBook_ref & SetBook_ref(void)
Select the variant.
void ResetCelementid(void)
Reset Celementid data member.
const TCsubelementid & GetCsubelementid(void) const
Get the Csubelementid member data.
TSubelementid GetSubelementid(void) const
Get the Subelementid member data.
void SetCsubelementid(const TCsubelementid &value)
Assign a value to Csubelementid data member.
@ eTextelement_figgrp
a figure or set of figures
@ eTextelement_unassigned
type of element
@ eTextelement_biblist
a lisf of references
@ eTextelement_box
an inserted box
@ eTextelement_section
a section or paragraph
@ eTextelement_chapter
a whole chapter
@ eTextelement_glossary
glossary
@ eTextelement_appendix
appendix
@ eTextelement_table
a table
unsigned int
A callback function used to compare two keys in a database.
#define TRUE
bool replacment for C indicating true.
C++ wrappers for the Perl-compatible regular expression (PCRE) library.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4