51 #if defined(__WXGTK__) || defined(__WXMAC__)
52 #include "cn3d42App.xpm"
63 #if defined(__WXMSW__)
66 | wxFRAME_FLOAT_ON_PARENT
69 viewerWidget(
NULL), viewer(parentViewer)
71 if (!parentViewer)
ERRORMSG(
"ViewerWindowBase::ViewerWindowBase() - got NULL pointer");
73 SetSizeHints(200, 150);
74 SetIcon(wxICON(cn3d));
78 int widths[2] = { 175, -1 };
79 SetStatusWidths(2, widths);
82 SetupFontFromRegistry();
84 menuBar =
new wxMenuBar;
85 viewMenu =
new wxMenu;
86 viewMenu->Append(MID_SHOW_TITLES,
"Show &Titles");
88 viewMenu->Append(MID_SHOW_GEOM_VLTNS,
"Show &Geometry Violations",
"",
true);
89 viewMenu->Append(MID_FIND_PATTERN,
"Find &Pattern");
90 viewMenu->AppendSeparator();
91 viewMenu->Append(MID_CACHE_HIGHLIGHTS,
"&Cache Highlights");
92 viewMenu->Append(MID_RESTORE_CACHED_HIGHLIGHTS,
"Rest&ore Cached Highlights");
93 menuBar->Append(viewMenu,
"&View");
95 editMenu =
new wxMenu;
96 editMenu->Append(MID_ENABLE_EDIT,
"&Enable Editor",
"",
true);
97 editMenu->Append(MID_UNDO,
"Undo\tCtrl-Z");
99 editMenu->Append(MID_REDO,
"Redo\tShift-Ctrl-Z");
102 editMenu->Append(MID_REDO,
"Redo");
104 editMenu->AppendSeparator();
105 editMenu->Append(MID_SPLIT_BLOCK,
"&Split Block",
"",
true);
106 editMenu->Append(MID_MERGE_BLOCKS,
"&Merge Blocks",
"",
true);
107 editMenu->Append(MID_CREATE_BLOCK,
"&Create Block",
"",
true);
108 editMenu->Append(MID_DELETE_BLOCK,
"&Delete Block",
"",
true);
109 editMenu->AppendSeparator();
110 editMenu->Append(MID_SYNC_STRUCS,
"Sy&nc Structure Colors");
112 menuBar->Append(editMenu,
"&Edit");
114 mouseModeMenu =
new wxMenu;
115 mouseModeMenu->Append(MID_SELECT_RECT,
"&Select Rectangle",
"",
true);
116 mouseModeMenu->Append(MID_SELECT_COLS,
"Select &Columns",
"",
true);
117 mouseModeMenu->Append(MID_SELECT_ROWS,
"Select &Rows",
"",
true);
118 mouseModeMenu->Append(MID_SELECT_BLOCKS,
"Select &Blocks",
"",
true);
119 mouseModeMenu->Append(MID_DRAG_HORIZ,
"&Horizontal Drag",
"",
true);
120 menuBar->Append(mouseModeMenu,
"&Mouse Mode");
124 entries[0].Set(wxACCEL_NORMAL,
's', MID_SELECT_RECT);
125 entries[1].Set(wxACCEL_NORMAL,
'c', MID_SELECT_COLS);
126 entries[2].Set(wxACCEL_NORMAL,
'r', MID_SELECT_ROWS);
127 entries[3].Set(wxACCEL_NORMAL,
'b', MID_SELECT_BLOCKS);
128 entries[4].Set(wxACCEL_NORMAL,
'h', MID_DRAG_HORIZ);
129 wxAcceleratorTable accel(5,
entries);
130 SetAcceleratorTable(accel);
132 justificationMenu =
new wxMenu;
133 justificationMenu->Append(MID_LEFT,
"&Left",
"",
true);
134 justificationMenu->Append(MID_RIGHT,
"&Right",
"",
true);
135 justificationMenu->Append(MID_CENTER,
"&Center",
"",
true);
136 justificationMenu->Append(
MID_SPLIT,
"&Split",
"",
true);
137 menuBar->Append(justificationMenu,
"Unaligned &Justification");
141 menuBar->Check(MID_SELECT_RECT,
true);
144 viewerWidget->TitleAreaOn();
146 EnableBaseEditorMenuItems(
false);
147 menuBar->Check(MID_SHOW_GEOM_VLTNS,
false);
160 unique_ptr<wxFont> font(wxFont::New(wxString(nativeFont.c_str())));
161 if (!font.get() || !font->Ok())
163 ERRORMSG(
"ViewerWindowBase::SetupFontFromRegistry() - error setting up font");
208 switch (event.GetId()) {
220 switch (event.GetId()) {
264 SetCursor(*wxCROSS_CURSOR);
272 SetCursor(*wxCROSS_CURSOR);
282 SetCursor(*wxCROSS_CURSOR);
292 SetCursor(*wxCROSS_CURSOR);
306 for (
unsigned int i=0;
i<items.GetCount(); ++
i)
307 items.Item(
i)->GetData()->Check(
308 (items.Item(
i)->GetData()->GetId() == event.GetId()) ?
true :
false);
310 switch (event.GetId()) {
327 menuBar->Check(
i, (
i == event.GetId()) ?
true :
false);
329 switch (event.GetId()) {
351 ViewerBase::AlignmentList::const_iterator
a, ae = alignments.end();
353 for (
a=alignments.begin();
a!=ae; ++
a)
356 INFOMSG(
"Found " << nViolations <<
" geometry violation"
357 << ((nViolations == 1) ?
"" :
"s") <<
" in this window");
363 static wxString previousPattern;
364 static wxString previousMode(
"Replace");
368 dialog.
m_Pattern->SetValue(previousPattern);
370 dialog.
m_Mode->SetStringSelection(previousMode);
371 int status = dialog.ShowModal();
372 wxString pattern = dialog.
m_Pattern->GetValue();
373 if (status != wxID_OK || pattern.size() == 0)
377 if (pattern[pattern.size() - 1] !=
'.') pattern +=
'.';
378 previousPattern = pattern;
379 previousMode = dialog.
m_Mode->GetStringSelection();
383 if (dialog.
m_Mode->GetStringSelection() ==
"Within")
385 if (dialog.
m_Mode->GetStringSelection() ==
"Replace" || dialog.
m_Mode->GetStringSelection() ==
"Within")
392 for (
unsigned int i=0;
i<display->
NRows(); ++
i) {
395 if (!sequence || usedSequences.
find(sequence) != usedSequences.
end())
continue;
396 usedSequences[sequence] =
true;
405 for (
unsigned int i=0;
i<display->
NRows(); ++
i) {
407 if (sequence && sequence->
identifier == identifier) {
void RestoreCachedHighlights(void)
void GetHighlights(MoleculeHighlightMap *copyHighlights)
void PostRedrawSequenceViewer(ViewerBase *viewer)
bool RemoveAllHighlights(bool postRedraws)
void PostRedrawAllSequenceViewers(void)
void CacheHighlights(void)
std::map< const MoleculeIdentifier *, std::vector< bool > > MoleculeHighlightMap
void AddBlockBoundaryRows(void)
const Sequence * GetSequenceForRow(unsigned int row) const
unsigned int NRows(void) const
void RedrawAlignedMolecules(void) const
void RemoveBlockBoundaryRows(void)
bool IsEditable(void) const
const MoleculeIdentifier * identifier
bool HighlightPattern(const std::string &pattern, const MoleculeHighlightMap &restrictTo) const
std::list< BlockMultipleAlignment * > AlignmentList
void SetUndoRedoMenuStates(void)
SequenceDisplay * GetCurrentDisplay(void)
const AlignmentList & GetCurrentAlignments(void) const
bool DoCreateBlock(void) const
@ MID_RESTORE_CACHED_HIGHLIGHTS
void NewDisplay(SequenceDisplay *display, bool enableSelectByColumn)
void DeleteBlockOff(void)
bool DoSplitBlock(void) const
void SetupFontFromRegistry(void)
virtual bool RequestEditorEnable(bool enable)
void MakeSequenceVisible(const MoleculeIdentifier *identifier)
void OnFindPattern(wxCommandEvent &event)
SequenceViewerWidget * viewerWidget
virtual SequenceViewerWidget::eMouseMode GetMouseModeForCreateAndMerge(void)=0
void SyncStructures(void)
BlockMultipleAlignment::eUnalignedJustification currentJustification
bool DoMergeBlocks(void) const
void MergeBlocksOff(void)
SequenceViewerWidget::eMouseMode prevMouseMode
void CancelBaseSpecialModesExcept(int id)
void UpdateGeometryViolations(void) const
void CreateBlockOff(void)
void OnJustification(wxCommandEvent &event)
void CancelAllSpecialModesExcept(int id)
void OnEditMenu(wxCommandEvent &event)
virtual ~ViewerWindowBase(void)
virtual void EnableDerivedEditorMenuItems(bool enable)
void OnMouseMode(wxCommandEvent &event)
bool AlwaysSyncStructures(void) const
void OnShowGeomVltns(wxCommandEvent &event)
bool DoDeleteBlock(void) const
void EnableBaseEditorMenuItems(bool enabled)
void UpdateDisplay(SequenceDisplay *display)
void OnTitleView(wxCommandEvent &event)
void OnCacheHighlights(wxCommandEvent &event)
bool GeometryViolationsShown(void) const
const_iterator end() const
const_iterator find(const key_type &key) const
wxFrame * GlobalTopWindow(void)
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
Messenger * GlobalMessenger(void)
const struct ncbi::grid::netcache::search::fields::SIZE size
ViewerWindowBase::OnEditMenu MID_SPLIT
static wxAcceleratorEntry entries[3]