|
[PATCH 4/11] improve genpref output: msg#00017window-managers.icewm.devel
a) finally parse true/false/yes/no for boolean options b) fix some descriptions in default.h and themable.h c) improve output from genpref: 1) brake long lines from description 2) print scope of option (global/themable/icewmbg) 3) print type of option (boolean/numeric/key) 4) print default option in separate line bert wesarg --- diff -urp old/src/default.h new/src/default.h --- old/src/default.h 2006-11-08 17:09:32.987700244 +0100 +++ new/src/default.h 2006-11-12 17:47:29.960143573 +0100 @@ -200,13 +200,10 @@ cfoption icewm_preferences[] = { OBV("ShowMoveSizeStatus", &showMoveSizeStatus, "Show position status window during move/resize"), OBV("ShowWorkspaceStatus", &workspaceSwitchStatus, "Show name of current workspace while switching"), OBV("MinimizeToDesktop", &minimizeToDesktop, "Display mini-icons on desktop for minimized windows"), - OBV("MiniIconsPlaceHorizontal", &miniIconsPlaceHorizontal, -"Place the mini-icons horizontal instead of vertical"), - OBV("MiniIconsRightToLeft", &miniIconsRightToLeft, -"Place new mini-icons from right to left"), - OBV("MiniIconsBottomToTop", &miniIconsBottomToTop, -"Place new mini-icons from bottom to top"), - OBV("StrongPointerFocus", &strongPointerFocus, "Always maintain focus under mouse window (makes some keyboard support non-functional or unreliable"), + OBV("MiniIconsPlaceHorizontal", &miniIconsPlaceHorizontal, "Place the mini-icons horizontal instead of vertical"), + OBV("MiniIconsRightToLeft", &miniIconsRightToLeft, "Place new mini-icons from right to left"), + OBV("MiniIconsBottomToTop", &miniIconsBottomToTop, "Place new mini-icons from bottom to top"), + OBV("StrongPointerFocus", &strongPointerFocus, "Always maintain focus under mouse window (makes some keyboard support non-functional or unreliable)"), OBV("OpaqueMove", &opaqueMove, "Opaque window move"), OBV("OpaqueResize", &opaqueResize, "Opaque window resize"), OBV("ManualPlacement", &manualPlacement, "Windows initially placed manually by user"), @@ -216,7 +213,7 @@ cfoption icewm_preferences[] = { OBV("AutoRaise", &autoRaise, "Auto raise windows after delay"), OBV("DelayPointerFocus", &delayPointerFocus, "Delay pointer focusing when mouse moves"), OBV("Win95Keys", &win95keys, "Support win95 keyboard keys (Penguin/Meta/Win_L,R shows menu)"), - OBV("ModSuperIsCtrlAlt", &modSuperIsCtrlAlt, "Treat Super/Win modifier as Ctrl+Alt"), + OBV("ModSuperIsCtrlAlt", &modSuperIsCtrlAlt, "Treat Super/Win modifier as Ctrl+Alt"), OBV("UseMouseWheel", &useMouseWheel, "Support mouse wheel"), OBV("ShowPopupsAbovePointer", &showPopupsAbovePointer, "Show popup menus above mouse pointer"), OBV("ReplayMenuCancelClick", &replayMenuCancelClick, "Send the clicks outside menus to target window"), @@ -227,7 +224,7 @@ cfoption icewm_preferences[] = { OBV("QuickSwitchGroupWorkspaces", &quickSwitchGroupWorkspaces, "Alt+Tab: group windows on current workspace"), OBV("QuickSwitchAllIcons", &quickSwitchAllIcons, "Show all reachable icons when quick switching"), OBV("QuickSwitchTextFirst", &quickSwitchTextFirst, "Show the window title above (all reachable) icons"), - OBV("QuickSwitchSmallWindow", &quickSwitchSmallWindow, "Attempt to create a small QuickSwitch window (1/3 instead of 3/5 of screen width)"), + OBV("QuickSwitchSmallWindow", &quickSwitchSmallWindow, "Attempt to create a small QuickSwitch window\n(1/3 instead of 3/5 of screen width)"), OBV("QuickSwitchMaxWidth", &quickSwitchMaxWidth, "Go trough all window titles and choose width of the longest one"), OBV("QuickSwitchVertical", &quickSwitchVertical, "Place the icons and titles vertical instead of horizontal"), OBV("QuickSwitchHugeIcon", &quickSwitchHugeIcon, "Show the huge (48x48) of the window icon for the active window"), @@ -258,17 +255,17 @@ cfoption icewm_preferences[] = { OBV("TaskBarShowTray", &taskBarShowTray, "Show windows in the tray"), OBV("TrayShowAllWindows", &trayShowAllWindows, "Show windows from all workspaces on tray"), #endif - OBV("TaskBarShowTransientWindows", &taskBarShowTransientWindows, "Show transient (dialogs, ...) windows on task bar"), + OBV("TaskBarShowTransientWindows", &taskBarShowTransientWindows, "Show transient (dialogs, ...) windows on task bar"), OBV("TaskBarShowAllWindows", &taskBarShowAllWindows, "Show windows from all workspaces on task bar"), OBV("TaskBarShowWindowIcons", &taskBarShowWindowIcons, "Show icons of windows on the task bar"), OBV("TaskBarShowStartMenu", &taskBarShowStartMenu, "Show 'Start' menu on task bar"), OBV("TaskBarShowWindowListMenu", &taskBarShowWindowListMenu, "Show 'window list' menu on task bar"), - OBV("TaskBarShowCPUStatus", &taskBarShowCPUStatus, "Show CPU status on task bar (Linux & Solaris)"), + OBV("TaskBarShowCPUStatus", &taskBarShowCPUStatus, "Show CPU status on task bar (Linux & Solaris)"), OBV("TaskBarShowNetStatus", &taskBarShowNetStatus, "Show network status on task bar (Linux only)"), OBV("TaskBarShowCollapseButton", &taskBarShowCollapseButton, "Show a button to collapse the taskbar"), OBV("TaskBarDoubleHeight", &taskBarDoubleHeight, "Use double-height task bar"), OBV("TaskBarWorkspacesLeft", &taskBarWorkspacesLeft, "Place workspace pager on left, not right"), - OBV("TaskBarLaunchOnSingleClick", &taskBarLaunchOnSingleClick, "Execute taskbar applet commands (like MailCommand, ClockCommand, ...) on single click"), + OBV("TaskBarLaunchOnSingleClick", &taskBarLaunchOnSingleClick, "Execute taskbar applet commands on single click\n(like MailCommand, ClockCommand, ...)"), #endif // OBV("WarpPointer", &warpPointer, "Move mouse when doing focusing in pointer focus mode"), OBV("ClientWindowMouseActions", &clientMouseActions, "Allow mouse actions on client windows (buggy with some programs)"), @@ -299,7 +296,7 @@ cfoption icewm_preferences[] = { OIV("MultiClickTime", &MultiClickTime, 0, 5000, "Multiple click time"), OIV("MenuActivateDelay", &MenuActivateDelay, 0, 5000, "Delay before activating menu items"), OIV("SubmenuMenuActivateDelay", &SubmenuActivateDelay, 0, 5000, "Delay before activating menu submenus"), - OIV("MenuMaximalWidth", &MenuMaximalWidth, 0, 16384, "Maximal width of popup menus, 2/3 of the screen's width if set to zero"), + OIV("MenuMaximalWidth", &MenuMaximalWidth, 0, 16384, "Maximal width of popup menus, 2/3 of the screen's width if set to zero"), #ifdef CONFIG_TOOLTIP OIV("ToolTipDelay", &ToolTipDelay, 0, 5000, "Delay before tooltip window is displayed"), OIV("ToolTipTime", &ToolTipTime, 0, 60000, "Time before tooltip window is hidden (0 means never"), @@ -307,7 +304,7 @@ cfoption icewm_preferences[] = { OIV("AutoHideDelay", &autoHideDelay, 0, 5000, "Delay before task bar is hidden"), OIV("AutoShowDelay", &autoShowDelay, 0, 5000, "Delay before task bar is shown"), OIV("AutoRaiseDelay", &autoRaiseDelay, 0, 5000, "Delay before windows are auto raised"), - OIV("EdgeResistance", &EdgeResistance, 0, 10000, "Resistance in pixels when trying to move windows off the screen (10000 = infinite)"), + OIV("EdgeResistance", &EdgeResistance, 0, 10000, "Resistance in pixels when trying to move windows off the screen\n(10000 = infinite)"), OIV("PointerFocusDelay", &pointerFocusDelay, 0, 1000, "Delay for pointer focus switching"), OIV("SnapDistance", &snapDistance, 0, 64, "Distance in pixels before windows snap together"), OIV("EdgeSwitchDelay", &edgeSwitchDelay, 0, 5000, "Screen edge workspace switching delay"), @@ -319,7 +316,7 @@ cfoption icewm_preferences[] = { OIV("UseRootButtons", &useRootButtons, 0, 255, "Bitmask of root window button click to use in window manager"), OIV("ButtonRaiseMask", &buttonRaiseMask, 0, 255, "Bitmask of buttons that raise the window when pressed"), OIV("DesktopWinMenuButton", &rootWinMenuButton, 0, 20, "Desktop mouse-button click to show the window list menu"), - OIV("DesktopWinListButton", &rootWinListButton, 0, 20, "Desktop mouse-button click to show the window list"), + OIV("DesktopWinListButton", &rootWinListButton, 0, 20, "Desktop mouse-button click to show the window list"), OIV("DesktopMenuButton", &rootMenuButton, 0, 20, "Desktop mouse-button click to show the root menu"), OIV("TitleBarMaximizeButton", &titleMaximizeButton, 0, 5, "TitleBar mouse-button double click to maximize the window"), OIV("TitleBarRollupButton", &titleRollupButton, 0, 5, "TitleBar mouse-button double click to rollup the window"), @@ -335,7 +332,7 @@ cfoption icewm_preferences[] = { OIV("XineramaPrimaryScreen", &xineramaPrimaryScreen, 0, 63, "Primary screen for xinerama (taskbar, ...)"), OIV("FocusRequestFlashTime", &focusRequestFlashTime, 0, (3600 * 24), "Number of seconds the taskbar app will blink when requesting focus"), - OIV("NestedThemeMenuMinNumber", &nestedThemeMenuMinNumber, 0, 1234, "Minimal number of themes after which the Themes menu becomes nested (0=disabled)"), + OIV("NestedThemeMenuMinNumber", &nestedThemeMenuMinNumber, 0, 1234, "Minimal number of themes after which the Themes menu becomes nested\n(0 = disabled)"), /// OSV("Theme", &themeName, "Theme name"), OSV("IconPath", &iconPath, "Icon search path (colon separated)"), OSV("MailBoxPath", &mailBoxPath, "Mailbox path (use $MAIL instead)"), @@ -456,8 +453,8 @@ cfoption icewm_preferences[] = { OKV("KeySysShowDesktop", gKeySysShowDesktop, ""), OKV("KeySysCollapseTaskBar", gKeySysCollapseTaskBar, ""), #endif - OKF("WorkspaceNames", addWorkspace, ""), OSV("WinMenuItems", &winMenuItems, "Items supported in menu window (rmsnxfhualytickw)"), + OKF("WorkspaceNames", addWorkspace, ""), OK0() }; diff -urp old/src/genpref.cc new/src/genpref.cc --- old/src/genpref.cc 2006-09-10 18:12:11.000000000 +0200 +++ new/src/genpref.cc 2006-11-09 19:40:26.220141728 +0100 @@ -18,26 +18,98 @@ void addBgImage(const char *, const char #include "themable.h" #include "icewmbg_prefs.h" -void show(cfoption *options) { +#include <cctype> + +void breaklines(const char *line) { + char pre[] = "##"; + unsigned maxlen = 76 - strlen(pre) - 1; + unsigned linelen; + char *p, *e; + char *linecpy = strdup(line); + char *c = linecpy; + + while (*c) { + linelen = strcspn(c, "\n"); + p = c; + c = p + linelen; + if (*c) + *c++ = '\0'; + + if (!linelen) { + printf("%s\n", pre); + continue; + } + + while (linelen) { + printf("%s ", pre); + + e = p; + while (*e && isspace(*e)) + e++; + linelen -= (int)(p - e); + p = e; + + if (linelen <= maxlen) { + printf("%s\n", p); + break; + } + + e = p + maxlen; + while (e >= p && !isspace(*e)) + --e; + + /* vary long word */ + /* find the end of this word and print */ + if (e == p) { + e = p + maxlen; + while (*e && !isspace(*e)) + e++; + } + + printf("%.*s\n", (int)(e - p), p); + linelen -= (int)(e - p); + p = e; + } + } + + free(linecpy); +} + +void show(const char *mode, cfoption *options) { for (unsigned int i = 0; options[i].type != cfoption::CF_NONE; i++) { - if (options[i].description) - printf("# %s\n", options[i].description); + if (options[i].description && *options[i].description) + breaklines(options[i].description); + + printf("## scope: %s\n", mode); switch (options[i].type) { case cfoption::CF_BOOL: - printf("# %s=%d # 0/1\n", - options[i].name, (*options[i].v.bool_value) ? 1 : 0); + printf("## type: boolean\n" + "## default: %s\n" + "# %s=%s\n", + (*options[i].v.bool_value) ? "true" : "false", + options[i].name, + (*options[i].v.bool_value) ? "true" : "false"); break; case cfoption::CF_INT: - printf("# %s=%d # [%d-%d]\n", - options[i].name, *options[i].v.i.int_value, - options[i].v.i.min, options[i].v.i.max); + printf("## type: numeric\n" + "## range: [%d-%d]\n" + "## default: %d\n" + "# %s=%d\n", + options[i].v.i.min, options[i].v.i.max, + *options[i].v.i.int_value, + options[i].name, *options[i].v.i.int_value); break; case cfoption::CF_STR: + printf("## type: string\n"); if (options[i].v.s.string_value) { - printf("# %s=\"%s\"\n", + printf("## default: \"%s\"\n" + "# %s=\"%s\"\n", + (*options[i].v.s.string_value) ? (*options[i].v.s.string_value) : "", options[i].name, (*options[i].v.s.string_value) ? (*options[i].v.s.string_value) : ""); + } else { + printf("# %s=\n", options[i].name); } break; #ifndef NO_KEYBIND @@ -45,7 +117,10 @@ void show(cfoption *options) { { WMKey *key = options[i].v.k.key_value; - printf("# %s=\"%s\"\n", options[i].name, key->name); + printf("## type: key\n" + "## default: \"%s\"\n" + "# %s=\"%s\"\n", + key->name, options[i].name, key->name); } break; #endif @@ -60,26 +135,31 @@ void show(cfoption *options) { int main() { #ifndef NO_CONFIGURE - printf("# preferences(%s) - generated by genpref\n\n", VERSION); - printf("# This file should be copied to /etc/icewm/ or $HOME/.icewm/ directory\n"); - printf("# NOTE: All settings are commented out by default, be sure to\n" - "# uncomment them if you change them!\n\n"); - - show(icewm_preferences); - - printf("# -----------------------------------------------------------\n" - "# Themable preferences. Themes will override these.\n" - "# To override the themes, place them in ~/.icewm/prefoverride\n" - "# -----------------------------------------------------------\n\n"); - - show(icewm_themable_preferences); + printf("## preferences(%s) - generated by genpref\n", VERSION); + puts("\n" + "## -------------------------------------------------------------------------\n" + "## This file should be copied to /etc/icewm/ or $HOME/.icewm/ directory\n" + "## NOTE: All settings are commented out by default (with one '#'),\n" + "## be sure to uncomment them if you change them!\n" + "## -------------------------------------------------------------------------\n"); + show("global", icewm_preferences); // special case, for now - puts("WorkspaceNames=\" 1 \", \" 2 \", \" 3 \", \" 4 \""); + puts("WorkspaceNames=\" 1 \", \" 2 \", \" 3 \", \" 4 \"\n"); - puts("\n#\n# icewmbg preferences\n#"); - puts("# IMPORTANT: You MUST run icewmbg (probably before icewm)\n" - "# to set the background!\n#\n"); - show(icewmbg_prefs); + puts("\n" + "## -------------------------------------------------------------------------\n" + "## Themable preferences. Themes will override these.\n" + "## To override the themes, place them in ~/.icewm/prefoverride\n" + "## -------------------------------------------------------------------------\n"); + show("themable", icewm_themable_preferences); + + puts("\n" + "## -------------------------------------------------------------------------\n" + "## icewmbg preferences\n" + "## IMPORTANT: You MUST run icewmbg (probably before icewm)\n" + "## to set the background!\n" + "## -------------------------------------------------------------------------\n"); + show("icewmbg", icewmbg_prefs); #endif } diff -urp old/src/themable.h new/src/themable.h --- old/src/themable.h 2006-09-10 18:12:11.000000000 +0200 +++ new/src/themable.h 2006-11-12 18:33:12.451464100 +0100 @@ -152,7 +152,7 @@ XSV(const char *, gradients, cfoption icewm_themable_preferences[] = { #ifndef LITE - OBV("RolloverButtonsSupported", &rolloverTitleButtons, "Does it support the 'O' title bar button images (for mouse rollover)"), + OBV("RolloverButtonsSupported", &rolloverTitleButtons, "Does it support the 'O' title bar button images (for mouse rollover)"), #endif OBV("TaskBarClockLeds", &prettyClock, "Task bar clock/APM uses nice pixmapped LCD display (but then it doesn't display correctly in many languages anymore, e.g. for Japanese and Korean it works only when a real font is used and not the LEDs"), OBV("TrayDrawBevel", &trayDrawBevel, "Surround the tray with plastic border"), @@ -184,14 +184,14 @@ cfoption icewm_themable_preferences[] = OIV("QuickSwitchVertMargin", &quickSwitchVMargin, 0, 64, "Vertical margin of the quickswitch window"), OIV("QuickSwitchIconMargin", &quickSwitchIMargin, 0, 64, "Vertical margin in the quickswitch window"), OIV("QuickSwitchIconBorder", &quickSwitchIBorder, 0, 64, "Distance between the active icon and it's border"), - OIV("QuickSwitchSeparatorSize", &quickSwitchSepSize, 0, 64, "Height of the separator between (all reachable) icons and text, 0 to avoid it"), + OIV("QuickSwitchSeparatorSize", &quickSwitchSepSize, 0, 64, "Height of the separator between (all reachable) icons and text\n(0 = avoid it)"), OSV("ThemeAuthor", &themeAuthor, "Theme author, e-mail address, credits"), OSV("ThemeDescription", &themeDescription, "Description of the theme, credits"), - OSV("TitleButtonsLeft", &titleButtonsLeft, "Titlebar buttons from left to right (x=close, m=max, i=min, h=hide, r=rollup, s=sysmenu, d=depth)"), - OSV("TitleButtonsRight", &titleButtonsRight, "Titlebar buttons from right to left (x=close, m=max, i=min, h=hide, r=rollup, s=sysmenu, d=depth)"), - OSV("TitleButtonsSupported", &titleButtonsSupported, "Titlebar buttons supported by theme (x,m,i,r,h,s,d)"), + OSV("TitleButtonsLeft", &titleButtonsLeft, "Titlebar buttons from left to right\n(x=close, m=max, i=min, h=hide, r=rollup, s=sysmenu, d=depth)"), + OSV("TitleButtonsRight", &titleButtonsRight, "Titlebar buttons from right to left\n(x=close, m=max, i=min, h=hide, r=rollup, s=sysmenu, d=depth)"), + OSV("TitleButtonsSupported", &titleButtonsSupported, "Titlebar buttons supported by theme\n(x,m,i,r,h,s,d)"), /************************************************************************************************************************************************************ * Font definitions ************************************************************************************************************************************************************/ @@ -233,7 +233,7 @@ cfoption icewm_themable_preferences[] = OSV("ColorNormalWorkspaceButton", &clrWorkspaceNormalButton, "Background of workspace buttons, ColorNormalButton is used if empty"), OSV("ColorNormalWorkspaceButtonText", &clrWorkspaceNormalButtonText, "Textcolor of workspace buttons, ColorNormalButtonText is used if empty"), OSV("ColorActiveWorkspaceButton", &clrWorkspaceActiveButton, "Background of the active workspace button, ColorActiveButton is used if empty"), - OSV("ColorActiveWorkspaceButtonText", &clrWorkspaceActiveButtonText, "Textcolor of the active workspace button, ColorActiveButtonText is used if empty"), + OSV("ColorActiveWorkspaceButtonText", &clrWorkspaceActiveButtonText, "Textcolor of the active workspace button, ColorActiveButtonText is used if empty"), OSV("ColorNormalTitleBar", &clrInactiveTitleBar, "Background of the titlebar of regular windows"), OSV("ColorNormalTitleBarText", &clrInactiveTitleBarText, "Textcolor of the titlebar of regular windows"), diff -urp old/src/yconfig.cc new/src/yconfig.cc --- old/src/yconfig.cc 2006-09-10 18:12:10.000000000 +0200 +++ new/src/yconfig.cc 2006-11-09 19:00:39.806247359 +0100 @@ -238,6 +238,10 @@ char *setOption(cfoption *options, char if (options[a].v.bool_value) { if ((arg[0] == '1' || arg[0] == '0') && arg[1] == 0) { *(options[a].v.bool_value) = (arg[0] == '1') ? true : false; + } else if (!strcasecmp(arg, "true") || !strcasecmp(arg, "yes")) { + *(options[a].v.bool_value) = true; + } else if (!strcasecmp(arg, "false") || !strcasecmp(arg, "no")) { + *(options[a].v.bool_value) = false; } else { msg(_("Bad argument: %s for %s"), arg, name); return rest; ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [PATCH 3/11] send keyevents with icesh: 00017, Bert Wesarg |
|---|---|
| Next by Date: | [PATCH 5/11] .icewm/theme: avoid multi # lines: 00017, Bert Wesarg |
| Previous by Thread: | [PATCH 3/11] send keyevents with iceshi: 00017, Bert Wesarg |
| Next by Thread: | [PATCH 5/11] .icewm/theme: avoid multi # lines: 00017, Bert Wesarg |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |