cross_aln_widget.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: cross_aln_widget.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 21:06:35 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: cross_aln_widget.cpp,v 1000.1 2004/06/01 21:06:35 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: Vlad Lebedev
- *
- */
- #include <ncbi_pch.hpp>
- #include <gui/widgets/aln_crossaln/cross_aln_widget.hpp>
- #include "cross_aln_pane.hpp"
- BEGIN_NCBI_SCOPE
- void s_CCrossAlnWidget_ScrollCB(Fl_Widget* w, void*)
- {
- dynamic_cast<CCrossAlnWidget&> (*w->parent()).x_ScrollCB();
- }
- CCrossAlnWidget::CCrossAlnWidget(int x, int y, int w, int h, const char* label)
- : Fl_Group(x, y, w, h, label)
- {
- const int kScrollBarSize = 15;
- const int kCrossPanelSize = 100;
-
- begin();
- m_ScrollX1 = new Fl_Scrollbar(x, y, w - kScrollBarSize, kScrollBarSize);
- m_ScrollX1->type(FL_HORIZONTAL);
- m_ScrollX1->callback( s_CCrossAlnWidget_ScrollCB );
- m_ScrollX1->labeltype(FL_NO_LABEL);
- int p_size = (h - kScrollBarSize * 2 - kCrossPanelSize) / 2;
-
- m_ScrollY1 = new Fl_Scrollbar
- (x + (w - kScrollBarSize), y + kScrollBarSize,
- kScrollBarSize, p_size);
- m_ScrollY1->callback( s_CCrossAlnWidget_ScrollCB );
- m_ScrollY1->labeltype(FL_NO_LABEL);
- m_ScrollX2 = new Fl_Scrollbar(x, y + h - kScrollBarSize,
- w - kScrollBarSize, kScrollBarSize);
- m_ScrollX2->type(FL_HORIZONTAL);
- m_ScrollX2->callback( s_CCrossAlnWidget_ScrollCB );
- m_ScrollX2->labeltype(FL_NO_LABEL);
- m_ScrollY2 = new Fl_Scrollbar
- (x + (w - kScrollBarSize), y + h - kScrollBarSize - p_size,
- kScrollBarSize, p_size);
- m_ScrollY2->callback( s_CCrossAlnWidget_ScrollCB );
- m_ScrollY2->labeltype(FL_NO_LABEL);
- // we wrap the panel in a group because FLTK will not respect the
- // widget's border type
- Fl_Group* group = new Fl_Group(x, y + kScrollBarSize,
- w - kScrollBarSize, h - kScrollBarSize * 2);
- const Fl_Boxtype panel_box = FL_THIN_DOWN_FRAME;
- group->box(panel_box);
- group->labeltype(FL_NO_LABEL);
-
- m_CrossPane.reset( new CCrossAlnPane
- (x + Fl::box_dx(panel_box),
- y + kScrollBarSize + Fl::box_dy(panel_box),
- w - kScrollBarSize - Fl::box_dw(panel_box),
- h - kScrollBarSize * 2 - Fl::box_dh(panel_box))
- );
-
- group->end();
- group->resizable(m_CrossPane.get());
-
- end();
- resizable(group);
- }
- CCrossAlnWidget::~CCrossAlnWidget()
- {
- delete m_ScrollX1;
- delete m_ScrollX2;
- delete m_ScrollY1;
- delete m_ScrollY2;
- }
- void CCrossAlnWidget::x_ScrollCB()
- {
- m_CrossPane->Scroll(m_ScrollX1->value(), m_ScrollY1->value(),
- m_ScrollX2->value(), m_ScrollY2->value() );
- }
- void CCrossAlnWidget::FitToWindow(void)
- {
- m_CrossPane->FitToWindow();
- }
- void CCrossAlnWidget::ZoomToSequence(void)
- {
- m_CrossPane->ZoomToSequence();
- }
- void CCrossAlnWidget::ZoomOnRange(const TSeqRange& range)
- {
- m_CrossPane->ZoomOnRange(range);
- }
- void CCrossAlnWidget::ZoomOnAlignment()
- {
- m_CrossPane->ZoomOnAlignment();
- }
-
- void CCrossAlnWidget::SetDataSource(CCrossAlnDataSource* ds)
- {
- m_CrossPane->SetDataSource(ds);
- }
- void CCrossAlnWidget::Update()
- {
- m_CrossPane->Update();
- }
- // Set/Clear selection
- void CCrossAlnWidget::SelectObject(const CObject* obj)
- {
- m_CrossPane->SelectObject(obj);
- }
- void CCrossAlnWidget::SelectSeqLoc(const CSeq_loc* loc)
- {
- //m_CrossPane->SelectSeqLoc(loc);
- }
- void CCrossAlnWidget::ClearSelection()
- {
- m_CrossPane->ClearSelection();
- }
- void CCrossAlnWidget::SetColor(EDisplayElement elem, Fl_Color color)
- {
- //m_CrossPane->SetColor(elem, color);
- }
- /*Fl_Color CCrossAlnWidget::GetColor(EDisplayElement elem) const
- {
- return m_CrossPane->GetColor(elem);
- }*/
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: cross_aln_widget.cpp,v $
- * Revision 1000.1 2004/06/01 21:06:35 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- *
- * Revision 1.4 2004/05/21 22:27:52 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.3 2004/03/11 17:50:41 dicuccio
- * Updated typedefs: dropped TDimension, TPosition, TIndex, TColor; use TSeqRange
- * instead of TRange
- *
- * Revision 1.2 2004/01/27 16:20:26 lebedev
- * Methods for working with selections added
- *
- * Revision 1.1 2003/12/22 13:12:34 lebedev
- * Initial revision
- *
- * ===========================================================================
- */