textaln_view.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: textaln_view.cpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 21:08:03 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: textaln_view.cpp,v 1000.2 2004/06/01 21:08:03 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_textaln/view.hpp>
- #include <gui/widgets/aln_data/align_ds.hpp>
- #include "panel.hpp"
- BEGIN_NCBI_SCOPE
- void s_CTextAlnView_ScrollCB(Fl_Widget* w, void*)
- {
- dynamic_cast<CTextAlnView&> (*w->parent()).x_ScrollCB();
- }
- CTextAlnView::CTextAlnView(int x, int y, int w, int h, const char* label)
- : Fl_Group(x, y, w, h, label)
- {
- const int kScrollBarSize = 15;
- m_ScrollX = new Fl_Scrollbar
- (x, y+(h - kScrollBarSize), w - kScrollBarSize, kScrollBarSize);
- m_ScrollX->type(FL_HORIZONTAL);
- m_ScrollX->callback( s_CTextAlnView_ScrollCB );
- m_ScrollX->labeltype(FL_NO_LABEL);
- m_ScrollY = new Fl_Scrollbar
- (x + (w - kScrollBarSize), y, kScrollBarSize, h - kScrollBarSize);
- m_ScrollY->callback( s_CTextAlnView_ScrollCB );
- m_ScrollY->labeltype(FL_NO_LABEL);
- m_TextAlnPanel = new CTextAlnPanel
- (x, y, w - kScrollBarSize, h - kScrollBarSize);
- m_TextAlnPanel->box(FL_DOWN_BOX);
- m_TextAlnPanel->labeltype(FL_NO_LABEL);
- Fl_Group::current()->resizable(m_TextAlnPanel);
- end(); // close the group
- }
- CTextAlnView::~CTextAlnView()
- {
- delete m_ScrollX;
- delete m_ScrollY;
- delete m_TextAlnPanel;
- }
- void CTextAlnView::x_ScrollCB()
- {
- m_TextAlnPanel->Scroll(TSeqPos(m_ScrollX->value()),
- TSeqPos(m_ScrollY->value()) );
- }
- void CTextAlnView::ShowSequenceAsDots(bool show_dots)
- {
- m_TextAlnPanel->ShowSequenceAsDots(show_dots);
- }
- void CTextAlnView::SetAnchor(size_t idx)
- {
- m_TextAlnPanel->SetAnchor(idx);
- }
- void CTextAlnView::UnsetAnchor(void)
- {
- m_TextAlnPanel->UnsetAnchor();
- }
- void CTextAlnView::SelectAll(bool flag)
- {
- m_TextAlnPanel->SelectAll(flag);
- }
- void CTextAlnView::SetDataSource(CAlignDataSource* ds)
- {
- m_TextAlnPanel->SetDataSource(ds);
- }
- void CTextAlnView::SetFeatureDisplay(EFeatureDisplay disp)
- {
- m_TextAlnPanel->SetFeatureDisplay(disp);
- }
- void CTextAlnView::SetColor(EDisplayElement elem, Fl_Color color)
- {
- m_TextAlnPanel->SetColor(elem, color);
- }
- Fl_Color CTextAlnView::GetColor(EDisplayElement elem) const
- {
- return m_TextAlnPanel->GetColor(elem);
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: textaln_view.cpp,v $
- * Revision 1000.2 2004/06/01 21:08:03 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 2003/09/24 18:34:58 dicuccio
- * Use new generic alignment data source. Removed USING_SCOPE(objects) from
- * headers; used objects:: where necessary
- *
- * Revision 1.1 2003/03/27 17:04:32 lebedev
- * Text Alignment Widget: Initial revision
- *
- * ===========================================================================
- */