status_enablefield(int fldindex, char fldname, char fieldfmt, boolean enable) -- notifies the window port which fields it is authorized to display. -- This may be called at any time, and is used to disable as well as enable fields, depending on the value of the final argument (TRUE = enable). -
| 3006 | -- There are MAXBLSTATS status fields (from botl.h) |
| 3007 | */ |
| 3008 | void |
| 3009 | mswin_status_enablefield(int fieldidx, const char *nm, const char *fmt, |
| 3010 | boolean enable) |
| 3011 | { |
| 3012 | logDebug("mswin_status_enablefield(%d, %s, %s, %d)\n", fieldidx, nm, fmt, |
| 3013 | (int) enable); |
| 3014 | |
| 3015 | nhassert(fieldidx <= SIZE(_status_fields)); |
| 3016 | mswin_status_field * field = &_status_fields[fieldidx]; |
| 3017 | |
| 3018 | nhassert(fieldidx <= SIZE(_status_strings)); |
| 3019 | mswin_status_string * string = &_status_strings[fieldidx]; |
| 3020 | |
| 3021 | if (field != NULL) { |
| 3022 | field->format = fmt; |
| 3023 | field->space_in_front = (fmt[0] == ' '); |
| 3024 | if (field->space_in_front) field->format++; |
| 3025 | field->name = nm; |
| 3026 | field->enabled = enable; |
| 3027 | |
| 3028 | string->str = (field->enabled ? field->string : NULL); |
| 3029 | string->space_in_front = field->space_in_front; |
| 3030 | |
| 3031 | if (field->field_index == BL_CONDITION) |
| 3032 | string->str = NULL; |
| 3033 | |
| 3034 | string->draw_bar = (field->enabled && field->field_index == BL_TITLE); |
| 3035 | } |
| 3036 | } |
| 3037 | |
| 3038 | /* TODO: turn this into a common helper; multiple identical implementations */ |
| 3039 | static int |
nothing calls this directly
no test coverage detected