- /*
- * ===========================================================================
- * PRODUCTION $Log: visible_range_dlg.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 21:01:35 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: visible_range_dlg.cpp,v 1000.1 2004/06/01 21:01:35 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: Lou Friedman
- *
- * File Description:
- * Visible range change dialog.
- *
- */
- #include <ncbi_pch.hpp>
- #include "visible_range_dlg.hpp"
- BEGIN_NCBI_SCOPE
- #include "visible_range_dlg_.cpp"
- CVisibleRangeDialog::CVisibleRangeDialog(TSeqPos scroll_to, TSeqPos seq_size)
- {
- m_Window.reset(x_CreateScrollToWindow());
- m_ScrollTo->value(NStr::UIntToString(scroll_to).c_str());
- m_SeqSizeBuffer = NStr::UIntToString(seq_size).c_str();
- m_ScrollToSize->label(m_SeqSizeBuffer.c_str());
- }
- CVisibleRangeDialog::CVisibleRangeDialog(TSeqPos seq_size)
- {
- m_Window.reset(x_CreateRangeWindow());
- m_SeqSizeBuffer = NStr::UIntToString(seq_size).c_str();
- m_SeqSize->label(m_SeqSizeBuffer.c_str());
- }
- TSeqRange CVisibleRangeDialog::GetRange()
- {
- TSeqRange range;
- range.SetFrom(NStr::StringToUInt(m_From->value()));
- range.SetTo (NStr::StringToUInt(m_To->value ()));
- return range;
- }
- void CVisibleRangeDialog::SetRange(TSeqRange range)
- {
- m_From->value(NStr::UIntToString(range.GetFrom()).c_str());
- m_To-> value(NStr::UIntToString(range.GetTo ()).c_str());
- }
- TSeqPos CVisibleRangeDialog::GetScrollTo()
- {
- return NStr::StringToUInt(m_ScrollTo->value());
- }
- void CVisibleRangeDialog::x_OnToInput()
- {
- if (strlen(m_To->value()) == 0) {
- return;
- }
- if (NStr::StringToUInt(m_To->value()) > atoi(m_SeqSize->label())) {
- m_ToErrorMsg->show();
- m_ToLabel->labelcolor(FL_RED);
- m_ToLabel->redraw();
- } else {
- m_ToErrorMsg->hide();
- m_ToLabel->labelcolor(FL_BLACK);
- m_ToLabel->redraw();
- }
- }
- void CVisibleRangeDialog::x_OnScrollToInput()
- {
- if (NStr::StringToUInt(m_ScrollTo->value()) >
- atoi(m_ScrollToSize->label())) {
- m_ScrollToErrorMsg->show();
- m_ScrollToLabel->labelcolor(FL_RED);
- m_ScrollToLabel->redraw();
- } else {
- m_ScrollToErrorMsg->hide();
- m_ScrollToLabel->labelcolor(FL_BLACK);
- m_ScrollToLabel->redraw();
- }
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: visible_range_dlg.cpp,v $
- * Revision 1000.1 2004/06/01 21:01:35 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- *
- * Revision 1.4 2004/05/21 22:27:49 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.3 2004/03/11 17:47:23 dicuccio
- * Use TSeqRange instead of TRange
- *
- * Revision 1.2 2003/12/22 13:34:10 friedman
- * Added new dialog for the scroll to visible range method
- *
- * Revision 1.1 2003/12/03 22:22:21 friedman
- * Initial revision
- *
- * ===========================================================================
- */