seqgraphic_widget.cpp

来自「ncbi源码」· C++ 代码 · 共 687 行 · 第 1/2 页

CPP
687
字号
{    CFltkCursorGuard WAIT_GUARD;    m_SearchStr = m_SearchInput->value();    //    // try numeric first    //    try {        list<string> toks;        NStr::Split(m_SearchStr, ", -:", toks);        if (toks.size() <= 2) {            TSeqPos pos = NStr::StringToInt(toks.front());            TSeqPos pos_end = pos + 100;            if (toks.size() == 2) {                pos_end = NStr::StringToInt(toks.back());            } else if (pos >= 100) {                pos -= 100;            }            m_SeqGraphicPane->ZoomOnRange(TSeqRange(pos, pos_end));            redraw();        }        return;    }    catch (...) {    }    //    // fall back to feature label search    //    m_SearchCount =        m_SeqGraphicPane->SearchFeature(m_SearchStr,                                        m_SearchChoice->text(),                                        m_RangeChoice->value() == eVisible);    m_PrevButton->deactivate();    if (m_SearchCount > 1)         m_NextButton->activate();    else         m_NextButton->deactivate();        x_UpdateSearchMsg( 0 );}void CSeqGraphicWidget::x_PrevCB(){    int pos = m_SeqGraphicPane->SearchFeaturePrev();    m_NextButton->activate();    if (pos > 0)         m_PrevButton->activate();    else         m_PrevButton->deactivate();        x_UpdateSearchMsg(pos);}void CSeqGraphicWidget::x_NextCB(){    int pos = m_SeqGraphicPane->SearchFeatureNext();    m_PrevButton->activate();    if (pos < m_SearchCount - 1) {        m_NextButton->activate();    } else {        m_NextButton->deactivate();    }    x_UpdateSearchMsg(pos);}    void CSeqGraphicWidget::x_UpdateSearchMsg(int pos){    string msg = m_SearchStr + ": " + (m_SearchCount == 0 ? "Nothing found" :             "Found: " + NStr::UIntToString(pos+1) + "/" +            NStr::UIntToString(m_SearchCount) +            " feature(s)");        m_SearchInput->value( msg.c_str() );}void CSeqGraphicWidget::SetZoomX(float value){    m_SeqGraphicPane->SetZoomX(value);}void CSeqGraphicWidget::ZoomOnRange(const TSeqRange& range){    m_SeqGraphicPane->ZoomOnRange(range);}TSeqRange CSeqGraphicWidget::GetVisibleRange() const{    return m_SeqGraphicPane->GetVisibleRange();}bool CSeqGraphicWidget::VisibleRangeChanged() const{    return m_SeqGraphicPane->VisibleRangeChanged();}void CSeqGraphicWidget::ResetVisibleRangeChanged(){    m_SeqGraphicPane->ResetVisibleRangeChanged();}void CSeqGraphicWidget::SetDataSource(CSeqGraphicDataSource* ds){    m_SeqGraphicPane->SetDataSource(ds);}void CSeqGraphicWidget::Print(const CPrintOptions& opts){    _TRACE("CSeqGraphicWidget::Print()");    m_SeqGraphicPane->Print(opts);}// Set/Clear selectionvoid CSeqGraphicWidget::SelectObject(const CObject* obj){    m_SeqGraphicPane->SelectObject(obj);}void CSeqGraphicWidget::SelectSeqLoc(const CSeq_loc* loc){    m_SeqGraphicPane->SelectSeqLoc(loc);}void CSeqGraphicWidget::ClearSelection(){    m_SeqGraphicPane->ClearSelection();}    // retrieve selected objects from this widgetconst TConstObjects& CSeqGraphicWidget::GetSelectedObjects(void) const{    return m_SeqGraphicPane->GetSelectedObjects();}// retrieve selected seq-locs from this object// this is only for selections of raw sequence, not for seq-locs// arising from features, for example.vector< CRef<CSeq_loc> >CSeqGraphicWidget::GetSelectedSeqLocs(void) const{    vector< CRef<CSeq_loc> > locs;    const CSeqGraphicPane::TRangeColl& ranges =                 m_SeqGraphicPane->GetSelectedSeqRanges();    ITERATE (CSeqGraphicPane::TRangeColl, iter, ranges) {        CRef<CSeq_loc> loc(new CSeq_loc());        loc->SetInt().SetFrom(iter->GetFrom());        loc->SetInt().SetTo  (iter->GetTo());        loc->SetInt().SetId().Assign            (*m_SeqGraphicPane->GetDataSource()->GetBioseqHandle().GetSeqId());        locs.push_back(loc);    }    return locs;}void CSeqGraphicWidget::SetConfig(CRef<CSeqGraphicConfig> config){    m_SeqGraphicPane->SetConfig(config);}void CSeqGraphicWidget::UpdateConfig(){    m_SeqGraphicPane->UpdateConfig();    redraw();}void CSeqGraphicWidget::redraw(){    m_SeqGraphicPane->redraw();    Fl_Group::redraw();}END_NCBI_SCOPE/* * =========================================================================== * $Log: seqgraphic_widget.cpp,v $ * Revision 1000.2  2004/06/01 21:12:59  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13 * * Revision 1.13  2004/05/21 22:27:55  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.12  2004/04/16 14:53:04  dicuccio * Pass objects using TConstObjects, not TObjSelections.  Added ISelection * interfaces. * * Revision 1.11  2004/03/12 15:57:32  lebedev * Implemented CCommandTarget interface, so the widget * can use command maps * * Revision 1.10  2004/03/11 17:53:06  dicuccio * Deprecated typedefs TPosition, TDimension, TIndex, TColor.  Use TSeqRange instead of TRange * * Revision 1.9  2004/02/13 18:11:32  lebedev * Use SeqGraphic config for enabling/disabling viewing options * * Revision 1.8  2004/02/10 13:15:34  lebedev * ISelHandlerHost interface implemented for selections on sequence pane * * Revision 1.7  2004/01/27 16:14:43  lebedev * Methods for working with selections added * * Revision 1.6  2004/01/20 20:35:31  rsmith * Add UpdateConfig method to notify classes when the configuration object has changed. * * Revision 1.5  2004/01/20 14:07:38  rsmith * use feat_config_list.hpp not feat_config. * * Revision 1.4  2004/01/14 20:31:35  rsmith * make feature type menu hierarchical. * * Revision 1.3  2004/01/06 20:53:05  dicuccio * Added CFltkCursorGuard to the search function * * Revision 1.2  2004/01/05 19:14:18  dicuccio * Added ability to jump to sequence location in search bar * * Revision 1.1  2003/12/22 12:59:01  lebedev * Files renamed * * Revision 1.27  2003/11/20 19:58:57  friedman * Changed the zoom slider and the horizontal scrollbar and their callbacks  * to invoke the view callback on release only * * Revision 1.26  2003/11/19 20:37:46  friedman * API to detect and reset visible range change * * Revision 1.25  2003/11/18 20:35:32  rsmith * Perculate redraw down to lower levels. Allow config object to live at the plugin level. * * Revision 1.24  2003/11/13 17:32:51  friedman * Fixed compiltion error. GetVisibleRange needs a return statement * * Revision 1.23  2003/11/13 15:31:53  lebedev * Methods to get visible sequence range added * * Revision 1.22  2003/11/06 20:15:15  dicuccio * Added USING_SCOPE(objects) to implementation file * * Revision 1.21  2003/10/30 13:21:59  lebedev * Display of master sequence under selected CDSs and Proteins added * * Revision 1.20  2003/10/28 15:29:07  lebedev * Use new configuration library * * Revision 1.19  2003/10/24 13:21:53  lebedev * ZoomOnRange method added * * Revision 1.18  2003/10/10 17:21:22  dicuccio * Changed box type to thin down frame * * Revision 1.17  2003/10/09 16:27:09  lebedev * Widget redesign: Use independent IRenderable panels for display * * Revision 1.16  2003/08/18 16:18:33  lebedev * New methods to show/hide features added * * Revision 1.15  2003/08/18 13:44:42  lebedev * Changed SearchBar to be the same width as widget * * Revision 1.14  2003/08/15 19:37:45  dicuccio * Reformatting changes for the search bar * * Revision 1.13  2003/08/14 18:39:47  lebedev * Search of features in the widget added. * Display panels are fully configurable now. Use feature type and subtype * combination to identify and configure features in the display. Some code * cleanup. * * Revision 1.12  2003/07/31 17:06:47  dicuccio * Fixed resizable issues * * Revision 1.11  2003/07/23 19:13:41  dicuccio * Added API to retrieve the value of a configured parameter * * Revision 1.10  2003/07/22 13:40:22  lebedev * Highlign master sequence in the alignment display * Anchor master sequence. In Lens 10x mode show viewing range on the * sequence bar. Improved (faster) drawing of STSs and Repeat regions. * * Revision 1.9  2003/07/21 19:38:23  dicuccio * Removed commented-out code: the explicit deletes in the dtor aren't necessary * (Fl_Group takes care of these). * * Revision 1.8  2003/07/21 19:36:42  dicuccio * Externalized selections.  Make sure to call the correct base class when * passing to the base class.  Moved some initialization into intializer lists. * * Revision 1.7  2003/06/20 14:55:21  dicuccio * Minor clean-ups.  Changed derivation of the graphical widget from Fl_Gl_Window * to CGlCanvas2d * * Revision 1.6  2003/06/10 12:01:58  lebedev * Rendering engine separated from FLTK into it's own class * * Revision 1.5  2003/06/05 11:22:32  lebedev * Prepare to separate display renderer from the widget itself * * Revision 1.4  2003/06/03 16:20:11  lebedev * FLTK calls removed from feature rendering engine. Minor clean-up. * * Revision 1.3  2003/05/23 10:56:21  lebedev * New rendering engine, hit test engine, many other changes * * Revision 1.2  2003/05/19 16:53:55  dicuccio * Better memory management.  Minor rearrangement of #includes * * Revision 1.1  2003/05/16 16:46:20  lebedev * Initial revision * * =========================================================================== */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?