view_genbank.cpp
来自「ncbi源码」· C++ 代码 · 共 260 行
CPP
260 行
/* * =========================================================================== * PRODUCTION $Log: view_genbank.cpp,v $ * PRODUCTION Revision 1000.5 2004/06/01 21:02:48 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10 * PRODUCTION * =========================================================================== *//* $Id: view_genbank.cpp,v 1000.5 2004/06/01 21:02:48 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 implementation file for extension of basic text viewer */#include <ncbi_pch.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/PluginInfo.hpp>#include <gui/plugin/PluginValue.hpp>#include <objects/seq/Bioseq.hpp>#include <objects/seqset/Seq_entry.hpp>#include <objmgr/util/sequence.hpp>#include <objtools/format/flat_file_generator.hpp>#include <serial/serial.hpp>#include <serial/objostrasn.hpp>#include "genbank_ff_formatter.hpp"#include "view_genbank.hpp"#include "paragraph.hpp"BEGIN_NCBI_SCOPEUSING_SCOPE(objects);#include "view_genbank_.cpp"void CViewGenbank::GetInfo(CPluginInfo& info){ info.Reset(); // version info macro info.SetInfo(CPluginVersion::eMajor, CPluginVersion::eMinor, 0, string(__DATE__) + " " + string(__TIME__), "CViewGenbank", "Text/Flat-File View", "GenBank Flat-File Text Viewer", ""); // command info CPluginCommandSet& cmds = info.SetCommands(); CPluginCommand& args = cmds.AddViewCommand(eViewCommand_new_view); args.AddArgument("id", "Seq-id of the record we wish to display", CSeq_id::GetTypeInfo());}CViewGenbank::CViewGenbank(const CPluginMessage& msg, const string& pool_name) : CView() , m_CurrentFont(FL_COURIER) , m_CurrentFontSize(12){ m_Window.reset(x_CreateWindow()); m_TextSize->value(1); m_TextFont->value(2); // create our view menu manager m_ViewMenuMgr.reset(new CViewMenuMgr(m_Menu, "View", this, pool_name)); // decode the argument const CPluginCommand& args = msg.GetRequest().GetCommand(); const CPluginArg& arg = args["id"]; const IDocument* doc = arg.GetDocument(); const CSeq_id* id = dynamic_cast<const CSeq_id*> (arg.GetObject()); // assign to our core components if (doc && id) { x_SetDocument(*doc); m_SeqId.Reset(id); }}void CViewGenbank::OnDocumentChanged(){ // Clear the m_Editor scroll widget m_EditPack->clear(); CBioseq_Handle handle = m_Document->GetScope().GetBioseqHandle(*m_SeqId); if (handle) { // Genbank format CFlatFileGenerator ffg; CRef<CGenbankEditOStream> os(new CGenbankEditOStream(this)); ffg.Generate(handle.GetParentEntry(), *os); } // retrieve a nice title SetTitle(x_GetTitle(handle)); m_Window->redraw(); if ( !GetSelBuffer() ) { SetSelBuffer().AddSelection(m_Document, *m_SeqId); } m_ViewMenuMgr->AddActiveViews(m_Document); m_ViewMenuMgr->AddNewViews();// (m_Document);}void CViewGenbank::AddToEditPack (CParagraph* p){ if ( p == 0 ) { return; } //int h = m_EditPack->h() + p->h(); //m_EditPack->size (m_EditPack->w(), h); p->SetSection (m_EditPack); m_EditPack->add ((Fl_Widget*)p);}const string& CViewGenbank::GetTitle(void) const{ static string s_str("Flat-File View"); return s_str;}void CViewGenbank::x_OnFontHelvetica(){ m_CurrentFont = FL_HELVETICA; m_TextFont->value(0); m_TextFont->redraw();}void CViewGenbank::x_OnFontTimes(){ m_CurrentFont = FL_TIMES; m_TextFont->value(1); m_TextFont->redraw();}void CViewGenbank::x_OnFontCourier(){ m_CurrentFont = FL_COURIER; m_TextFont->value(2); m_TextFont->redraw();}void CViewGenbank::x_OnFontSmall(){ m_CurrentFontSize = 10; m_TextSize->value(0); m_TextSize->redraw();}void CViewGenbank::x_OnFontNormal(){ m_CurrentFontSize = 12; m_TextSize->value(1); m_TextSize->redraw();}void CViewGenbank::x_OnFontLarge(){ m_CurrentFontSize = 14; m_TextSize->value(2); m_TextSize->redraw();}//// help submenu//void CViewGenbank::x_OnHelpTextViewHelp(){}END_NCBI_SCOPE/* * =========================================================================== * $Log: view_genbank.cpp,v $ * Revision 1000.5 2004/06/01 21:02:48 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10 * * Revision 1.10 2004/05/21 22:27:50 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.9 2004/04/22 16:05:51 shomrat * CFlatFileGenerator initialization change * * Revision 1.8 2004/04/16 14:47:57 dicuccio * Use appropriate ISelection interface for dynamic menus * * Revision 1.7 2004/04/07 13:05:11 dicuccio * Changed view API - require CPluginMessage instead of CPluginArgSet * * Revision 1.6 2004/03/26 14:14:56 shomrat * Use new API * * Revision 1.5 2003/12/22 19:35:41 dicuccio * Updated to match new APIs in IView. Added taxonomy tree / common tree browser * * Revision 1.4 2003/12/18 14:06:28 shomrat * using format library instead of flat * * Revision 1.3 2003/11/24 15:45:47 dicuccio * Renamed CVersion to CPluginVersion * * Revision 1.2 2003/11/20 13:19:18 dicuccio * Fixed calling parameters for views to match new requirements - pass view's message pool name as second param * * Revision 1.1 2003/11/04 17:27:22 dicuccio * Split text views into three components * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?