view_alninfo.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: view_alninfo.cpp,v $
- * PRODUCTION Revision 1000.5 2004/06/01 20:58:57 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.20
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: view_alninfo.cpp,v 1000.5 2004/06/01 20:58:57 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: Mike DiCuccio
- *
- * File Description:
- * User-modifiable portion of the alignment informational view for GBENCH.
- */
- #include <ncbi_pch.hpp>
- #include "view_alninfo.hpp"
- #include "alninfo_table.hpp"
- #include <gui/widgets/aln_data/align_ds.hpp>
- #include <gui/core/plugin_utils.hpp>
- #include <gui/core/version.hpp>
- #include <gui/plugin/PluginRequest.hpp>
- #include <gui/plugin/PluginCommand.hpp>
- #include <gui/plugin/PluginCommandSet.hpp>
- #include <gui/plugin/PluginValue.hpp>
- #include <objmgr/align_ci.hpp>
- #include <objtools/alnmgr/alnmix.hpp>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- // We include the generated _.cpp file here. This avoids a nasty bug in some
- // versions of gcc in which inline functions are not intantiated.
- #include "view_alninfo_.cpp"
- void CAlnInfoView::GetInfo(CPluginInfo& info)
- {
- info.Reset();
- // version info macro
- info.SetInfo(CPluginVersion::eMajor, CPluginVersion::eMinor, 0,
- string(__DATE__) + " " + string(__TIME__),
- "CAlnInfoView",
- "Alignment Info Viewer",
- "Alignment Info Viewer", "");
- // command info
- CPluginCommandSet& cmds = info.SetCommands();
- CPluginCommand& args = cmds.AddViewCommand(eViewCommand_new_view);
- args.AddArgument("alignments", "Alignments to merge and render",
- CSeq_annot::GetTypeInfo(),
- CPluginArg::TData::e_Single);
- args.SetConstraint("alignments",
- *CPluginValueConstraint::CreateAnnotType
- (CSeq_annot::TData::e_Align));
- }
- CAlnInfoView::CAlnInfoView(const CPluginMessage& msg, const string& pool_name)
- : CAlnView()
- {
- m_Window.reset(x_CreateWindow());
- // set our core components
- const CPluginCommand& args = msg.GetRequest().GetCommand();
- const CPluginArg& arg = args["alignments"];
- // extract the alignments from the argument
- const CSeq_annot* annot =
- dynamic_cast<const CSeq_annot*>(arg.GetObject());
- const IDocument* doc = arg.GetDocument();
- if (annot && doc) {
- x_SetDocument(*doc);
- m_AnnotData.Reset(annot);
- }
- }
- const string& CAlnInfoView::GetTitle() const
- {
- static string s_str("Alignment Information");
- return s_str;
- }
- //void CAlnInfoView::Update(TUpdateFlags flags)
- //{cout << "CAlnInfoView::Update" << endl;}
- /*
- if (flags & fDocumentChanged) {
- if ( m_AnnotData) {
- m_DataSource.Reset(new CAlignDataSource(*m_AnnotData,
- m_Document->GetScope()));
- }
- if (m_DataSource) {
- m_AlnInfo->Update(m_DataSource->SetAlnMgr());
- }
- m_TitleStr = m_Document->GetShortTitle() + ": " + GetTitle();
- m_Window->label(m_TitleStr.c_str());
- }
- }
- */
- void CAlnInfoView::OnDocumentChanged()
- {
- if ( m_AnnotData) {
- m_DataSource.Reset(new CAlignDataSource());
- m_DataSource->Init(*m_AnnotData, m_Document->GetScope());
- }
- if (m_DataSource) {
- m_AlnInfo->Update(m_DataSource->SetAlnMgr());
- }
- SetTitle(m_Document->GetShortTitle() + ": " + GetTitle());
- }
- void CAlnInfoView::x_OnFileClose()
- {
- Hide();
- }
- void CAlnInfoView::x_OnHelp()
- {
- }
- void CAlnInfoView::x_OnShowSegments()
- {
- m_AlnInfo->SetMode(CAlnInfoTable::eSegments);
- }
- void CAlnInfoView::x_OnShowSequence()
- {
- m_AlnInfo->SetMode(CAlnInfoTable::eSequence);
- }
- void CAlnInfoView::x_OnShowScores()
- {
- m_AlnInfo->SetMode(CAlnInfoTable::eScores);
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: view_alninfo.cpp,v $
- * Revision 1000.5 2004/06/01 20:58:57 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.20
- *
- * Revision 1.20 2004/05/21 22:27:49 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.19 2004/04/07 13:05:10 dicuccio
- * Changed view API - require CPluginMessage instead of CPluginArgSet
- *
- * Revision 1.18 2004/02/11 15:23:06 yazhuk
- * Replaced constructor with arguments with default constructor and Init() call
- *
- * Revision 1.17 2003/12/22 19:33:12 dicuccio
- * Lots of changes. Changed to match new APIs in IView. Added better handling of messages received from other views
- *
- * Revision 1.16 2003/11/24 15:45:42 dicuccio
- * Renamed CVersion to CPluginVersion
- *
- * Revision 1.15 2003/11/19 20:45:25 friedman
- * Added handling a visible range change event
- *
- * Revision 1.14 2003/11/04 12:51:27 friedman
- * Added event message pool callbacks for the document all-view message pool.
- *
- * Revision 1.13 2003/10/07 13:47:06 dicuccio
- * Renamed CPluginURL* to CPluginValue*
- *
- * Revision 1.12 2003/09/24 18:26:46 dicuccio
- * Large clean-ups to alignment viewers. Reimplemented data sources and alignment
- * generation mechanism to be more generic.
- *
- * Revision 1.11 2003/09/04 14:54:21 dicuccio
- * Use IDocument instead of CDocument. Changed APIs to match changes in IView
- *
- * Revision 1.10 2003/07/22 15:32:16 dicuccio
- * Changed to make use of new API in plugin_utils.hpp - GetArgValue()
- *
- * Revision 1.9 2003/06/26 15:33:41 dicuccio
- * Moved GetURLValue() from PluginURL.hpp to plugin_utils.hpp. Fixed compilation
- * errors relating to missing #includes
- *
- * Revision 1.8 2003/06/25 17:02:59 dicuccio
- * Split CPluginHandle into a handle (pointer-to-implementation) and
- * implementation file. Lots of #include file clean-ups.
- *
- * Revision 1.7 2003/06/20 14:53:51 dicuccio
- * Revised plugin registration - moved GetInfo() into the plugin handler
- *
- * Revision 1.6 2003/06/02 16:06:22 dicuccio
- * Rearranged src/objects/ subtree. This includes the following shifts:
- * - src/objects/asn2asn --> arc/app/asn2asn
- * - src/objects/testmedline --> src/objects/ncbimime/test
- * - src/objects/objmgr --> src/objmgr
- * - src/objects/util --> src/objmgr/util
- * - src/objects/alnmgr --> src/objtools/alnmgr
- * - src/objects/flat --> src/objtools/flat
- * - src/objects/validator --> src/objtools/validator
- * - src/objects/cddalignview --> src/objtools/cddalignview
- * In addition, libseq now includes six of the objects/seq... libs, and libmmdb
- * replaces the three libmmdb? libs.
- *
- * Revision 1.5 2003/05/19 13:43:32 dicuccio
- * Moved gui/core/plugin --> gui/plugin/. Merged core libraries into libgui_core
- *
- * Revision 1.4 2003/04/24 16:40:38 dicuccio
- * Updated to reflect changes in plugin API. Added new common alignment view base
- * class - handles notions of creating alignment manager in a standard way
- *
- * Revision 1.3 2003/03/17 14:54:14 dicuccio
- * Changed base class CView - added member variable for FLTK gui component for
- * child windows, which is now maintained via an auto_ptr<>. Eliminated
- * Show()/Hide() as a pure virtual requirement.
- *
- * Revision 1.2 2003/03/07 16:52:01 dicuccio
- * Fixed minor compilation issue for Win32 - add USING_SCOPE(objects)
- *
- * Revision 1.1 2003/03/03 18:29:55 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */