Changeset 928
- Timestamp:
- Dec 2, 2009, 8:43:57 AM (14 years ago)
- Location:
- trunk/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Colours.cc
r921 r928 22 22 #include "Colours.h" 23 23 24 #include "Configuration.h" 25 24 26 #include <cstdlib> 27 #include <ctype.h> 25 28 26 29 namespace theplu { … … 60 63 colour_map_[12].label="black"; 61 64 colour_map_[12].r= 0; colour_map_[12].g= 0; colour_map_[12].b= 0; 65 66 typedef std::map<std::string, std::string> ACmap; 67 const ACmap& authcols=Configuration::instance().author_colors(); 68 std::map<std::string,std::vector<colour>::iterator>::iterator j; 69 for (ACmap::const_iterator i=authcols.begin(); i!=authcols.end(); i++) { 70 colour c; 71 c.label=i->first; 72 c.r= 16*to_decimal(i->second[0]) + to_decimal(i->second[1]); 73 c.g= 16*to_decimal(i->second[2]) + to_decimal(i->second[3]); 74 c.b= 16*to_decimal(i->second[4]) + to_decimal(i->second[5]); 75 next_colour_=colour_map_.insert(next_colour_,c); 76 author_map_.insert(std::make_pair(c.label, next_colour_++)); 77 } 62 78 } 63 79 … … 88 104 } 89 105 106 107 int Colours::to_decimal(int hex) 108 { 109 hex=toupper(hex); 110 if (hex>47 && hex<58) // 0--9 111 return hex-48; 112 if (hex>64 && hex<71) // A--F 113 return hex-55; 114 return -1; 115 } 116 90 117 }} // end of namespace svndigest and namespace theplu -
trunk/lib/Colours.h
r919 r928 65 65 Colours(const Colours&); 66 66 67 // Convert char from hexadecimal to decimal, if char is out of 68 // range -1 is returned. 69 int to_decimal(int); 70 67 71 // Assignment not implemented because assignment is always self-assignment 68 72 Colours& operator=(const Colours&); -
trunk/lib/Configuration.cc
r908 r928 2 2 3 3 /* 4 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 5 Copyright (C) 2009 Peter Johansson 4 Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 6 5 7 6 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 60 59 } 61 60 61 62 const std::map<std::string, std::string>& 63 Configuration::author_colors(void) const 64 { 65 return author_color_; 66 } 62 67 63 68 std::string Configuration::author_str_color(const std::string& author) const -
trunk/lib/Configuration.h
r847 r928 5 5 6 6 /* 7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 7 Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson 9 8 10 9 This file is part of svndigest, http://dev.thep.lu.se/svndigest … … 46 45 47 46 /** 48 \return hexadecimal color code (e.g. 5aee4a) that is used in49 blame output . If no color is configured for \a author, an empty50 string is returned.47 \return Hexadecimal color code (e.g. 5aee4a) that is used in 48 blame output and as line colors in plots. If no color is 49 configured for \a author, an empty string is returned. 51 50 */ 52 51 std::string author_str_color(const std::string& author) const; 52 53 /** 54 The map to lookup the author-color mapping set in the 55 configuration file. The color code is a six digit hexadecimal 56 number rrggbb. 57 58 \return The author-color map 59 */ 60 const std::map<std::string, std::string>& author_colors(void) const; 53 61 54 62 /**
Note: See TracChangeset
for help on using the changeset viewer.