view_fasta.cpp

来自「ncbi源码」· C++ 代码 · 共 256 行

CPP
256
字号
/* * =========================================================================== * PRODUCTION $Log: view_fasta.cpp,v $ * PRODUCTION Revision 1000.5  2004/06/01 21:02:38  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * PRODUCTION * =========================================================================== *//*  $Id: view_fasta.cpp,v 1000.5 2004/06/01 21:02:38 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 "view_fasta.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>BEGIN_NCBI_SCOPEUSING_SCOPE(objects);#include "view_fasta_.cpp"void CViewFasta::GetInfo(CPluginInfo& info){    info.Reset();    // version info macro    info.SetInfo(CPluginVersion::eMajor, CPluginVersion::eMinor, 0,                 string(__DATE__) + " " + string(__TIME__),                 "CViewFasta", "Text/FastA Sequence View",                 "View the selected sequence in FastA format", "");    // command info    CPluginCommandSet& cmds = info.SetCommands();    CPluginCommand&    args = cmds.AddViewCommand(eViewCommand_new_view);    args.AddArgument("loc", "Seq-loc of the record we wish to display",                     CSeq_loc::GetTypeInfo());}CViewFasta::CViewFasta(const CPluginMessage& msg, const string& pool_name)    : CView()    , m_CurrentFont(FL_COURIER)    , m_CurrentFontSize(12){    m_Window.reset(x_CreateWindow());    m_Buffer.reset(new Fl_Text_Buffer());    m_Text->buffer(m_Buffer.get());    m_Text->textfont(m_CurrentFont);    m_Text->textsize(m_CurrentFontSize);    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["loc"];    const IDocument* doc = arg.GetDocument();    const CSeq_loc* loc =        dynamic_cast<const CSeq_loc*> (arg.GetObject());    // assign to our core components    if (doc  &&  loc) {        x_SetDocument(*doc);        m_SeqLoc.Reset(loc);        m_DataSource.Reset            (new CFastaTextDS(doc->GetScope().GetBioseqHandle(*loc), *loc));        m_Text->SetDataSource(*m_DataSource);    }}CViewFasta::~CViewFasta(){    m_Window.reset();    m_Buffer.reset();}void CViewFasta::OnDocumentChanged(){    if (m_Text) {        m_Text->Update();    }    // retrieve a nice title    SetTitle(x_GetTitle(m_DataSource->GetBioseqHandle()));    m_Window->redraw();    if ( !GetSelBuffer() ) {        SetSelBuffer().AddSelection(m_Document, *m_SeqLoc);    }    m_ViewMenuMgr->AddActiveViews(m_Document);    m_ViewMenuMgr->AddNewViews();//   (m_Document);}const string& CViewFasta::GetTitle(void) const{    static string s_str("FastA Text View");    return s_str;}void CViewFasta::x_OnFontHelvetica(){    m_CurrentFont = FL_HELVETICA;    m_Text->textfont(FL_HELVETICA);    m_Text->redraw();    m_TextFont->value(0);    m_TextFont->redraw();}void CViewFasta::x_OnFontTimes(){    m_CurrentFont = FL_TIMES;    m_Text->textfont(FL_TIMES);    m_Text->redraw();    m_TextFont->value(1);    m_TextFont->redraw();}void CViewFasta::x_OnFontCourier(){    m_CurrentFont = FL_COURIER;    m_Text->textfont(FL_COURIER);    m_Text->redraw();    m_TextFont->value(2);    m_TextFont->redraw();}void CViewFasta::x_OnFontSmall(){    m_CurrentFontSize = 10;    m_Text->textsize(10);    m_Text->redraw();    m_TextSize->value(0);    m_TextSize->redraw();}void CViewFasta::x_OnFontNormal(){    m_CurrentFontSize = 12;    m_Text->textsize(12);    m_Text->redraw();    m_TextSize->value(1);    m_TextSize->redraw();}void CViewFasta::x_OnFontLarge(){    m_CurrentFontSize = 14;    m_Text->textsize(14);    m_Text->redraw();    m_TextSize->value(2);    m_TextSize->redraw();}//// help submenu//void CViewFasta::x_OnHelpTextViewHelp(){}END_NCBI_SCOPE/* * =========================================================================== * $Log: view_fasta.cpp,v $ * Revision 1000.5  2004/06/01 21:02:38  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * * Revision 1.9  2004/05/21 22:27:50  gorelenk * Added PCH ncbi_pch.hpp * * 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/02/17 13:53:06  dicuccio * Enabled copy/paste for FASTA view * * Revision 1.5  2004/01/22 17:44:47  dicuccio * Use CConn_MemoryStream instead of CNcbiOstrstream for in-code streaming * * Revision 1.4  2003/12/22 19:35:40  dicuccio * Updated to match new APIs in IView.  Added taxonomy tree / common tree browser * * 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:21  dicuccio * Split text views into three components * * =========================================================================== */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?