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

Go to the SVN repository for this file.

1 /* $Id: cdd_book_ref_dialog.cpp 73357 2016-07-01 10:25:11Z thiessen $
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: Paul Thiessen
27 *
28 * File Description:
29 * dialog for editing CDD book references
30 *
31 * ===========================================================================
32 */
33 
34 #include <ncbi_pch.hpp>
35 #include <corelib/ncbistd.hpp>
36 #include <util/xregexp/regexp.hpp>
37 #include <util/ncbi_url.hpp>
38 
42 
44 
45 #include "cdd_book_ref_dialog.hpp"
46 #include "structure_set.hpp"
47 #include "cn3d_tools.hpp"
48 
49 #include <wx/clipbrd.h>
50 #include <wx/tokenzr.h>
51 
52 ////////////////////////////////////////////////////////////////////////////////////////////////
53 // The following is taken unmodified from wxDesigner's C++ header from cdd_book_ref_dialog.wdr
54 ////////////////////////////////////////////////////////////////////////////////////////////////
55 
56 #include <wx/image.h>
57 #include <wx/statline.h>
58 #include <wx/spinbutt.h>
59 #include <wx/spinctrl.h>
60 #include <wx/splitter.h>
61 #include <wx/listctrl.h>
62 #include <wx/treectrl.h>
63 #include <wx/notebook.h>
64 #include <wx/grid.h>
65 
66 // Declare window functions
67 
68 #define ID_LISTBOX 10000
69 #define ID_B_UP 10001
70 #define ID_B_LAUNCH 10002
71 #define ID_B_NEW 10003
72 #define ID_B_SAVE 10004
73 #define ID_B_DOWN 10005
74 #define ID_B_EDIT 10006
75 #define ID_B_PASTE 10007
76 #define ID_B_DELETE 10008
77 #define ID_LINE 10009
78 #define ID_TEXT 10010
79 #define ID_T_NAME 10011
80 #define ID_C_TYPE 10012
81 #define ID_T_ADDRESS 10013
82 #define ID_T_SUBADDRESS 10014
83 #define ID_B_DONE 10015
84 wxSizer *SetupBookRefDialog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
85 
86 ////////////////////////////////////////////////////////////////////////////////////////////////
87 
90 
91 
92 BEGIN_SCOPE(Cn3D)
93 
94 #define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type) \
95  type *var; \
96  var = wxDynamicCast(FindWindow(id), type); \
97  if (!var) { \
98  ERRORMSG("Can't find window with id " << id); \
99  return; \
100  }
101 
102 BEGIN_EVENT_TABLE(CDDBookRefDialog, wxDialog)
103  EVT_CLOSE ( CDDBookRefDialog::OnCloseWindow)
104  EVT_BUTTON (-1, CDDBookRefDialog::OnClick)
105  EVT_LISTBOX (-1, CDDBookRefDialog::OnClick)
107 
108 static TypeStringAssociator < CCdd_book_ref::ETextelement > enum2str;
109 
111  wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos) :
112  wxDialog(parent, id, title, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE),
113  sSet(structureSet), dialogHandle(handle), selectedItem(-1), editOn(false), isNew(false)
114 {
115  if (enum2str.Size() == 0) {
116  enum2str.Associate(CCdd_book_ref::eTextelement_unassigned, "unassigned");
117  enum2str.Associate(CCdd_book_ref::eTextelement_section, "section");
118  enum2str.Associate(CCdd_book_ref::eTextelement_figgrp, "figure");
119  enum2str.Associate(CCdd_book_ref::eTextelement_table, "table");
120  enum2str.Associate(CCdd_book_ref::eTextelement_chapter, "chapter");
121  enum2str.Associate(CCdd_book_ref::eTextelement_biblist, "biblist");
122  enum2str.Associate(CCdd_book_ref::eTextelement_box, "box");
123  enum2str.Associate(CCdd_book_ref::eTextelement_glossary, "def-item");
124  enum2str.Associate(CCdd_book_ref::eTextelement_appendix, "appendix");
125  enum2str.Associate(CCdd_book_ref::eTextelement_other, "other");
126  }
127 
128  if (!structureSet || !(descrSet = structureSet->GetCDDDescrSet())) {
129  ERRORMSG("CDDBookRefDialog::CDDBookRefDialog() - error getting descr set data");
130  Destroy();
131  return;
132  }
133 
134  // construct the dialog
135  wxSizer *topSizer = SetupBookRefDialog(this, false);
136 
137  // fill in list box with available references
138  SetWidgetStates();
139 
140  // call sizer stuff
141  topSizer->Fit(this);
142  topSizer->SetSizeHints(this);
143 }
144 
146 {
147  // so owner knows that this dialog has been destroyed
149  TRACEMSG("CDD book references dialog destroyed");
150 }
151 
152 // same as hitting done
153 void CDDBookRefDialog::OnCloseWindow(wxCloseEvent& event)
154 {
155  // see what user wants to do about unsaved edit
156  if (editOn) {
157  int option = wxYES_NO | wxYES_DEFAULT | wxICON_EXCLAMATION | wxCENTRE;
158  if (event.CanVeto()) option |= wxCANCEL;
159  wxMessageDialog dialog(NULL, "Do you want to save your edited item?", "", option);
160  option = dialog.ShowModal();
161  if (option == wxID_CANCEL) {
162  event.Veto();
163  return;
164  }
165  if (option == wxID_YES) {
166  wxCommandEvent fake(wxEVT_COMMAND_BUTTON_CLICKED, ID_B_SAVE);
167  OnClick(fake);
168  }
169  }
170  Destroy();
171 }
172 
173 // The return value is a string used in Portal style URLs based on
174 // .../books/NBK.... Return an empty string if there is any problem.
175 static wxString MakePortalParameterString(const CCdd_book_ref& bref)
176 {
177  wxString paramWxStr;
178  string paramStr = ncbi::cd_utils::CCddBookRefToPortalString(bref);
179  paramWxStr.Printf("%s", paramStr.c_str());
180 
181  return paramWxStr;
182 }
183 
184 
185 // The return value is a string used in "DTD2" style URLs based on br.fcgi.
186 // However, note that the CCdd_book_ref could have been encoded based
187 // on URLs from either br.fcgi or bv.fcgi and there's no way to deduce
188 // from which service the data originated.
189 static wxString MakeBrParameterString(const CCdd_book_ref& bref)
190 {
191  wxString paramWxStr;
192 
193  // Trap a few unexpected cases before calling library function.
194  if (!bref.IsSetElementid() && !bref.IsSetCelementid())
195  ERRORMSG("MakeBrParameterString() failed - neither elementid nor celementid is set");
196 
197  else if (bref.IsSetElementid() && bref.IsSetCelementid())
198  ERRORMSG("MakeBrParameterString() failed - both elementid and celementid are set");
199 
200  else if (bref.IsSetSubelementid() && bref.IsSetCsubelementid())
201  ERRORMSG("MakeBrParameterString() failed - both subelementid and csubelementid are set");
202 
203  else {
204  string paramStr = ncbi::cd_utils::CCddBookRefToBrString(bref);
205  paramWxStr.Printf("%s", paramStr.c_str());
206  }
207 
208  return paramWxStr;
209 }
210 
212 {
214  listbox->Clear();
215 
216  // set items in listbox
217  CCdd_descr_set::Tdata::iterator d, de = descrSet->Set().end();
218  for (d=descrSet->Set().begin(); d!=de; ++d) {
219  if ((*d)->IsBook_ref()) {
220  // make client data of menu item a pointer to the CRef containing the CCdd_descr object
221  wxString descrText;
222  if (ncbi::cd_utils::IsPortalDerivedBookRef((*d)->GetBook_ref())) {
223  descrText = MakePortalParameterString((*d)->GetBook_ref());
224  } else {
225  descrText = MakeBrParameterString((*d)->GetBook_ref());
226  }
227  if (descrText.size() > 0)
228  listbox->Append(descrText, &(*d));
229  }
230  }
231  if (selectedItem < 0 && listbox->GetCount() > 0)
232  selectedItem = 0;
233 
234  // set info fields
239  if (selectedItem >= 0 && selectedItem < (int) listbox->GetCount() && listbox->GetClientData(selectedItem) && !isNew) {
240  listbox->SetSelection(selectedItem, true);
241  const CCdd_book_ref& bref =
242  (*(reinterpret_cast<CRef<CCdd_descr>*>(listbox->GetClientData(selectedItem))))->GetBook_ref();
243  tName->SetValue(bref.GetBookname().c_str());
244  cType->SetStringSelection(enum2str.Find(bref.GetTextelement())->c_str());
245 
246  wxString s;
247  if (bref.IsSetElementid())
248  s.Printf("%i", bref.GetElementid());
249  else
250  s.Printf("%s", bref.GetCelementid().c_str());
251  tAddress->SetValue(s);
252  if (bref.IsSetSubelementid() || bref.IsSetCsubelementid()) {
253  if (bref.IsSetSubelementid())
254  s.Printf("%i", bref.GetSubelementid());
255  else
256  s.Printf("%s", bref.GetCsubelementid().c_str());
257  } else
258  s.Clear();
259  tSubaddress->SetValue(s);
260  } else {
261  tName->Clear();
262  cType->SetSelection(1); // default is 'section'
263  tAddress->Clear();
264  tSubaddress->Clear();
265  }
266 
267  // set widget states
268  listbox->Enable(!editOn);
269  tName->Enable(editOn);
270  cType->Enable(editOn);
271  tAddress->Enable(editOn);
272  tSubaddress->Enable(editOn);
281  bool readOnly;
283  bUp->Enable(!readOnly && !editOn && selectedItem > 0);
284  bDown->Enable(!readOnly && !editOn && selectedItem < (int) listbox->GetCount() - 1);
285  bEdit->Enable(!readOnly && !editOn && selectedItem >= 0 && selectedItem < (int) listbox->GetCount());
286  bSave->Enable(!readOnly && editOn);
287  bNew->Enable(false); // bNew->Enable(!readOnly && !editOn); // see if anyone yells
288  bDelete->Enable(!readOnly && selectedItem >= 0 && selectedItem < (int) listbox->GetCount());
289  bLaunch->Enable(!editOn && (int) listbox->GetCount() > 0);
290  bPaste->Enable(!readOnly && !editOn);
291 }
292 
293 static void InsertAfter(int selectedItem, CCdd_descr_set *descrSet, CCdd_descr *descr)
294 {
295  if (selectedItem < 0) {
296  descrSet->Set().push_back(CRef < CCdd_descr >(descr));
297  return;
298  }
299 
300  CCdd_descr_set::Tdata::iterator d, de = descrSet->Set().end();
301  int s = 0;
302  for (d=descrSet->Set().begin(); d!=de; ++d) {
303  if ((*d)->IsBook_ref()) {
304  if (s == selectedItem) {
305  ++d;
306  descrSet->Set().insert(d, CRef < CCdd_descr >(descr));
307  return;
308  }
309  ++s;
310  }
311  }
312  ERRORMSG("InsertAfter() - selectedItem = " << selectedItem << " but there aren't that many book refs");
313 }
314 
315 // Break up URLs formatted as per br.fcgi conventions;
316 // allow use of the entire URL.
317 bool BrURLToBookRef(wxTextDataObject& data, CRef < CCdd_descr >& descr)
318 {
319 
321  string brBookUrl = WX_TO_STD(data.GetText().Strip(wxString::both));
322  bool result = ncbi::cd_utils::BrBookURLToCCddBookRef(brBookUrl, bookRef);
323  if (result && bookRef.NotEmpty() && descr.NotEmpty()) {
324  descr->SetBook_ref().Assign(*bookRef);
325  } else {
326  result = false;
327  descr.Reset();
328  }
329 
330  return result;
331 }
332 
333 // Break up URLs formatted as per Bookshelf URL scheme released 2010;
334 // allow use of the entire URL.
335 bool BookURLToBookRef(wxTextDataObject& data, CRef < CCdd_descr >& descr)
336 {
338  string portalBookUrl = WX_TO_STD(data.GetText().Strip(wxString::both));
339  bool result = ncbi::cd_utils::PortalBookURLToCCddBookRef(portalBookUrl, bookRef);
340  if (result && bookRef.NotEmpty() && descr.NotEmpty()) {
341  descr->SetBook_ref().Assign(*bookRef);
342  } else {
343  result = false;
344  descr.Reset();
345  }
346 
347  return result;
348 }
349 
350 void CDDBookRefDialog::OnClick(wxCommandEvent& event)
351 {
352  int eventId = event.GetId();
354  CRef < CCdd_descr > *selDescr = NULL;
355 
356  // Avoid some unnecessary warning in debug-mode
357  if ((eventId != ID_B_PASTE) && (eventId != ID_B_DONE) && (eventId != ID_B_EDIT) && (eventId != ID_B_NEW) && (eventId != ID_LISTBOX)) {
358  selDescr = reinterpret_cast<CRef<CCdd_descr>*>(listbox->GetClientData(selectedItem));
359  }
360 
361  if (event.GetId() == ID_B_DONE) {
362  Close(false);
363  return;
364  }
365 
366  else if (event.GetId() == ID_B_LAUNCH) {
367  if (selDescr) {
368  // If the book reference was derived from a Portal URL (i.e., the
369  // bookname has the 'NBK' prefix), launch with a Portal URL.
370  // Since book reference data stored in a CD may have been parsed
371  // from br.fcgi URLs, launch with a br.fcgi URL in such cases as
372  // Entrez will redirect those links to the corresponding Portal-ized URLs.
373  wxString url;
374  if (ncbi::cd_utils::IsPortalDerivedBookRef((*selDescr)->GetBook_ref())) {
375  url.Printf("https://www.ncbi.nlm.nih.gov/books/%s",
376  MakePortalParameterString((*selDescr)->GetBook_ref()).c_str());
377  } else {
378  url.Printf("https://www.ncbi.nlm.nih.gov/bookshelf/br.fcgi?book=%s",
379  MakeBrParameterString((*selDescr)->GetBook_ref()).c_str());
380  }
381  LaunchWebPage(url.c_str());
382  }
383  }
384 
385  else if (event.GetId() == ID_B_UP || event.GetId() == ID_B_DOWN) {
386  CRef < CCdd_descr > *switchWith = NULL;
387  if (event.GetId() == ID_B_UP && selectedItem > 0) {
388  switchWith = reinterpret_cast<CRef<CCdd_descr>*>(listbox->GetClientData(selectedItem - 1));
389  --selectedItem;
390  } else if (event.GetId() == ID_B_DOWN && selectedItem < (int) listbox->GetCount() - 1){
391  switchWith = reinterpret_cast<CRef<CCdd_descr>*>(listbox->GetClientData(selectedItem + 1));
392  ++selectedItem;
393  } else {
394  WARNINGMSG("CDDBookRefDialog::OnClick() - invalid up/down request");
395  return;
396  }
397  CRef < CCdd_descr > tmp = *switchWith;
398  *switchWith = *selDescr;
399  *selDescr = tmp;
401  }
402 
403 
404  else if (event.GetId() == ID_B_EDIT) {
405  editOn = true;
406  isNew = false;
407  }
408 
409  else if (event.GetId() == ID_B_SAVE) {
414  if (tAddress->GetValue().size() == 0) {
415  ERRORMSG("Address is required");
416  return;
417  }
418  CCdd_descr *descr;
419  if (selDescr && !isNew) {
420  // editing existing item
421  descr = selDescr->GetPointer();
422  } else {
423  // create new item
424  CRef < CCdd_descr > newDescr(new CCdd_descr);
426  ++selectedItem;
427  descr = newDescr.GetPointer();
428  }
429  isNew = false;
430  descr->SetBook_ref().SetBookname(WX_TO_STD(tName->GetValue()));
431  descr->SetBook_ref().SetTextelement(*(enum2str.Find(string(cType->GetStringSelection().c_str()))));
432  long address, subaddress;
433  if (tAddress->GetValue().ToLong(&address)) {
434  descr->SetBook_ref().SetElementid((int) address);
435  descr->SetBook_ref().ResetCelementid();
436  } else {
437  descr->SetBook_ref().SetCelementid(WX_TO_STD(tAddress->GetValue()));
438  descr->SetBook_ref().ResetElementid();
439  }
440  if (tSubaddress->GetValue().size() > 0) {
441  if (tSubaddress->GetValue().ToLong(&subaddress)) {
442  descr->SetBook_ref().SetSubelementid((int) subaddress);
443  descr->SetBook_ref().ResetCsubelementid();
444  } else {
445  descr->SetBook_ref().SetCsubelementid(WX_TO_STD(tSubaddress->GetValue()));
446  descr->SetBook_ref().ResetSubelementid();
447  }
448  } else {
449  descr->SetBook_ref().ResetSubelementid();
450  descr->SetBook_ref().ResetCsubelementid();
451  }
453  editOn = false;
454  }
455 
456  else if (event.GetId() == ID_B_NEW) {
457  editOn = true;
458  isNew = true;
459  }
460 
461  else if (event.GetId() == ID_B_PASTE) {
462  if (wxTheClipboard->Open()) {
463  if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
464  CRef < CCdd_descr > descr(new CCdd_descr);
465  wxTextDataObject data;
466  wxTheClipboard->GetData(data);
467 
468  // This is the *old* method of parsing strings from a br.fcgi URL.
469  //bool madeBookRef = BrURLToBookRef(data, descr);
470 
471  bool madeBookRef = BookURLToBookRef(data, descr);
472  if (madeBookRef) {
474  ++selectedItem;
476  isNew = false;
477  } else {
478  INFOMSG("Book reference could not be created from pasted URL:\n" << data.GetText());
479  }
480 
481  }
482  wxTheClipboard->Close();
483  }
484  }
485 
486  else if (event.GetId() == ID_B_DELETE) {
487  if (selDescr && !isNew) {
488  CCdd_descr_set::Tdata::iterator d, de = descrSet->Set().end();
489  for (d=descrSet->Set().begin(); d!=de; ++d) {
490  if (&(*d) == selDescr) {
491  descrSet->Set().erase(d);
493  if (selectedItem == (int) listbox->GetCount() - 1)
494  --selectedItem;
495  break;
496  }
497  }
498  }
499  editOn = false;
500  isNew = false;
501  }
502 
503  else if (event.GetId() == ID_LISTBOX) {
504  selectedItem = listbox->GetSelection();
505  }
506 
507  SetWidgetStates();
508 }
509 
510 END_SCOPE(Cn3D)
511 
512 //////////////////////////////////////////////////////////////////////////////////////////////////
513 // The following is taken *without* modification from wxDesigner C++ code generated from
514 // cdd_book_ref_dialog.wdr.
515 //////////////////////////////////////////////////////////////////////////////////////////////////
516 
517 wxSizer *SetupBookRefDialog( wxWindow *parent, bool call_fit, bool set_sizer )
518 {
519  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
520 
521  wxStaticBox *item2 = new wxStaticBox( parent, -1, wxT("Book References") );
522  wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
523 
524  wxString *strs3 = (wxString*) NULL;
525  wxListBox *item3 = new wxListBox( parent, ID_LISTBOX, wxDefaultPosition, wxSize(80,100), 0, strs3, wxLB_SINGLE );
526  item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
527 
528  wxGridSizer *item4 = new wxGridSizer( 2, 0, 0, 0 );
529 
530  wxButton *item5 = new wxButton( parent, ID_B_UP, wxT("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
531  item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 );
532 
533  wxButton *item6 = new wxButton( parent, ID_B_LAUNCH, wxT("Launch"), wxDefaultPosition, wxDefaultSize, 0 );
534  item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
535 
536  wxButton *item7 = new wxButton( parent, ID_B_NEW, wxT("New"), wxDefaultPosition, wxDefaultSize, 0 );
537  item4->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 );
538 
539  wxButton *item8 = new wxButton( parent, ID_B_SAVE, wxT("Save"), wxDefaultPosition, wxDefaultSize, 0 );
540  item4->Add( item8, 0, wxALIGN_CENTRE|wxALL, 5 );
541 
542  wxButton *item9 = new wxButton( parent, ID_B_DOWN, wxT("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
543  item4->Add( item9, 0, wxALIGN_CENTRE|wxALL, 5 );
544 
545  wxButton *item10 = new wxButton( parent, ID_B_EDIT, wxT("Edit"), wxDefaultPosition, wxDefaultSize, 0 );
546  item4->Add( item10, 0, wxALIGN_CENTRE|wxALL, 5 );
547 
548  wxButton *item11 = new wxButton( parent, ID_B_PASTE, wxT("Paste"), wxDefaultPosition, wxDefaultSize, 0 );
549  item4->Add( item11, 0, wxALIGN_CENTRE|wxALL, 5 );
550 
551  wxButton *item12 = new wxButton( parent, ID_B_DELETE, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
552  item4->Add( item12, 0, wxALIGN_CENTRE|wxALL, 5 );
553 
554  item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
555 
556  wxStaticLine *item13 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
557  item1->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
558 
559  wxFlexGridSizer *item14 = new wxFlexGridSizer( 1, 0, 0, 0 );
560  item14->AddGrowableCol( 1 );
561 
562  wxStaticText *item15 = new wxStaticText( parent, ID_TEXT, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
563  item14->Add( item15, 0, wxALIGN_CENTRE|wxALL, 5 );
564 
565  wxTextCtrl *item16 = new wxTextCtrl( parent, ID_T_NAME, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
566  item14->Add( item16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
567 
568  wxStaticText *item17 = new wxStaticText( parent, ID_TEXT, wxT("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
569  item14->Add( item17, 0, wxALIGN_CENTRE|wxALL, 5 );
570 
571  wxString strs18[] =
572  {
573  wxT("unassigned"),
574  wxT("section"),
575  wxT("figure"),
576  wxT("table"),
577  wxT("chapter"),
578  wxT("biblist"),
579  wxT("box"),
580  wxT("def-item"), // used to be 'glossary'
581  wxT("appendix"),
582  wxT("other")
583  };
584  wxChoice *item18 = new wxChoice( parent, ID_C_TYPE, wxDefaultPosition, wxSize(100,-1), 10, strs18, 0 );
585  item14->Add( item18, 0, wxALIGN_CENTRE|wxALL, 5 );
586 
587  item1->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
588 
589  wxFlexGridSizer *item19 = new wxFlexGridSizer( 1, 0, 0, 0 );
590  item19->AddGrowableCol(3);
591 
592  wxStaticText *item20 = new wxStaticText( parent, ID_TEXT, wxT("Address:"), wxDefaultPosition, wxDefaultSize, 0 );
593  item19->Add( item20, 0, wxALIGN_CENTRE|wxALL, 5 );
594 
595  wxTextCtrl *item21 = new wxTextCtrl( parent, ID_T_ADDRESS, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
596  item19->Add( item21, 0, wxALIGN_CENTRE|wxALL, 5 );
597 
598  wxStaticText *item22 = new wxStaticText( parent, ID_TEXT, wxT("Sub-address:"), wxDefaultPosition, wxDefaultSize, 0 );
599  item19->Add( item22, 0, wxALIGN_CENTRE|wxALL, 5 );
600 
601  wxTextCtrl *item23 = new wxTextCtrl( parent, ID_T_SUBADDRESS, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
602  item19->Add( item23, 0, wxGROW/*wxALIGN_CENTRE*/|wxALL, 5 );
603 
604  item1->Add( item19, 0, wxGROW/*wxALIGN_CENTRE*/|wxALL, 5 );
605 
606  item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
607 
608  wxButton *item24 = new wxButton( parent, ID_B_DONE, wxT("Done"), wxDefaultPosition, wxDefaultSize, 0 );
609  item24->SetDefault();
610  item0->Add( item24, 0, wxALIGN_CENTRE|wxALL, 5 );
611 
612  if (set_sizer)
613  {
614  parent->SetAutoLayout( TRUE );
615  parent->SetSizer( item0 );
616  if (call_fit)
617  {
618  item0->Fit( parent );
619  item0->SetSizeHints( parent );
620  }
621  }
622 
623  return item0;
624 }
static char tmp[2048]
Definition: utf8.c:62
string CCddBookRefToBrString(const CCdd_book_ref &bookRef)
void ResetCsubelementid(void)
Reset Csubelementid data member.
#define ID_B_PASTE
ncbi::objects::CCdd_descr_set * descrSet
Definition: dbpivot.c:60
CCdd_descr –.
Definition: Cdd_descr.hpp:65
void SetTextelement(TTextelement value)
Assign a value to Textelement data member.
#define option
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:73
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:970
#define ERRORMSG(stream)
Definition: Interface.cpp:48
END_EVENT_TABLE()
#define ID_LISTBOX
TTextelement GetTextelement(void) const
Get the Textelement member data.
Tdata & Set(void)
Assign a value to data member.
bool IsSetCsubelementid(void) const
exact address, if character string Check if a value has been assigned to Csubelementid data member...
#define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type)
#define ID_B_NEW
bool PortalBookURLToCCddBookRef(const string &portalBookUrl, CRef< CCdd_book_ref > &bookRef)
#define ID_B_LAUNCH
CCdd_book_ref –.
bool IsPortalDerivedBookRef(const CCdd_book_ref &bookRef)
static wxString MakePortalParameterString(const CCdd_book_ref &bref)
TBook_ref & SetBook_ref(void)
Select the variant.
Definition: Cdd_descr_.cpp:408
static const std::string REG_ADVANCED_SECTION
Definition: cn3d_tools.hpp:191
#define NULL
Definition: ncbistd.hpp:225
#define ID_T_SUBADDRESS
void ResetElementid(void)
Reset Elementid data member.
#define ID_B_DONE
#define ID_TEXT
USING_NCBI_SCOPE
#define ID_T_NAME
#define ID_B_SAVE
static const std::string REG_CDD_ANNOT_READONLY
Definition: cn3d_tools.hpp:192
void OnCloseWindow(wxCloseEvent &event)
string CCddBookRefToPortalString(const CCdd_book_ref &bookRef)
User-defined methods of the data storage class.
bool BrBookURLToCCddBookRef(const string &brBookUrl, CRef< CCdd_book_ref > &bookRef)
TElementid GetElementid(void) const
Get the Elementid member data.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define ID_C_TYPE
#define ID_B_UP
#define ID_B_EDIT
void SetDataChanged(unsigned int what) const
bool RegistryGetBoolean(const string &section, const string &name, bool *value)
Definition: cn3d_tools.cpp:250
static void InsertAfter(int selectedItem, CCdd_descr_set *descrSet, CCdd_descr *descr)
#define ID_B_DOWN
void LaunchWebPage(const char *url)
Definition: cn3d_tools.cpp:432
static const unsigned int eCDDData
static wxString MakeBrParameterString(const CCdd_book_ref &bref)
#define ID_B_DELETE
const TCelementid & GetCelementid(void) const
Get the Celementid member data.
CRef –.
Definition: ncbiobj.hpp:616
TSubelementid GetSubelementid(void) const
Get the Subelementid member data.
const TCsubelementid & GetCsubelementid(void) const
Get the Csubelementid member data.
void SetCsubelementid(const TCsubelementid &value)
Assign a value to Csubelementid data member.
void ResetCelementid(void)
Reset Celementid data member.
User-defined methods of the data storage class.
CDDBookRefDialog ** dialogHandle
void SetSubelementid(TSubelementid value)
Assign a value to Subelementid data member.
CCdd_descr_set –.
#define wxT(x)
Definition: muParser.cpp:41
else result
Definition: token2.c:20
wxSizer * SetupBookRefDialog(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
bool BookURLToBookRef(wxTextDataObject &data, CRef< CCdd_descr > &descr)
void SetBookname(const TBookname &value)
Assign a value to Bookname data member.
bool IsSetSubelementid(void) const
exact address, used with section Check if a value has been assigned to Subelementid data member...
#define ID_LINE
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:70
#define TRACEMSG(stream)
Definition: Interface.cpp:45
USING_SCOPE(objects)
#define const
Definition: zconf.h:217
bool IsSetCelementid(void) const
address of the text element, if character string Check if a value has been assigned to Celementid dat...
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
Definition: ncbiobj.hpp:709
const TBookname & GetBookname(void) const
Get the Bookname member data.
bool IsSetElementid(void) const
numerical address of the text-element Check if a value has been assigned to Elementid data member...
static TypeStringAssociator< CCdd_book_ref::ETextelement > enum2str
#define WX_TO_STD(wxstring)
Definition: cn3d_tools.hpp:285
Definition: testodbc.c:30
void SetCelementid(const TCelementid &value)
Assign a value to Celementid data member.
#define INFOMSG(stream)
Definition: Interface.cpp:46
#define WARNINGMSG(stream)
Definition: Interface.cpp:47
unsigned int
Definition: types.hpp:1153
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:756
#define ID_T_ADDRESS
void OnClick(wxCommandEvent &event)
bool BrURLToBookRef(wxTextDataObject &data, CRef< CCdd_descr > &descr)
void SetElementid(TElementid value)
Assign a value to Elementid data member.
void ResetSubelementid(void)
Reset Subelementid data member.
Modified on Mon Jul 25 16:54:13 2016 by modify_doxy.py rev. 506947