NCBI C++ ToolKit
seq_text_conf.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: seq_text_conf.cpp 39602 2017-10-13 19:04:41Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Colleen Bollin, based on a file by Vlad Lebedev
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <gui/objutils/utils.hpp>
37 
39 
40 static const string kShowKey("show");
41 static const string kColorsKey("color");
42 
44  : CSettingsSet("SequenceTextView", config_cache)
45  , m_PaneConfig(config_cache)
46 {
47 }
48 
50 {
51 }
52 
53 
55 {
58  Uncache();
59 }
60 
61 
62 bool CSeqTextConfig::GetShow(int subtype) const
63 {
64  return GetBool(GetFeatReadKey(subtype, kEmptyStr, kShowKey));
65 }
66 
67 
69 {
71  if (iter == m_FeatColors.end()) {
74  color.Lighten(.5);
75 
76  m_FeatColors[subtype] = CRgbaColor(color);
77  iter = m_FeatColors.find(subtype);
78  _ASSERT(iter != m_FeatColors.end());
79  }
80 
81  return &(iter->second);
82 }
83 
84 
85 void CSeqTextConfig::SetShow(objects::CSeqFeatData::ESubtype subtype, bool b)
86 {
89 }
90 
91 
92 void CSeqTextConfig::SetColor(objects::CSeqFeatData::ESubtype subtype, CRgbaColor color)
93 {
96 }
97 
98 
99 void CSeqTextConfig::SetCaseFeature(objects::CSeqFeatData::ESubtype subtype)
100 {
101  m_PaneConfig.SetCaseFeature(subtype);
102 }
103 
104 
106 {
108 
109 }
110 
111 
112 objects::SAnnotSelector *CSeqTextConfig::GetCaseFeature ()
113 {
114  return m_PaneConfig.GetCaseFeature();
115 }
116 
117 void CSeqTextConfig::SetFontSize(int font_size)
118 {
119  m_PaneConfig.SetFontSize(font_size);
120 }
121 
122 
124 {
125  return m_PaneConfig.GetFontSize();
126 }
127 
128 
130 {
132 }
133 
134 
136 {
138 }
139 
140 
142 {
144 }
145 
146 
148 {
149  m_PaneConfig.SetShowFeatAsLower(show_lower);
150 }
151 
152 
154 {
156 }
157 
158 
160 {
162 }
163 
164 
166 {
168 }
169 
170 
172 {
174 }
175 
176 
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
void SetColor(objects::CSeqFeatData::ESubtype subtype, CRgbaColor color)
TFeatColorMap m_FeatColors
void SetFeatureColorationChoice(CSeqTextPaneConfig::EFeatureDisplayType ftype)
CSeqTextPaneConfig m_PaneConfig
bool GetShow(int subtype) const
void SetShowAbsolutePosition(bool show_abs)
void SetShowFeatAsLower(bool show_lower)
bool GetShowFeatAsLower()
void SetFontSize(int font_size)
void SetShow(objects::CSeqFeatData::ESubtype subtype, bool show)
void SetCaseFeature(objects::CSeqFeatData::ESubtype subtype)
CSeqTextConfig(CGuiRegistry *config_cache=0)
void SetCodonDrawChoice(CSeqTextPaneConfig::EFeatureDisplayType ftype)
CRgbaColor * GetColor(int subtype) const
objects::SAnnotSelector * GetCaseFeature()
CSeqTextPaneConfig::EFeatureDisplayType GetFeatureColorationChoice()
CSeqTextPaneConfig::EFeatureDisplayType GetCodonDrawChoice()
bool GetShowAbsolutePosition()
int GetCaseFeatureSubtype()
void Reload()
uncache any cached data
void SetShowFeatAsLower(bool show_lower)
void Reload()
uncache any cached data
void SetShowAbsolutePosition(bool show_abs)
void SetFontSize(int font_size)
objects::SAnnotSelector * GetCaseFeature()
void SetFeatureColorationChoice(EFeatureDisplayType ftype)
EFeatureDisplayType GetCodonDrawChoice()
void SetCodonDrawChoice(EFeatureDisplayType ftype)
EFeatureDisplayType GetFeatureColorationChoice()
void SetCaseFeature(TFeatSubtype subtype)
CSettingsSet is an adapter of the CGuiRegistry to provide persistance of and easy access to view's (o...
static string GetFeatWriteKey(TFeatSubtype feat_subtype, const string &section)
retrieve the key name to write values for a given feature subtype
void Set(const string &key, int val)
set a named integer value
void Uncache()
uncache any cached lookup data
CRgbaColor GetColor(const string &key, const CRgbaColor &default_val=CRgbaColor()) const
Retrieve a named color value from a section.key.
static const string kDefaultDelim
must be the same used as a default in CGuiRegistry.
string GetFeatReadKey(TFeatSubtype feat_subtype, const string &section, const string &subkey=kEmptyStr) const
retrieve the key name to read values for a given feature subtype
bool GetBool(const string &key, bool default_val=false) const
Retrieve a named bool value from a section.key.
const_iterator end() const
Definition: map.hpp:152
void clear()
Definition: map.hpp:169
const_iterator find(const key_type &key) const
Definition: map.hpp:153
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
n background color
static const string kColorsKey("color")
static const string kShowKey("show")
#define _ASSERT
Modified on Thu Jun 13 17:33:21 2024 by modify_doxy.py rev. 669887