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

Go to the SVN repository for this file.

1 /* $Id: update_viewer_window.hpp 64773 2014-10-08 13:59:20Z 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 * implementation of GUI part of update viewer
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef CN3D_UPDATE_VIEWER_WINDOW__HPP
35 #define CN3D_UPDATE_VIEWER_WINDOW__HPP
36 
37 #include "viewer_window_base.hpp"
38 
39 #include <wx/spinctrl.h>
41 
42 
43 BEGIN_SCOPE(Cn3D)
44 
45 class UpdateViewer;
46 class SequenceDisplay;
47 
49 {
50  friend class SequenceDisplay;
51 
52 public:
53  UpdateViewerWindow(UpdateViewer *parentUpdateViewer);
54  ~UpdateViewerWindow(void);
55 
56  void EnableDerivedEditorMenuItems(bool enabled);
57 
58  bool SaveDialog(bool prompt, bool canCancel);
59 
60  void SetWindowTitle(void);
61 
62 private:
64 
65  // menu identifiers - additional items beyond base class items
66  enum {
90  };
91 
92  void OnCloseWindow(wxCloseEvent& event);
93  void OnSortUpdates(wxCommandEvent& event);
94  void OnRunThreader(wxCommandEvent& event);
95  void OnRunBlast(wxCommandEvent& event);
96  void OnBlockAlign(wxCommandEvent& event);
97  void OnExtend(wxCommandEvent& event);
98  void OnSetRegion(wxCommandEvent& event);
99  void OnMerge(wxCommandEvent& event);
100  void OnDelete(wxCommandEvent& event);
101  void OnImport(wxCommandEvent& event);
102 
104  {
105  menuBar->Check(MID_DELETE_ALL_BLOCKS, false);
106  SetCursor(wxNullCursor);
107  }
108  void ThreadSingleOff(void)
109  {
110  menuBar->Check(MID_THREAD_ONE, false);
111  SetCursor(wxNullCursor);
112  }
113  void BlastSingleOff(void)
114  {
115  menuBar->Check(MID_BLAST_ONE, false);
116  SetCursor(wxNullCursor);
117  }
119  {
120  menuBar->Check(MID_BLAST_PSSM_ONE, false);
121  SetCursor(wxNullCursor);
122  }
124  {
125  menuBar->Check(MID_BLAST_NEIGHBOR, false);
126  SetCursor(wxNullCursor);
127  }
129  {
130  menuBar->Check(MID_BLOCKALIGN_ONE, false);
131  SetCursor(wxNullCursor);
132  }
133  void ExtendSingleOff(void)
134  {
135  menuBar->Check(MID_EXTEND_ONE, false);
136  SetCursor(wxNullCursor);
137  }
138  void SetRegionOff(void)
139  {
140  menuBar->Check(MID_SET_REGION, false);
141  SetCursor(wxNullCursor);
142  }
143  void MergeSingleOff(void)
144  {
145  menuBar->Check(MID_MERGE_ONE, false);
146  SetCursor(wxNullCursor);
147  }
148  void MergeNeighborOff(void)
149  {
150  menuBar->Check(MID_MERGE_NEIGHBOR, false);
151  SetCursor(wxNullCursor);
152  }
153  void DeleteSingleOff(void)
154  {
155  menuBar->Check(MID_DELETE_ONE, false);
156  SetCursor(wxNullCursor);
157  }
158 
160  {
162  }
163 
164  DECLARE_EVENT_TABLE()
165 
166 public:
167  bool DoDeleteAllBlocks(void) const { return menuBar->IsChecked(MID_DELETE_ALL_BLOCKS); }
168  bool DoThreadSingle(void) const { return menuBar->IsChecked(MID_THREAD_ONE); }
169  bool DoBlastSingle(void) const { return menuBar->IsChecked(MID_BLAST_ONE); }
170  bool DoBlastPSSMSingle(void) const { return menuBar->IsChecked(MID_BLAST_PSSM_ONE); }
171  bool DoBlastNeighborSingle(void) const { return menuBar->IsChecked(MID_BLAST_NEIGHBOR); }
172  bool DoBlockAlignSingle(void) const { return menuBar->IsChecked(MID_BLOCKALIGN_ONE); }
173  bool DoExtendSingle(void) const { return menuBar->IsChecked(MID_EXTEND_ONE); }
174  bool DoSetRegion(void) const { return menuBar->IsChecked(MID_SET_REGION); }
175  bool DoMergeSingle(void) const { return menuBar->IsChecked(MID_MERGE_ONE); }
176  bool DoMergeNeighbor(void) const { return menuBar->IsChecked(MID_MERGE_NEIGHBOR); }
177  bool DoDeleteSingle(void) const { return menuBar->IsChecked(MID_DELETE_ONE); }
178 
180  {
183  if (id != MID_BLAST_ONE && DoBlastSingle()) BlastSingleOff();
188  if (id != MID_SET_REGION && DoSetRegion()) SetRegionOff();
189  if (id != MID_MERGE_ONE && DoMergeSingle()) MergeSingleOff();
192  }
193 };
194 
195 
196 ///// dialog used to get threader options from user /////
197 
198 class ThreaderOptions;
199 class Sequence;
200 
201 class ThreaderOptionsDialog : public wxDialog
202 {
203 public:
204  ThreaderOptionsDialog(wxWindow* parent, const ThreaderOptions& initialOptions);
206 
207  // set the ThreaderOptions from values in the panel; returns true if all values are valid
208  bool GetValues(ThreaderOptions *options);
209 
210 private:
211  wxButton *bOK, *bCancel;
212  ncbi::FloatingPointSpinCtrl *fpWeight, *fpLoops;
213  ncbi::IntegerSpinCtrl *iStarts, *iResults, *iCutoff;
214  wxCheckBox *bMerge, *bFreeze;
215 
216  void OnCloseWindow(wxCloseEvent& event);
217  void OnButton(wxCommandEvent& event);
218 
219  DECLARE_EVENT_TABLE()
220 };
221 
222 class RegionDialog : public wxDialog
223 {
224 public:
225  RegionDialog(wxWindow* parentFrame, const Sequence *sequence, int initialFrom, int initialTo);
226  ~RegionDialog(void);
227 
228  // get the values in the panel; returns true if all values are valid
229  bool GetValues(int *from, int *to);
230 
231 private:
232  ncbi::IntegerSpinCtrl *iFrom, *iTo;
233 
234  void OnCloseWindow(wxCloseEvent& event);
235  void OnButton(wxCommandEvent& event);
236 
237  DECLARE_EVENT_TABLE()
238 };
239 
240 END_SCOPE(Cn3D)
241 
242 #endif // CN3D_UPDATE_VIEWER_WINDOW__HPP
void OnButton(wxCommandEvent &event)
RegionDialog(wxWindow *parentFrame, const Sequence *sequence, int initialFrom, int initialTo)
bool GetValues(int *from, int *to)
ncbi::IntegerSpinCtrl * iFrom
ncbi::IntegerSpinCtrl * iTo
void OnCloseWindow(wxCloseEvent &event)
bool GetValues(ThreaderOptions *options)
void OnCloseWindow(wxCloseEvent &event)
ThreaderOptionsDialog(wxWindow *parent, const ThreaderOptions &initialOptions)
ncbi::IntegerSpinCtrl * iStarts
ncbi::FloatingPointSpinCtrl * fpWeight
void OnButton(wxCommandEvent &event)
ncbi::FloatingPointSpinCtrl * fpLoops
ncbi::IntegerSpinCtrl * iResults
ncbi::IntegerSpinCtrl * iCutoff
void OnImport(wxCommandEvent &event)
void OnRunThreader(wxCommandEvent &event)
void EnableDerivedEditorMenuItems(bool enabled)
bool DoThreadSingle(void) const
bool DoBlastSingle(void) const
void OnDelete(wxCommandEvent &event)
void OnExtend(wxCommandEvent &event)
bool DoBlastPSSMSingle(void) const
void OnBlockAlign(wxCommandEvent &event)
bool SaveDialog(bool prompt, bool canCancel)
bool DoMergeSingle(void) const
bool DoDeleteSingle(void) const
void OnSortUpdates(wxCommandEvent &event)
SequenceViewerWidget::eMouseMode GetMouseModeForCreateAndMerge(void)
void OnCloseWindow(wxCloseEvent &event)
bool DoExtendSingle(void) const
void CancelDerivedSpecialModesExcept(int id)
bool DoBlockAlignSingle(void) const
void OnMerge(wxCommandEvent &event)
void OnRunBlast(wxCommandEvent &event)
bool DoSetRegion(void) const
bool DoBlastNeighborSingle(void) const
bool DoDeleteAllBlocks(void) const
bool DoMergeNeighbor(void) const
void OnSetRegion(wxCommandEvent &event)
UpdateViewerWindow(UpdateViewer *parentUpdateViewer)
#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
Modified on Thu Apr 11 15:18:37 2024 by modify_doxy.py rev. 669887