alnmulti_pane.cpp

来自「ncbi源码」· C++ 代码 · 共 885 行 · 第 1/2 页

CPP
885
字号
    m_MarkHandler.UnMarkAll();}const   CAlnMultiPane::TRowToMarkMap&  CAlnMultiPane::GetMarks() const{    return m_MarkHandler.GetMarks();}int     CAlnMultiPane::GetAlignVPHeight() const{    return GetListAreaHeight();}int     CAlnMultiPane::GetAlignVPWidth() const{    int iAlign = m_Renderer.GetColumnIndexByType(IAlignRow::eAlignment);    return m_Renderer.GetColumn(iAlign).m_Width;}/////////////////////////////////////////////////////////////////////////////////// protected membersvoid    CAlnMultiPane::x_RenderSelection(){    if(x_GetParent()) {        const CGlPane& VP = x_GetContext()->GetAlignPort();        if(! VP.GetVisibleRect().IsEmpty())        {               TVPRect rc_vp = m_Renderer.GetColumnRect(IAlignRow::eAlignment);            if(rc_vp.Width() > 0)   {                m_HandlerPane.EnableOffset();                m_HandlerPane.SetViewport(rc_vp);                    TModelRect rcM = VP.GetModelLimitsRect();                  rcM.SetVert(0, 1);                          m_HandlerPane.SetModelLimitsRect(rcM);                    TModelRect rcV = VP.GetVisibleRect();                        rcV.SetVert(0, 1);                          m_HandlerPane.SetVisibleRect(rcV);                glEnable(GL_BLEND);                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);                m_SelHandler.Render(m_HandlerPane);                       glDisable(GL_BLEND);            }        }    }}void    CAlnMultiPane::x_RenderMark(){    if(x_GetParent()) {        const CGlPane& VP = x_GetContext()->GetAlignPort();                TVPRect rc_vp = m_Renderer.GetColumnRect(IAlignRow::eAlignment);        if(rc_vp.Width() > 0)   {            rc_vp.SetTop(m_Renderer.GetVPListTop());             m_HandlerPane.SetViewport(rc_vp);                                    TModelRect rcM = VP.GetModelLimitsRect();              m_HandlerPane.SetModelLimitsRect(rcM);                TModelRect rcV = VP.GetVisibleRect();                    rcV.SetBottom(rcV.Top() + rc_vp.Height());            m_HandlerPane.SetVisibleRect(rcV);            glEnable(GL_BLEND);            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);            m_MarkHandler.Render(m_HandlerPane);                    glDisable(GL_BLEND);        }    }}void    CAlnMultiPane::x_RenderZoomHandler(){    if(x_GetParent()) {               TVPRect rc_vp = m_Renderer.GetColumnRect(IAlignRow::eAlignment);        if(rc_vp.Width() > 0)   {            m_HandlerPane.SetViewport(rc_vp);                        glEnable(GL_BLEND);            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);            m_MouseZoomHandler.Render(m_HandlerPane);                   glDisable(GL_BLEND);        }    }}int     CAlnMultiPane::x_GetLineByWindowY(int WinY) const{    int vpY = WinY - m_Renderer.GetListTop();    int OffsetY = (int) x_GetContext()->GetAlignPort().GetVisibleRect().Top();            return x_GetContext()->GetLineByModelY(vpY + OffsetY);}TVPRect CAlnMultiPane::x_GetLineRect(int Index){    int Top = 0, H = 0;    if(x_GetParent()  &&  Index >= 0) {        int OffsetY = (int) x_GetContext()->GetAlignPort().GetVisibleRect().Top();                Top = x_GetContext()->GetLinePosY(Index) - OffsetY;        H = x_GetContext()->GetLineHeight(Index);    }    return TVPRect(0, Top + H -1, w()-1, Top);}////////////////////////////////////////////////////////////////////////////////// ISelListView implementationvoid  CAlnMultiPane::SLV_SetModel(TSelListModel* pModel){    m_pModel = pModel;}void  CAlnMultiPane::SLV_UpdateItems(const TIndexVector& v_indexes){    bool bRedraw = false;    TVPRect rcVisible(0, 0, w() - 1, h() - 1);    for( size_t i = 0;  i < v_indexes.size() &&  ! bRedraw;  i++ ) {        int index = v_indexes[i];        TVPRect rcItem = x_GetLineRect(index);        bRedraw = rcItem.Intersects(rcVisible);     }    if(bRedraw)        redraw();    x_NotifyParent(IAlnMultiPaneParent::eRowSelChanged);}void  CAlnMultiPane::SLV_UpdateRange(int iFirstItem, int iLastItem){    if(iLastItem >= iFirstItem) {        TVPRect rcFirst = x_GetLineRect(iFirstItem);        TVPRect rcLast = x_GetLineRect(iLastItem);        rcFirst.CombineWith(rcLast);        TVPRect rcVisible(0, 0, w() - 1, h() - 1);            if(rcFirst.Intersects(rcVisible))            redraw();    } else redraw();    x_NotifyParent(IAlnMultiPaneParent::eRowSelChanged);}/////////////////////////////////////////////////////////////////////////////////// CSelListController extensionCAlnMultiPane::TSelListModel* CAlnMultiPane::SLC_GetModel(){    return x_GetModel();}int     CAlnMultiPane::SLC_GetHeight(){    return h();}int CAlnMultiPane::SLC_GetLineByWindowY(int WinY, bool b_clip){    int h = m_Renderer.GetRulerAreaHeight() + m_Renderer.GetMasterAreaHeight();    if(! b_clip  ||  WinY >= h) {        return  x_GetLineByWindowY(WinY);    } else return -1;}void    CAlnMultiPane::SLC_VertScrollToMakeVisible(int Index){    // not implemented}/////////////////////////////////////////////////////////////////////////////////// ISelHandlerHost implementationvoid CAlnMultiPane::SHH_Redraw(){    redraw();}TModelUnit  CAlnMultiPane::SHH_GetModelByWindow(int z, EOrientation orient){    switch(orient)  {    case eHorz: return m_HandlerPane.UnProjectX(z);    case eVert: return m_HandlerPane.UnProjectY(h() - z);    default:    _ASSERT(false); return -1;    }}TVPUnit     CAlnMultiPane::SHH_GetWindowByModel(TModelUnit z, EOrientation orient){    switch(orient)  {    case eHorz: return m_HandlerPane.ProjectX(z);    case eVert: return h() - m_HandlerPane.ProjectY(z);    default:    _ASSERT(false); return -1;    }}/////////////////////////////////////////////////////////////////////////////////// IAlnMarkHandlerHost implementationconst IAlnMultiDataSource*      CAlnMultiPane::MHH_GetAlnDS() const{    return x_GetParent()->GetDataSource();}const CAlnMultiPane::TSelListModel*    CAlnMultiPane::MHH_GetSelListModel() const{    return x_GetModel();}CAlnMultiPane::TNumrow    CAlnMultiPane::MHH_GetRowByLine(int Index) const{    return x_GetParent()->GetRowNumByLine(Index);}int CAlnMultiPane::MHH_GetLineByRowNum(TNumrow Row) const{    return x_GetParent()->GetLineByRowNum(Row);}int CAlnMultiPane::MHH_GetLineByWindowY(int Y) const{    return x_GetLineByWindowY(Y);}int CAlnMultiPane::MHH_GetLinePosY(int Index) const{    return x_GetContext()->GetLinePosY(Index);}int CAlnMultiPane::MHH_GetLineHeight(int Index) const{    return x_GetContext()->GetLineHeight(Index);}///### refactor ??TModelUnit  CAlnMultiPane::MHH_GetSeqPosByX(int X) const{    return m_HandlerPane.UnProjectX(X);}void    CAlnMultiPane::MHH_Redraw(){    redraw();}TModelUnit  CAlnMultiPane::MZHH_GetScale(EScaleType type){    const CGlPane& port = x_GetContext()->GetAlignPort();    switch(type)    {    case eCurrent:   return port.GetScaleX();    case eMin: return port.GetMinScaleX();    case eMax: return port.GetZoomAllScaleX();    default: _ASSERT(false); return -1;    }}void    CAlnMultiPane::MZHH_SetScale(TModelUnit scale, const TModelPoint& point) {    x_GetParent()->OnSetScaleX(scale, point);}void     CAlnMultiPane::MZHH_ZoomRect(const TModelRect& rc){    x_GetParent()->OnZoomRect(rc);}void    CAlnMultiPane::MZHH_Scroll(TModelUnit d_x, TModelUnit d_y){    x_GetParent()->OnScroll(d_x, d_y);}TVPUnit  CAlnMultiPane::MZHH_GetVPPosByY(int y) const{    return h() - 1  - y;}void    CAlnMultiPane::MZHH_Redraw(void){    redraw();}void    CAlnMultiPane::ARH_OnRowChanged(IAlignRow* p_row){    x_GetParent()->OnRowChanged(p_row);}TVPPoint    CAlnMultiPane::ARH_GetVPMousePos(){    int y = h() - 1 - Fl::event_y();    int x = Fl::event_x();    return TVPPoint(x, y);}END_NCBI_SCOPE/* * =========================================================================== * $Log: alnmulti_pane.cpp,v $ * Revision 1000.6  2004/06/01 21:07:09  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.42 * * Revision 1.42  2004/05/21 22:27:52  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.41  2004/05/10 17:46:35  yazhuk * Addressed GCC warnings * * Revision 1.40  2004/04/22 17:10:34  yazhuk * Fixed rendering of focus state * * Revision 1.39  2004/04/06 16:05:24  yazhuk * Clean-up * * Revision 1.38  2004/04/06 13:34:50  dicuccio * Commented unused iteration over HTML active areas * * Revision 1.37  2004/04/05 14:50:05  yazhuk * Zoom from keyboard * * Revision 1.36  2004/04/02 16:39:13  yazhuk * Implemented parent notification about changes in selection * * Revision 1.35  2004/03/29 19:06:24  yazhuk * Added GetRenderer(), implemented CHTMLActiveArea-s generation * * Revision 1.34  2004/03/25 13:05:49  dicuccio * Use _TRACE() instead of cout * * Revision 1.33  2004/03/17 20:13:18  yazhuk * Added SetContext(), modified SetWidget() * * Revision 1.32  2004/03/09 21:02:59  yazhuk * Replaced some of the calls to x_GetParent() with x_GetContext(); cleaned-up * * Revision 1.31  2004/03/08 15:41:32  yazhuk * Moved rendering to CAlnMultiRenderer class. * * Revision 1.30  2004/03/02 15:12:45  yazhuk * Expanded "Icons" column * * Revision 1.29  2004/02/18 02:17:34  ucko * Portability fix: don't try to use the return value of map<>::erase(), * which yields void in many implementations. * * Revision 1.28  2004/02/17 15:19:24  yazhuk * Support for graphics caching * * Revision 1.27  2004/01/15 20:14:46  yazhuk * Fixed bug in focus handling; added new argument to SLC_GetLineByWindowY * * Revision 1.26  2004/01/08 19:43:24  yazhuk * Refactored and improved tooltips support * * Revision 1.25  2003/12/29 23:21:27  yazhuk * Implemented tooltips support using CTooltip * * Revision 1.24  2003/12/22 16:24:27  yazhuk * Added SetRulerHeight(), clean-up * * Revision 1.23  2003/12/18 21:22:42  yazhuk * Updated code to support template ISelListModel * * Revision 1.22  2003/12/10 17:10:04  yazhuk * Updated IMouseZoomHandlerHost implementation. * Basic support for popup menus. * * Revision 1.21  2003/12/08 15:15:18  yazhuk * Removed x_RenderContent(). Implemented workaround for OpenGL precision problems. * * Revision 1.20  2003/12/01 17:00:22  yazhuk * Refactored event handling - introduced CGUIEvent, updated * ISelHandlerHost implementation. * * Revision 1.19  2003/11/24 20:32:22  friedman * Commented out check for Fl:damage() == 0 * * Revision 1.18  2003/11/24 15:15:27  dicuccio * Added check for Fl::damage() = 0 * * Revision 1.17  2003/11/18 17:58:08  yazhuk * Fixed GCC warnings * * Revision 1.16  2003/11/17 21:20:10  yazhuk * Fixed spelling errors, renamed GetScale() to MZHH_GetScale() * * Revision 1.15  2003/11/03 16:55:54  yazhuk * Implemented IAlignRowHost interface and handling events by IAlignRow * objects. Added x_SetupPaneForRow(), x_SetupPaneForColumn() functions. * * Revision 1.14  2003/10/29 23:33:16  yazhuk * Migrated to new classes, did a lot of refactoring * * Revision 1.13  2003/10/20 15:50:28  yazhuk * Implemented generalized event handling using IEventHandler. Added CMouseZoomHandler. * * Revision 1.12  2003/10/15 21:26:38  yazhuk * Migrated from using CAlnVec to accessing data via "generic" interface in CAlignDataSource. * * Revision 1.11  2003/10/10 19:02:52  yazhuk * Changed inheritance from CAlnMultiEditPane to CGlCanvas2d * * Revision 1.10  2003/09/29 17:00:09  dicuccio * fl.H -> Fl.H * * Revision 1.9  2003/09/29 15:53:42  dicuccio * Reordered #include statements * * Revision 1.8  2003/09/29 13:42:39  yazhuk * Added "SeqEnd" column, implemented GetMarks() * * Revision 1.7  2003/09/23 21:05:20  yazhuk * Added support for Marks, implemented mouse event handling functions, added x_RenderRow function * * Revision 1.6  2003/09/15 13:39:18  yazhuk * SColumn::m_UserData compilation fix * * Revision 1.5  2003/09/10 21:49:47  yazhuk * GCC compilation fixes * * Revision 1.4  2003/09/10 20:43:05  yazhuk * Merged 4 Pane classes into CAlnMultiPane class. Introduced notion of Columns. * * Revision 1.3  2003/09/08 16:25:10  yazhuk * Modified IAlignParent function calls * * Revision 1.2  2003/09/02 16:53:57  yazhuk * GCC compilation fixes * * Revision 1.1  2003/08/28 18:25:28  yazhuk * Initial revision * * =========================================================================== */

⌨️ 快捷键说明

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