📄 alnmulti_pane.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: alnmulti_pane.hpp,v $ * PRODUCTION Revision 1000.4 2004/04/12 18:15:55 gouriano * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.30 * PRODUCTION * =========================================================================== */#ifndef __GUI_WIDGETS_ALNMULTI___ALNMULTI_PANE__HPP#define __GUI_WIDGETS_ALNMULTI___ALNMULTI_PANE__HPP/* $Id: alnmulti_pane.hpp,v 1000.4 2004/04/12 18:15:55 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors: Andrey Yazhuk * * File Description: * */#include <corelib/ncbistl.hpp>#include <gui/opengl/glcanvas2d.hpp>#include <gui/widgets/gl/ruler.hpp>#include <gui/widgets/gl/mouse_zoom_handler.hpp>#include <gui/widgets/gl/linear_sel_handler.hpp>#include <gui/widgets/fl/tooltip.hpp>#include <gui/widgets/aln_multiple/alnmulti_renderer.hpp>#include <gui/widgets/aln_multiple/alnmulti_base_pane.hpp>#include <gui/widgets/aln_multiple/list_mvc.hpp>#include <gui/widgets/aln_multiple/sel_list_controller.hpp>#include <gui/widgets/aln_multiple/align_mark_handler.hpp>BEGIN_NCBI_SCOPEtypedef ISelListView<IAlnMultiDataSource::TNumrow> TNumrowSelListView;typedef CSelListController<IAlnMultiDataSource::TNumrow> TNumrowSelListController;/////////////////////////////////////////////////////////////////////////////////// class CAlnMultiPane class NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT CAlnMultiPane : public CGlCanvas2d, public TNumrowSelListController, public TNumrowSelListView, public ISelHandlerHost, public IAlignMarkHandlerHost, public IMouseZoomHandlerHost, public IAlignRowHost {public: typedef CLinearSelHandler::TRangeColl TRangeColl; typedef IAlignRow::EColumnType EColumnType; typedef map<TNumrow, TRangeColl> TRowToMarkMap; typedef ISelListModel<TNumrow> TSelListModel; CAlnMultiPane(int PosX, int PosY, int Width, int Height, const char* Label = NULL); void SetWidget(IAlnMultiPaneParent* p_arent); void SetContext(IAlnMultiRendererContext* p_context); void SetBackColor(const CGlColor Color); // FLTK overridables virtual void resize(int x, int y, int w, int h); virtual int handle(int event); virtual void draw(); /// @name Interface for a Widget /// @{ int GetAlignVPHeight() const; int GetAlignVPWidth() const; virtual void Update(); virtual void Render(); CRuler& GetRuler(); void SetRulerHeight(int height); CAlnMultiRenderer& GetRenderer(); CRange<TSeqPos> GetSelectionLimits(); const TRangeColl& GetSelection() const; void SetSelection(const TRangeColl& C, bool bRedraw); void ResetSelection(bool bRedraw); void MarkSelectedRows(const TRangeColl& C, bool bMark); void UnMarkAll(); const TRowToMarkMap& GetMarks() const; /// @} /// @name CSelListController extension /// @{ virtual TSelListModel* SLC_GetModel(); virtual int SLC_GetHeight(); virtual int SLC_GetLineByWindowY(int WinY, bool b_clip = false); virtual void SLC_VertScrollToMakeVisible(int Index); /// @} /// @name TNumrowSelListView implementation /// @{ virtual void SLV_SetModel(TSelListModel* pModel); virtual void SLV_UpdateItems(const TIndexVector& vIndices); virtual void SLV_UpdateRange(int iFirstItem, int iLastItem); /// @} /// @name ISelHandlerHost implementation /// @{ virtual void SHH_Redraw(); virtual TModelUnit SHH_GetModelByWindow(int z, EOrientation orient); virtual TVPUnit SHH_GetWindowByModel(TModelUnit z, EOrientation orient); /// @} /// @name IAlnMarkHandlerHost implementation /// @{ virtual const IAlnMultiDataSource* MHH_GetAlnDS() const; virtual const TSelListModel* MHH_GetSelListModel() const; virtual TNumrow MHH_GetRowByLine(int Index) const; virtual int MHH_GetLineByRowNum(TNumrow Row) const; virtual int MHH_GetLineByWindowY(int Y) const; virtual int MHH_GetLinePosY(int Index) const; virtual int MHH_GetLineHeight(int Index) const; virtual TModelUnit MHH_GetSeqPosByX(int X) const; virtual void MHH_Redraw(); /// @} /// @name IMouseZoomHandlerHost implementation /// @{ virtual TModelUnit MZHH_GetScale(EScaleType type); virtual void MZHH_SetScale(TModelUnit scale, const TModelPoint& point); virtual void MZHH_ZoomRect(const TModelRect& rc); virtual void MZHH_Scroll(TModelUnit d_x, TModelUnit d_y); virtual TVPUnit MZHH_GetVPPosByY(int y) const; virtual void MZHH_Redraw(void); /// @} /// @name IAlignRowHost implementation /// @{ virtual void ARH_OnRowChanged(IAlignRow* p_row); virtual TVPPoint ARH_GetVPMousePos(); /// @} int GetListAreaHeight() const { return m_Renderer.GetListAreaHeight(); } protected: // Rendering functions void x_RenderSelection(); void x_RenderMark(); void x_RenderZoomHandler(); void x_Layout(); /// @name Event handling /// @{ int x_HandleKeyEvent(); int x_HandleMouseMove(); int x_HandleMousePush(); int x_HandleMouseDrag(); int x_HandleMouseRelease(); int x_HandleMouseWheel(); int x_Row_handle(); void x_UpdateTooltip(); virtual string x_GetRowTooltip(IAlignRow* p_row, int i_col, int vp_top_y); /// @} /// @name IEventHandler management function /// @{ void x_AddHandler(IEventHandler* handler, int area); int x_Handlers_handle(int area, IEventHandler*& handler, bool ignore_curr = true); int x_GetLineByWindowY(int WinY) const; TVPRect x_GetLineRect(int Index); /// @} IAlnMultiPaneParent* x_GetParent() { return m_pParent; } const IAlnMultiPaneParent* x_GetParent() const { return m_pParent; } void x_SendCommand(TCmdID cmd); IAlnMultiRendererContext* x_GetContext() { return m_pContext; } const IAlnMultiRendererContext* x_GetContext() const { return m_pContext; } inline TSelListModel* x_GetModel() { return m_pModel; } inline const TSelListModel* x_GetModel() const { return m_pModel; } inline void x_NotifyParent(IAlnMultiPaneParent::ENotification notification); protected: enum EHandlerArea { fDescrArea = 0x1, fAlignArea = 0x2, fAllAreas }; typedef list<pair<IEventHandler*, int> > THandlerList; IAlnMultiPaneParent* m_pParent; IAlnMultiRendererContext* m_pContext; TSelListModel* m_pModel; // event handling CGUIEvent m_Event; THandlerList m_lsHandlers; IEventHandler* m_pCurrHandler; CLinearSelHandler m_SelHandler; CAlignMarkHandler m_MarkHandler; CMouseZoomHandler m_MouseZoomHandler; CGlPane m_HandlerPane; CTooltip m_Tooltip; CAlnMultiRenderer m_Renderer;};inline void CAlnMultiPane::x_NotifyParent(IAlnMultiPaneParent::ENotification notification){ if(x_GetParent()) { x_GetParent()->OnNotify(notification); }}END_NCBI_SCOPE/* * =========================================================================== * $Log: alnmulti_pane.hpp,v $ * Revision 1000.4 2004/04/12 18:15:55 gouriano * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.30 * * Revision 1.30 2004/04/05 14:50:21 yazhuk * Zoom from keyboard * * Revision 1.29 2004/04/02 16:28:30 yazhuk * Implemented support for selection broadcasting * * Revision 1.28 2004/03/29 19:05:05 yazhuk * Added GetRenderer() * * Revision 1.27 2004/03/17 20:12:37 yazhuk * Added SetContext() * * Revision 1.26 2004/03/09 21:01:39 yazhuk * Clean-up; added comments * * Revision 1.25 2004/03/08 15:41:21 yazhuk * Moved rendering to CAlnMultiRenderer class. * * Revision 1.24 2004/02/17 15:19:37 yazhuk * Support for graphics caching * * Revision 1.23 2004/01/15 20:17:01 yazhuk * Added new argument to SLC_GetLineByWindowY() * * Revision 1.22 2004/01/08 19:42:12 yazhuk * Added x_GetColumnTypeByIndex(), modified x_GetRowTooltip() * * Revision 1.21 2003/12/29 23:20:23 yazhuk * Implemented tooltips using CTooltip * * Revision 1.20 2003/12/29 16:05:48 johnson * added msvc export specifier to CAlnMultiPane * * Revision 1.19 2003/12/22 16:20:59 yazhuk * Added access to Ruler * * Revision 1.18 2003/12/18 21:25:01 yazhuk * Updated code to support template ISelListModel * * Revision 1.17 2003/12/10 17:08:06 yazhuk * Updated IMouseZoomHandlerHost implementation. Added x_HandleMouseRelease(). * * Revision 1.16 2003/12/08 15:10:20 yazhuk * Killed x_RenderContent() declaration * * Revision 1.15 2003/12/01 16:54:35 yazhuk * Refactored event handling - introduced CGUIEvent; added support for zooming by * rectangle and panoraming. * * Revision 1.14 2003/11/17 21:15:06 yazhuk * Update include for mouse_zoom_handler.hpp, fixed speling errors, renamed * GetScale() function * * Revision 1.13 2003/11/07 20:45:21 rsmith * Qualifiers like CAlnMultiPane:: are not allowed in the definition of class CAlnMultiPane. * * Revision 1.12 2003/11/03 16:55:33 yazhuk * Implemented IAlignRowHost interface and handling events by IAlignRow * objects. Added x_SetupPaneForRow(), x_SetupPaneForColumn() functions. * * Revision 1.11 2003/10/31 14:05:36 dicuccio * Fixed spelling error: CRuler -> CRuler * * Revision 1.10 2003/10/29 23:36:33 yazhuk * Replaced old classes with a new ones * * Revision 1.9 2003/10/20 15:50:09 yazhuk * Implemented generalized event handling using IEventHandler. Added CMouseZoomHandler. * * Revision 1.8 2003/10/15 21:21:42 yazhuk * Migrated from using CAlnVec to accessing data via "generic" interface in CAlignDataSource. * * Revision 1.7 2003/10/10 19:02:14 yazhuk * Changed inheritance from CAlnMultiEditPane to CGlCanvas2d * * Revision 1.6 2003/09/29 13:42:59 yazhuk * Implemented GetMarks() * * Revision 1.5 2003/09/23 21:04:28 yazhuk * Added support for Marks, added mouse event handling functions, added x_RenderRow function * * Revision 1.4 2003/09/15 13:39:48 yazhuk * SColumn::m_UserData compilation fix * * Revision 1.3 2003/09/10 21:48:19 yazhuk * GCC compilation fixes * * Revision 1.2 2003/09/10 20:42:52 yazhuk * Merged 4 Pane classes into CAlnMultiPane class. Introduced notion of Columns. * * Revision 1.1 2003/08/28 18:22:45 yazhuk * Initial revision * * =========================================================================== */#endif // __GUI_WIDGETS_ALNMULTI___ALNMULTI_PANE__HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -