NCBI C++ ToolKit
phylo_tree_pane.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: phylo_tree_pane.cpp 43510 2019-07-19 18:26:44Z katargir $
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: Vladimir Tereshkov
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <corelib/ncbitime.hpp>
34 
38 
42 
44 #include <gui/opengl/glutils.hpp>
45 #include <gui/opengl/irender.hpp>
46 #include <corelib/ncbitime.hpp>
47 
48 #include <wx/wxchar.h>
49 #include <wx/dcclient.h>
50 
52 
53 #define AXIS_AREA_W 50
54 #define AXIS_AREA_H 30
55 
56 
57 BEGIN_EVENT_TABLE(CPhyloTreePane, CGlWidgetPane)
58  EVT_SIZE(CPhyloTreePane::OnSize)
59  EVT_LEFT_DOWN(CPhyloTreePane::OnLeftDown)
60  EVT_KEY_DOWN(CPhyloTreePane::OnKeyEvent)
62 
64 : CGlWidgetPane(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0),
65  m_CurrRenderer(-1),
66  m_BackColor(0.95f, 1.0f, 0.95f),
67  m_pTextFont(NULL),
68  m_pLblFont(NULL),
69  m_VertSelHandler(eVert),
70  m_BottomRuler(true),
71  m_TopRuler(true),
72  m_LeftRuler(false),
73  m_RightRuler(false)
74 {
75  m_Gen.SetIntegerMode(true, true);
76  m_Gen.EnableOneBased(true, true);
77  m_Grid.EnableIntegerCentering(true);
78 
81 
82  m_TooltipManager.SetHost(static_cast<IStickyTooltipHandlerHost*>(this));
83  x_RegisterHandler(dynamic_cast<IGlEventHandler*>(&m_TooltipManager),
84  fMatrixArea, &m_MatrixPane);
85 
86  m_MouseZoomHandler.SetHost(static_cast<IMouseZoomHandlerHost*>(this));
87  x_RegisterHandler(dynamic_cast<IGlEventHandler*>(&m_MouseZoomHandler),
88  fMatrixArea, &m_MatrixPane);
89 
90  m_MinimapHandler.SetHost(static_cast<IMinimapHandlerHost*>(this));
91  x_RegisterHandler(dynamic_cast<IGlEventHandler*>(&m_MinimapHandler),
92  fMatrixArea, &m_MatrixPane);
93 
94  x_Layout();
95  x_SetupAxes();
96 
98 
99  CRegistryReadView view =
100  gui_reg.GetReadView("GBENCH.Mouse.ModePhylo");
101 
102  std::string pan_mode = view.GetString("Pan");
103  if (pan_mode == "lmouse") {
104  m_MouseZoomHandler.SetPanMode(CMouseZoomHandler::eLmouse);
105  }
106  else {
107  m_MouseZoomHandler.SetPanMode(CMouseZoomHandler::ePkey);
108  }
109 }
110 
112 {
113  return static_cast<CPhyloTreeWidget*>(GetParent());
114 }
115 
117 {
120 }
121 
122 
124 {
126 }
127 
129 {
133 }
134 
136 {
137  // This is for the purpose of cancelling any background jobs
138  // dependent on the data source. We do not re-display based on this.
139  if (m_CurrRenderer>=0) {
140  if (m_CurrRenderer < (int)m_Renderers.size())
142  }
143 }
144 
146 {
147  CPhyloTreeWidget* phyWidget = x_GetWidget();
148  for (auto &rr : m_Renderers)
149  rr->UpdateDataSource(*phyWidget->GetDS(), m_MatrixPane);
150 }
151 
152 void CPhyloTreePane::OnSize(wxSizeEvent& event)
153 {
154  // If the event was not forced by the windows dialog gl fix
155  if (!m_PseudoSized) {
156  x_Layout();
157 
158  event.Skip();
159  }
160  else {
161  m_PseudoSized = false;
162  }
163 }
164 /*
165 // For debugging - redo layout after a key event.
166 void CPhyloTreePane::OnKeyEvent(wxKeyEvent& event)
167 {
168 #ifdef ATTRIB_MENU_SUPPORT
169  if (event.GetEventType() == wxEVT_KEY_DOWN) {
170  if (CAttribMenuInstance::GetInstance().KeyPress(event.GetKeyCode())) {
171  x_Layout();
172  Refresh();
173  return;
174  }
175  }
176 #endif
177 
178  x_HandleAccels(event);
179 
180  //trace = true;
181  if (!x_Handlers_handle(event, 0xFFFFFFFF, false)) {
182  event.Skip();
183  }
184 }
185 */
186 
188 {
190  // recursive call - something wrong or renderer crashed
191  //m_MatrixPane.Close();
192  return;
193  }
194 
195  CPhyloTreeWidget* phyWidget = x_GetWidget();
196  // Beware of empty trees
197  if (!phyWidget->GetDS() ||
198  !phyWidget->GetDS()->GetTree() ||
199  phyWidget->GetDS()->GetTree()->GetRootIdx() == CPhyloTree::Null())
200  return;
201 
202  CStopWatch render_total;
203  render_total.Start();
204 
205  CRgbaColor bg(1.0f, 1.0f, 1.0f, 1.0f);
206  if (phyWidget->HasScheme())
207  bg = phyWidget->GetScheme().SetColor(
209  glClearColor(bg.GetRed(), bg.GetGreen(), bg.GetBlue(), bg.GetAlpha());
210  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
211 
212  // Make sure layout has been called (special case for first-time render
213  // of newly created view)
214  if (m_CurrRenderer >= 0 &&
215  m_CurrRenderer < (int)m_Renderers.size() &&
216  phyWidget->GetDS()) {
217  if (m_Renderers[m_CurrRenderer]->ValidLayout() ==
219  SoftUpdate();
220  else if (m_Renderers[m_CurrRenderer]->ValidLayout() ==
222  Update();
223  }
224 
225  const CGlPane& VP = phyWidget->GetPort();
226 
227  // prepare CGlPanes
228 
229  // The limits rect is set in Layout() and OnSize(). But
230  // we need updates to the visible rect since it captures
231  // zoom. Not sure why the design called for a CGlPane in
232  // both this (CPhyloTreePane) and CPhyloTreeWidget, forcing
233  // us to keep them in sync.....
234  TModelRect rc_V = VP.GetVisibleRect();
237 
238  // now rendering
239 
240  if (m_CurrRenderer >= 0 &&
241  m_CurrRenderer < (int)m_Renderers.size() &&
242  phyWidget->GetDS()) {
243 
244  /// Stop rendering if Render() returns false (can return false
245  /// in force layout due to active data synchronization)
246  if (!m_Renderers[m_CurrRenderer]->Render(
247  m_MatrixPane, *phyWidget->GetDS())) {
248  return;
249  }
250  }
251 
253 #ifdef ATTRIB_MENU_SUPPORT
255 #endif
256 
257  phyWidget->GetDS()->GetModel().m_TotalTime = render_total.Elapsed();
258 }
259 
260 
262 {
264 }
265 
266 
268 {
269  CPhyloTreeWidget* phyWidget = x_GetWidget();
270  _ASSERT(phyWidget);
271 
272  if (m_CurrRenderer>=0 && phyWidget && phyWidget->GetDS()) {
274 
275  // Make sure we have a valid tree first:
276  if (phyWidget->GetDS()->GetTree() == NULL ||
277  phyWidget->GetDS()->GetTree()->GetRootIdx() == CPhyloTree::Null())
278  return;
279 
280  if (m_CurrRenderer < (int)m_Renderers.size())
281  GetCurrRenderer()->Layout(*phyWidget->GetDS(), m_MatrixPane);
283 
284  phyWidget->SetPortLimits(m_MatrixPane.GetModelLimitsRect(), true);
285  }
286 }
287 
288 
290 {
291  CPhyloTreeWidget* phyWidget = x_GetWidget();
292  _ASSERT(phyWidget);
293 
294  if (m_CurrRenderer>=0 && phyWidget && phyWidget->GetDS()) {
295  if (m_CurrRenderer < (int)m_Renderers.size()) {
296  GetCurrRenderer()->Layout(*phyWidget->GetDS(), m_MatrixPane);
297 
299  phyWidget->SetPortLimits(m_MatrixPane.GetModelLimitsRect(), false);
300 
301  // Synchronize matrix pane with pane in widget (again not quite sure why
302  // both have a pane) Then update collision grid since it depends on pane
303  // zoom especially when zooming only vertically or horizontally.
304  // InitCollisionInfo also called from BufferedRender but that call can give
305  // incorrect results when visible rect is not yet set.
309  }
310  }
311 }
312 
314 {
316 }
317 
318 
320 {
322 }
323 
324 
326 {
327  return Empty() ? CGlPane() : m_History[m_BackForwardPos];
328 }
329 
331 {
332  // compute roughly the pct scrolling that has taken place in order
333  // to ignore very (imperceptibly) small changes
334  TModelRect l = lhs.GetVisibleRect();
335  TModelRect r = rhs.GetVisibleRect();
336 
337  float delta = fabs(l.Left() - r.Left()) +
338  fabs(l.Right() - r.Right()) +
339  fabs(l.Top() - r.Top()) +
340  fabs(l.Bottom() - r.Bottom());
341 
342  float m = l.Width() + l.Height() + r.Width() + r.Height();
343 
344  float delta_pct = delta/m;
345 
346  return delta_pct < 0.0001f;
347 }
348 
350 {
351  m_History.clear();
352  m_History.push_back(p);
353  m_BackForwardPos = 0;
354 }
355 
357 {
358  if (m_BackForwardPos < m_History.size()) {
359  m_History.erase(m_History.begin() + m_BackForwardPos +1,
360  m_History.end());
361  }
362 
363  m_History.push_back(p);
364  m_BackForwardPos = m_History.size() - 1;
365 }
366 
368 {
369  CPhyloTreeWidget* phyWidget = x_GetWidget();
370  if (m_NavHistory.Empty() ||
371  !m_NavHistory.EqualPanes(phyWidget->GetPort(), m_NavHistory.Current())) {
372  m_NavHistory.Add(phyWidget->GetPort());
373  }
374 }
375 
377 {
378  return m_NavHistory.CanGoBack();
379 }
380 
381 
383 {
384  return m_NavHistory.CanGoForward();
385 }
386 
387 
389 {
390  CPhyloTreeWidget* phyWidget = x_GetWidget();
391  if (CanGoBack()) {
392  CGlPane p = m_NavHistory.Back();
393  //m_MatrixPane = p;
398  phyWidget->UpdateViewingArea();
399  phyWidget->Refresh();
400  }
401 }
402 
403 
405 {
406  CPhyloTreeWidget* phyWidget = x_GetWidget();
407  if (CanGoForward()) {
409  //m_MatrixPane = p;
413  phyWidget->UpdateViewingArea();
414  phyWidget->Refresh();
415  }
416 }
417 
418 
420 {
422  m_rcMatrix.Init(0, 0, GetClientSize().GetWidth() - 1, GetClientSize().GetHeight() - 1);
424 
425  CPhyloTreeWidget* phyWidget = x_GetWidget();
426  if (m_CurrRenderer >= 0 && phyWidget->GetDS() != NULL) {
428 
429  if (m_CurrRenderer < (int)m_Renderers.size()) {
431 
432 
433  phyWidget->SetPortLimits(m_MatrixPane.GetModelLimitsRect(), false);
434 
435  // Synchronize matrix pane with pane in widget (again not quite sure why
436  // both have a pane) Then update collision grid since it depends on pane
437  // zoom especially when zooming only vertically or horizontally.
438  // InitCollisionInfo also called from BufferedRender but that call can give
439  // incorrect results when visible rect is not yet set.
443  }
444  }
445 
447 }
448 
450 {
451  if (m_CurrRenderer >= 0 &&
452  m_CurrRenderer < (int)m_Renderers.size() &&
453  x_GetWidget()->GetDS()) {
455  }
456 }
457 
459 {
460  CPhyloTreeWidget* phyWidget = x_GetWidget();
461  if (m_CurrRenderer >= 0 &&
462  m_CurrRenderer < (int)m_Renderers.size() &&
463  phyWidget->GetDS()) {
465  m_MatrixPane, *phyWidget->GetDS());
466  }
467 }
468 
469 void CPhyloTreePane::RenderPdf(CRef<CPdf> pdf, bool render_tooltips)
470 {
471  CPhyloTreeWidget* phyWidget = x_GetWidget();
472  if (m_CurrRenderer >= 0 &&
473  m_CurrRenderer < (int)m_Renderers.size() &&
474  phyWidget->GetDS()) {
475  phyWidget->GetDS()->GetTree()->GetGraphicsModel().SetRenderTooltips(render_tooltips);
477  m_MatrixPane, *phyWidget->GetDS(), pdf);
478  }
479 }
480 
482 {
483  CPhyloTreeWidget* phyWidget = x_GetWidget();
484  if (m_CurrRenderer >= 0 &&
485  m_CurrRenderer < (int)m_Renderers.size() &&
486  phyWidget->GetDS()){
488  m_MatrixPane, *phyWidget->GetDS(), false);
489  }
490 }
491 
493  bool b_model_x,
494  bool b_model_y)
495 {
496  const CGlPane& VP = x_GetWidget()->GetPort();
497 
498  TModelRect rc_vis = VP.GetVisibleRect();
499  TModelRect rc_lim = VP.GetModelLimitsRect();
500 
501  // assuming that Viewport in the pane has been set properly
502  if(! b_model_x) { // adjust horz range to represent pixels
503  int max_x = pane.GetViewport().Width() - 1;
504  rc_lim.SetHorz(0, max_x);
505  rc_vis.SetHorz(0, max_x);
506  }
507 
508  if(! b_model_y) { // adjust vert range to represent pixels
509  int max_y = pane.GetViewport().Height() - 1;
510  rc_lim.SetVert(0, max_y);
511  rc_vis.SetVert(0, max_y);
512  }
513  pane.SetModelLimitsRect(rc_lim);
514  pane.SetVisibleRect(rc_vis);
515 }
516 
518 {
519  if(m_rcMatrix.PtInRect(vp_x, vp_y)) {
520  return fMatrixArea;
521  } else if(m_rcBottomSeq.PtInRect(vp_x, vp_y)) {
522  return fSubjectArea;
523  } else if(m_rcLeftSeq.PtInRect(vp_x, vp_y)) {
524  return fQueryArea;
525  }
526  return fOther;
527 }
528 
530 {
531  IRender& gl = GetGl();
532  gl.Enable(GL_BLEND);
533  gl.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
534 
536  m_MinimapHandler.Render(pane);
537 
538 
539  gl.Disable(GL_BLEND);
540 }
541 
543 {
544  // Grab the focus unless user is in a text control. This is primarly here
545  // for the case where the user is typing in the search control, and may use
546  // the mouse to move the cursor around. We do not want to lose focus for
547  // the text control in this case.
549  return true;
550 
551  return false;
552 
553  // Maybe not - I think you only want to take focus from certain controls,
554  // such as maybe those (other than the text edit control) in the search bar.
555  /*
556  wxWindow* w = wxWindow::FindFocus();
557 
558  if (w != NULL) {
559  //_TRACE("Focus Parent: " << w->GetClassInfo()->GetClassName() << " " << w->GetName());
560 
561  if (wxString(w->GetClassInfo()->GetClassName()) == wxT("wxTextCtrl") ||
562  wxString(w->GetClassInfo()->GetClassName()) == wxT("wxRichTextCtrl") ||
563  wxString(w->GetClassInfo()->GetClassName()) == wxT("wxComboBox"))
564  return false;
565  }
566 
567  return true;
568  */
569 }
570 ////////////////////////////////////////////////////////////////////////////////
571 /// IAlnMarkHandlerHost implementation
572 
574 {
575  CPhyloTreeWidget* phyWidget = x_GetWidget();
576  const CGlPane& VP = phyWidget->GetPort();
577 
578  if (m_CurrRenderer < 0)
579  return -1;
580 
581  switch(type) {
583  return phyWidget->GetScheme().GetZoomBehavior(GetCurrRenderer()->GetDescription())==CPhyloTreeScheme::eZoomY ?
584  VP.GetScaleY() : VP.GetScaleX();
585  }
587  return phyWidget->GetScheme().GetZoomBehavior(GetCurrRenderer()->GetDescription())==CPhyloTreeScheme::eZoomY?
588  VP.GetMinScaleY() : VP.GetMinScaleX();
589  }
591  return phyWidget->GetScheme().GetZoomBehavior(GetCurrRenderer()->GetDescription())==CPhyloTreeScheme::eZoomY?
593  }
594  default: _ASSERT(false); return -1;
595  }
596 }
597 
599  const TModelPoint& point)
600 {
601  x_GetWidget()->OnSetScaleXY(scale, point);
602 }
603 
605 {
606  x_GetWidget()->ZoomRect(rc);
607 }
608 
609 
611  TModelUnit factor)
612 {
613  x_GetWidget()->ZoomPoint(point, factor);
614 }
615 
616 
618 {
619  SaveCurrentView();
620 }
621 
622 
624 {
625  x_GetWidget()->Scroll(d_x, d_y);
626 }
627 
628 
630 {
631  return GetClientSize().GetHeight() - 1 - y;
632 }
633 
634 
635 
636 
637 
639 {
640  return GetClientSize().GetHeight() - 1 - y;
641 }
642 
643 
644 
645 void CPhyloTreePane::HMGH_UpdateLimits(bool force_redraw)
646 {
647  CPhyloTreeWidget* phyWidget = x_GetWidget();
648  _ASSERT(phyWidget);
649 
650  if (m_CurrRenderer>=0 && phyWidget && phyWidget->GetDS()) {
653  phyWidget->UpdateViewingArea();
654 
655  if ( force_redraw) {
656  phyWidget->Refresh();
657 
658  // Mac tends not redraw the display as much as needed when a force-based
659  // layout is in progress. Update helps.
660 #if defined(__WXMAC__)
661  phyWidget->Update();
662 #endif
663  }
664 
666  }
667 }
668 
669 
670 
671 ////////////////////////////////////////////////////////////////////////////////
672 /// ISelHandlerHost implementation
673 
674 
676 {
678  Send(&evt, ePool_Parent);
679 
680  Refresh();
681 }
682 
683 void CPhyloTreePane::SHH_SetCursor(const wxCursor& cursor)
684 {
685  SetCursor(cursor);
686 }
687 
688 
690 {
691  switch(orient) {
692  case eHorz: return m_MatrixPane.UnProjectX(z);
693  case eVert: return m_MatrixPane.UnProjectY(GetClientSize().GetHeight() - z);
694  default: _ASSERT(false); return -1;
695  }
696 }
697 
698 
700 {
701  switch(orient) {
702  case eHorz: return m_MatrixPane.ProjectX(z);
703  case eVert: return GetClientSize().GetHeight() - m_MatrixPane.ProjectY(z);
704  default: _ASSERT(false); return -1;
705  }
706 }
707 
708 
710 {
711  renderer->SetZoomHandler(&m_MouseZoomHandler);
712  renderer->SetFont(m_pLblFont);
713  renderer->SetRegenerateTexture(true);
714 
715  m_Renderers.push_back(renderer);
716 
717  renderer->SetHost(static_cast<IPhyloTreeRenderHost*>(this));
718 
720 }
721 
723 {
724  if (m_CurrRenderer != idx) {
725 
726  if (m_CurrRenderer >= 0) {
727  if (m_CurrRenderer < (int)m_Renderers.size()) {
729  m_Renderers[m_CurrRenderer]->StartRendering(false);
730  }
731  }
732 
733  m_CurrRenderer = idx;
734 
735  if (m_CurrRenderer < (int)m_Renderers.size()) {
736  m_Renderers[m_CurrRenderer]->StartRendering(true);
740  }
741  else {
744  }
745  }
746  }
747 }
748 
749 string CPhyloTreePane::TTHH_NeedTooltip(const wxPoint & pt)
750 {
751  // Don't pop up tool tips while zooming in and out(this can
752  // be called if zoom key (z) is down but mouse isn't)
754  return "";
755 
756  return GetCurrRenderer()->TTHH_NeedTooltip(pt);
757 }
758 
760 {
761  return GetCurrRenderer()->TTHH_GetTooltip(rect);
762 }
763 
765 {
767 }
768 
770 {
771  x_GetWidget()->SendEditEvent(ec);
772 }
773 
775 {
776  const CGlPane& VP = x_GetWidget()->GetPort();
777 
778  switch(type) {
779  case IMinimapHandlerHost::eCurrent: return VP.GetScaleX();
780  case IMinimapHandlerHost::eMin: return VP.GetMinScaleX();
782  default: _ASSERT(false); return -1;
783  }
784 }
785 
787 {
788  SaveCurrentView();
789 }
790 
791 
793 {
794  x_GetWidget()->Scroll(d_x, d_y);
795 }
796 
797 
799 {
800  return GetClientSize().GetHeight() - 1 - y;
801 }
802 
803 
805  float& ycoord_limit)
806 {
807  return GetCurrRenderer()->GetTexture(xcoord_limit, ycoord_limit);
808 }
809 
810 
812 {
815 }
816 
818 {
819  Refresh();
820 }
821 
822 void CPhyloTreePane::OnLeftDown(wxMouseEvent& evt)
823 {
824  SetFocus();
825 
826  bool handled = false;
827 
828  if(m_pCurrHandlerRec) {
829  if (dynamic_cast<CMouseZoomHandler*>(m_pCurrHandlerRec->m_pHandler) != NULL &&
832  }
833  }
834 
835  if (!handled) {
836  wxPoint pos = evt.GetPosition();
837  int area = x_GetAreaByWindowPos(pos);
838  if( ! x_Handlers_handle(evt, area)) {
839  evt.Skip();
840  }
841  }
842 }
843 
static CAttribMenu & GetInstance()
Return a static instance of CAttribMenu.
Definition: attrib_menu.cpp:50
void DrawMenu()
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
void x_SetupGLContext()
Definition: glcanvas.cpp:264
class CGlPane
Definition: glpane.hpp:62
virtual void Scroll(TModelUnit d_x, TModelUnit d_y)
virtual void ZoomRect(const TModelRect &rc)
virtual void ZoomPoint(const TModelPoint &point, TModelUnit factor, CGlPane::EZoomOptions=CGlPane::fZoomXY)
CGlWidgetPane represent a window component residing in CGlWidgetBase client area.
bool x_DispatchEventToHandler(wxEvent &event, SHandlerRec *rec)
bool m_PseudoSized
For windows (e.g. tree) that do not want to layout/update for the fake size event.
bool x_Handlers_handle(wxEvent &event, int area, bool ignore_curr=true)
bool x_UnregisterHandler(IGlEventHandler *handler)
bool x_RegisterHandler(IGlEventHandler *handler, int area, CGlPane *pane, int index=-1)
virtual bool x_GrabFocus()
void OnKeyEvent(wxKeyEvent &event)
virtual int x_GetAreaByWindowPos(const wxPoint &pos)
SHandlerRec * m_pCurrHandlerRec
pointer to record for last active handler
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
const TRangeColl & GetSelection() const
void Render(CGlPane &Pane)
CMouseZoomHandler provides support for mouse-driven zoom and pan operations.
virtual bool IsScaleMode() const
virtual EPanMode GetPanMode() const
virtual void Render(CGlPane &Pane)
CPhyloTree * GetTree()
CTreeGraphicsModel & GetModel()
Get model for rendering.
class CPhyloTreePane
void OnLeftDown(wxMouseEvent &evt)
TVPRect m_rcMatrix
rectangle in OpenGL coordinates
virtual void MMHH_Scroll(TModelUnit d_x, TModelUnit d_y)
void OnSize(wxSizeEvent &event)
virtual void FireCBEvent(void)
virtual TModelUnit MMHH_GetScale(IMinimapHandlerHost::EMMScaleType type)
void GoBack()
move to view position prior to most recent zoom/pan
virtual void MZHH_EndOp()
virtual int x_GetAreaByVPPos(TVPUnit vp_x, TVPUnit vp_y)
virtual CTooltipInfo TTHH_GetTooltip(const wxRect &rect)
Return the contents to be displayed in the tool tip.
virtual void SHH_SetCursor(const wxCursor &cursor)
virtual void MZHH_SetScale(TModelUnit scale, const TModelPoint &point)
void SetCurrRendererIdx(int idx)
void RenderPdf(CRef< CPdf > pdf, bool render_tooltips)
CPhyloTreeWidget * x_GetWidget() const
virtual void MMHH_EndOp()
virtual string TTHH_NeedTooltip(const wxPoint &pt)
Return id of the underlying element to dispaly a tooltip, otherwise "".
const TRangeColl & GetQuerySelection() const
CLinearSelHandler m_HorzSelHandler
virtual TModelUnit MZHH_GetScale(IMouseZoomHandlerHost::EScaleType type)
IAlnMarkHandlerHost implementation.
IPhyloTreeRender * GetCurrRenderer(void)
virtual void x_Render(void)
CGlWidgetPane overridables.
void AddRenderer(CRef< IPhyloTreeRender > &&renderer)
void RemoveCurrentDataSource()
CMouseZoomHandler m_MouseZoomHandler
virtual void MZHH_Scroll(TModelUnit d_x, TModelUnit d_y)
virtual I3DTexture * MMHH_GetTexture(float &xcoord_limit, float &ycoord_limit)
gets a texture and its coordinate limits for the minmap
void UpdatePane(const TModelRect &r)
void GoForward()
return to view position that you just left through 'GoBack()'
const TRangeColl & GetSubjectSelection() const
virtual TVPUnit MZHH_GetVPPosByY(int y) const
converts window coord to Viewport coord
CGlTextureFont * m_pLblFont
void x_RenderMouseZoomHandler(CGlPane &pane)
virtual void SHH_OnChanged()
ISelHandlerHost implementation.
virtual void HMGH_UpdateLimits(bool force_redraw=false)
virtual void HMGH_OnRefresh(void)
a chnage that requires a redraw but no GL buffer updates
virtual TVPUnit HMGH_GetVPPosByY(int y) const
virtual bool x_GrabFocus()
void SaveCurrentView()
Record current zoom/pan so that user can undo/redo navigation.
virtual void Update(void)
virtual void HMGH_OnChanged(void)
a topology or selection (color) change (requires update to buffers
TRenderers m_Renderers
virtual TVPUnit MMHH_GetVPPosByY(int y) const
converts window coord to Viewport coord
bool CanGoForward() const
Return true if there are saved view positions you can nav forward to.
virtual void MZHH_ZoomRect(const TModelRect &rc)
void x_AdjustToMasterPane(CGlPane &pane, bool b_model_x, bool b_model_y)
adjusts limits and visible rect of the given pane to the master pane
virtual TModelUnit SHH_GetModelByWindow(int z, EOrientation orient)
virtual void SoftUpdate(void)
CLinearSelHandler m_VertSelHandler
virtual void x_OnShowPopup()
virtual TVPUnit SHH_GetWindowByModel(TModelUnit z, EOrientation orient)
CMinimapHandler m_MinimapHandler
virtual void FireEditEvent(EPhyloTreeEditCommand ec)
virtual void MZHH_ZoomPoint(const TModelPoint &point, TModelUnit factor)
TreeNavHistory m_NavHistory
virtual TVPPoint GetPortSize(void)
returns size of the master pane in screen coordinates
bool CanGoBack() const
Return true if there are previous view positions you can nav back to.
TZoomBehavior GetZoomBehavior(const string &renderer)
CRgbaColor & SetColor(TPhyloTreeObject obj, TPhyloTreeColors col)
class CPhyloTreeWidget
virtual CGlPane & GetPort()
implement these 2 functions in derived classes
virtual CPhyloTreeDataSource * GetDS(void)
virtual void OnShowPopup()
virtual void OnSetScaleXY(TModelUnit scale_x, const TModelPoint &point)
void SetPortLimits(const TModelRect &rect, bool bZoomAll=true)
void SendEditEvent(EPhyloTreeEditCommand ec=eCmdSomethingEdited)
CPhyloTreeScheme & GetScheme(void)
CTreeGraphicsModel & GetGraphicsModel()
Get model for rendering.
Definition: phylo_tree.cpp:74
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
string GetString(const string &key, const string &default_val=kEmptyStr) const
Definition: reg_view.cpp:246
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
@ eTop
Definition: ruler.hpp:93
@ eRight
Definition: ruler.hpp:95
void SetHorizontal(bool b_horz, ELabelPlacement place=eDefault, ELabelAlign aln=eAln_Center)
Definition: ruler.cpp:92
CStopWatch –.
Definition: ncbitime.hpp:1937
Contents of a single tool tip including display text and an ID that will indicate which underlying vi...
static TTreeIdx Null()
Return the index value that represents a NULL node.
Definition: tree_model.hpp:678
TTreeIdx GetRootIdx() const
Return the index of the root node.
Definition: tree_model.hpp:267
@ eWidgetSelectionChanged
a view has been destroyed
Definition: view_event.hpp:55
IGlEventHandler.
Interface IMinimapHandlerHost represents a context in which CMinimapHandler functions.
@ eCurrent
minimal scale
Interface IMouseZoomHandlerHost represents a context in which CMouseZoomHandler functions.
virtual void RenderPdf(CGlPane &pane, CPhyloTreeDataSource &ds, CRef< CPdf > pdf)
CTooltipInfo TTHH_GetTooltip(const wxRect &rect)
string TTHH_NeedTooltip(const wxPoint &pt)
I3DTexture * GetTexture(float &xcoord_limit, float &ycoord_limit)
virtual void RemoveCurrentDataSource()
void ComputeViewingLimits(CGlPane &pane, bool force_square=false, bool init_collision_info=true)
Compute the optimal viewing pane size so that the tree occupies the entire viewing area,...
virtual void BufferedRender(CGlPane &pane, CPhyloTreeDataSource &ds, bool init_collision_info=true, bool select_edge=false)
virtual void Layout(CPhyloTreeDataSource &ds, CGlPane &p)
virtual void RenderForHardcopy(CGlPane &pane, CPhyloTreeDataSource &ds)
IStickyTooltipHandlerHost - Class from which windows that want to support sticky tooltips ultimately ...
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
GLdouble TModelUnit
Definition: gltypes.hpp:48
void SetModelLimitsRect(const TModelRect &R)
Definition: glpane.hpp:342
T Height() const
Definition: glrect.hpp:90
void SetViewport(const TVPRect &R)
Definition: glpane.cpp:96
virtual void Enable(GLenum glstate)=0
void Init()
Definition: glrect.hpp:62
CGlPoint< TVPUnit > TVPPoint
Definition: gltypes.hpp:50
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)=0
Options to be used when GL_BLEND is enabled.
T Width() const
Definition: glrect.hpp:86
TVPUnit ProjectX(TModelUnit m_x) const
Definition: glpane.cpp:661
IRender & GetGl()
convenience function for getting current render manager
TVPRect & GetViewport(void)
Definition: glpane.hpp:332
TVPUnit ProjectY(TModelUnit m_y) const
Definition: glpane.cpp:676
TModelUnit UnProjectX(TVPUnit m_x) const
Definition: glpane.cpp:706
void AdjustToLimits()
Definition: glpane.hpp:504
TModelRect & GetModelLimitsRect(void)
Definition: glpane.hpp:347
bool PtInRect(T x, T y) const
Definition: glrect.hpp:154
TModelUnit GetZoomAllScaleY(void) const
Definition: glpane.cpp:138
TModelUnit UnProjectY(TVPUnit m_y) const
Definition: glpane.cpp:722
TModelUnit GetMinScaleY(void) const
Definition: glpane.hpp:457
int TVPUnit
Definition: gltypes.hpp:47
TModelUnit GetZoomAllScaleX(void) const
Definition: glpane.cpp:133
void SetVert(T bottom, T top)
Definition: glrect.hpp:123
void SetVisibleRect(const TModelRect &R)
Definition: glpane.cpp:113
EProjectionMode GetProjMode(void) const
Definition: glpane.hpp:437
TModelRect & GetVisibleRect(void)
Definition: glpane.hpp:357
virtual void Disable(GLenum glstate)=0
glDisable()
TModelUnit GetMinScaleX(void) const
Definition: glpane.hpp:452
TModelUnit GetScaleX(void) const
Definition: glpane.cpp:118
TModelUnit GetScaleY(void) const
Definition: glpane.cpp:123
void SetHorz(T left, T right)
Definition: glrect.hpp:117
EOrientation
Definition: gltypes.hpp:58
@ eNone
Definition: glpane.hpp:65
@ eHorz
Definition: gltypes.hpp:59
@ eVert
Definition: gltypes.hpp:60
float GetBlue(void) const
Definition: rgba_color.hpp:333
float GetGreen(void) const
Definition: rgba_color.hpp:327
float GetAlpha(void) const
Definition: rgba_color.hpp:339
virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Sends an event synchronously.
float GetRed(void) const
Get specific channels in floating point values.
Definition: rgba_color.hpp:321
@ eEvent_Message
message from one class to another
Definition: event.hpp:99
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
Definition: ncbitime.hpp:2775
void Start(void)
Start the timer.
Definition: ncbitime.hpp:2764
END_EVENT_TABLE()
#define fabs(v)
Definition: ncbi_dispd.c:46
Defines: CTimeFormat - storage class for time format.
Int4 delta(size_t dimension_, const Int4 *score_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
EPhyloTreeEditCommand
static static static wxID_ANY
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
IGlEventHandler * m_pHandler
size_t m_BackForwardPos
position in history
void Reset(const CGlPane &p)
bool EqualPanes(const CGlPane &lhs, const CGlPane &rhs) const
std::vector< CGlPane > m_History
Definition: type.c:6
#define _ASSERT
void SetFocus(CRef< objects::CSeq_entry > entry)
Modified on Wed Sep 04 15:01:30 2024 by modify_doxy.py rev. 669887