NCBI C++ ToolKit
viewer_base.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: viewer_base.hpp 33815 2007-05-04 17:18:18Z kazimird $
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 * base functionality for non-GUI part of viewers
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef CN3D_VIEWER_BASE__HPP
35 #define CN3D_VIEWER_BASE__HPP
36 
37 #include <corelib/ncbistl.hpp>
38 
39 #include <list>
40 #include <string>
41 
42 
43 BEGIN_SCOPE(Cn3D)
44 
45 class ViewerWindowBase;
46 class Sequence;
47 class Messenger;
48 class SequenceDisplay;
50 class Vector;
51 class AlignmentManager;
52 class Molecule;
53 class MoleculeIdentifier;
54 
56 {
57  friend class ViewerWindowBase;
58  friend class AlignmentManager;
59  friend class SequenceDisplay;
60 
61 public:
62 
63  // to update/remove the GUI window
64  void Refresh(void);
65  void DestroyGUI(void);
66 
67  void GUIDestroyed(void) { *viewerWindow = NULL; }
68 
69  // set customized window title
70  void SetWindowTitle(void) const;
71 
72  // ask whether the editor is enabled for this viewer
73  bool EditorIsOn(void) const;
74 
75  void RemoveBlockBoundaryRows(void);
76 
77  // tell viewer to save its data
78  virtual void SaveDialog(bool prompt);
79 
80  // to be notified of font change
81  void NewFont(void);
82 
83  // make residue visible, if present
84  void MakeResidueVisible(const Molecule *molecule, int seqIndex);
85  void MakeSequenceVisible(const MoleculeIdentifier *identifier);
86 
87  void CalculateSelfHitScores(const BlockMultipleAlignment *multiple);
88 
89  typedef std::list < BlockMultipleAlignment * > AlignmentList;
90 
91 protected:
92  // can't instantiate this base class
93  ViewerBase(ViewerWindowBase* *window, AlignmentManager *alnMgr);
94  virtual ~ViewerBase(void);
95 
97 
98  // handle to the associated window
100 
101 private:
102  // alignment and display stack data
104  typedef std::list < AlignmentList > AlignmentStack;
106 
108  typedef std::list < SequenceDisplay * > DisplayStack;
110 
111  // limits the size of the stack (set to -1 for unlimited)
112  static const unsigned int MAX_UNDO_STACK_SIZE;
113 
116 
117  void CopyDataFromStack(void);
118  void ClearAllData(void);
119  void SetUndoRedoMenuStates(void);
120 
121 public:
122 
123  // initialization
124  void InitData(const AlignmentList *alignments, SequenceDisplay *display);
125 
126  // to store alignment+display data for undo/redo during editing
127  void EnableStacks(void);
128  void Save(void);
129  void Undo(void);
130  void Redo(void);
131 
132  // revert back to bottom of stack, or keep current
133  void Revert(void);
134  void KeepCurrent(void);
135 
136 protected:
137  const AlignmentList& GetCurrentAlignments(void) const { return currentAlignments; }
140 };
141 
142 END_SCOPE(Cn3D)
143 
144 #endif // CN3D_VIEWER_BASE__HPP
AlignmentStack alignmentStack
void SetWindowTitle(void) const
Definition: viewer_base.cpp:77
virtual ~ViewerBase(void)
Definition: viewer_base.cpp:63
AlignmentList currentAlignments
std::list< BlockMultipleAlignment * > AlignmentList
Definition: viewer_base.hpp:89
void MakeSequenceVisible(const MoleculeIdentifier *identifier)
void SetUndoRedoMenuStates(void)
void ClearAllData(void)
AlignmentManager * alignmentManager
Definition: viewer_base.hpp:96
void RemoveBlockBoundaryRows(void)
void Save(void)
std::list< AlignmentList > AlignmentStack
void KeepCurrent(void)
SequenceDisplay * GetCurrentDisplay(void)
DisplayStack displayStack
std::list< SequenceDisplay * > DisplayStack
bool EditorIsOn(void) const
SequenceDisplay * currentDisplay
void InitData(const AlignmentList *alignments, SequenceDisplay *display)
Definition: viewer_base.cpp:83
void Refresh(void)
void EnableStacks(void)
Definition: viewer_base.cpp:92
void Revert(void)
bool stacksEnabled
virtual void SaveDialog(bool prompt)
void GUIDestroyed(void)
Definition: viewer_base.hpp:67
void CalculateSelfHitScores(const BlockMultipleAlignment *multiple)
ViewerBase(ViewerWindowBase **window, AlignmentManager *alnMgr)
Definition: viewer_base.cpp:57
AlignmentList & GetCurrentAlignments(void)
static const unsigned int MAX_UNDO_STACK_SIZE
ViewerWindowBase **const viewerWindow
Definition: viewer_base.hpp:99
void Undo(void)
void MakeResidueVisible(const Molecule *molecule, int seqIndex)
void DestroyGUI(void)
Definition: viewer_base.cpp:69
void NewFont(void)
void CopyDataFromStack(void)
void Redo(void)
const AlignmentList & GetCurrentAlignments(void) const
#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
The NCBI C++/STL use hints.
Modified on Fri Sep 20 14:57:45 2024 by modify_doxy.py rev. 669887