multi_demo_ui.cpp
来自「ncbi源码」· C++ 代码 · 共 227 行
CPP
227 行
/* * =========================================================================== * PRODUCTION $Log: multi_demo_ui.cpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 21:07:42 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13 * PRODUCTION * =========================================================================== *//* $Id: multi_demo_ui.cpp,v 1000.2 2004/06/01 21:07:42 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: * */#include <ncbi_pch.hpp>#include "multi_demo_ui.hpp"#include <gui/utils/message_box.hpp>#include <gui/widgets/fl/menu.hpp>#include <objtools/data_loaders/genbank/gbloader.hpp>#include <serial/objistr.hpp>#include <objmgr/bioseq_handle.hpp>#include <gui/widgets/aln_multiple/align_row.hpp>BEGIN_NCBI_SCOPE#include "multi_demo_ui_.cpp"staticDEFINE_MENU(Menu) SUBMENU("Zoom") MENU_ITEM(eCmdZoomIn, "Zoom In") MENU_ITEM(eCmdZoomOut, "Zoom Out") MENU_ITEM(eCmdZoomAll, "Zoom All") MENU_ITEM(eCmdZoomSeq, "Zoom to Sequence") MENU_ITEM(eCmdZoomSel, "Zoom Selection") END_SUBMENU() SUBMENU("Master") MENU_ITEM(eCmdSetSelMaster , "Set Selected") MENU_ITEM(eCmdSetConsMaster, "Set Consensus") MENU_ITEM(eCmdUnsetMaster, "Unset") END_SUBMENU() SUBMENU("Selection") MENU_ITEM(eCmdResetSelection, "Reset Selection") MENU_ITEM(eCmdMoveSelectedUp, "Move Selected Items Up") END_SUBMENU() SUBMENU("Mark") MENU_ITEM(eCmdMarkSelected, "Mark Selected") MENU_ITEM(eCmdUnMarkSelected, "UnMark selected") MENU_ITEM(eCmdUnMarkAll, "UnMark All") END_SUBMENU() SUBMENU("Hide Rows") MENU_ITEM(eCmdHideSelected, "Hide Selected") MENU_ITEM(eCmdShowAll, "Show All") END_SUBMENU()END_MENU()CMultiDemoUI::CMultiDemoUI(){ m_Window.reset(x_CreateWindow()); m_AlnWidget->Create(); m_AlnWidget->SetTraceGraphStyle(CTraceGraphProperties::eIntensity); m_MenuBar->SetCmdTarget(dynamic_cast<CCommandTarget*>(m_AlnWidget)); m_MenuBar->SetItems(Menu); m_StyleCatalog.SetDefaultStyle(new CAlnVecRowDisplayStyle()); m_StyleCatalog.SetWidgetStyle(m_AlnWidget->GetDisplayStyle()); m_AlnWidget->SetStyleCatalog(&m_StyleCatalog); m_DataSource.Reset(new CAlnVecMultiDataSource());}CMultiDemoUI::~CMultiDemoUI(){ // these must be deleted in proper order m_DataSource.Reset(); m_Window.reset(); m_Scope.Reset(); m_ObjMgr.Reset();}#define DEF_ACC "gnl|TR_ASSM_CH|127"//#define DEF_ACC "19172277"void CMultiDemoUI::Show(int argc, char** argv){ m_Accession->value(DEF_ACC); m_Accession->redraw(); m_Window->show(argc, argv); while (m_Window->shown()) { Fl::wait(); }}void CMultiDemoUI::x_OnLoadAccession(){ CSeq_id id(m_Accession->value()); if (id.Which() == CSeq_id::e_not_set) { string msg("Accession '"); msg += m_Accession->value(); msg += "' not recognized as a valid accession"; NcbiMessageBox(msg, eDialog_Ok, eIcon_Exclamation, "Unhandled Accession"); return; } if ( !m_ObjMgr ) { m_ObjMgr.Reset(new CObjectManager()); m_ObjMgr->RegisterDataLoader(*new CGBDataLoader(), CObjectManager::eDefault); m_Scope.Reset(new CScope(*m_ObjMgr)); m_Scope->AddDefaults(); } // retrieve our sequence CBioseq_Handle handle = m_Scope->GetBioseqHandle(id); if ( !handle ) { string msg("Can't find sequence for accession '"); msg += m_Accession->value(); msg += "'"; NcbiMessageBox(msg, eDialog_Ok, eIcon_Exclamation, "Sequence Not Found"); return; } // now, set our data source //m_DataSource.Reset(new CAlnVecMultiDataSource(handle, m_Scope.GetObject())); m_DataSource->Init(handle, *m_Scope); //m_DataSource->CreateConsensus(); m_DataSource->SetAnchor(0); m_AlnWidget->SetDataSource( static_cast<IAlnMultiDataSource*>(m_DataSource.GetPointer()));}void CMultiDemoUI::x_OnLoadFile(){}END_NCBI_SCOPE/* * =========================================================================== * $Log: multi_demo_ui.cpp,v $ * Revision 1000.2 2004/06/01 21:07:42 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13 * * Revision 1.13 2004/05/21 22:27:52 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.12 2004/05/17 17:58:46 gorelenk * Changed GetObject to deref. operator - causes problems on MSVC7 * * Revision 1.11 2004/04/06 16:07:07 yazhuk * Made changes to menu and default settings * * Revision 1.10 2004/02/11 15:28:25 yazhuk * Replaced constructor with arguments with default constructor and Init() call * * Revision 1.9 2004/01/15 21:02:14 ucko * Remove redundant tokens (already supplied by *_MENU). * * Revision 1.8 2004/01/15 20:16:17 yazhuk * Added menu definition and menu setup code * * Revision 1.7 2004/01/07 17:39:04 vasilche * Fixed include path to genbank loader. * * Revision 1.6 2003/12/18 21:23:06 yazhuk * Support for display styles * * Revision 1.5 2003/10/29 23:34:51 yazhuk * Replaced CDemoMultiDS with new data source classes * * Revision 1.4 2003/10/10 19:10:11 yazhuk * Removed m_OldAlnWidget * * Revision 1.3 2003/09/25 20:49:17 yazhuk * Added CAlignDataSource::CreateConsensus() call * * Revision 1.2 2003/08/28 18:27:19 yazhuk * Modified to accomodate both old and new widgets * * Revision 1.1 2003/07/14 17:36:47 dicuccio * Initial revision * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?