view_val_plg.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:7k
- /*
- * ===========================================================================
- * PRODUCTION $Log: view_val_plg.cpp,v $
- * PRODUCTION Revision 1000.4 2004/06/01 21:03:26 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.17
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: view_val_plg.cpp,v 1000.4 2004/06/01 21:03:26 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: Mati Shomrat
- *
- * File Description:
- *
- */
- #include <ncbi_pch.hpp>
- #include "valview.hpp"
- #include "view_val_plg.hpp"
- #include <FL/Fl.H>
- #include <FL/Fl_Window.H>
- #include <corelib/ncbistd.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/utils/message_box.hpp>
- #include <objects/seqset/Seq_entry.hpp>
- #include <objtools/validator/validator.hpp>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- USING_SCOPE(validator);
-
- void CViewValidator::GetInfo(CPluginInfo& info)
- {
- info.Reset();
- // version info macro
- info.SetInfo(CPluginVersion::eMajor, CPluginVersion::eMinor, 0,
- string(__DATE__) + " " + string(__TIME__),
- "CViewValidator",
- "",
- "Default validator viewer",
- "");
- // command info
- CPluginCommand& cmd =
- info.SetCommands().AddViewCommand(eViewCommand_new_view);
- cmd.AddArgument("errors", "Validation errors",
- CPluginArg::eObject);
- // The following arguments are needed for re-validation
- cmd.AddOptionalArgument("object", "The validated object",
- CSeq_entry::GetTypeInfo());
- cmd.AddOptionalArgument("scope", "Scope of validation",
- CPluginArg::eObject );
- cmd.AddOptionalArgument("options", "Options for validation",
- CPluginArg::eInteger);
- }
- static void s_ExitCallback(Fl_Widget* w, void* data)
- {
- CViewValidator* view = static_cast<CViewValidator*>(data);
- if (view) {
- view->OnExit();
- }
- }
- CViewValidator::CViewValidator(const CPluginMessage& msg, const string& pool)
- : CView(),
- m_ValidatorWindow(0)
- {
- const CPluginCommand& args = msg.GetRequest().GetCommand();
- if ( CPluginUtils::IsValid(args["errors"]) ) {
- const CValidError& errors =
- dynamic_cast<const CValidError&>(args["errors"].AsObject());
- if ( errors.TotalSize() == 0 ) {
- NcbiMessageBox("Validation succeeded!", eDialog_Ok, eIcon_Info);
- } else {
- m_ValidatorWindow = new CValidatorView;
- m_Window.reset(m_ValidatorWindow);
- m_Window->callback(s_ExitCallback, this);
- m_ValidatorWindow->SetValidError(errors);
- x_SetDocument(args["document"].AsDocument());
- }
- } else {
- // throw exception;
- }
- }
-
- CViewValidator::~CViewValidator(void)
- {
- }
- void CViewValidator::Update(TUpdateFlags flags)
- {
- }
- const string& CViewValidator::GetTitle() const
- {
- static string s_str("Validator View");
- return s_str;
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: view_val_plg.cpp,v $
- * Revision 1000.4 2004/06/01 21:03:26 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.17
- *
- * Revision 1.17 2004/05/21 22:27:50 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.16 2004/05/20 12:40:07 dicuccio
- * Use Fl_Window instead of CChild; include Fl_Window where necessary
- *
- * Revision 1.15 2004/04/07 13:05:11 dicuccio
- * Changed view API - require CPluginMessage instead of CPluginArgSet
- *
- * Revision 1.14 2003/11/24 15:45:48 dicuccio
- * Renamed CVersion to CPluginVersion
- *
- * Revision 1.13 2003/11/20 13:19:19 dicuccio
- * Fixed calling parameters for views to match new requirements - pass view's message pool name as second param
- *
- * Revision 1.12 2003/10/10 17:20:29 dicuccio
- * Implemented OnExit() as callback for all views when closed from system icon
- *
- * Revision 1.11 2003/09/04 14:54:24 dicuccio
- * Use IDocument instead of CDocument. Changed APIs to match changes in IView
- *
- * Revision 1.10 2003/07/23 19:14:10 dicuccio
- * Moved logic for validating plugin arguments into CPluginUtils.
- *
- * Revision 1.9 2003/07/14 14:59:02 shomrat
- * Removed menu item description
- *
- * Revision 1.8 2003/06/25 17:03:02 dicuccio
- * Split CPluginHandle into a handle (pointer-to-implementation) and
- * implementation file. Lots of #include file clean-ups.
- *
- * Revision 1.7 2003/06/20 14:53:54 dicuccio
- * Revised plugin registration - moved GetInfo() into the plugin handler
- *
- * Revision 1.6 2003/06/02 16:06:25 dicuccio
- * Rearranged src/objects/ subtree. This includes the following shifts:
- * - src/objects/asn2asn --> arc/app/asn2asn
- * - src/objects/testmedline --> src/objects/ncbimime/test
- * - src/objects/objmgr --> src/objmgr
- * - src/objects/util --> src/objmgr/util
- * - src/objects/alnmgr --> src/objtools/alnmgr
- * - src/objects/flat --> src/objtools/flat
- * - src/objects/validator --> src/objtools/validator
- * - src/objects/cddalignview --> src/objtools/cddalignview
- * In addition, libseq now includes six of the objects/seq... libs, and libmmdb
- * replaces the three libmmdb? libs.
- *
- * Revision 1.5 2003/05/30 14:15:44 dicuccio
- * Renamed MessageBox to NcbiMessageBox because brain-dead MSVC thinks this is
- * ::MessageBox and rewrites the symbol as MessageBoxA, which results in an
- * unresolved external and conflict with the Win32 API :(.
- *
- * Revision 1.4 2003/05/30 13:04:14 dicuccio
- * Use MessageBox() instead of fl_message()
- *
- * Revision 1.3 2003/05/01 19:04:11 shomrat
- * Added call to set the view's document
- *
- * Revision 1.2 2003/04/22 16:24:05 shomrat
- * Fl -> FL
- *
- * Revision 1.1 2003/04/18 19:57:41 shomrat
- * Initial revision
- *
- *
- * ===========================================================================
- */