1 /* color.h */
2 
3 /* Node coloration */
4 
5 /* fsv - 3D File System Visualizer
6  *
7  * Copyright (C)2009-1010 Yury P. Fedorchenko <yuryfdr@users.sf.net>
8  * Copyright (C)1999 Daniel Richard G. <skunk@mit.edu>
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23  */
24 
25 
26 #ifndef FSV_COLOR_H
27 #define FSV_COLOR_H
28 
29 #ifdef __cplusplus
30 /* The various coloring modes */
31 typedef enum {
32 	COLOR_BY_NODETYPE,
33 	COLOR_BY_TIMESTAMP,
34 	COLOR_BY_WPATTERN,
35   COLOR_NONE
36 } ColorMode;
37 
38 /* Every file has three timestamps */
39 typedef enum {
40 	TIMESTAMP_ACCESS, /* atime - time of last access */
41 	TIMESTAMP_MODIFY, /* mtime - time of last modification */
42 	TIMESTAMP_ATTRIB, /* ctime - time of last attribute change */
43 	TIMESTAMP_NONE
44 } TimeStampType;
45 
46 /* Various kinds of spectrums */
47 typedef enum {
48 	SPECTRUM_RAINBOW,
49   SPECTRUM_HEAT,
50 	SPECTRUM_GRADIENT,
51 	SPECTRUM_NONE
52 } SpectrumType;
53 
54 #include <vector>
55 #include <string>
56 /* Used indirectly in struct ColorConfig (see below) */
57 struct WPatternGroup {
58 	RGBcolor color;
59 	std::vector<std::string> wp_list; /* elements: char * */
60 };
61 
62 struct ColorConfig {
63 	/* Node type colors */
64 	struct ColorByNodeType {
65 		RGBcolor colors[NUM_NODE_TYPES];
66 	} by_nodetype;
67 
68 	/* Temporal spectrum type and range */
69 	struct ColorByTime {
70 		SpectrumType spectrum_type;
71 		TimeStampType timestamp_type;
72 		time_t new_time;
73 		time_t old_time;
74 		/* Following two are for gradient spectrums */
75 		RGBcolor old_color;
76 		RGBcolor new_color;
77 	} by_timestamp;
78 
79 	/* Wildcard patterns */
80 	struct ColorByWPattern {
81 		std::vector<WPatternGroup> wpgroup_list; /* elements: struct WPatternGroup */
82 		RGBcolor default_color;
83 	} by_wpattern;
84 };
85 
86 
87 void color_get_config( struct ColorConfig *ccfg );
88 void color_set_config( struct ColorConfig *new_ccfg, ColorMode mode );
89 RGBcolor color_spectrum_color( SpectrumType type, double x, void *data );
90 
91 ColorMode color_get_mode( void );
92 void color_set_mode( ColorMode mode );
93 void color_write_config( void );
94 void color_init( void );
95 extern "C" {
96 #endif
97 void color_assign_recursive( GNode *dnode );
98 #ifdef __cplusplus
99 };
100 #endif
101 
102 #endif
103 /* end color.h */
104 
105