📄 plugin_table.cpp
字号:
/* * =========================================================================== * PRODUCTION $Log: plugin_table.cpp,v $ * PRODUCTION Revision 1000.3 2004/06/01 20:48:45 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.15 * PRODUCTION * =========================================================================== *//* $Id: plugin_table.cpp,v 1000.3 2004/06/01 20:48:45 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: * CPluginTable - multi-column list display for plugin information */#include <ncbi_pch.hpp>#include "plugin_table.hpp"#include <gui/core/plugin_registry.hpp>#include <gui/utils/fltk_utils.hpp>BEGIN_NCBI_SCOPEUSING_SCOPE(objects);CPluginTable::CPluginTable(int x, int y, int w, int h, const char* label) : CTablePanel<CPluginHandle>(x, y, w, h, label){ // // set up the actual columns for our internal data // SetColumn(eLibName, "Plugin Library", eString, FL_ALIGN_LEFT, 0.1f); SetColumn(eClassName, "Plugin", eString, FL_ALIGN_LEFT, 0.1f); SetColumn(ePluginType, "Type", eString, FL_ALIGN_CENTER, 0.1f); SetColumn(eLoaded, "Loaded?", eString, FL_ALIGN_CENTER, 0.1f); SetColumn(eEnabled, "Enabled?", eString, FL_ALIGN_CENTER, 0.1f); SetColumn(eDescription,"Description", eString, FL_ALIGN_LEFT, 0.4f); SetColumn(eVersion, "Version", eString, FL_ALIGN_LEFT, 0.1f); SetColumn(eBuildDate, "Build Date", eString, FL_ALIGN_LEFT, 0.1f); /** // set the default virtual columns // this defines the order in which all the columns appear m_VirtCols.push_back(eClassName); m_VirtCols.push_back(eDescription); m_VirtCols.push_back(ePluginType); m_VirtCols.push_back(eVersion); m_VirtCols.push_back(eLoaded); m_VirtCols.push_back(eEnabled); **/ Update();}CPluginTable::~CPluginTable(){}void CPluginTable::Update(){ int row = 0; CPluginRegistry::TPlugins algo_plugins = CPluginRegistry::GetPlugins(); SetRows(0); Reserve(algo_plugins.size()); NON_CONST_ITERATE (CPluginRegistry::TPlugins, algo_iter, algo_plugins) { CPluginHandle& plugin = *algo_iter; SetCell(row, eLibName, plugin.GetLibrary()); SetCell(row, eDescription, plugin.GetToolTip()); SetCell(row, eClassName, plugin.GetClassName()); SetCell(row, eLoaded, (plugin.IsLoaded() ? "yes" : "no")); SetCell(row, eEnabled, "yes"); SetCell(row, eVersion, NStr::IntToString(plugin.GetVerMajor()) + "." + NStr::IntToString(plugin.GetVerMinor()) + ", rev " + NStr::IntToString(plugin.GetVerRevision())); SetCell(row, eBuildDate, plugin.GetVerBuildDate()); switch (plugin.GetCommand()) { case CPluginCommandSet::e_Algo: SetCell(row, ePluginType, "algorithm"); break; case CPluginCommandSet::e_View: SetCell(row, ePluginType, "view"); break; case CPluginCommandSet::e_Data: SetCell(row, ePluginType, "data loader"); break; } SetData(row, plugin); ++row; } /** // clear the current table m_Data.clear(); // // algorithmic plugins // CPluginRegistry::TPlugins algo_plugins = CPluginRegistry::GetPlugins(); NON_CONST_ITERATE (CPluginRegistry::TPlugins, algo_iter, algo_plugins) { CPluginHandle& plugin = *algo_iter; TColumns cols(eMaxCols); cols[eLibName ] = plugin.GetLibrary(); cols[eDescription] = plugin.GetToolTip(); cols[eClassName ] = plugin.GetClassName(); cols[eLoaded ] = (plugin.IsLoaded() ? "yes" : "no"); cols[eEnabled ] = "yes"; cols[eVersion ] = NStr::IntToString(plugin.GetVerMajor()) + "." + NStr::IntToString(plugin.GetVerMinor()) + ", rev " + NStr::IntToString(plugin.GetVerRevision()); cols[eBuildDate ] = plugin.GetVerBuildDate(); switch (plugin.GetCommand()) { case CPluginCommandSet::e_Algo: cols[ePluginType] = "algorithm"; break; case CPluginCommandSet::e_View: cols[ePluginType] = "view"; break; case CPluginCommandSet::e_Data: cols[ePluginType] = "data loader"; break; } TRow row; row.m_Data = plugin; row.m_Columns = cols; m_Data.push_back(row); } **/ // finalize the view redraw();}int CPluginTable::handle(int event){ switch (event) { case FL_PUSH: // we ignore events bound to our internal popup state // this removes an artifact with selection mode - it protects our // selections when we popup our context menu if (CFltkEvent::GetProcessedEvent() != CFltkEvent::ePopupState) { // FIXME get_row(Fl::event_x(), Fl::event_y()) != -1) { break; } //ShowColSelectDlg(); break; } return CTablePanel<CPluginHandle>::handle(event);};END_NCBI_SCOPE/* * =========================================================================== * $Log: plugin_table.cpp,v $ * Revision 1000.3 2004/06/01 20:48:45 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.15 * * Revision 1.15 2004/05/21 22:27:42 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.14 2004/01/20 18:15:52 dicuccio * Changed to match new API in CTablePanel * * Revision 1.13 2003/12/04 18:12:54 dicuccio * Changed to match API change in CTablePanel * * Revision 1.12 2003/11/06 20:09:47 dicuccio * Added USING_SCOPE(objects) to implemnentation files * * Revision 1.11 2003/07/28 11:51:47 dicuccio * Rewrote CTablePanel<> to be more flexible and better contained. Added standard * multicolumn list dialog. Deprecated use of COutputDlg. * * Revision 1.10 2003/07/25 13:43:40 dicuccio * Replaced Flv_Table with Fl_Table * * Revision 1.9 2003/06/25 17:02:56 dicuccio * Split CPluginHandle into a handle (pointer-to-implementation) and * implementation file. Lots of #include file clean-ups. * * Revision 1.8 2003/03/21 17:02:17 dicuccio * Moved fltk_utils.hpp --> gui/utils. Added link against libgui_utils * * Revision 1.7 2003/03/11 15:18:57 kuznets * iterate -> ITERATE * * Revision 1.6 2003/02/25 14:48:16 dicuccio * Implemented most of the plugin manager dialog features. * * Revision 1.5 2003/02/24 13:03:19 dicuccio * Renamed classes in plugin spec: * CArgSeg --> CPluginArgSet * CArgument --> CPluginArg * CPluginArgs --> CPluginCommand * CPluginCommands --> CPluginCommandSet * * Revision 1.4 2003/02/20 19:50:47 dicuccio * Created new plugin architecture, based on ASN.1 spec. Moved GBENCH framework * over to use new architecture. * * Revision 1.3 2003/01/17 19:01:16 dicuccio * Added plugin description column * * Revision 1.2 2003/01/13 13:10:10 dicuccio * Namespace clean-up. Retired namespace gui -> converted all to namespace * ncbi. Moved all FLUID-generated code into namespace ncbi. * * Revision 1.1 2003/01/10 17:27:15 dicuccio * Added first pass at plugin manager dialog - displays information about the * currently loaded plugins, allows setting plugin paths via GUI * * =========================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -