pane_content_conf.cpp

来自「ncbi源码」· C++ 代码 · 共 354 行

CPP
354
字号
/* * =========================================================================== * PRODUCTION $Log: pane_content_conf.cpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 21:12:45  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.11 * PRODUCTION * =========================================================================== *//*  $Id: pane_content_conf.cpp,v 1000.1 2004/06/01 21:12:45 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:  Robert Smith * * File Description: * */#include <ncbi_pch.hpp>#include <gui/widgets/seq_graphic/pane_content_conf.hpp>#include <gui/config/feat_config_list.hpp>BEGIN_NCBI_SCOPEstring CCPaneContentFactoryDefaults::Get(const string& key) const{        string  key1, key2;    NStr::SplitInTwo(key, "|", key1, key2);    if (key1 == "histogram") {        if (key2 == "Master") {            return "false";        } else if (key2 == "repeat_region") {            return "true";        } else if (key2 == "STS") {            return "true";        }    } else if (key1 == "layout_specs") {        if (key2 == "array") {            return "0";        }    }    return CFeatShowFactoryDefaults::Get(key);    // use if we do not inherit from another config class.    //NCBI_THROW(CConfigException, eNoDefaultValue, "key: " + key);     // return kEmptyStr;}CPaneContentConf::CPaneContentConf(objects::CPluginConfigCache* config_cache,                                   const string& desc)    : CFeatConfigShow(config_cache, "Feature Pane Content",                      new CCPaneContentFactoryDefaults(), desc)    , m_ShowAlignments(true)    , m_ShowGraphs(true)    , m_ShowPWAlignLabels(true)    , m_ShowSegmentMap(true)    , m_RulerSpacer(0){    LoadCurrentSettings(eLoad_Current);}bool CPaneContentConf::LoadCurrentSettings(ELoadValueSource src){        CFeatConfigShow::LoadCurrentSettings(src);    ClearHistograms();    string featvaluestr;    const CFeatConfigList& featureList = *GetFeatConfigList();    ITERATE ( CFeatConfigList, fc_it, featureList ) {        int myType = fc_it->GetType();        int mySubtype = fc_it->GetSubtype();        try {            featvaluestr = Get("histogram" + GetKeyDelimiter() +                               fc_it->GetStoragekey(), src);            SetHistogram( myType, mySubtype,  NStr::StringToBool(featvaluestr));            SetHistogramInherited( myType, mySubtype, false);        }        catch (const CConfigException&) {        }    }    // Build list of Layout Specs (i.e. feature filter passes)    const string kLayoutSpecsKey("layout_specs");    int specs_count = GetArraySize(kLayoutSpecsKey, src);    for (int i = 1;  i <= specs_count;  ++i) {        string chooser_str = GetArrayItem(kLayoutSpecsKey, i, "Chooser", src);        CLayoutObjectChooser* chooser =            CLayoutObjectChooser::FromString(chooser_str);        CRef<CLayoutSpec> spec(new CLayoutSpec(*chooser));        spec->SetSpecName(GetArrayItem(kLayoutSpecsKey, i,"Name", src));        spec->SetLinkFeatures            (NStr::StringToBool(GetArrayItem(kLayoutSpecsKey, i,                                             "LinkFeatures", src)));        spec->SetShowProtProd            (NStr::StringToBool(GetArrayItem(kLayoutSpecsKey, i,                                             "ShowProtProd", src)));        spec->SetIfNotUsed            (NStr::StringToBool(GetArrayItem(kLayoutSpecsKey, i,                                             "IfNotUsed", src)));        SetLayoutSpecs().push_back(spec);    }    return true;}bool CPaneContentConf::SaveCurrentSettings(void){        CFeatConfigShow::SaveCurrentSettings();    // save Histogram settings.    const CFeatConfigList& featureList = *GetFeatConfigList();    ITERATE(CFeatConfigList, fc_it, featureList) {        int myType = fc_it->GetType();        int mySubtype = fc_it->GetSubtype();        if ( ! m_HistFeat.GetInherited(myType, mySubtype)) {            Set("histogram" + GetKeyDelimiter() + fc_it->GetStoragekey(),                 NStr::BoolToString(GetHistogram(myType, mySubtype)) );        }    }    // save list of layout specs.    const CLayoutSpec::TLayoutSpecs& layout_specs = GetLayoutSpecs();    const string kLayoutSpecsKey("layout_specs");    SetArraySize(kLayoutSpecsKey, layout_specs.size());    int i = 0;    ITERATE(CLayoutSpec::TLayoutSpecs, layouts_it, layout_specs) {        SetArrayItem(kLayoutSpecsKey, i, "Name",                      (*layouts_it)->GetSpecName() );                SetArrayItem(kLayoutSpecsKey, i, "Chooser",                      (*layouts_it)->GetObjectChooser().ToString() );        SetArrayItem(kLayoutSpecsKey, i, "LinkFeatures",                      NStr::BoolToString((*layouts_it)->GetLinkFeatures()));        SetArrayItem(kLayoutSpecsKey, i, "ShowProtProd",                      NStr::BoolToString((*layouts_it)->GetShowProtProd()));        SetArrayItem(kLayoutSpecsKey, i, "IfNotUsed",                      NStr::BoolToString((*layouts_it)->GetIfNotUsed()));        ++i;    }    return true;}bool CPaneContentConf::GetHistogram(int type, int subtype) const{    return m_HistFeat.GetValue(type, subtype);}void CPaneContentConf::SetHistogram(int type, int subtype, bool hist){    m_HistFeat.SetValue(type, subtype, hist);}void CPaneContentConf::SetHistogramInherited(int type, int subtype, bool inherited){    m_HistFeat.SetInherited(type, subtype, inherited);}const CFeatConfigValues<bool>& CPaneContentConf::GetHistograms() const{    return m_HistFeat;}void CPaneContentConf::SetHistograms(CFeatConfigValues<bool>& o){    m_HistFeat = o;}void CPaneContentConf::ClearHistograms(){    m_HistFeat.ClearValues();}const CLayoutSpec::TLayoutSpecs& CPaneContentConf::GetLayoutSpecs() const{    return m_LayoutSpecs;}CLayoutSpec::TLayoutSpecs& CPaneContentConf::SetLayoutSpecs(){    return m_LayoutSpecs;}void CPaneContentConf::SetLayoutSpecs(CLayoutSpec::TLayoutSpecs& specs){    m_LayoutSpecs = specs;}//// CLaySpec methods.//CLayoutSpec::CLayoutSpec(CLayoutObjectChooser& chooser) :m_Chooser(&chooser), m_LinkFeatures(false), m_ShowProtProd(false){}string CLayoutSpec::GetSpecName() const{    return m_SpecName;}void CLayoutSpec::SetSpecName(const string& aName){    m_SpecName = aName;}const CLayoutObjectChooser& CLayoutSpec::GetObjectChooser() const{    return *m_Chooser;}CLayoutObjectChooser& CLayoutSpec::SetObjectChooser(){    return *m_Chooser;}void CLayoutSpec::SetObjectChooser(CLayoutObjectChooser& chooser){    m_Chooser.Reset(&chooser);}bool CLayoutSpec::GetLinkFeatures() const{    return m_LinkFeatures;}void CLayoutSpec::SetLinkFeatures(bool f){    m_LinkFeatures = f;}bool CLayoutSpec::GetShowProtProd() const{    return m_ShowProtProd;}void CLayoutSpec::SetShowProtProd(bool f){    m_ShowProtProd = f;}bool CLayoutSpec::GetIfNotUsed() const{    return m_IfNotUsed;}void CLayoutSpec::SetIfNotUsed(bool f){    m_IfNotUsed = f;}END_NCBI_SCOPE/* * =========================================================================== * $Log: pane_content_conf.cpp,v $ * Revision 1000.1  2004/06/01 21:12:45  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.11 * * Revision 1.11  2004/05/21 22:27:55  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.10  2004/05/12 16:54:12  lebedev * Added  option to specify a space between the ruler and the rest of the dispay * * Revision 1.9  2004/05/10 15:57:53  lebedev * Configuration option to show/hide segment maps added. * * Revision 1.8  2004/05/07 11:12:13  lebedev * Configuration option to show/hide labels for pairwise alignments and mate pairs added. * * Revision 1.7  2004/04/06 13:45:15  dicuccio * Formatting changes.  Added API to set/get default render status for graphs, alignments * * Revision 1.6  2004/02/02 18:45:48  rsmith * add description to CSettingsSet, constructor and descendants. * * Revision 1.5  2004/01/20 14:03:34  rsmith * Inherit from FeatConfigShow. * * Revision 1.4  2003/12/31 15:05:15  dicuccio * Use FromString() - renamed from sm_FronString() * * Revision 1.3  2003/12/31 13:23:44  rsmith * sm_FromString() not FromString. * * Revision 1.2  2003/12/30 15:05:19  dicuccio * Fixed compiler errors/warnings on MSVC * * Revision 1.1  2003/12/29 14:57:34  rsmith * initial checkin. * * Revision 1.3  2003/11/21 12:56:22  rsmith * Added ClearHistograms() to fix bug when loading data from the PluginConfigCache. * * Revision 1.2  2003/11/18 20:34:15  rsmith * Get/set all histogram settings. Add back in old get/set element colors (background, selectionsm etc.). * * Revision 1.1  2003/10/31 14:07:49  dicuccio * Initial revision * * =========================================================================== */

⌨️ 快捷键说明

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