📄 layout_conf.cpp
字号:
/* * =========================================================================== * PRODUCTION $Log: layout_conf.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 21:12:43 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3 * PRODUCTION * =========================================================================== *//* $Id: layout_conf.cpp,v 1000.1 2004/06/01 21:12:43 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. * * =========================================================================== * * Author: Robert G. Smith * * File Description: * */#include <ncbi_pch.hpp>#include <gui/widgets/seq_graphic/layout_conf.hpp>#include <util/static_map.hpp>BEGIN_NCBI_SCOPEclass CLayoutDefaultSettings : public IFactoryDefaultSettings{public: virtual ~CLayoutDefaultSettings() {} string Get(const string& key) const { return "packed"; }};CLayoutConfig::CLayoutConfig(objects::CPluginConfigCache* config_cache, const string& desc ) : CSettingsSet(config_cache, "Layout", new CLayoutDefaultSettings, desc){}CLayoutConfig::~CLayoutConfig(){}//// static lookup table for converting string-based feature type to actual// feature type//// these must be in "ASCIIbetical" order; beware of the fact that// closing quotes sort after spaces.//namespace {typedef pair<const string, CLayoutConfig::ELayout> TLayoutType;const TLayoutType s_LayoutTypes[] = { TLayoutType("overlayed", CLayoutConfig::eLayout_Overlayed), TLayoutType("packed", CLayoutConfig::eLayout_Packed), TLayoutType("separated", CLayoutConfig::eLayout_Separated)};typedef CStaticArrayMap<const string, CLayoutConfig::ELayout, PCase> TLayoutTypeMap;const TLayoutTypeMap s_LayoutPolicyMap(s_LayoutTypes, sizeof(s_LayoutTypes));}/// convert between current settings and the PluginConfigCache.static const string s_key("layout");bool CLayoutConfig::LoadCurrentSettings(ELoadValueSource src){ m_Layout = eLayout_Packed; const string value_str(Get(s_key, src)); TLayoutTypeMap::const_iterator rp_it = s_LayoutPolicyMap.find(value_str); if (rp_it != s_LayoutPolicyMap.end()) { m_Layout = rp_it->second; } return true;}bool CLayoutConfig::SaveCurrentSettings(void){ ITERATE(TLayoutTypeMap, rp_it, s_LayoutPolicyMap) { if (rp_it->second == m_Layout) { Set(s_key, rp_it->first); break; } } return true;}CLayoutConfig::ELayout CLayoutConfig::GetLayout() const{ return m_Layout;}END_NCBI_SCOPE/** ===========================================================================** $Log: layout_conf.cpp,v $* Revision 1000.1 2004/06/01 21:12:43 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3** Revision 1.3 2004/05/21 22:27:55 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.2 2004/02/04 15:16:07 rsmith* add const to GetLayout** Revision 1.1 2004/02/04 15:04:18 rsmith* initial checkin*** ===========================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -