/** Parse active window style information. */ void ParseActiveWindowStyle(const TokenNode *tp) { const TokenNode *np; Assert(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FOREGROUND: SetColor(COLOR_TITLE_ACTIVE_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TITLE_ACTIVE_BG1, COLOR_TITLE_ACTIVE_BG2); break; case TOK_OUTLINE: SetColor(COLOR_BORDER_ACTIVE_LINE, np->value); break; case TOK_OPACITY: settings.activeClientOpacity = ParseOpacity(np, np->value); break; default: InvalidTag(np, TOK_ACTIVE); break; } } }
/** Parse a option group option. */ void ParseGroupOption(const TokenNode *tp, struct GroupType *group, const char *option) { int x; if(!option) { return; } /* Look up the option in the option map using binary search. */ x = FindValue(OPTION_MAP, OPTION_MAP_COUNT, option); if(x >= 0) { AddGroupOption(group, (OptionType)x); return; } /* These options have arguments and so we handled them separately. */ if(!strncmp(option, "layer:", 6)) { const WinLayerType layer = ParseLayer(tp, option + 6); AddGroupOptionUnsigned(group, OPTION_LAYER, layer); } else if(!strncmp(option, "desktop:", 8)) { const unsigned int desktop = (unsigned int)atoi(option + 8); AddGroupOptionUnsigned(group, OPTION_DESKTOP, desktop); } else if(!strncmp(option, "icon:", 5)) { AddGroupOptionString(group, OPTION_ICON, option + 5); } else if(!strncmp(option, "opacity:", 8)) { const unsigned int opacity = ParseOpacity(tp, option + 8); AddGroupOptionUnsigned(group, OPTION_OPACITY, opacity); } else { ParseError(tp, "invalid Group Option: %s", option); } }
/** Parse menu style. */ void ParseMenuStyle(const TokenNode *tp) { const TokenNode *np; Assert(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_MENU, np->value); break; case TOK_FOREGROUND: SetColor(COLOR_MENU_FG, np->value); break; case TOK_BACKGROUND: SetColor(COLOR_MENU_BG, np->value); break; case TOK_ACTIVE: ParseActiveMenuStyle(np); break; case TOK_OPACITY: settings.menuOpacity = ParseOpacity(np, np->value); break; case TOK_OUTLINE: SetColor(COLOR_MENU_OUTLINE, np->value); break; default: InvalidTag(np, TOK_MENUSTYLE); break; } } }
/** Parse a option group option. */ void ParseGroupOption(const TokenNode *tp, struct GroupType *group, const char *option) { int x; if(!option) { return; } for(x = 0; OPTION_MAP[x].name; x++) { if(!strcmp(option, OPTION_MAP[x].name)) { AddGroupOption(group, OPTION_MAP[x].option); return; } } /* These options have arguments and so we handled them separately. */ if(!strncmp(option, "layer:", 6)) { const WinLayerType layer = ParseLayer(tp, option + 6); AddGroupOptionUnsigned(group, OPTION_LAYER, layer); } else if(!strncmp(option, "desktop:", 8)) { const unsigned int desktop = (unsigned int)atoi(option + 8); AddGroupOptionUnsigned(group, OPTION_DESKTOP, desktop); } else if(!strncmp(option, "icon:", 5)) { AddGroupOptionString(group, OPTION_ICON, option + 5); } else if(!strncmp(option, "opacity:", 8)) { const unsigned int opacity = ParseOpacity(tp, option + 8); AddGroupOptionUnsigned(group, OPTION_OPACITY, opacity); } else { ParseError(tp, "invalid Group Option: %s", option); } }
/** Parse tray style. */ void ParseTrayStyle(const TokenNode *tp) { const TokenNode *np; for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_TRAY, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TRAY_BG1, COLOR_TRAY_BG2); break; case TOK_FOREGROUND: SetColor(COLOR_TRAY_FG, np->value); break; case TOK_ACTIVEBACKGROUND: ParseGradient(np->value, COLOR_TRAY_ACTIVE_BG1, COLOR_TRAY_ACTIVE_BG2); break; case TOK_ACTIVEFOREGROUND: SetColor(COLOR_TRAY_ACTIVE_FG, np->value); break; case TOK_OPACITY: settings.trayOpacity = ParseOpacity(np, np->value); break; default: InvalidTag(np, TOK_TRAYSTYLE); break; } } }
/** Parse window style. */ void ParseWindowStyle(const TokenNode *tp) { const TokenNode *np; const char *decorations; decorations = FindAttribute(tp->attributes, "decorations"); if(decorations) { if(!strcmp(decorations, "motif")) { settings.handles = 1; } else if(!strcmp(decorations, "flat")) { settings.handles = 0; } else { ParseError(tp, "invalid WindowStyle decorations: %s\n", decorations); } } else { settings.handles = 0; } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_BORDER, np->value); break; case TOK_WIDTH: settings.borderWidth = ParseUnsigned(np, np->value); break; case TOK_HEIGHT: settings.titleHeight = ParseUnsigned(np, np->value); break; case TOK_CORNER: settings.cornerRadius = ParseUnsigned(np, np->value); break; case TOK_ACTIVE: ParseActiveWindowStyle(np); break; case TOK_FOREGROUND: SetColor(COLOR_TITLE_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TITLE_BG1, COLOR_TITLE_BG2); break; case TOK_OUTLINE: SetColor(COLOR_BORDER_LINE, np->value); break; case TOK_OPACITY: settings.inactiveClientOpacity = ParseOpacity(tp, np->value); break; default: InvalidTag(np, TOK_WINDOWSTYLE); break; } } }
/** Parse window style. */ void ParseWindowStyle(const TokenNode *tp) { const TokenNode *np; settings.windowDecorations = ParseDecorations(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_BORDER, np->value); break; case TOK_WIDTH: settings.borderWidth = ParseUnsigned(np, np->value); break; case TOK_HEIGHT: settings.titleHeight = ParseUnsigned(np, np->value); break; case TOK_CORNER: settings.cornerRadius = ParseUnsigned(np, np->value); break; case TOK_ACTIVE: ParseActiveWindowStyle(np); break; case TOK_FOREGROUND: SetColor(COLOR_TITLE_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TITLE_BG1, COLOR_TITLE_BG2); break; case TOK_OUTLINE: ParseGradient(np->value, COLOR_TITLE_DOWN, COLOR_TITLE_UP); break; case TOK_OPACITY: settings.inactiveClientOpacity = ParseOpacity(tp, np->value); break; default: InvalidTag(np, TOK_WINDOWSTYLE); break; } } }
/** Parse tray style. */ void ParseTrayStyle(const TokenNode *tp) { const TokenNode *np; const char *temp; settings.trayDecorations = ParseDecorations(tp); temp = FindAttribute(tp->attributes, "group"); if(temp) { settings.groupTasks = !strcmp(temp, TRUE_VALUE); } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_TRAY, np->value); break; case TOK_ACTIVE: ParseActiveTrayStyle(np); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TRAY_BG1, COLOR_TRAY_BG2); break; case TOK_FOREGROUND: SetColor(COLOR_TRAY_FG, np->value); break; case TOK_OUTLINE: ParseGradient(np->value, COLOR_TRAY_DOWN, COLOR_TRAY_UP); break; case TOK_OPACITY: settings.trayOpacity = ParseOpacity(np, np->value); break; default: InvalidTag(np, TOK_TRAYSTYLE); break; } } }