Merge pull request #137 from Kayvlim/master

Added new color for 'D' state.
This commit is contained in:
Hisham Muhammad 2014-10-13 23:01:37 -03:00
commit 66ec872fc6
3 changed files with 16 additions and 3 deletions

7
CRT.c
View File

@ -67,6 +67,7 @@ typedef enum ColorElements_ {
PROCESS_MEGABYTES,
PROCESS_TREE,
PROCESS_R_STATE,
PROCESS_D_STATE,
PROCESS_BASENAME,
PROCESS_HIGH_PRIORITY,
PROCESS_LOW_PRIORITY,
@ -280,6 +281,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[PROCESS_BASENAME] = A_BOLD;
CRT_colors[PROCESS_TREE] = A_BOLD;
CRT_colors[PROCESS_R_STATE] = A_BOLD;
CRT_colors[PROCESS_D_STATE] = A_BOLD;
CRT_colors[PROCESS_HIGH_PRIORITY] = A_BOLD;
CRT_colors[PROCESS_LOW_PRIORITY] = A_DIM;
CRT_colors[PROCESS_THREAD] = A_BOLD;
@ -343,6 +345,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[PROCESS_BASENAME] = ColorPair(Blue,White);
CRT_colors[PROCESS_TREE] = ColorPair(Green,White);
CRT_colors[PROCESS_R_STATE] = ColorPair(Green,White);
CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,White);
CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,White);
CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,White);
CRT_colors[PROCESS_THREAD] = ColorPair(Blue,White);
@ -406,6 +409,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[PROCESS_BASENAME] = ColorPair(Green,Black);
CRT_colors[PROCESS_TREE] = ColorPair(Blue,Black);
CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black);
CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black);
CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black);
CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black);
CRT_colors[PROCESS_THREAD] = ColorPair(Blue,Black);
@ -469,6 +473,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Blue);
CRT_colors[PROCESS_TREE] = ColorPair(Cyan,Blue);
CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Blue);
CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Blue);
CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Blue);
CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Blue);
CRT_colors[PROCESS_THREAD] = ColorPair(Green,Blue);
@ -534,6 +539,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[PROCESS_THREAD] = ColorPair(Green,Black);
CRT_colors[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black);
CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black);
CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black);
CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black);
CRT_colors[BAR_BORDER] = A_BOLD | ColorPair(Green,Black);
@ -596,6 +602,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Black);
CRT_colors[PROCESS_TREE] = ColorPair(Cyan,Black);
CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black);
CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black);
CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black);
CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black);
CRT_colors[PROCESS_THREAD] = ColorPair(Green,Black);

1
CRT.h
View File

@ -58,6 +58,7 @@ typedef enum ColorElements_ {
PROCESS_MEGABYTES,
PROCESS_TREE,
PROCESS_R_STATE,
PROCESS_D_STATE,
PROCESS_BASENAME,
PROCESS_HIGH_PRIORITY,
PROCESS_LOW_PRIORITY,

View File

@ -533,9 +533,14 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
}
case STATE: {
snprintf(buffer, n, "%c ", this->state);
attr = this->state == 'R'
? CRT_colors[PROCESS_R_STATE]
: attr;
switch(this->state) {
case 'R':
attr = CRT_colors[PROCESS_R_STATE];
break;
case 'D':
attr = CRT_colors[PROCESS_D_STATE];
break;
}
break;
}
case PRIORITY: {