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

Go to the SVN repository for this file.

1 /* $Id: preferences_dialog.cpp 99208 2023-02-27 15:50:52Z dzhang $
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 * dialogs for editing program preferences
30 *
31 * ===========================================================================
32 */
33 
34 #include <ncbi_pch.hpp>
35 #include <corelib/ncbistd.hpp>
36 #include <corelib/ncbireg.hpp>
37 
39 
40 #include "preferences_dialog.hpp"
42 #include "opengl_renderer.hpp"
43 #include "cn3d_tools.hpp"
44 #include "messenger.hpp"
45 #include "cn3d_cache.hpp"
46 
47 
48 ////////////////////////////////////////////////////////////////////////////////////////////////
49 // The following is taken unmodified from wxDesigner's C++ header from preferences_dialog.wdr
50 ////////////////////////////////////////////////////////////////////////////////////////////////
51 
52 #include <wx/image.h>
53 #include <wx/statline.h>
54 #include <wx/spinbutt.h>
55 #include <wx/spinctrl.h>
56 #include <wx/splitter.h>
57 #include <wx/listctrl.h>
58 #include <wx/treectrl.h>
59 #include <wx/notebook.h>
60 #include <wx/grid.h>
61 
62 // Declare window functions
63 
64 #define ID_NOTEBOOK 10000
65 #define ID_B_DONE 10001
66 #define ID_B_CANCEL 10002
67 wxSizer *SetupPreferencesNotebook( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
68 
69 #define ID_TEXT 10003
70 #define ID_TEXTCTRL 10004
71 #define ID_SPINBUTTON 10005
72 #define ID_C_HIGHLIGHT 10006
73 #define ID_RADIOBOX 10007
74 #define ID_B_Q_LOW 10008
75 #define ID_B_Q_MED 10009
76 #define ID_B_Q_HIGH 10010
77 wxSizer *SetupQualityPage( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
78 
79 #define ID_C_CACHE_ON 10011
80 #define ID_LINE 10012
81 #define ID_T_CACHE_1 10013
82 #define ID_B_CACHE_BROWSE 10014
83 #define ID_T_CACHE_FOLDER 10015
84 #define ID_T_CACHE_2 10016
85 #define ID_B_CACHE_CLEAR 10017
86 wxSizer *SetupCachePage( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
87 
88 #define ID_C_ANNOT_RO 10018
89 #define ID_T_LAUNCH 10019
90 #define ID_T_NSTRUCT 10020
91 #define ID_T_FOOT 10021
92 #define ID_T_SEPARATION 10022
93 #define ID_C_PROXIMAL 10023
94 wxSizer *SetupAdvancedPage( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
95 
96 ////////////////////////////////////////////////////////////////////////////////////////////////
97 
99 
100 
101 BEGIN_SCOPE(Cn3D)
102 
103 static IntegerSpinCtrl
107 
108 #define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type) \
109  type *var; \
110  var = wxDynamicCast(FindWindow(id), type); \
111  if (!var) { \
112  ERRORMSG("Can't find window with id " << id); \
113  return; \
114  }
115 
116 BEGIN_EVENT_TABLE(PreferencesDialog, wxDialog)
118  EVT_BUTTON (-1, PreferencesDialog::OnButton)
121 
122 #define SET_ISPINCTRL_FROM_REGISTRY_VALUE(section, name, iSpinCtrl) \
123  do { \
124  int value; \
125  if (!RegistryGetInteger((section), (name), &value) || !((iSpinCtrl)->SetInteger(value))) \
126  WARNINGMSG("PreferencesDialog::PreferencesDialog() - error with " << (name)); \
127  } while (0)
128 
129 #define SET_FSPINCTRL_FROM_REGISTRY_VALUE(section, name, fSpinCtrl) \
130  do { \
131  double value; \
132  if (!RegistryGetDouble((section), (name), &value) || !((fSpinCtrl)->SetDouble(value))) \
133  WARNINGMSG("PreferencesDialog::PreferencesDialog() - error with " << (name)); \
134  } while (0)
135 
136 #define SET_CHECKBOX_FROM_REGISTRY_VALUE(section, name, id) \
137  do { \
138  bool on; \
139  wxCheckBox *box = wxDynamicCast(FindWindow(id), wxCheckBox); \
140  if (!box || !RegistryGetBoolean((section), (name), &on)) \
141  WARNINGMSG("PreferencesDialog::PreferencesDialog() - error with " << (name)); \
142  else \
143  box->SetValue(on); \
144  } while (0)
145 
146 #define SET_RADIOBOX_FROM_REGISTRY_VALUE(section, name, id) \
147  do { \
148  string value; \
149  wxRadioBox *radio = wxDynamicCast(FindWindow(id), wxRadioBox); \
150  if (!radio || !RegistryGetString((section), (name), &value)) \
151  WARNINGMSG("PreferencesDialog::PreferencesDialog() - error with " << (name)); \
152  else \
153  radio->SetStringSelection(value.c_str()); \
154  } while (0)
155 
156 #define SET_TEXTCTRL_FROM_REGISTRY_VALUE(section, name, id) \
157  do { \
158  string value; \
159  wxTextCtrl *text = wxDynamicCast(FindWindow(id), wxTextCtrl); \
160  if (!text || !RegistryGetString((section), (name), &value)) \
161  WARNINGMSG("PreferencesDialog::PreferencesDialog() - error with " << (name)); \
162  else \
163  text->SetValue(value.c_str()); \
164  } while (0)
165 
166 
168  wxDialog(parent, -1, "Preferences", wxPoint(400, 100), wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
169 {
170  // construct the panel
171  wxSizer *topSizer = SetupPreferencesNotebook(this, false);
172 
173  // get SpinCtrl pointers
184 
185  // set initial values
194 
197 
199  wxCommandEvent fakeCheck(wxEVT_COMMAND_CHECKBOX_CLICKED, ID_C_CACHE_ON);
200  OnCheckbox(fakeCheck); // set initial GUI enabled state
201 
203 #ifdef __WXGTK__
205 #endif
208 
211 
212  // call sizer stuff
213  topSizer->Fit(this);
214  topSizer->SetSizeHints(this);
215 }
216 
218 {
219  delete iWormSegments;
220  delete iWormSides;
221  delete iBondSides;
222  delete iHelixSides;
223  delete iAtomSlices;
224  delete iAtomStacks;
225  delete iCacheSize;
226  delete iMaxStructs;
227  delete iFootRes;
228  delete fSeparation;
229 }
230 
231 #define SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(section, name, iSpinCtrl, changedPtr) \
232  do { \
233  int oldValue, newValue; \
234  if (!RegistryGetInteger((section), (name), &oldValue)) throw "RegistryGetInteger() failed"; \
235  if (!((iSpinCtrl)->GetInteger(&newValue))) throw "GetInteger() failed"; \
236  if (newValue != oldValue) { \
237  if (!RegistrySetInteger((section), (name), newValue)) \
238  throw "RegistrySetInteger() failed"; \
239  if (changedPtr != NULL) *((bool*) changedPtr) = true; \
240  } \
241  } while (0)
242 
243 #define SET_DOUBLE_REGISTRY_VALUE_IF_DIFFERENT(section, name, fSpinCtrl, changedPtr) \
244  do { \
245  double oldValue, newValue; \
246  if (!RegistryGetDouble((section), (name), &oldValue)) throw "RegistryGetInteger() failed"; \
247  if (!((fSpinCtrl)->GetDouble(&newValue))) throw "GetInteger() failed"; \
248  if (newValue != oldValue) { \
249  if (!RegistrySetDouble((section), (name), newValue)) \
250  throw "RegistrySetInteger() failed"; \
251  if (changedPtr != NULL) *((bool*) changedPtr) = true; \
252  } \
253  } while (0)
254 
255 #define SET_BOOL_REGISTRY_VALUE_IF_DIFFERENT(section, name, id, changedPtr) \
256  do { \
257  bool oldValue, newValue; \
258  if (!RegistryGetBoolean((section), (name), &oldValue)) throw "RegistryGetBoolean() failed"; \
259  wxCheckBox *box = wxDynamicCast(FindWindow(id), wxCheckBox); \
260  if (!box) throw "Can't get wxCheckBox*"; \
261  newValue = box->GetValue(); \
262  if (newValue != oldValue) { \
263  if (!RegistrySetBoolean((section), (name), newValue, true)) \
264  throw "RegistrySetBoolean() failed"; \
265  if (changedPtr != NULL) *((bool*) changedPtr) = true; \
266  } \
267  } while (0)
268 
269 #define SET_RADIO_REGISTRY_VALUE_IF_DIFFERENT(section, name, id, changedPtr) \
270  do { \
271  string oldValue, newValue; \
272  if (!RegistryGetString((section), (name), &oldValue)) throw "RegistryGetString() failed"; \
273  wxRadioBox *radio = wxDynamicCast(FindWindow(id), wxRadioBox); \
274  if (!radio) throw "Can't get wxRadioBox*"; \
275  newValue = radio->GetStringSelection().c_str(); \
276  if (newValue != oldValue) { \
277  if (!RegistrySetString((section), (name), newValue)) \
278  throw "RegistrySetString() failed"; \
279  if (changedPtr != NULL) *((bool*) changedPtr) = true; \
280  } \
281  } while (0)
282 
283 #define SET_STRING_REGISTRY_VALUE_IF_DIFFERENT(section, name, textCtrl) \
284  do { \
285  string oldValue, newValue; \
286  if (!RegistryGetString((section), (name), &oldValue)) throw "RegistryGetString() failed"; \
287  newValue = (textCtrl)->GetValue().c_str(); \
288  if (newValue != oldValue) { \
289  if (!RegistrySetString((section), (name), newValue)) \
290  throw "RegistrySetString() failed"; \
291  } \
292  } while (0)
293 
294 // same as hitting done button
295 void PreferencesDialog::OnCloseWindow(wxCloseEvent& event)
296 {
297  bool okay = true, qualityChanged = false;
298 
299  // set values if changed
300  try {
302  REG_QUALITY_ATOM_SLICES, iAtomSlices, &qualityChanged);
304  REG_QUALITY_ATOM_STACKS, iAtomStacks, &qualityChanged);
306  REG_QUALITY_BOND_SIDES, iBondSides, &qualityChanged);
308  REG_QUALITY_WORM_SIDES, iWormSides, &qualityChanged);
310  REG_QUALITY_WORM_SEGMENTS, iWormSegments, &qualityChanged);
312  REG_QUALITY_HELIX_SIDES, iHelixSides, &qualityChanged);
314  REG_HIGHLIGHTS_ON, ID_C_HIGHLIGHT, &qualityChanged);
316  REG_PROJECTION_TYPE, ID_RADIOBOX, &qualityChanged);
317 
322 
324 #ifdef __WXGTK__
326  SET_STRING_REGISTRY_VALUE_IF_DIFFERENT(REG_ADVANCED_SECTION, REG_BROWSER_LAUNCH, tLaunch);
327 #endif
330 
333 
334  // Limit cache size to current value now
335  int size;
336  if (iCacheSize->GetInteger(&size)) TruncateCache(size);
337 
338  } catch (const char *err) {
339  ERRORMSG("Error setting registry values - " << err);
340  okay = false;
341  }
342 
343  // close dialog only if all user values are legit
344  if (okay) {
345  if (qualityChanged) GlobalMessenger()->PostRedrawAllStructures();
346  EndModal(wxOK);
347  } else {
348  if (event.CanVeto())
349  event.Veto();
350  }
351 }
352 
353 void PreferencesDialog::OnButton(wxCommandEvent& event)
354 {
355  switch (event.GetId()) {
356 
357  case ID_B_DONE: {
358  wxCloseEvent fake;
359  OnCloseWindow(fake); // handle on-exit stuff there
360  break;
361  }
362  case ID_B_CANCEL:
363  EndModal(wxCANCEL);
364  break;
365 
366  // quality page stuff
367  case ID_B_Q_LOW:
368  iWormSegments->SetInteger(2);
369  iWormSides->SetInteger(4);
370  iBondSides->SetInteger(4);
371  iHelixSides->SetInteger(8);
372  iAtomSlices->SetInteger(5);
373  iAtomStacks->SetInteger(3);
374  break;
375  case ID_B_Q_MED:
376  iWormSegments->SetInteger(6);
377  iWormSides->SetInteger(6);
378  iBondSides->SetInteger(6);
379  iHelixSides->SetInteger(12);
380  iAtomSlices->SetInteger(10);
381  iAtomStacks->SetInteger(8);
382  break;
383  case ID_B_Q_HIGH:
384  iWormSegments->SetInteger(10);
385  iWormSides->SetInteger(20);
386  iBondSides->SetInteger(16);
387  iHelixSides->SetInteger(30);
388  iAtomSlices->SetInteger(20);
389  iAtomStacks->SetInteger(14);
390  break;
391 
392  // cache page stuff
393  case ID_B_CACHE_BROWSE: {
395  wxString path;
396  path = wxDirSelector("Select a cache folder:", tCache->GetValue());
397  if (path.size() > 0 && wxDirExists(path.c_str()))
398  tCache->SetValue(path);
399  break;
400  }
401  case ID_B_CACHE_CLEAR:
402  TruncateCache(0);
403  break;
404 
405  default:
406  event.Skip();
407  }
408 }
409 
410 void PreferencesDialog::OnCheckbox(wxCommandEvent& event)
411 {
412  if (event.GetId() == ID_C_CACHE_ON) {
419  st1->Enable(c->GetValue());
420  b1->Enable(c->GetValue());
421  t->Enable(c->GetValue());
422  st2->Enable(c->GetValue());
423  b2->Enable(c->GetValue());
424  iCacheSize->GetTextCtrl()->Enable(c->GetValue());
425 // iCacheSize->GetSpinButton()->Enable(c->GetValue());
426  }
427 }
428 
429 END_SCOPE(Cn3D)
430 
432 
433 
434 ////////////////////////////////////////////////////////////////////////////////////////////////
435 // The following is taken *unmodified* from wxDesigner's C++ code from preferences_dialog.wdr
436 ////////////////////////////////////////////////////////////////////////////////////////////////
437 
438 wxSizer *SetupPreferencesNotebook( wxWindow *parent, bool call_fit, bool set_sizer )
439 {
440  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
441 
442  wxNotebook *item2 = new wxNotebook( parent, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, 0 );
443 
444  wxPanel *item3 = new wxPanel( item2, -1 );
445  SetupQualityPage( item3, FALSE );
446  item2->AddPage( item3, "Quality" );
447 
448  wxPanel *item4 = new wxPanel( item2, -1 );
449  SetupCachePage( item4, FALSE );
450  item2->AddPage( item4, "Cache" );
451 
452  wxPanel *item5 = new wxPanel( item2, -1 );
453  SetupAdvancedPage( item5, FALSE );
454  item2->AddPage( item5, "Advanced" );
455 
456  item0->Add( item2, 0, wxALIGN_CENTRE|wxALL, 5 );
457 
458  wxBoxSizer *item6 = new wxBoxSizer( wxHORIZONTAL );
459 
460  wxButton *item7 = new wxButton( parent, ID_B_DONE, "Done", wxDefaultPosition, wxDefaultSize, 0 );
461  item7->SetDefault();
462  item6->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 );
463 
464  item6->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
465 
466  wxButton *item8 = new wxButton( parent, ID_B_CANCEL, "Cancel", wxDefaultPosition, wxDefaultSize, 0 );
467  item6->Add( item8, 0, wxALIGN_CENTRE|wxALL, 5 );
468 
469  item0->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
470 
471  if (set_sizer)
472  {
473  parent->SetAutoLayout( TRUE );
474  parent->SetSizer( item0 );
475  if (call_fit)
476  {
477  item0->Fit( parent );
478  item0->SetSizeHints( parent );
479  }
480  }
481 
482  return item0;
483 }
484 
485 ////////////////////////////////////////////////////////////////////////////////////////////////
486 // The following is modified from wxDesigner's C++ code from preferences_dialog.wdr
487 ////////////////////////////////////////////////////////////////////////////////////////////////
488 
489 wxSizer *SetupAdvancedPage( wxWindow *parent, bool call_fit, bool set_sizer )
490 {
491  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
492 
493  wxStaticBox *item2 = new wxStaticBox( parent, -1, "Advanced" );
494  wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
495 
496  wxCheckBox *item3 = new wxCheckBox( parent, ID_C_ANNOT_RO, "CDD annotations are read-only", wxDefaultPosition, wxDefaultSize, 0 );
497  item3->SetValue( TRUE );
498  item1->Add( item3, 0, wxALIGN_CENTRE|wxALL, 5 );
499 
500 #ifdef __WXGTK__
501  wxFlexGridSizer *item4 = new wxFlexGridSizer( 1, 0, 0, 0 );
502  item4->AddGrowableCol( 0 );
503 
504  wxTextCtrl *item5 = new wxTextCtrl( parent, ID_T_LAUNCH, "", wxDefaultPosition, wxSize(80,-1), 0 );
505  item4->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
506 
507  wxStaticText *item6 = new wxStaticText( parent, ID_TEXT, "Browser launch", wxDefaultPosition, wxDefaultSize, 0 );
508  item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
509 
510  item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
511 #endif
512 
513  wxFlexGridSizer *item7 = new wxFlexGridSizer( 2, 0, 0, 0 );
514  item7->AddGrowableCol( 0 );
515 
516  wxStaticText *item8 = new wxStaticText( parent, ID_TEXT, "Max structures to load:", wxDefaultPosition, wxDefaultSize, 0 );
517  item7->Add( item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
518  giMaxStructs = new IntegerSpinCtrl(parent,
519  0, 100, 1, 10,
520  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
521  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
522  item7->Add(giMaxStructs->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
523 // item7->Add(giMaxStructs->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
524 
525  wxStaticText *item11 = new wxStaticText( parent, ID_TEXT, "Footprint excess residues:", wxDefaultPosition, wxDefaultSize, 0 );
526  item7->Add( item11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
527  giFootRes = new IntegerSpinCtrl(parent,
528  0, 1000, 5, 15,
529  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
530  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
531  item7->Add(giFootRes->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
532 // item7->Add(giFootRes->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
533 
534  item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
535 
536  item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
537 
538  wxStaticBox *item15 = new wxStaticBox( parent, -1, wxT("Stereo Settings") );
539  wxStaticBoxSizer *item14 = new wxStaticBoxSizer( item15, wxVERTICAL );
540 
541  wxFlexGridSizer *item16 = new wxFlexGridSizer( 3, 0, 0 );
542  item16->AddGrowableCol( 0 );
543 
544  wxStaticText *item17 = new wxStaticText( parent, ID_TEXT, wxT("Eye separation (degrees):"), wxDefaultPosition, wxDefaultSize, 0 );
545  item16->Add( item17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
546  gfSeparation = new FloatingPointSpinCtrl(parent,
547  0.0, 15.0, 0.1, 5.0,
548  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
549  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
550  item16->Add(gfSeparation->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
551 // item16->Add(gfSeparation->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
552 
553  wxStaticText *item20 = new wxStaticText( parent, ID_TEXT, wxT("Proximal (cross-eyed):"), wxDefaultPosition, wxDefaultSize, 0 );
554  item16->Add( item20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
555 
556  wxCheckBox *item21 = new wxCheckBox( parent, ID_C_PROXIMAL, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
557  item16->Add( item21, 0, wxALIGN_CENTRE|wxALL, 5 );
558 
559  item16->Add( 5, 5, 0, wxALIGN_CENTRE|wxALL, 5 );
560 
561  item14->Add( item16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
562 
563  item0->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
564 
565  if (set_sizer)
566  {
567  parent->SetAutoLayout( TRUE );
568  parent->SetSizer( item0 );
569  if (call_fit)
570  {
571  item0->Fit( parent );
572  item0->SetSizeHints( parent );
573  }
574  }
575 
576  return item0;
577 }
578 
579 wxSizer *SetupQualityPage(wxWindow *parent, bool call_fit, bool set_sizer)
580 {
581  wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 );
582 
583  wxStaticBox *item2 = new wxStaticBox( parent, -1, "Rendering Settings" );
584  wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
585  wxFlexGridSizer *item3 = new wxFlexGridSizer( 2, 0, 0 ); // 3, 0 ,0
586  item3->AddGrowableCol( 0 );
587 
588  wxStaticText *item5 = new wxStaticText(parent, ID_TEXT, "Worm segments:", wxDefaultPosition, wxDefaultSize, 0);
589  item3->Add(item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
590  giWormSegments = new IntegerSpinCtrl(parent,
591  2, 30, 2, 4,
592  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
593  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
594  item3->Add(giWormSegments->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
595 // item3->Add(giWormSegments->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
596 
597  wxStaticText *item8 = new wxStaticText(parent, ID_TEXT, "Worm sides:", wxDefaultPosition, wxDefaultSize, 0);
598  item3->Add(item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
599  giWormSides = new IntegerSpinCtrl(parent,
600  4, 30, 2, 6,
601  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
602  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
603  item3->Add(giWormSides->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
604 // item3->Add(giWormSides->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
605 
606  wxStaticText *item11 = new wxStaticText(parent, ID_TEXT, "Bond sides:", wxDefaultPosition, wxDefaultSize, 0);
607  item3->Add(item11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
608  giBondSides = new IntegerSpinCtrl(parent,
609  3, 30, 1, 6,
610  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
611  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
612  item3->Add(giBondSides->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
613 // item3->Add(giBondSides->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
614 
615  wxStaticText *item14 = new wxStaticText(parent, ID_TEXT, "Helix sides:", wxDefaultPosition, wxDefaultSize, 0);
616  item3->Add(item14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
617  giHelixSides = new IntegerSpinCtrl(parent,
618  3, 40, 1, 12,
619  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
620  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
621  item3->Add(giHelixSides->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
622 // item3->Add(giHelixSides->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
623 
624  wxStaticText *item17 = new wxStaticText(parent, ID_TEXT, "Atom slices:", wxDefaultPosition, wxDefaultSize, 0);
625  item3->Add(item17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
626  giAtomSlices = new IntegerSpinCtrl(parent,
627  3, 30, 1, 8,
628  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
629  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
630  item3->Add(giAtomSlices->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
631 // item3->Add(giAtomSlices->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
632 
633  wxStaticText *item20 = new wxStaticText(parent, ID_TEXT, "Atom stacks:", wxDefaultPosition, wxDefaultSize, 0);
634  item3->Add(item20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
635  giAtomStacks = new IntegerSpinCtrl(parent,
636  2, 30, 1, 6,
637  wxDefaultPosition, wxSize(80,SPIN_CTRL_HEIGHT), 0,
638  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
639  item3->Add(giAtomStacks->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
640 // item3->Add(giAtomStacks->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
641 
642  item1->Add(item3, 0, wxALIGN_CENTRE|wxALL, 5);
643 
644  wxFlexGridSizer *item22 = new wxFlexGridSizer( 2, 0, 0, 0 );
645  item22->AddGrowableCol( 1 );
646 
647  wxStaticText *item23 = new wxStaticText( parent, ID_TEXT, "Highlights:", wxDefaultPosition, wxDefaultSize, 0 );
648  item22->Add( item23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
649 
650  wxCheckBox *item24 = new wxCheckBox( parent, ID_C_HIGHLIGHT, "", wxDefaultPosition, wxDefaultSize, 0 );
651  item22->Add( item24, 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5 );
652 
653  wxStaticText *item25 = new wxStaticText( parent, ID_TEXT, "Projection:", wxDefaultPosition, wxDefaultSize, 0 );
654  item22->Add( item25, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
655 
656  wxString strs26[] =
657  {
658  "Perspective",
659  "Orthographic"
660  };
661  wxRadioBox *item26 = new wxRadioBox( parent, ID_RADIOBOX, "", wxDefaultPosition, wxDefaultSize, 2, strs26, 1, wxRA_SPECIFY_COLS );
662  item22->Add( item26, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
663 
664  item1->Add( item22, 0, wxALIGN_CENTRE, 5 );
665 
666  item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
667 
668  wxStaticBox *item28 = new wxStaticBox( parent, -1, "Presets" );
669  wxStaticBoxSizer *item27 = new wxStaticBoxSizer( item28, wxHORIZONTAL );
670 
671  wxBoxSizer *item29 = new wxBoxSizer( wxVERTICAL );
672 
673  wxButton *item30 = new wxButton( parent, ID_B_Q_LOW, "Low", wxDefaultPosition, wxDefaultSize, 0 );
674  item29->Add( item30, 0, wxALIGN_CENTRE|wxALL, 5 );
675 
676  item29->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
677 
678  wxButton *item31 = new wxButton( parent, ID_B_Q_MED, "Medium", wxDefaultPosition, wxDefaultSize, 0 );
679  item29->Add( item31, 0, wxALIGN_CENTRE|wxALL, 5 );
680 
681  item29->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
682 
683  wxButton *item32 = new wxButton( parent, ID_B_Q_HIGH, "High", wxDefaultPosition, wxDefaultSize, 0 );
684  item29->Add( item32, 0, wxALIGN_CENTRE|wxALL, 5 );
685 
686  item27->Add( item29, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
687 
688  item0->Add( item27, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
689 
690  if (set_sizer)
691  {
692  parent->SetAutoLayout(TRUE);
693  parent->SetSizer(item0);
694  if (call_fit)
695  {
696  item0->Fit(parent);
697  item0->SetSizeHints(parent);
698  }
699  }
700 
701  return item0;
702 }
703 
704 wxSizer *SetupCachePage( wxWindow *parent, bool call_fit, bool set_sizer )
705 {
706  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
707 
708  wxStaticBox *item2 = new wxStaticBox( parent, -1, "Cache Settings" );
709  wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
710 
711  wxCheckBox *item3 = new wxCheckBox( parent, ID_C_CACHE_ON, "Enable Biostruc cache", wxDefaultPosition, wxDefaultSize, 0 );
712  item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 );
713 
714  wxStaticLine *item4 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
715  item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
716 
717  wxBoxSizer *item5 = new wxBoxSizer( wxVERTICAL );
718 
719  wxFlexGridSizer *item6 = new wxFlexGridSizer( 1, 0, 0, 0 );
720  item6->AddGrowableCol( 1 );
721 
722  wxStaticText *item7 = new wxStaticText( parent, ID_T_CACHE_1, "Cache folder:", wxDefaultPosition, wxDefaultSize, 0 );
723  item6->Add( item7, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 );
724 
725  item6->Add( 20, 20, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 );
726 
727  wxButton *item8 = new wxButton( parent, ID_B_CACHE_BROWSE, "Browse", wxDefaultPosition, wxDefaultSize, 0 );
728  item6->Add( item8, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 );
729 
730  item5->Add( item6, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
731 
732  wxTextCtrl *item9 = new wxTextCtrl( parent, ID_T_CACHE_FOLDER, "", wxDefaultPosition, wxDefaultSize, 0 );
733  item5->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
734 
735  item5->Add( 20, 20, 0, wxALIGN_CENTRE, 5 );
736 
737  wxFlexGridSizer *item10 = new wxFlexGridSizer( 1, 0, 0, 0 );
738  item10->AddGrowableCol( 2 );
739 
740  wxStaticText *item11 = new wxStaticText( parent, ID_T_CACHE_2, "Maximum folder size (MB):", wxDefaultPosition, wxDefaultSize, 0 );
741  item10->Add( item11, 0, wxALIGN_CENTRE|wxALL, 5 );
742 
743  giCacheSize = new IntegerSpinCtrl(parent,
744  1, 500, 1, 50,
745  wxDefaultPosition, wxSize(50,SPIN_CTRL_HEIGHT), 0,
746  wxDefaultPosition, wxSize(-1,SPIN_CTRL_HEIGHT));
747  item10->Add(giCacheSize->GetTextCtrl(), 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5);
748 // item10->Add(giCacheSize->GetSpinButton(), 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5);
749 
750  item10->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
751 
752  wxButton *item14 = new wxButton( parent, ID_B_CACHE_CLEAR, "Clear now", wxDefaultPosition, wxDefaultSize, 0 );
753  item10->Add( item14, 0, wxALIGN_CENTRE|wxALL, 5 );
754 
755  item5->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 );
756 
757  item1->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
758 
759  item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
760 
761  if (set_sizer)
762  {
763  parent->SetAutoLayout( TRUE );
764  parent->SetSizer( item0 );
765  if (call_fit)
766  {
767  item0->Fit( parent );
768  item0->SetSizeHints( parent );
769  }
770  }
771 
772  return item0;
773 }
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
wxTextCtrl * GetTextCtrl(void) const
Definition: wx_tools.hpp:206
wxTextCtrl * GetTextCtrl(void) const
Definition: wx_tools.hpp:152
void PostRedrawAllStructures(void)
Definition: messenger.cpp:79
void OnCheckbox(wxCommandEvent &event)
ncbi::IntegerSpinCtrl * iAtomSlices
ncbi::FloatingPointSpinCtrl * fSeparation
PreferencesDialog(wxWindow *parent)
ncbi::IntegerSpinCtrl * iWormSides
ncbi::IntegerSpinCtrl * iMaxStructs
ncbi::IntegerSpinCtrl * iHelixSides
ncbi::IntegerSpinCtrl * iBondSides
ncbi::IntegerSpinCtrl * iAtomStacks
ncbi::IntegerSpinCtrl * iFootRes
void OnCloseWindow(wxCloseEvent &event)
ncbi::IntegerSpinCtrl * iWormSegments
void OnButton(wxCommandEvent &event)
ncbi::IntegerSpinCtrl * iCacheSize
void TruncateCache(unsigned int maxSize)
Definition: cn3d_cache.cpp:299
static const std::string REG_FOOTPRINT_RES
Definition: cn3d_tools.hpp:197
static const std::string REG_QUALITY_ATOM_STACKS
Definition: cn3d_tools.hpp:174
static const std::string REG_QUALITY_ATOM_SLICES
Definition: cn3d_tools.hpp:173
static const std::string REG_MAX_N_STRUCTS
Definition: cn3d_tools.hpp:196
static const std::string REG_QUALITY_SECTION
Definition: cn3d_tools.hpp:172
static const std::string REG_PROJECTION_TYPE
Definition: cn3d_tools.hpp:180
static const std::string REG_QUALITY_BOND_SIDES
Definition: cn3d_tools.hpp:175
static const std::string REG_HIGHLIGHTS_ON
Definition: cn3d_tools.hpp:179
static const std::string REG_QUALITY_WORM_SIDES
Definition: cn3d_tools.hpp:176
static const std::string REG_CACHE_MAX_SIZE
Definition: cn3d_tools.hpp:189
static const std::string REG_PROXIMAL_STEREO
Definition: cn3d_tools.hpp:199
static const std::string REG_CACHE_FOLDER
Definition: cn3d_tools.hpp:188
static const std::string REG_QUALITY_HELIX_SIDES
Definition: cn3d_tools.hpp:178
static const std::string REG_CACHE_ENABLED
Definition: cn3d_tools.hpp:187
static const std::string REG_ADVANCED_SECTION
Definition: cn3d_tools.hpp:191
static const std::string REG_CDD_ANNOT_READONLY
Definition: cn3d_tools.hpp:192
static const std::string REG_QUALITY_WORM_SEGMENTS
Definition: cn3d_tools.hpp:177
#define ERRORMSG(stream)
Definition: cn3d_tools.hpp:86
static const std::string REG_STEREO_SEPARATION
Definition: cn3d_tools.hpp:198
static const std::string REG_CACHE_SECTION
Definition: cn3d_tools.hpp:186
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define NULL
Definition: ncbistd.hpp:225
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
END_EVENT_TABLE()
Messenger * GlobalMessenger(void)
Definition: messenger.cpp:73
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
EIPRangeType t
Definition: ncbi_localip.c:101
Process information in the NCBI Registry, including working with configuration files.
static IntegerSpinCtrl * giFootRes
#define ID_B_CACHE_BROWSE
#define ID_LINE
static IntegerSpinCtrl * giMaxStructs
#define ID_B_Q_MED
#define ID_C_ANNOT_RO
static IntegerSpinCtrl * giWormSegments
#define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type)
#define SET_RADIOBOX_FROM_REGISTRY_VALUE(section, name, id)
#define SET_RADIO_REGISTRY_VALUE_IF_DIFFERENT(section, name, id, changedPtr)
#define SET_BOOL_REGISTRY_VALUE_IF_DIFFERENT(section, name, id, changedPtr)
#define SET_TEXTCTRL_FROM_REGISTRY_VALUE(section, name, id)
#define SET_STRING_REGISTRY_VALUE_IF_DIFFERENT(section, name, textCtrl)
wxSizer * SetupAdvancedPage(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
#define ID_B_CANCEL
#define SET_CHECKBOX_FROM_REGISTRY_VALUE(section, name, id)
static IntegerSpinCtrl * giAtomSlices
#define SET_DOUBLE_REGISTRY_VALUE_IF_DIFFERENT(section, name, fSpinCtrl, changedPtr)
#define SET_FSPINCTRL_FROM_REGISTRY_VALUE(section, name, fSpinCtrl)
static IntegerSpinCtrl * giBondSides
#define ID_B_CACHE_CLEAR
#define ID_C_PROXIMAL
#define ID_T_CACHE_2
#define ID_B_Q_HIGH
wxSizer * SetupCachePage(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
#define SET_ISPINCTRL_FROM_REGISTRY_VALUE(section, name, iSpinCtrl)
#define ID_TEXT
#define SET_INTEGER_REGISTRY_VALUE_IF_DIFFERENT(section, name, iSpinCtrl, changedPtr)
USING_SCOPE(Cn3D)
#define ID_T_LAUNCH
#define ID_NOTEBOOK
static FloatingPointSpinCtrl * gfSeparation
wxSizer * SetupPreferencesNotebook(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
wxSizer * SetupQualityPage(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
static IntegerSpinCtrl * giHelixSides
static IntegerSpinCtrl * giWormSides
#define ID_B_DONE
#define ID_RADIOBOX
static IntegerSpinCtrl * giCacheSize
#define ID_C_HIGHLIGHT
#define ID_T_CACHE_FOLDER
#define ID_T_CACHE_1
#define ID_C_CACHE_ON
USING_NCBI_SCOPE
#define ID_B_Q_LOW
static IntegerSpinCtrl * giAtomStacks
@ FALSE
Definition: testodbc.c:27
@ TRUE
Definition: testodbc.c:27
Modified on Mon Dec 11 02:36:38 2023 by modify_doxy.py rev. 669887