⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alnmulti_widget.hpp

📁 ncbi源码
💻 HPP
字号:
/* * =========================================================================== * PRODUCTION $Log: alnmulti_widget.hpp,v $ * PRODUCTION Revision 1000.6  2004/06/02 20:23:47  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.37 * PRODUCTION * =========================================================================== */#ifndef GUI_WIDGETS_ALNMULTI___ALNMULTI_WIDGET__HPP#define GUI_WIDGETS_ALNMULTI___ALNMULTI_WIDGET__HPP/*  $Id: alnmulti_widget.hpp,v 1000.6 2004/06/02 20:23:47 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/ncbiobj.hpp>#include <util/range_coll.hpp>#include <gui/opengl/glcanvas2d.hpp>#include <gui/utils/command.hpp>#include <objects/seqloc/Seq_loc.hpp>#include <gui/widgets/fl/menu.hpp>#include <gui/widgets/aln_multiple/alnmulti_model.hpp>#include <gui/widgets/aln_multiple/alnmulti_pane.hpp>#include <FL/Fl_Group.H>#include <FL/Fl_Scrollbar.H>BEGIN_NCBI_SCOPEclass IAlnMultiDataSource;/// Definitions for Multiple Alignment Widget commands///enum    EAlnMultiCommands {    eCmdSetSelMaster = eBaseCmdLast + 1, // make selected sequence Master    eCmdSetConsMaster, // make consensus Master    eCmdUnsetMaster,       eCmdResetSelection,    eCmdMarkSelected,    eCmdUnMarkSelected,    eCmdUnMarkAll,    eCmdHideSelected,    eCmdShowAll,    eCmdMoveSelectedUp,    //insert new commands here    eAlnMultiCmdLast};class NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT    CAlnMultiWidgetListener{public:    virtual void    OnNotify(                    IAlnMultiPaneParent::ENotification notification) = 0;};/////////////////////////////////////////////////////////////////////////////////// class CAlnMultiWidgetclass NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT CAlnMultiWidget    : public Fl_Group,       // FLTK      public CCommandTarget, // Command handling      public IAlnMultiPaneParent  // Widget-Pane relashionship{public:    typedef CAlnMultiModel::TNumrow     TNumrow;    typedef int TLine;    typedef list<objects::CSeq_loc*>        TPSeqLocList;    typedef CRangeCollection<TSeqPos>       TRangeColl;    typedef vector<CConstRef<CSeq_id> >     TRSeqIdVector;    CAlnMultiWidget(int x, int y, int w, int h, const char* label = NULL);    virtual ~CAlnMultiWidget();    /// performs initialization, creates Model and Controls. Call Create()    /// right after constructing CAlnMultiWidget    virtual void    Create();    virtual void    SetStyleCatalog(const CRowStyleCatalog* catalog);    virtual const CWidgetDisplayStyle*      GetDisplayStyle() const;        virtual void    SetDataSource(IAlnMultiDataSource* p_ds);    virtual void    SetListener(CAlnMultiWidgetListener* listener);        virtual CAlnMultiModel* GetModel();    virtual const CAlnMultiModel* GetModel() const;    /// makes specified rows visible/hidden, other rows aren't affected    virtual void    SetVisible(const vector<TNumrow>& rows, bool b_visible,                                bool b_invert_others = false);    virtual void    Select(const vector<TNumrow>& rows, bool b_select,                                bool b_invert_others = false);        /// @name IAlnMultiRenderContext implementation     /// @{    bool            IsRendererFocused();    /// @}        IAlnMultiDataSource*  GetDataSource();        /// @name IAlnMultiPaneParent implementation     /// @{    const IAlnMultiDataSource*  GetDataSource() const;    virtual TNumrow     GetRowNumByLine(TLine line) const;    virtual int         GetLineByRowNum(TNumrow Row) const;        virtual void        OnChildResize();      virtual void        OnSetScaleX(TModelUnit scale_x, const TModelPoint& point);    virtual void        OnZoomRect(const TModelRect& rc);    virtual void        OnScroll(TModelUnit d_x, TModelUnit d_y);    virtual void        OnRowChanged(IAlignRow* p_row);    virtual void        OnShowPopup();    virtual void    OnNotify(ENotification notification);    /// @}    /// @name Fl_Widget overridables    // @{    virtual void    resize(int x, int y, int w, int h);    /// @}        /// @name Command Handlers    /// @{    virtual void    OnZoomIn(void);    virtual void    OnZoomOut(void);    void    OnZoomAll(void);    void    OnZoomSequence(void);    void    OnZoomSelection(void);    void    MakeSelectedRowMaster(void);    void    UnsetMaster(void);    void    MakeConsensusRowMaster(void);    void    OnResetSelection(void);    void    OnMarkSelected(void);    void    OnUnMarkSelected(void);    void    OnUnMarkAll(void);        void    OnHideSelected(void); /// hide selected rows    void    OnShowAll(void); /// show all hidden rows    void    OnMoveSelectedUp(void);    /// @}    /// @name Selection handling    /// @{    void    GetSelectedIds(TRSeqIdVector& ids) const;    void    SetSelectedIds(const TRSeqIdVector& ids, CScope& scope);    const   TRangeColl& GetSelection(void) const;    void    GetMarks(TPSeqLocList& ls_locs) const;    /// @}    void    UpdateSortOrder(void);protected:        DECLARE_CMD_MAP();    virtual void    x_CreateModel(void) = 0; /// factory method    virtual void    x_CreateControls(void); ///factory method       /// @name Update handlers    /// Functions in this group are called by the widget when something changes.    /// Each functions performs minimal set of operations needed to keep widget    /// up-to-date.    /// @{    virtual void    x_UpdateOnDataChanged(bool b_reset = true);     void    x_UpdateOnRowHChanged(void);        void    x_UpdateOnSwitchMaster(TNumrow NewMasterRow);    void    x_UpdateOnZoom(void);    void    x_OnResize(void);    /// @}    void    x_SetScrollbars(void);    void    x_AdjustVisible(bool b_reset);    void    x_RedrawControls(void);                // scrollbar callbacks    static void x_OnScrollX(Fl_Widget*, void* pData);    static void x_OnScrollY(Fl_Widget*, void* pData);        void    x_ZoomToRange(TSeqPos from, TSeqPos to);        void    x_MakeVisibleHorz(TSeqPos pos);    void    x_MakeVisibleHorz(TSeqPos from, TSeqPos to);    CGlPane&    x_GetAlignPort();protected:       IAlnMultiDataSource*        m_pDataSource; /// source of alignment data    CAlnMultiWidgetListener*    m_pListener; /// notifications listener    CAlnMultiModel*  m_pModel; /// representation of alignment data         CAlnMultiPane* m_pAlignPane; /// widget rendering data and handling events        Fl_Scrollbar*  m_pScrollX;    Fl_Scrollbar*  m_pScrollY;    CPopupMenu* m_pPopupMenu;};END_NCBI_SCOPE#endif  // GUI_WIDGETS_ALNMULTI___ALNMULTI_WIDGET__HPP/* * =========================================================================== * $Log: alnmulti_widget.hpp,v $ * Revision 1000.6  2004/06/02 20:23:47  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.37 * * Revision 1.37  2004/06/01 21:10:27  johnson * made OnZoomIn/Out virtual * * Revision 1.36  2004/05/20 17:02:45  johnson * added eAlnMultiCmdLast * * Revision 1.35  2004/04/29 21:39:56  johnson * make viewport reset in x_UpdateOnDataChanged optional * * Revision 1.34  2004/04/06 15:32:38  yazhuk * Added eCmdMoveSelectedUp command and OnMoveSelectedUp() handler * * Revision 1.33  2004/04/02 16:27:55  yazhuk * Implemented support for selection broadcasting * * Revision 1.32  2004/03/18 17:06:54  yazhuk * Added "b_invert_others" argument to SetVisible() * * Revision 1.31  2004/03/17 20:10:36  yazhuk * Refined class interface * * Revision 1.30  2004/03/12 15:35:18  rsmith * removed redundant (and illegal) type specifier inside a class definition. * * Revision 1.29  2004/03/09 21:00:03  yazhuk * Separated part of the class into CAlnMultiModel. * * Revision 1.28  2004/03/08 15:40:02  yazhuk * Implemented new functions for IAlnMultiPaneParent interface * * Revision 1.27  2004/01/15 20:11:58  yazhuk * Added UpdateSortOrder() and m_pPopupMenu, renamed some x_Update... functions * * Revision 1.26  2004/01/08 19:39:42  yazhuk * Implemented row sorting * * Revision 1.25  2003/12/22 16:21:40  yazhuk * Refactoring of Update system, added comments * * Revision 1.24  2003/12/18 22:18:34  yazhuk * Workshop problems fixes * * Revision 1.23  2003/12/18 21:19:22  yazhuk * Major refactoring - implemented rows hiding. * * Revision 1.22  2003/12/18 03:25:56  ucko * Declare TRangeColl only once. * * Revision 1.21  2003/12/17 19:15:17  yazhuk * Added GetSelection() * * Revision 1.20  2003/12/10 17:06:59  yazhuk * Added "ref. point" argument to OnSetScaleX(). Basic support for popup menus. * * Revision 1.19  2003/12/01 16:57:19  yazhuk * Added OnZoomRect() and OnScroll(); updated includes * * Revision 1.18  2003/11/06 20:01:09  dicuccio * Removed USING_SCOPE(objects) * * Revision 1.17  2003/11/03 16:57:19  yazhuk * Added OnRowChanged(), x_UpdateOnRowChanged() functions * * Revision 1.16  2003/10/29 23:37:03  yazhuk * Replaced old classes with a new ones, did a lot of refactoring *  * Revision 1.15 2003/10/20 15:48:21 yazhuk  * Implemented OnSetScaleX() *  * Revision 1.14 2003/10/15 21:21:10 yazhuk * Migrated from using CAlnVec to accessing data via "generic" interface in  * CAlignDataSource. *  * Revision 1.13 2003/10/10 18:57:17 yazhuk * Added scoring, OnZoomSequence() and fonts *  * Revision 1.12 2003/10/03 16:37:50 yazhuk * Inherited CAlnMultiWidget from CCommandTarget *  * Revision 1.11 2003/09/29 15:20:08 dicuccio  * Deprecated gui/scope.hpp.  Merged gui/core/types.hpp into gui/types.hpp *  * Revision 1.10 2003/09/29 13:39:37 yazhuk * Added GetMarks() function *  * Revision 1.9 2003/09/23 20:49:40 yazhuk   * Updated IAlnMultiPaneParent member function declarations, added Mark  * manipulation functions, removed m_pConsensusRow data member *  * Revision 1.8 2003/09/16 14:37:13 dicuccio * Cleaned up and clarified export specifiers - added a new specifier for each * library *  * Revision 1.7 2003/09/12 12:59:14 dicuccio * Added export specifiers.  Inlined virtual dtors for interface classes *  * Revision 1.6 2003/09/10 20:49:10 yazhuk  * Merged 4 Panes into CAlnMultiPane class *  * Revision 1.5 2003/09/08 20:43:45 yazhuk * Typedefed TRangeColl *  * Revision 1.4 2003/09/08 16:18:00 yazhuk  * Support for anchoring sequences, "Zoom Selection" and 'Reset Selection"  * operations, bugfixes *  * Revision 1.3 2003/09/02 16:52:21 yazhuk * GCC compilation fixes *  * Revision 1.2 2003/08/28 18:23:47 yazhuk  * Modified to be used with new CAlnMultiWidget *  * Revision 1.1 2003/07/14 17:37:18 dicuccio * Initial Revision * * =========================================================================== */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -