structure_window.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:10k
源码类别:

生物技术

开发平台:

C/C++

  1. /*
  2.  * ===========================================================================
  3.  * PRODUCTION $Log: structure_window.hpp,v $
  4.  * PRODUCTION Revision 1000.3  2004/06/01 18:29:36  gouriano
  5.  * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13
  6.  * PRODUCTION
  7.  * ===========================================================================
  8.  */
  9. /*  $Id: structure_window.hpp,v 1000.3 2004/06/01 18:29:36 gouriano Exp $
  10. * ===========================================================================
  11. *
  12. *                            PUBLIC DOMAIN NOTICE
  13. *               National Center for Biotechnology Information
  14. *
  15. *  This software/database is a "United States Government Work" under the
  16. *  terms of the United States Copyright Act.  It was written as part of
  17. *  the author's official duties as a United States Government employee and
  18. *  thus cannot be copyrighted.  This software/database is freely available
  19. *  to the public for use. The National Library of Medicine and the U.S.
  20. *  Government have not placed any restriction on its use or reproduction.
  21. *
  22. *  Although all reasonable efforts have been taken to ensure the accuracy
  23. *  and reliability of the software and data, the NLM and the U.S.
  24. *  Government do not and cannot warrant the performance or results that
  25. *  may be obtained by using this software or data. The NLM and the U.S.
  26. *  Government disclaim all warranties, express or implied, including
  27. *  warranties of performance, merchantability or fitness for any particular
  28. *  purpose.
  29. *
  30. *  Please cite the author in any work or product based on this material.
  31. *
  32. * ===========================================================================
  33. *
  34. * Authors:  Paul Thiessen
  35. *
  36. * File Description:
  37. *      structure window object for Cn3D
  38. *
  39. * ===========================================================================
  40. */
  41. #ifndef CN3D_STRUCTURE_WINDOW__HPP
  42. #define CN3D_STRUCTURE_WINDOW__HPP
  43. #include <corelib/ncbistd.hpp>
  44. #include <objects/ncbimime/Ncbi_mime_asn1.hpp>
  45. #include <string>
  46. #ifdef __WXMSW__
  47. #include <windows.h>
  48. #include <wx/msw/winundef.h>
  49. #endif
  50. #include <wx/wx.h>
  51. #include <wx/html/helpctrl.h>
  52. #include <wx/fileconf.h>
  53. #include "multitext_dialog.hpp"
  54. #include "file_messaging.hpp"
  55. BEGIN_SCOPE(Cn3D)
  56. class Cn3DGLCanvas;
  57. class CDDAnnotateDialog;
  58. class MultiTextDialog;
  59. class CDDRefDialog;
  60. class CDDBookRefDialog;
  61. class CDDSplashDialog;
  62. class CommandProcessor;
  63. class StructureWindow: public wxFrame, public MultiTextDialogOwner, public ncbi::MessageResponder
  64. {
  65. public:
  66.     StructureWindow(const wxString& title, const wxPoint& pos, const wxSize& size);
  67.     ~StructureWindow();
  68.     // public data
  69.     Cn3DGLCanvas *glCanvas;
  70.     // MessageResponder callbacks and setup
  71.     void ReceivedCommand(const std::string& fromApp, unsigned long id,
  72.         const std::string& command, const std::string& data);
  73.     void ReceivedReply(const std::string& fromApp, unsigned long id,
  74. ncbi::MessageResponder::ReplyStatus status, const std::string& data);
  75.     void SetupFileMessenger(const std::string& messageFilename,
  76.         const std::string& messageApp, bool readOnly);
  77.     bool IsFileMessengerActive(void) const { return (fileMessenger != NULL); }
  78.     void SendCommand(const std::string& toApp, const std::string& command, const std::string& data);
  79.     // public methods
  80.     bool LoadData(const char *filename, bool force, ncbi::objects::CNcbi_mime_asn1 *mimeData = NULL);
  81.     bool SaveDialog(bool prompt, bool canCancel);
  82.     void SetWindowTitle(void);
  83.     void DialogTextChanged(const MultiTextDialog *changed);
  84.     void DialogDestroyed(const MultiTextDialog *destroyed);
  85.     enum {
  86.         // File menu
  87.             MID_OPEN,
  88.             MID_NETWORK_OPEN,
  89.             MID_SAVE_SAME,
  90.             MID_SAVE_AS,
  91.             MID_PNG,
  92.             MID_REFIT_ALL,
  93.             MID_PREFERENCES,
  94.             MID_FONTS,
  95.                 MID_OPENGL_FONT,
  96.                 MID_SEQUENCE_FONT,
  97.             MID_EXIT,
  98.         // View menu
  99.             MID_ZOOM_IN,
  100.             MID_ZOOM_OUT,
  101.             MID_RESET,
  102.             MID_RESTORE,
  103.             MID_NEXT_FRAME,
  104.             MID_PREV_FRAME,
  105.             MID_FIRST_FRAME,
  106.             MID_LAST_FRAME,
  107.             MID_ALL_FRAMES,
  108.             MID_STEREO,
  109.             MID_ANIMATE,
  110.                 MID_PLAY,
  111.                 MID_SPIN,
  112.                 MID_STOP,
  113.                 MID_ANIM_CONTROLS,
  114.         // Show/Hide menu
  115.             MID_SHOW_HIDE,
  116.             MID_SHOW_ALL,
  117.             MID_SHOW_DOMAINS,
  118.             MID_SHOW_ALIGNED,
  119.             MID_SHOW_UNALIGNED,
  120.                 MID_SHOW_UNALIGNED_ALL,
  121.                 MID_SHOW_UNALIGNED_ALN_DOMAIN,
  122.             MID_SHOW_SELECTED_RESIDUES,
  123.             MID_SHOW_SELECTED_DOMAINS,
  124.             MID_SELECT_MOLECULE,
  125.             MID_DIST_SELECT,
  126.                 MID_DIST_SELECT_RESIDUES,
  127.                 MID_DIST_SELECT_ALL,
  128.                 MID_DIST_SELECT_OTHER_RESIDUES,
  129.                 MID_DIST_SELECT_OTHER_ALL,
  130.         // Structure Alignments menu
  131.         // Style menu
  132.             MID_EDIT_STYLE,
  133.             MID_RENDER, // rendering shortcuts
  134.                 MID_WORM,
  135.                 MID_TUBE,
  136.                 MID_WIRE,
  137.                 MID_BNS,
  138.                 MID_SPACE,
  139.                 MID_SC_TOGGLE,
  140.             MID_COLORS, // color shortcuts
  141.                 MID_SECSTRUC,
  142.                 MID_ALIGNED,
  143.                 MID_CONS,
  144.                     MID_IDENTITY,
  145.                     MID_VARIETY,
  146.                     MID_WGHT_VAR,
  147.                     MID_INFO,
  148.                     MID_FIT,
  149.                     MID_BLOCK_FIT,
  150.                     MID_BLOCK_Z_FIT,
  151.                     MID_BLOCK_ROW_FIT,
  152.                 MID_OBJECT,
  153.                 MID_DOMAIN,
  154.                 MID_MOLECULE,
  155.                 MID_RAINBOW,
  156.                 MID_HYDROPHOB,
  157.                 MID_CHARGE,
  158.                 MID_TEMP,
  159.                 MID_ELEMENT,
  160.             MID_ANNOTATE,
  161.             MID_FAVORITES, // favorites submenu
  162.                 MID_ADD_FAVORITE,
  163.                 MID_REMOVE_FAVORITE,
  164.                 MID_FAVORITES_FILE,
  165.         // Window menu
  166.             MID_SHOW_LOG,
  167.             MID_SHOW_LOG_START,
  168.             MID_SHOW_SEQ_V,
  169.             MID_SEND_SELECTION,
  170.         // CDD menu
  171.             MID_CDD_OVERVIEW,
  172.             MID_EDIT_CDD_NAME,
  173.             MID_EDIT_CDD_DESCR,
  174.             MID_EDIT_CDD_NOTES,
  175.             MID_EDIT_CDD_REFERENCES,
  176.             MID_EDIT_CDD_BOOK_REFERENCES,
  177.             MID_ANNOT_CDD,
  178.             MID_CDD_REJECT_SEQ,
  179.             MID_CDD_SHOW_REJECTS,
  180.         // Messaging menu (only when file messenger specified on command line)
  181.             MID_MESSAGING,
  182.         // Help menu
  183.             MID_HELP_COMMANDS,
  184.             MID_ONLINE_HELP,
  185.             MID_ABOUT = wxID_ABOUT,     // special case so that this comes under Apple menu on Mac
  186.         // not actually menu items, but used to enumerate style favorites list
  187.             MID_FAVORITES_BEGIN = 100,
  188.             MID_FAVORITES_END   = 149
  189.     };
  190.     void ShowCDDOverview(void);
  191.     void ShowCDDAnnotations(void);
  192.     void ShowCDDReferences(void);
  193.     void ShowCDDBookReferences(void);
  194. private:
  195.     // non-modal dialogs owned by this object
  196.     CDDAnnotateDialog *cddAnnotateDialog;
  197.     MultiTextDialog *cddDescriptionDialog, *cddNotesDialog;
  198.     CDDRefDialog *cddRefDialog;
  199.     CDDBookRefDialog *cddBookRefDialog;
  200.     CDDSplashDialog *cddOverview;
  201.     void DestroyNonModalDialogs(void);
  202.     void OnExit(wxCommandEvent& event);
  203.     void OnCloseWindow(wxCloseEvent& event);
  204.     void OnShowWindow(wxCommandEvent& event);
  205.     void SetRenderingMenuFlag(int which);
  206.     void SetColoringMenuFlag(int which);
  207.     // menu-associated methods
  208.     void OnOpen(wxCommandEvent& event);
  209.     void OnSave(wxCommandEvent& event);
  210.     void OnPNG(wxCommandEvent& event);
  211.     void OnAlignStructures(wxCommandEvent& event);
  212.     void OnAdjustView(wxCommandEvent& event);
  213.     void OnShowHide(wxCommandEvent& event);
  214.     void OnDistanceSelect(wxCommandEvent& event);
  215.     void OnSetStyle(wxCommandEvent& event);
  216.     void OnEditFavorite(wxCommandEvent& event);
  217.     void OnSelectFavorite(wxCommandEvent& event);
  218.     void OnCDD(wxCommandEvent& event);
  219.     void OnPreferences(wxCommandEvent& event);
  220.     void OnSetFont(wxCommandEvent& event);
  221.     void OnAnimate(wxCommandEvent& event);
  222.     void OnAnimationTimer(wxTimerEvent& event);
  223.     void OnHelp(wxCommandEvent& event);
  224.     void OnSendSelection(wxCommandEvent& event);
  225.     wxMenuBar *menuBar;
  226.     wxMenu *fileMenu, *favoritesMenu, *windowMenu;
  227.     void SetupFavoritesMenu(void);
  228.     wxTimer animationTimer;
  229.     enum { ANIM_FRAMES, ANIM_SPIN };    // animation modes
  230.     int animationMode;
  231.     double spinIncrement;
  232.     // help window and associated config file (for saving bookmarks, etc.)
  233.     wxHtmlHelpController *helpController;
  234.     wxFileConfig *helpConfig;
  235.     // MessageResponder stuff
  236.     ncbi::FileMessagingManager fileMessagingManager;
  237.     wxTimer fileMessagingTimer;
  238.     ncbi::FileMessenger *fileMessenger;
  239.     void OnFileMessagingTimer(wxTimerEvent& event);
  240.     std::string messageTargetApp;
  241.     CommandProcessor *commandProcessor;
  242.     DECLARE_EVENT_TABLE()
  243. };
  244. END_SCOPE(Cn3D)
  245. #endif // CN3D_STRUCTURE_WINDOW__HPP
  246. /*
  247. * ---------------------------------------------------------------------------
  248. * $Log: structure_window.hpp,v $
  249. * Revision 1000.3  2004/06/01 18:29:36  gouriano
  250. * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13
  251. *
  252. * Revision 1.13  2004/04/22 00:05:04  thiessen
  253. * add seclect molecule
  254. *
  255. * Revision 1.12  2004/02/19 17:05:17  thiessen
  256. * remove cn3d/ from include paths; add pragma to disable annoying msvc warning
  257. *
  258. * Revision 1.11  2004/01/17 01:47:27  thiessen
  259. * add network load
  260. *
  261. * Revision 1.10  2004/01/17 00:17:32  thiessen
  262. * add Biostruc and network structure load
  263. *
  264. * Revision 1.9  2004/01/08 15:31:03  thiessen
  265. * remove hard-coded CDTree references in messaging; add Cn3DTerminated message upon exit
  266. *
  267. * Revision 1.8  2003/12/03 15:07:10  thiessen
  268. * add more sophisticated animation controls
  269. *
  270. * Revision 1.7  2003/11/15 16:08:37  thiessen
  271. * add stereo
  272. *
  273. * Revision 1.6  2003/09/26 17:12:46  thiessen
  274. * add book reference dialog
  275. *
  276. * Revision 1.5  2003/07/17 18:47:01  thiessen
  277. * add -f option to force save to same file
  278. *
  279. * Revision 1.4  2003/07/10 18:47:29  thiessen
  280. * add CDTree->Select command
  281. *
  282. * Revision 1.3  2003/07/10 13:47:22  thiessen
  283. * add LoadFile command
  284. *
  285. * Revision 1.2  2003/03/14 19:22:59  thiessen
  286. * add CommandProcessor to handle file-message commands; fixes for GCC 2.9
  287. *
  288. * Revision 1.1  2003/03/13 14:26:18  thiessen
  289. * add file_messaging module; split cn3d_main_wxwin into cn3d_app, cn3d_glcanvas, structure_window, cn3d_tools
  290. *
  291. */