diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-12-21 18:03:28 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-12-21 18:03:28 +0000 |
commit | 51e21a316be6e052251b3dfc7d671061ebd67cee (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/viewercolorpct.cpp | |
parent | ad6f4dfcc671d3f8d458c42b0992956f2a2cf979 (diff) | |
download | build-51e21a316be6e052251b3dfc7d671061ebd67cee.tar.gz build-51e21a316be6e052251b3dfc7d671061ebd67cee.tar.bz2 build-51e21a316be6e052251b3dfc7d671061ebd67cee.tar.xz build-51e21a316be6e052251b3dfc7d671061ebd67cee.zip |
Removed the old trunk contents. About to load up m3
Diffstat (limited to 'src/viewercolorpct.cpp')
-rw-r--r-- | src/viewercolorpct.cpp | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/src/viewercolorpct.cpp b/src/viewercolorpct.cpp deleted file mode 100644 index 5bc3cba..0000000 --- a/src/viewercolorpct.cpp +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | #include "viewercolorpct.h" | ||
2 | #include "perform.h" | ||
3 | #include "bu/plugger.h" | ||
4 | #include <math.h> | ||
5 | |||
6 | PluginInterface2( colorpct, ViewerColorPct, Viewer, "Mike Buland", 0, 1 ); | ||
7 | |||
8 | ViewerColorPct::ViewerColorPct() : | ||
9 | bRunClean( true ) | ||
10 | { | ||
11 | } | ||
12 | |||
13 | ViewerColorPct::~ViewerColorPct() | ||
14 | { | ||
15 | } | ||
16 | |||
17 | void ViewerColorPct::beginCommand( Action::eAction nAct, const std::string &sTarget ) | ||
18 | { | ||
19 | Cmd cmd; | ||
20 | if( sCmd.empty() ) | ||
21 | cmd.nLevel = 0; | ||
22 | else | ||
23 | cmd.nLevel = sCmd.front().nLevel+1; | ||
24 | |||
25 | cmd.bCmdClean = true; | ||
26 | cmd.sTarget = sTarget; | ||
27 | |||
28 | sCmd.push_front( cmd ); | ||
29 | } | ||
30 | |||
31 | void ViewerColorPct::endCommand() | ||
32 | { | ||
33 | if( sCmd.front().bCmdClean == false ) | ||
34 | printf("\n"); | ||
35 | sCmd.pop_front(); | ||
36 | if(sCmd.empty()) | ||
37 | iCC++; | ||
38 | } | ||
39 | |||
40 | void ViewerColorPct::indent() | ||
41 | { | ||
42 | if( sCmd.empty() ) return; | ||
43 | int jmax = sCmd.front().nLevel; | ||
44 | for( int j = 0; j < jmax; j++ ) | ||
45 | { | ||
46 | printf(" "); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | void ViewerColorPct::printHead() | ||
51 | { | ||
52 | if( sCmd.front().bCmdClean == true ) | ||
53 | { | ||
54 | bRunClean = false; | ||
55 | sCmd.front().bCmdClean = false; | ||
56 | indent(); | ||
57 | if(sCmd.size() > 1) | ||
58 | printf("\033[37;22m--- \033[36m%s\033[37m ---\033[0m\n", sCmd.front().sTarget.c_str() ); | ||
59 | else | ||
60 | printf("\033[37;1m--- [\033[32m%d/%d\033[37m] \033[36m%s\033[37m ---\033[0m\n", iCC, iTC, sCmd.front().sTarget.c_str() ); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | void ViewerColorPct::printPerform(const char *sRule, const char *sTarget) | ||
65 | { | ||
66 | int iPct = (int)round( | ||
67 | ((double)sCmd.front().iCP/(double)sCmd.front().iTP)*100.0 | ||
68 | ); | ||
69 | if(sCmd.size() > 1) | ||
70 | printf( "\033[37;22m[\033[32m%3d%%\033[37m] \033[35m%8s\033[37m: %s\033[0m\n", iPct, sRule, sTarget ); | ||
71 | else | ||
72 | printf( "\033[37;1m[\033[32m%3d%%\033[37m] \033[35m%8s\033[37m: %s\033[0m\n", iPct, sRule, sTarget ); | ||
73 | } | ||
74 | |||
75 | void ViewerColorPct::beginRequiresCheck( bool bCached, const std::string &sName ) | ||
76 | { | ||
77 | printHead(); | ||
78 | indent(); | ||
79 | printPerform("deps", sName.c_str()); | ||
80 | } | ||
81 | |||
82 | void ViewerColorPct::endRequiresCheck() | ||
83 | { | ||
84 | sCmd.front().iCP++; | ||
85 | } | ||
86 | |||
87 | void ViewerColorPct::skipRequiresCheck( bool bCached, const std::string &sName ) | ||
88 | { | ||
89 | sCmd.front().iCP++; | ||
90 | } | ||
91 | |||
92 | void ViewerColorPct::beginPerform( Perform *pPerform ) | ||
93 | { | ||
94 | printHead(); | ||
95 | indent(); | ||
96 | printPerform(pPerform->getRule().c_str(), pPerform->getTarget().c_str()); | ||
97 | } | ||
98 | |||
99 | void ViewerColorPct::endPerform() | ||
100 | { | ||
101 | sCmd.front().iCP++; | ||
102 | } | ||
103 | |||
104 | void ViewerColorPct::skipPerform( Perform *pPerform ) | ||
105 | { | ||
106 | sCmd.front().iCP++; | ||
107 | } | ||
108 | |||
109 | void ViewerColorPct::beginPerforms( int nCount ) | ||
110 | { | ||
111 | sCmd.front().iTP = nCount*2; | ||
112 | sCmd.front().iCP = 1; | ||
113 | } | ||
114 | |||
115 | void ViewerColorPct::beginAction( const std::string &sName, int nCommands ) | ||
116 | { | ||
117 | iTC = nCommands; | ||
118 | iCC = 1; | ||
119 | } | ||
120 | |||
121 | void ViewerColorPct::endAction() | ||
122 | { | ||
123 | if( bRunClean == true ) | ||
124 | { | ||
125 | printf("Nothing to be done.\n\n"); | ||
126 | } | ||
127 | printf("\033[0m"); | ||
128 | } | ||
129 | |||