NCBI C++ ToolKit
structure_window.hpp

Search Toolkit Book for ure_window_8hpp_source

Go to the documentation of this file.
1 /* $Id: structure_window.hpp 97176 2022-06-24 15:25: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 * structure window object for Cn3D
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef CN3D_STRUCTURE_WINDOW__HPP
35 #define CN3D_STRUCTURE_WINDOW__HPP
36 
37 #include <corelib/ncbistd.hpp>
38 
41 
42 #include <string>
43 
44 #ifdef __WXMSW__
45 #include <windows.h>
46 #include <wx/msw/winundef.h>
47 #endif
48 #include <wx/wx.h>
49 #include <wx/html/helpctrl.h>
50 #include <wx/fileconf.h>
51 
52 #include "multitext_dialog.hpp"
53 #include "file_messaging.hpp"
54 
55 
56 BEGIN_SCOPE(Cn3D)
57 
58 class Cn3DGLCanvas;
59 class CDDAnnotateDialog;
60 //class IBISAnnotateDialog;
61 class MultiTextDialog;
62 class CDDRefDialog;
63 class CDDBookRefDialog;
64 class CDDSplashDialog;
65 class CommandProcessor;
66 class OpenGLRenderer;
67 class StructureSet;
68 
69 class StructureWindow: public wxFrame, public MultiTextDialogOwner, public ncbi::MessageResponder
70 {
71 public:
72  StructureWindow(const wxString& title, const wxPoint& pos, const wxSize& size);
74 
75  // public data
77 
78  // MessageResponder callbacks and setup
79  void ReceivedCommand(const std::string& fromApp, unsigned long id,
80  const std::string& command, const std::string& data);
81  void ReceivedReply(const std::string& fromApp, unsigned long id,
82  ncbi::MessageResponder::ReplyStatus status, const std::string& data);
83  void SetupFileMessenger(const std::string& messageFilename,
84  const std::string& messageApp, bool readOnly);
85  bool IsFileMessengerActive(void) const { return (fileMessenger != NULL); }
86  void SendCommand(const std::string& toApp, const std::string& command, const std::string& data);
87 
88  // public methods
89  bool LoadData(const char *filename, bool force, bool noAlignmentWindow, ncbi::objects::CNcbi_mime_asn1 *mimeData = NULL);
90  bool SaveDialog(bool prompt, bool canCancel);
91  void SetWindowTitle(void);
92  void DialogTextChanged(const MultiTextDialog *changed);
93  void DialogDestroyed(const MultiTextDialog *destroyed);
95 
96  enum {
97  // File menu
98  MID_OPEN = 1, // wxMac doesn't like MID_OPEN = 0 on Mac OSX 10.4 and higher
109  // View menu
125  // Show/Hide menu
139  // Structure Alignments menu
140  // Style menu
142  MID_RENDER, // rendering shortcuts
149  MID_COLORS, // color shortcuts
171  MID_FAVORITES, // favorites submenu
175  // Window menu
180  // CDD menu
188  // MID_ANNOT_IBIS,
191  // Messaging menu (only when file messenger specified on command line)
193  // Help menu
196  MID_ABOUT = wxID_ABOUT, // special case so that this comes under Apple menu on Mac
197 
198  // not actually menu items, but used to enumerate style favorites list
200  MID_FAVORITES_END = 149
201  };
202 
203  void ShowCDDOverview(void);
204  void ShowCDDAnnotations(void);
205  void ShowCDDReferences(void);
206  void ShowCDDBookReferences(void);
207  // void ShowIBISAnnotations(void);
208 
209  void SetRenderingMenuFlag(int which);
210  void SetColoringMenuFlag(int which);
211 
212 private:
213 
214  // non-modal dialogs owned by this object
216  // IBISAnnotateDialog *ibisAnnotateDialog;
221  void DestroyNonModalDialogs(void);
222 
223  void OnExit(wxCommandEvent& event);
224  void OnCloseWindow(wxCloseEvent& event);
225  void OnShowWindow(wxCommandEvent& event);
226 
227  // menu-associated methods
228  void OnOpen(wxCommandEvent& event);
229  void OnSave(wxCommandEvent& event);
230  void OnPNG(wxCommandEvent& event);
231  void OnAlignStructures(wxCommandEvent& event);
232  void OnAdjustView(wxCommandEvent& event);
233  void OnShowHide(wxCommandEvent& event);
234  void OnSelect(wxCommandEvent& event);
235  void OnSetStyle(wxCommandEvent& event);
236  void OnEditFavorite(wxCommandEvent& event);
237  void OnSelectFavorite(wxCommandEvent& event);
238  void OnCDD(wxCommandEvent& event);
239  void OnPreferences(wxCommandEvent& event);
240  void OnSetFont(wxCommandEvent& event);
241  void OnAnimate(wxCommandEvent& event);
242  void OnAnimationTimer(wxTimerEvent& event);
243  void OnHelp(wxCommandEvent& event);
244  void OnSendSelection(wxCommandEvent& event);
245 
246  wxMenuBar *menuBar;
248  void SetupFavoritesMenu(void);
250 
251  wxTimer animationTimer;
252  enum { ANIM_FRAMES, ANIM_SPIN }; // animation modes
255 
256  // help window and associated config file (for saving bookmarks, etc.)
257  wxHtmlHelpController *helpController;
258  wxFileConfig *helpConfig;
259 
260  // MessageResponder stuff
261  ncbi::FileMessagingManager fileMessagingManager;
263  ncbi::FileMessenger *fileMessenger;
264  void OnFileMessagingTimer(wxTimerEvent& event);
266 
268 
269  DECLARE_EVENT_TABLE()
270 };
271 
272 bool LoadDataOnly(StructureSet **sset, OpenGLRenderer *renderer, const char *filename,
273  ncbi::objects::CNcbi_mime_asn1 *mimeData = NULL, const std::string& favoriteStyle = kEmptyStr,
275 
276 END_SCOPE(Cn3D)
277 
278 #endif // CN3D_STRUCTURE_WINDOW__HPP
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CDDRefDialog * cddRefDialog
bool SaveDialog(bool prompt, bool canCancel)
void OnShowWindow(wxCommandEvent &event)
CDDBookRefDialog * cddBookRefDialog
std::string preferredFavoriteStyle
void ShowCDDReferences(void)
void OnPNG(wxCommandEvent &event)
void OnSetStyle(wxCommandEvent &event)
ncbi::FileMessagingManager fileMessagingManager
void OnShowHide(wxCommandEvent &event)
void OnAlignStructures(wxCommandEvent &event)
void OnAnimationTimer(wxTimerEvent &event)
void OnExit(wxCommandEvent &event)
void ReceivedReply(const std::string &fromApp, unsigned long id, ncbi::MessageResponder::ReplyStatus status, const std::string &data)
void ShowCDDOverview(void)
void SetWindowTitle(void)
void OnCloseWindow(wxCloseEvent &event)
StructureWindow(const wxString &title, const wxPoint &pos, const wxSize &size)
void SetRenderingMenuFlag(int which)
void SetPreferredFavoriteStyle(const std::string &s)
void SendCommand(const std::string &toApp, const std::string &command, const std::string &data)
bool IsFileMessengerActive(void) const
void OnSelectFavorite(wxCommandEvent &event)
void OnFileMessagingTimer(wxTimerEvent &event)
void SetupFavoritesMenu(void)
void OnCDD(wxCommandEvent &event)
void OnPreferences(wxCommandEvent &event)
void DialogTextChanged(const MultiTextDialog *changed)
void ShowCDDBookReferences(void)
void OnHelp(wxCommandEvent &event)
void OnSelect(wxCommandEvent &event)
CommandProcessor * commandProcessor
void OnSave(wxCommandEvent &event)
void SetupFileMessenger(const std::string &messageFilename, const std::string &messageApp, bool readOnly)
void ReceivedCommand(const std::string &fromApp, unsigned long id, const std::string &command, const std::string &data)
MultiTextDialog * cddDescriptionDialog
void OnEditFavorite(wxCommandEvent &event)
void ShowCDDAnnotations(void)
void OnSetFont(wxCommandEvent &event)
wxFileConfig * helpConfig
ncbi::FileMessenger * fileMessenger
wxHtmlHelpController * helpController
void OnOpen(wxCommandEvent &event)
void SetColoringMenuFlag(int which)
Cn3DGLCanvas * glCanvas
void DialogDestroyed(const MultiTextDialog *destroyed)
CDDAnnotateDialog * cddAnnotateDialog
CDDSplashDialog * cddOverview
bool LoadData(const char *filename, bool force, bool noAlignmentWindow, ncbi::objects::CNcbi_mime_asn1 *mimeData=NULL)
void OnAnimate(wxCommandEvent &event)
void DestroyNonModalDialogs(void)
void OnAdjustView(wxCommandEvent &event)
void OnSendSelection(wxCommandEvent &event)
MultiTextDialog * cddNotesDialog
std::string messageTargetApp
Include a standard set of the NCBI C++ Toolkit most basic headers.
char data[12]
Definition: iconv.c:80
string
Definition: cgiapp.hpp:687
#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
#define kEmptyStr
Definition: ncbistr.hpp:123
EModel_type
Access to EModel_type's attributes (values, names) as defined in spec.
Definition: Model_type_.hpp:63
@ eModel_type_ncbi_all_atom
Definition: Model_type_.hpp:66
const struct ncbi::grid::netcache::search::fields::SIZE size
const char * command
bool LoadDataOnly(StructureSet **sset, OpenGLRenderer *renderer, const char *filename, ncbi::objects::CNcbi_mime_asn1 *mimeData=NULL, const std::string &favoriteStyle=kEmptyStr, ncbi::objects::EModel_type model=ncbi::objects::eModel_type_ncbi_all_atom, StructureWindow *window=NULL)
Modified on Wed May 22 11:34:18 2024 by modify_doxy.py rev. 669887