valview.cpp
来自「ncbi源码」· C++ 代码 · 共 255 行
CPP
255 行
/* * =========================================================================== * PRODUCTION $Log: valview.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 21:03:22 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * PRODUCTION * =========================================================================== *//* $Id: valview.cpp,v 1000.1 2004/06/01 21:03:22 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: * Main graphical view class for the validator * */#include <ncbi_pch.hpp>#include <corelib/ncbistd.hpp>#include <objtools/validator/validator.hpp>#include <FL/Fl_Double_Window.H>#include <FL/Fl_Menu_Item.H>#include <FL/Fl_Menu_Bar.H>#include <FL/Fl_Button.H>#include <FL/Fl_Return_Button.H>#include <FL/Fl_Box.H>#include <FL/Fl_Widget.H>#include <set>#include "valview.hpp"#include "filter.hpp"#include "valerror_display.hpp"BEGIN_NCBI_SCOPEUSING_SCOPE(objects::validator);Fl_Menu_Item CValidatorView::sm_Menutable[] = { {"&File", 0, 0, 0, FL_SUBMENU}, {"&Revalidate", FL_CTRL+'r', 0, 0, FL_MENU_DIVIDER}, {"&Close", 0, (Fl_Callback*)CValidatorView::cb_OnClose}, {0}, {"&Edit", 0, 0, 0, FL_SUBMENU}, {"Cu&t", FL_CTRL+'x'}, {"&Copy", FL_CTRL+'c'}, {"&Paste", FL_CTRL+'v', 0, 0, FL_MENU_DIVIDER}, {"&Options...", 0, 0, 0}, {0}, {0}};const int CValidatorView::sm_MinW = 400;const int CValidatorView::sm_MinH = 500;CValidatorView::CValidatorView(int w, int h) : Fl_Window(0, 0, w, h, "Validator View"), m_Filter(0), m_Display(0), m_CloseButton(0), m_RevalidateButton(0), m_Menubar(0), m_Errors(0){ box(FL_ENGRAVED_BOX); resizable(0); AddMenuBar(); AddFilter(); AddDisplay(); //resizable(m_Display); AddButtons(); m_Filter->SetDisplay(m_Display); end();}CValidatorView::~CValidatorView(void){}void CValidatorView::SetValidError(const CValidError& errors){ m_Errors.Reset(&errors); PopulateFilter(errors); m_Display->SetValidError(errors);}void CValidatorView::resize(int X, int Y, int W, int H){ if ( W < sm_MinW ) { W = sm_MinW; } if ( H < sm_MinH ) { H = sm_MinH; } Fl_Window::resize(X, Y, W, H);}void CValidatorView::cb_OnClose(Fl_Widget* w, void *user_data){ CValidatorView* _this = 0; if ( dynamic_cast<Fl_Button*>(w) ) { _this = static_cast<CValidatorView*>(user_data); } else if ( dynamic_cast<Fl_Menu_*>(w) ) { _this = static_cast<CValidatorView*>(w->user_data()); } if ( _this != 0 ) { _this->x_OnClose(); }}void CValidatorView::x_OnClose(void){ hide();}// Private:void CValidatorView::AddMenuBar(void){ m_Menubar = new Fl_Menu_Bar(1, 1, w()-2, 25, 0); m_Menubar->copy(sm_Menutable); m_Menubar->box(FL_ENGRAVED_BOX); m_Menubar->user_data(this);}void CValidatorView::AddFilter(void){ m_Filter = new CValidatorFilter(w() / 60, 5 * (h() / 70));}void CValidatorView::AddDisplay(void){ int fh = m_Filter->y() + m_Filter->h(); m_Display = new CValidErrorDisplay(10, fh + 20, w() - 20, h() - fh - 80);}void CValidatorView::AddButtons(void){ int H = 25; int X = x(); int Y = y() + h() - H - 5; int W = w(); Fl_Group* g = new Fl_Group(X, Y, W, H); new Fl_Box(X, Y, 10, H); AddRevalidateButton(X + 10, Y, 100, H); g->resizable(new Fl_Box(X + 110, Y, W - 110, H)); g->end(); //AddCloseButton(X, Y);}void CValidatorView::AddRevalidateButton(int X, int Y, int W, int H){ m_RevalidateButton = new Fl_Button(X, Y, W, H, "Revalidate");}void CValidatorView::AddCloseButton(int X, int Y, int W, int H){ m_CloseButton = new Fl_Return_Button(X, Y, W, H, "Close"); m_CloseButton->callback((Fl_Callback*)CValidatorView::cb_OnClose, this);}void CValidatorView::PopulateFilter(const CValidError& errors){ set<string> err_codes; err_codes.insert("All"); for ( CValidError_CI iter(errors); iter; ++iter ) { err_codes.insert(iter->GetErrCode()); } m_Filter->SetErrCodes(err_codes);}END_NCBI_SCOPE/* * =========================================================================== * * $Log: valview.cpp,v $ * Revision 1000.1 2004/06/01 21:03:22 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * * Revision 1.6 2004/05/21 22:27:50 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.5 2004/05/20 12:40:07 dicuccio * Use Fl_Window instead of CChild; include Fl_Window where necessary * * Revision 1.4 2003/10/10 17:20:29 dicuccio * Implemented OnExit() as callback for all views when closed from system icon * * Revision 1.3 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.2 2003/04/22 16:24:25 shomrat * Fl -> FL * * Revision 1.1 2003/04/18 19:57:31 shomrat * Initial revision * * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?