📄 load_file.cpp
字号:
/* * =========================================================================== * PRODUCTION $Log: load_file.cpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 20:48:14 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5 * PRODUCTION * =========================================================================== *//* $Id: load_file.cpp,v 1000.2 2004/06/01 20:48:14 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: Josh Cherry * * File Description: Load a file by calling CFileLoader gbench plugin * */#include <ncbi_pch.hpp>#include "load_file.hpp"#include "gbench.hpp"#include <gui/core/plugin_registry.hpp>#include <gui/plugin/PluginMessage.hpp>#include <gui/plugin/PluginValue.hpp>BEGIN_NCBI_SCOPEUSING_SCOPE(objects);/// Load a file by calling CFileLoader gbench pluginvoid GBenchLoadFile(const string& fname, const string& ftype, bool do_view){ CPluginHandle handle = CPluginRegistry::GetPlugin("CFileLoader"); CRef<CPluginMessage> msg(new CPluginMessage); CPluginRequest& request = msg->SetRequest(); handle.FillDefaults(eDataCommand_load, request.SetData()); request.SetData()["file"].SetFile(fname); string orig_fmt = request.GetData()["fmt"].AsString(); request.SetData()["fmt"].SetString(ftype); handle.Execute(*msg); request.SetData()["fmt"].SetString(orig_fmt); CGBenchApp::Raise(); if (do_view) { // launch default viewer(s) const CPluginReply& reply = msg->GetReply(); if (reply.CanGetRaw()) { ITERATE (CPluginReply::TRaw, iter, reply.GetRaw()) { if (!(*iter)->IsDocument()) { continue; } GBenchViewDefault(*(*iter)->GetDocument()); } } }}/// Launch default viewer for a document by calling pluginvoid GBenchViewDefault(const IDocument& document){ CPluginHandle handle = CPluginRegistry::GetPlugin("CAlgoPlugin_ViewDefault"); CRef<CPluginMessage> msg(new CPluginMessage); CPluginRequest& request = msg->SetRequest(); handle.FillDefaults(eAlgoCommand_run, request.SetData()); request.SetData()["document"].SetDocument(document); handle.Execute(*msg);}END_NCBI_SCOPE/* * =========================================================================== * $Log: load_file.cpp,v $ * Revision 1000.2 2004/06/01 20:48:14 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5 * * Revision 1.5 2004/05/21 22:27:42 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.4 2004/04/16 14:40:05 dicuccio * Added call to Raise() after loading a file * * Revision 1.3 2004/03/22 15:40:20 jcherry * Added file type command-line argument * * Revision 1.2 2004/03/15 16:06:18 jcherry * Launch default viewer when opening file from command line * * Revision 1.1 2004/03/11 19:24:44 jcherry * Initial version (moved from gui/utils) * * =========================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -