val_progress.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: val_progress.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 20:57:14 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: val_progress.cpp,v 1000.1 2004/06/01 20:57: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: Mati Shomrat
- *
- * File Description:
- * A plugin wrap for the validator
- *
- */
- #include <ncbi_pch.hpp>
- #include <corelib/ncbistd.hpp>
- #include <FL/Fl.H>
- #include <FL/Fl_Window.H>
- #include <FL/Fl_Progress.H>
- #include <FL/Fl_Box.H>
- #include <FL/Fl_Button.H>
- #include "val_progress.hpp"
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- USING_SCOPE(objects::validator);
- CValProgress::CValProgress(void) :
- Fl_Double_Window(280, 130, "Validation Progress"),
- m_TotalText(0),
- m_TotalProgress(0),
- //m_CurrentText(0),
- //m_CurrentProgress(0),
- m_Total(0),
- m_TotalDone(0),
- m_Current(0),
- m_CurrentDone(0),
- m_State(CValidator::CProgressInfo::eState_not_set),
- m_Cancel(false)
- {
- set_modal();
- m_TotalText = new Fl_Box(20, 20, 100, 25, "Validating ...");
- m_TotalText->labelfont(FL_COURIER);
- m_TotalText->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
- m_TotalProgress = new Fl_Progress(20, 40, 235, 20, 0);
- /*
- m_CurrentText = new Fl_Box(20, 70, 100, 20, 0);
- m_CurrentText->labelfont(FL_COURIER);
- m_CurrentText->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
- m_CurrentProgress = new Fl_Progress(20, 90, 235, 20, 0);
- */
- Fl_Button* b = new Fl_Button(95, 85, 90, 25, "Cancel");
- b->callback((Fl_Callback*)x_OnCancelPressed, this);
- end();
- }
- CValProgress::~CValProgress(void)
- {
- }
-
-
- int CValProgress::handle(int event)
- {
- return Fl_Double_Window::handle(event);
- }
- void CValProgress::Update(CValidator::CProgressInfo* info)
- {
- if ( m_State != info->GetState() ) {
- if ( m_State == CValidator::CProgressInfo::eState_Initializing ) {
- m_TotalProgress->maximum(info->GetTotal());
- }
- m_State = info->GetState();
- }
- m_TotalProgress->value(info->GetTotalDone());
- }
- bool CValProgress::Cancel(void) const
- {
- return m_Cancel;
- }
- // Private:
- void CValProgress::x_OnCancelPressed(Fl_Button* b, void* user_data)
- {
- CValProgress* _this = reinterpret_cast<CValProgress*>(user_data);
- _this->OnCancelPressed();
- }
- void CValProgress::OnCancelPressed(void)
- {
- m_Cancel = true;
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: val_progress.cpp,v $
- * Revision 1000.1 2004/06/01 20:57:14 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- *
- * Revision 1.4 2004/05/21 22:27:48 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.3 2003/04/22 16:17:13 shomrat
- * Fl -> FL
- *
- * Revision 1.2 2003/04/18 19:15:00 shomrat
- * Code cleanup
- *
- *
- * ===========================================================================
- */