⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plugin_mgr_dlg.cpp

📁 ncbi源码
💻 CPP
字号:
/* * =========================================================================== * PRODUCTION $Log: plugin_mgr_dlg.cpp,v $ * PRODUCTION Revision 1000.2  2004/06/01 20:48:34  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13 * PRODUCTION * =========================================================================== *//*  $Id: plugin_mgr_dlg.cpp,v 1000.2 2004/06/01 20:48:34 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 portion of the plugin manager dialog */#include <ncbi_pch.hpp>#include "plugin_mgr_dlg.hpp"#include "scanner_output_dlg.hpp"#include <corelib/ncbiapp.hpp>#include <corelib/ncbireg.hpp>#include <gui/dialogs/file_browser.hpp>BEGIN_NCBI_SCOPE// Include the *_.cpp file to avoid compilation issues with gcc#include "plugin_mgr_dlg_.cpp"CPluginMgrDlg::CPluginMgrDlg(){    m_Window.reset(x_CreateWindow());}void CPluginMgrDlg::Show(){    // call the base class first    CDialog::Show();    // now correct any paths we need to    if (m_Window.get()) {        m_PathsList->clear();        // fill the list of search paths from the config file        CNcbiApplication* app = CNcbiApplication::Instance();        _ASSERT(app);        const CNcbiRegistry& reg = app->GetConfig();        string search_path = reg.Get("app", "plugin_path");        if ( !search_path.empty() ) {            list<string> paths;            NStr::Split(search_path, ", ", paths);            ITERATE (list<string>, iter, paths) {                m_PathsList->add(iter->c_str());            }        }    }}void CPluginMgrDlg::x_OnPathUp(){    int start = -1;    int stop = -1;    for (int i = 1;  i < m_PathsList->size()+1;  ++i) {        if ( m_PathsList->selected(i)  &&  start == -1) {            start = i;        } else if ( !m_PathsList->selected(i)  &&  start != -1) {            stop = i - 1;            break;        }    }    if (start <= 1) {        return;    }    if (stop == -1) {        stop = m_PathsList->size();    }    string path = m_PathsList->text(start - 1);    m_PathsList->insert(stop + 1, path.c_str());    m_PathsList->remove(start - 1);}void CPluginMgrDlg::x_OnPathDown(){    int start = -1;    int stop = -1;    for (int i = 1;  i < m_PathsList->size()+1;  ++i) {        if ( m_PathsList->selected(i)  &&  start == -1) {            start = i;        } else if ( !m_PathsList->selected(i)  &&  start != -1) {            stop = i - 1;            break;        }    }    if (start == -1) {        return;    }    if (stop == -1  ||  stop >= m_PathsList->size() + 1) {        return;    }    string path = m_PathsList->text(stop + 1);    m_PathsList->remove(stop + 1);    m_PathsList->insert(start, path.c_str());}void CPluginMgrDlg::x_OnAddPath(){    string path = NcbiDirBrowser("Select a plugin directory", "");    if ( path.empty() ) {        return;    }    // append the path to the paths list    m_PathsList->add(path.c_str());    // add the path to the registry    CNcbiApplication* app = CNcbiApplication::Instance();    _ASSERT(app);    CNcbiRegistry& reg = app->GetConfig();    reg.Set("app", "plugin_path",            x_ListToPluginPath(), CNcbiRegistry::ePersistent);}void CPluginMgrDlg::x_OnRemovePath(){    for (int i = 0;  i <= m_PathsList->size();  ++i) {        if ( !m_PathsList->selected(i) ) {            continue;        }        m_PathsList->remove(i);        --i;    }    // add the path to the registry    CNcbiApplication* app = CNcbiApplication::Instance();    _ASSERT(app);    CNcbiRegistry& reg = app->GetConfig();    reg.Set("app", "plugin_path",            x_ListToPluginPath(), CNcbiRegistry::ePersistent);}void CPluginMgrDlg::x_OnRescanPlugins(){    if ( !m_OutputDlg.get() ) {        m_OutputDlg.reset(new CScannerOutputDlg());    }        m_OutputDlg->Show(x_ListToPluginPath());}void CPluginMgrDlg::x_OnToggleEnable(){}string CPluginMgrDlg::x_ListToPluginPath(){    string ret_val;    for (int i = 1;  i <= m_PathsList->size();  ++i) {        if ( !ret_val.empty() ) {            ret_val += ", ";        }        ret_val += m_PathsList->text(i);    }    return ret_val;}END_NCBI_SCOPE/* * =========================================================================== * $Log: plugin_mgr_dlg.cpp,v $ * Revision 1000.2  2004/06/01 20:48:34  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13 * * Revision 1.13  2004/05/21 22:27:42  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.12  2004/03/11 17:35:05  dicuccio * Use new file/dir browser * * Revision 1.11  2003/09/29 15:33:15  dicuccio * Inherit dialog from CDialog * * Revision 1.10  2003/08/22 15:46:43  dicuccio * Removed config file from CSettings - accessible through CNcbiApplication * * 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/05/07 17:56:25  dicuccio * Must add plugin path to list *before* saving the list contents to the * registry file... * * Revision 1.7  2003/04/29 14:51:52  dicuccio * Reworked FLUID-generated code: more explicit control over constructor, better * memeory management * * Revision 1.6  2003/03/25 13:15:48  dicuccio * Implemented removal of plugin path elements.  Changed addition to use * standard path formatting function * * Revision 1.5  2003/03/11 15:18:57  kuznets * iterate -> ITERATE * * Revision 1.4  2003/02/26 19:23:47  dicuccio * Added dialog for 'gbench_plugin_scan' output * * Revision 1.3  2003/02/25 14:48:16  dicuccio * Implemented most of the plugin manager dialog features. * * 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 + -