color_conf.cpp
来自「ncbi源码」· C++ 代码 · 共 306 行
CPP
306 行
/* * =========================================================================== * PRODUCTION $Log: color_conf.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 21:12:24 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.11 * PRODUCTION * =========================================================================== *//* $Id: color_conf.cpp,v 1000.1 2004/06/01 21:12:24 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: Mike DiCuccio * * File Description: * */#include <ncbi_pch.hpp>#include <gui/widgets/seq_graphic/color_conf.hpp>#include <util/static_map.hpp>BEGIN_NCBI_SCOPE typedef pair<const char*, const char*> TColorPair;static TColorPair sc_Colors[] = { TColorPair("BG|AlignSmear", "white"), TColorPair("BG|Alignment", "white"), TColorPair("BG|Comment", "white"), TColorPair("BG|Feature", "white"), TColorPair("BG|Histogram", "white"), TColorPair("BG|MatePair", "white"), TColorPair("BG|PWAlign", "white"), TColorPair("BG|ProtProduct", "white"), TColorPair("BG|Ruler", "white"), TColorPair("BG|SeqGraph", "lightsteelblue"), TColorPair("BG|SeqSegment", "white"), TColorPair("Background", "white"), TColorPair("FG|AlignSmear", "red"), TColorPair("FG|Alignment", "red"), TColorPair("FG|Comment", "red"), TColorPair("FG|MatePairDistance", "light salmon"), TColorPair("FG|MatePairLink", "indian red"), TColorPair("FG|MatePairNo", "light green"), TColorPair("FG|MatePairNonUnique", "red"), TColorPair("FG|MatePairOrientation", "indian red"), TColorPair("FG|PWAlign", "light blue"), TColorPair("FG|ProtProduct", "black"), TColorPair("FG|SeqGraph", "blue"), TColorPair("FG|SeqSegmentExc", "black"), TColorPair("FG|SeqSegmentInc", "red"), TColorPair("GridHorizontal", "grey95"), TColorPair("GridVertical", "grey95"), TColorPair("Label|AlignSmear", "blue"), TColorPair("Label|Alignment", "blue"), TColorPair("Label|Comment", "blue"), TColorPair("Label|Feature", "blue"), TColorPair("Label|Histogram", "blue"), TColorPair("Label|MatePair", "blue"), TColorPair("Label|PWAlign", "blue"), TColorPair("Label|ProtProduct", "blue"), TColorPair("Label|Ruler", "blue"), TColorPair("Label|SeqGraph", "blue"), TColorPair("Ruler_Grid", "black"), TColorPair("SelLabel|AlignSmear", "red"), TColorPair("SelLabel|Alignment", "red"), TColorPair("SelLabel|Comment", "red"), TColorPair("SelLabel|Feature", "red"), TColorPair("SelLabel|Histogram", "red"), TColorPair("SelLabel|MatePair", "red"), TColorPair("SelLabel|PWAlign", "red"), TColorPair("SelLabel|ProtProduct", "red"), TColorPair("SelLabel|Ruler", "red"), TColorPair("SelLabel|SeqGraph", "red"), TColorPair("SelLabel|SeqSegment", "red"), TColorPair("Selection|AlignSmear", "black"), TColorPair("Selection|Alignment", "black"), TColorPair("Selection|Comment", "black"), TColorPair("Selection|Feature", "black"), TColorPair("Selection|Histogram", "black"), TColorPair("Selection|MatePair", "black"), TColorPair("Selection|PWAlign", "black"), TColorPair("Selection|Panel", "gray" ), TColorPair("Selection|ProtProduct", "black"), TColorPair("Selection|Ruler", "green"), TColorPair("Selection|SeqGraph", "black"), TColorPair("Selection|SeqSegment", "black"), TColorPair("Seq|AlignSmear", "black"), TColorPair("Seq|Alignment", "black"), TColorPair("Seq|MatePairDistance", "black"), TColorPair("Seq|MatePairMismatchDistance", "yellow"), TColorPair("Seq|MatePairMismatchNo", "red"), TColorPair("Seq|MatePairMismatchNonUnique", "yellow"), TColorPair("Seq|MatePairMismatchOrientation", "yellow"), TColorPair("Seq|MatePairNo", "dark green"), TColorPair("Seq|MatePairNonUnique", "black"), TColorPair("Seq|MatePairOrientation", "black"), TColorPair("Seq|PWAlign", "dark blue"), TColorPair("Seq|PWAlignMismatch", "red"), TColorPair("Seq|ProtMismatch", "yellow"), TColorPair("Seq|ProtOriginal", "black"), TColorPair("Seq|ProtTranslated", "white"), TColorPair("Seq|SequenceBar", "white")};typedef CStaticArrayMap<const char*, const char*, PCase> TColorMap;static TColorMap sc_ColorMap(sc_Colors, sizeof(sc_Colors));string CSeqGraphicColorFactoryDefaults::Get(const string& key) const{ TColorMap::const_iterator iter = sc_ColorMap.find(key.c_str()); if (iter != sc_ColorMap.end()) { return CRgbaColor::ColorStrFromName(iter->second); } return CFeatColorFactoryDefaults::Get(key);}CSeqGraphicColorConfig::CSeqGraphicColorConfig(objects::CPluginConfigCache* config_cache, const string& desc) : CFeatConfigColor(config_cache, "Graphic View Colors", new CSeqGraphicColorFactoryDefaults(), desc){ // labels m_Colors[eLabel_ProtProduct].first = "Label|ProtProduct"; m_Colors[eLabel_Alignment].first = "Label|Alignment"; m_Colors[eLabel_PWAlign].first = "Label|PWAlign"; m_Colors[eLabel_AlignSmear].first = "Label|AlignSmear"; m_Colors[eLabel_Comment].first = "Label|Comment"; m_Colors[eLabel_Feature].first = "Label|Feature"; m_Colors[eLabel_SeqGraph].first = "Label|SeqGraph"; m_Colors[eLabel_Ruler].first = "Label|Ruler"; m_Colors[eLabel_MatePair].first = "Label|MatePair"; // Selected label m_Colors[eSelLabel_ProtProduct].first = "SelLabel|ProtProduct"; m_Colors[eSelLabel_Alignment].first = "SelLabel|Alignment"; m_Colors[eSelLabel_PWAlign].first = "SelLabel|PWAlign"; m_Colors[eSelLabel_AlignSmear].first = "SelLabel|AlignSmear"; m_Colors[eSelLabel_Feature].first = "SelLabel|Feature"; m_Colors[eSelLabel_SeqGraph].first = "SelLabel|SeqGraph"; m_Colors[eSelLabel_SeqSegment].first = "SelLabel|SeqSegment"; m_Colors[eSelLabel_MatePair].first = "SelLabel|MatePair"; // Selection color m_Colors[eSelection_ProtProduct].first = "Selection|ProtProduct"; m_Colors[eSelection_Alignment].first = "Selection|Alignment"; m_Colors[eSelection_PWAlign].first = "Selection|PWAlign"; m_Colors[eSelection_AlignSmear].first = "Selection|AlignSmear"; m_Colors[eSelection_Feature].first = "Selection|Feature"; m_Colors[eSelection_SeqGraph].first = "Selection|SeqGraph"; m_Colors[eSelection_Histogram].first = "Selection|Histogram"; m_Colors[eSelection_SeqSegment].first = "Selection|SeqSegment"; m_Colors[eSelection_Ruler].first = "Selection|Ruler"; m_Colors[eSelection_Panel].first = "Selection|Panel"; m_Colors[eSelection_MatePair].first = "Selection|MatePair"; // Sequence letters m_Colors[eSeq_SequenceBar].first = "Seq|SequenceBar"; m_Colors[eSeq_ProtOriginal].first = "Seq|ProtOriginal"; m_Colors[eSeq_ProtTranslated].first = "Seq|ProtTranslated"; m_Colors[eSeq_ProtMismatch].first = "Seq|ProtMismatch"; m_Colors[eSeq_MatePairNo].first = "Seq|MatePairNo"; m_Colors[eSeq_MatePairMismatchNo].first = "Seq|MatePairMismatchNo"; m_Colors[eSeq_MatePairOrientation].first = "Seq|MatePairOrientation"; m_Colors[eSeq_MatePairMismatchOrientation].first = "Seq|MatePairMismatchOrientation"; m_Colors[eSeq_MatePairNonUnique].first = "Seq|MatePairNonUnique"; m_Colors[eSeq_MatePairMismatchNonUnique].first = "Seq|MatePairMismatchNonUnique"; m_Colors[eSeq_MatePairDistance].first = "Seq|MatePairDistance"; m_Colors[eSeq_MatePairMismatchDistance].first = "Seq|MatePairMismatchDistance"; m_Colors[eSeq_PWAlign].first = "Seq|PWAlign"; m_Colors[eSeq_PWAlignMismatch].first = "Seq|PWAlignMismatch"; // Foreground m_Colors[eFG_Alignment].first = "FG|Alignment"; m_Colors[eFG_PWAlign].first = "FG|PWAlign"; m_Colors[eFG_AlignSmear].first = "FG|AlignSmear"; m_Colors[eFG_ProtProduct].first = "FG|ProtProduct"; m_Colors[eFG_SeqGraph].first = "FG|SeqGraph"; m_Colors[eFG_Comment].first = "FG|Comment"; m_Colors[eFG_SeqSegmentInc].first = "FG|SeqSegmentInc"; m_Colors[eFG_SeqSegmentExc].first = "FG|SeqSegmentExc"; m_Colors[eFG_MatePairNo].first = "FG|MatePairNo"; m_Colors[eFG_MatePairOrientation].first = "FG|MatePairOrientation"; m_Colors[eFG_MatePairNonUnique].first = "FG|MatePairNonUnique"; m_Colors[eFG_MatePairDistance].first = "FG|MatePairDistance"; m_Colors[eFG_MatePairLink].first = "FG|MatePairLink"; // Background Color m_Colors[eBG_Alignment].first = "BG|Alignment"; m_Colors[eBG_PWAlign].first = "BG|PWAlign"; m_Colors[eBG_AlignSmear].first = "BG|AlignSmear"; m_Colors[eBG_ProtProduct].first = "BG|ProtProduct"; m_Colors[eBG_SeqGraph].first = "BG|SeqGraph"; m_Colors[eBG_Comment].first = "BG|Comment"; m_Colors[eBG_SeqSegment].first = "BG|SeqSegment"; m_Colors[eBG_MatePair].first = "BG|MatePair"; // General m_Colors[eBackground].first = "Background"; m_Colors[eRuler_Grid].first = "Ruler_Grid"; m_Colors[eGridVertical].first = "GridVertical"; m_Colors[eGridHorizontal].first = "GridHorizontal"; LoadCurrentSettings(eLoad_Current);}bool CSeqGraphicColorConfig::LoadCurrentSettings(ELoadValueSource src){ CFeatConfigColor::LoadCurrentSettings(src); NON_CONST_ITERATE(TColorMap, iter, m_Colors) { TColorPair& cp = (*iter).second; cp.second = CGlColor( Get( cp.first, src) ); } return true;}bool CSeqGraphicColorConfig::SaveCurrentSettings(void){ CFeatConfigColor::SaveCurrentSettings(); NON_CONST_ITERATE(TColorMap, iter, m_Colors) { TColorPair& cp = (*iter).second; Set(cp.first, cp.second.ToString(false)); } return true;}CGlColor CSeqGraphicColorConfig::GetElementColor(EDisplayElement e) const{ if (m_Colors.find(e) != m_Colors.end()) { TColorPair p = m_Colors.find(e)->second; CGlColor color = p.second; glColor3f(color.GetRed(), color.GetGreen(), color.GetBlue()); return color; } ERR_POST("Bad enumerated argument to CSeqGraphicColorConfig::GetElementColor : " << e); return CGlColor();}void CSeqGraphicColorConfig::SetElementColor(EDisplayElement e, const CGlColor& c){ if (m_Colors.find(e) != m_Colors.end()) { m_Colors[e].second = c; return; } ERR_POST("Bad enumerated argument to CSeqGraphicColorConfig::SetElementColor : " << e);}END_NCBI_SCOPE/* * =========================================================================== * $Log $ * * Revision 1.1 2003/10/31 14:07:49 dicuccio * Initial revision * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?