eterm/src/options.h

177 lines
7.3 KiB
C
Raw Normal View History

/*
* Copyright (C) 1997-2002, Michael Jennings
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _OPTIONS_H_
#define _OPTIONS_H_
#include <X11/Xfuncproto.h>
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
/************ Macros and Definitions ************/
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org> This is the first public availability of the work thus far on Eterm 0.9.1. There's quite a bit of new stuff here. * Added scrollbar thumb support. * Completely redid the terminfo/termcap stuff. The terminfo file is now compiled (by tic) and installed by default (unless you specify --without-terminfo). The config files still say xterm, though, because some programs (like SLang and GNU mc) use the silly algorithm of "Is $TERM set to xterm?" to detect mouse reporting support in a terminal. =P But if you don't ever use xterm, you can use Eterm's termcap and just name it "xterm" instead. Thanks to Marius Gedminas <mgedmin@takas.lt> for his patch that started this whole revamp. * Added the kEsetroot script for KDE users from Dax Games <dgames@isoc.net>. * You can now configure the Home and End emulation via --with-home= and --with-end= options to configure. The --with-terminfo option is also new, and --enable-xim is now the default. * Added a new image state, disabled, for when Eterm loses focus. This is supported by all widgets (well, all those that could possibly be on screen when Eterm lost focus), even the background image. So you could actually have all your images darken on focus out and restore to normal on focus in. * Widget colors formerly dealt with as colors (menu text color, scrollbar color, etc.) are now handled by the imageclasses. Each image state can have a foreground and background color defined. The current exception is the background image; I hope to add that later. The foreground is the text color and the background is the object color (for solid color mode). So menu text color is set by the menu imageclass. And again, for unfocused colors, use the disabled state of the imageclass. * Proportionally-spaced fonts are now handled much better. They are still forced into evenly-spaced columns (it's a terminal for crying out loud!) but at least you don't end up with Eterm's wider than your screen. :-) * Home on refresh is gone, as is home on echo. It's now much simpler. There are two options: home on output, and home on input, the former being a combination of echo and refresh. Also, keypresses that don't necessarily have corresonding output can trigger a home on input, like Ctrl-End or whatever...ones that don't have special meaning. Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out this issue and the one with "m-" in font names. * I finally got around to re-merging the new parser stuff from my work on the Not Game. Closed up some old potential behavior quirks with theme parsing. * Added a new escape sequence to fork-and-exec a program. Also added a scrollback search capability to highlight all occurances of a string in your scrollback buffer. Use the new "Etsearch" utility to access it. "Etsearch string" to search for a string, then "Etsearch" by itself to reset the highlighting. * And of course, the biggie. Eterm now supports a completely- customizeable buttonbar. Not a menubar, a buttonbar. It can have an arbitrary number of buttons, and each button can perform an action, just like a menuitem. So a button could bring up a menu (like a menubar) or launch a program (like a launchbar) or perform an operation (like a toolbar). Each button can have an icon, text, or both. And you can have buttons left- or right-justified in the buttonbar. You will eventually be able to have an arbitrary number of buttonbars, but I'm still working on that. As with any change this big, things could very easily be broken. So beware. :-) I have tested this myself, and everything seems to work, but I can't test every possibility. Let me know if you find anything that's broken, and enjoy! SVN revision: 2048
2000-02-10 16:25:07 -08:00
#define OPT_BOOLEAN 0x0001
#define OPT_INTEGER 0x0002
#define OPT_STRING 0x0004
#define OPT_ARGUMENT 0x0008
#define OPT_STR(s, l, d, p) { s, l, "(str) " d, OPT_STRING, (const char **) p, 0, 0 }
#define OPT_INT(s, l, d, p) { s, l, "(int) " d, OPT_INTEGER, (const int *) p, 0, 0 }
#define OPT_BOOL(s, l, d, v, m) { s, l, "(bool) " d, OPT_BOOLEAN, NULL, v, m }
#define OPT_LONG(l, d, p) { 0, l, "(str) " d, OPT_STRING, (const char **) p, 0, 0 }
#define OPT_ARGS(s, l, d, p) { s, l, "(str) " d, OPT_ARGUMENT, (const char ***) p, 0, 0 }
#define OPT_BLONG(l, d, v, m) { 0, l, "(bool) " d, OPT_BOOLEAN, NULL, v, m }
#define OPT_ILONG(l, d, p) { 0, l, "(int) " d, OPT_INTEGER, (const int *) p, 0, 0 }
#define optList_numoptions() (sizeof(optList)/sizeof(optList[0]))
# define Opt_console (1LU << 0)
# define Opt_login_shell (1LU << 1)
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org> This is the first public availability of the work thus far on Eterm 0.9.1. There's quite a bit of new stuff here. * Added scrollbar thumb support. * Completely redid the terminfo/termcap stuff. The terminfo file is now compiled (by tic) and installed by default (unless you specify --without-terminfo). The config files still say xterm, though, because some programs (like SLang and GNU mc) use the silly algorithm of "Is $TERM set to xterm?" to detect mouse reporting support in a terminal. =P But if you don't ever use xterm, you can use Eterm's termcap and just name it "xterm" instead. Thanks to Marius Gedminas <mgedmin@takas.lt> for his patch that started this whole revamp. * Added the kEsetroot script for KDE users from Dax Games <dgames@isoc.net>. * You can now configure the Home and End emulation via --with-home= and --with-end= options to configure. The --with-terminfo option is also new, and --enable-xim is now the default. * Added a new image state, disabled, for when Eterm loses focus. This is supported by all widgets (well, all those that could possibly be on screen when Eterm lost focus), even the background image. So you could actually have all your images darken on focus out and restore to normal on focus in. * Widget colors formerly dealt with as colors (menu text color, scrollbar color, etc.) are now handled by the imageclasses. Each image state can have a foreground and background color defined. The current exception is the background image; I hope to add that later. The foreground is the text color and the background is the object color (for solid color mode). So menu text color is set by the menu imageclass. And again, for unfocused colors, use the disabled state of the imageclass. * Proportionally-spaced fonts are now handled much better. They are still forced into evenly-spaced columns (it's a terminal for crying out loud!) but at least you don't end up with Eterm's wider than your screen. :-) * Home on refresh is gone, as is home on echo. It's now much simpler. There are two options: home on output, and home on input, the former being a combination of echo and refresh. Also, keypresses that don't necessarily have corresonding output can trigger a home on input, like Ctrl-End or whatever...ones that don't have special meaning. Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out this issue and the one with "m-" in font names. * I finally got around to re-merging the new parser stuff from my work on the Not Game. Closed up some old potential behavior quirks with theme parsing. * Added a new escape sequence to fork-and-exec a program. Also added a scrollback search capability to highlight all occurances of a string in your scrollback buffer. Use the new "Etsearch" utility to access it. "Etsearch string" to search for a string, then "Etsearch" by itself to reset the highlighting. * And of course, the biggie. Eterm now supports a completely- customizeable buttonbar. Not a menubar, a buttonbar. It can have an arbitrary number of buttons, and each button can perform an action, just like a menuitem. So a button could bring up a menu (like a menubar) or launch a program (like a launchbar) or perform an operation (like a toolbar). Each button can have an icon, text, or both. And you can have buttons left- or right-justified in the buttonbar. You will eventually be able to have an arbitrary number of buttonbars, but I'm still working on that. As with any change this big, things could very easily be broken. So beware. :-) I have tested this myself, and everything seems to work, but I can't test every possibility. Let me know if you find anything that's broken, and enjoy! SVN revision: 2048
2000-02-10 16:25:07 -08:00
# define Opt_iconic (1LU << 2)
# define Opt_visual_bell (1LU << 3)
# define Opt_map_alert (1LU << 4)
# define Opt_reverse_video (1LU << 5)
# define Opt_write_utmp (1LU << 6)
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org> This is the first public availability of the work thus far on Eterm 0.9.1. There's quite a bit of new stuff here. * Added scrollbar thumb support. * Completely redid the terminfo/termcap stuff. The terminfo file is now compiled (by tic) and installed by default (unless you specify --without-terminfo). The config files still say xterm, though, because some programs (like SLang and GNU mc) use the silly algorithm of "Is $TERM set to xterm?" to detect mouse reporting support in a terminal. =P But if you don't ever use xterm, you can use Eterm's termcap and just name it "xterm" instead. Thanks to Marius Gedminas <mgedmin@takas.lt> for his patch that started this whole revamp. * Added the kEsetroot script for KDE users from Dax Games <dgames@isoc.net>. * You can now configure the Home and End emulation via --with-home= and --with-end= options to configure. The --with-terminfo option is also new, and --enable-xim is now the default. * Added a new image state, disabled, for when Eterm loses focus. This is supported by all widgets (well, all those that could possibly be on screen when Eterm lost focus), even the background image. So you could actually have all your images darken on focus out and restore to normal on focus in. * Widget colors formerly dealt with as colors (menu text color, scrollbar color, etc.) are now handled by the imageclasses. Each image state can have a foreground and background color defined. The current exception is the background image; I hope to add that later. The foreground is the text color and the background is the object color (for solid color mode). So menu text color is set by the menu imageclass. And again, for unfocused colors, use the disabled state of the imageclass. * Proportionally-spaced fonts are now handled much better. They are still forced into evenly-spaced columns (it's a terminal for crying out loud!) but at least you don't end up with Eterm's wider than your screen. :-) * Home on refresh is gone, as is home on echo. It's now much simpler. There are two options: home on output, and home on input, the former being a combination of echo and refresh. Also, keypresses that don't necessarily have corresonding output can trigger a home on input, like Ctrl-End or whatever...ones that don't have special meaning. Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out this issue and the one with "m-" in font names. * I finally got around to re-merging the new parser stuff from my work on the Not Game. Closed up some old potential behavior quirks with theme parsing. * Added a new escape sequence to fork-and-exec a program. Also added a scrollback search capability to highlight all occurances of a string in your scrollback buffer. Use the new "Etsearch" utility to access it. "Etsearch string" to search for a string, then "Etsearch" by itself to reset the highlighting. * And of course, the biggie. Eterm now supports a completely- customizeable buttonbar. Not a menubar, a buttonbar. It can have an arbitrary number of buttons, and each button can perform an action, just like a menuitem. So a button could bring up a menu (like a menubar) or launch a program (like a launchbar) or perform an operation (like a toolbar). Each button can have an icon, text, or both. And you can have buttons left- or right-justified in the buttonbar. You will eventually be able to have an arbitrary number of buttonbars, but I'm still working on that. As with any change this big, things could very easily be broken. So beware. :-) I have tested this myself, and everything seems to work, but I can't test every possibility. Let me know if you find anything that's broken, and enjoy! SVN revision: 2048
2000-02-10 16:25:07 -08:00
# define Opt_scrollbar (1LU << 7)
# define Opt_meta8 (1LU << 8)
# define Opt_home_on_output (1LU << 9)
# define Opt_scrollbar_right (1LU << 10)
# define Opt_borderless (1LU << 11)
# define Opt_no_input (1LU << 12)
# define Opt_no_cursor (1LU << 13)
# define Opt_pause (1LU << 14)
# define Opt_home_on_input (1LU << 15)
# define Opt_report_as_keysyms (1LU << 16)
# define Opt_xterm_select (1LU << 17)
# define Opt_select_whole_line (1LU << 18)
# define Opt_scrollbar_popup (1LU << 19)
# define Opt_select_trailing_spaces (1LU << 20)
# define Opt_install (1LU << 21)
# define Opt_scrollbar_floating (1LU << 22)
# define Opt_double_buffer (1LU << 23)
# define Opt_mbyte_cursor (1LU << 24)
# define Opt_proportional (1LU << 25)
# define Opt_resize_gravity (1LU << 26)
# define IMOPT_TRANS (1U << 0)
Mon Mar 6 21:11:13 PST 2000 Michael Jennings <mej@eterm.org> Added a new option. -0 (that's a zero) or --itrans will invoke the immotile optimization for transparency, so named because it works best on windows that don't move around much on the desktop. It works even better for windows that are sticky between desktops. So if you have logging windows (running tail -f and the like) that are shaded/tinted, you definitely want to have this. It will even benefit ordinary Eterm windows, provided you don't move them around a lot. Eterms that do not change desktops may be better off with the other way; Eterms that are not shaded or tinted at all will not behave any differently. Here's the technical explanation for those who are interested. The old (and still the default) behavior is for Eterm to check to see if any color modifiers are applied to the image_bg class, and if so, to make a copy of the *entire* desktop image which is then shaded/tinted appropriately. It then snapshots a portion of that for the actual background. This way, if the Eterm window is moved, all the shading and tinting will have already been done, so all it has to do is grab another portion of the desktop and use it. However, this involves a LOT of calculations (one per pixel of the desktop pixmap) on startup and at every desktop switch. The immotile optimization is intended to reverse that logic by optimizing for windows that do not move (hence the term "immotile"). It takes the snapshot of the desktop pixmap and applies any shading or tinting *after* taking the portion it needs. This requires much fewer calculations on startup and when changing desktops, but the entire set of calculations must be repeated whenever the window is moved. This is fine for small windows or windows that don't move very often, but that's not always the case. So it is to your advantage to pick one or the other depending on how you use each particular theme or window. Two notes. One, keep in mind that the -0/--itrans option doesn't *activate* transparency; you still need -O/--trans for that. Two, this does not affect Eterms with no color modifiers applied to the background. In that case, Eterm still references the existing desktop pixmap to save memory. SVN revision: 2191
2000-03-06 21:30:33 -08:00
# define IMOPT_ITRANS (1U << 1)
# define IMOPT_VIEWPORT (1U << 2)
# define BBAR_FORCE_TOGGLE (0x03)
# define SAVE_THEME_CONFIG ((unsigned char) 1)
# define SAVE_USER_CONFIG ((unsigned char) 0)
#define PARSE_TRY_USER_THEME ((unsigned char) 0x01)
#define PARSE_TRY_DEFAULT_THEME ((unsigned char) 0x02)
#define PARSE_TRY_NO_THEME ((unsigned char) 0x04)
#define PARSE_TRY_ALL ((unsigned char) 0x07)
/* This defines how many mistakes to allow before giving up
and printing the usage -- mej */
#define BAD_THRESHOLD 3
#define CHECK_BAD() do { \
if (++bad_opts >= BAD_THRESHOLD) { \
print_error("Error threshold exceeded, giving up.\n"); \
usage(); \
} else { \
print_error("Attempting to continue, but strange things may happen.\n"); \
} \
} while(0)
#define to_keysym(p,s) do { KeySym sym; \
if (s && ((sym = XStringToKeysym(s)) != 0)) *p = sym; \
} while (0)
#define CHECK_VALID_INDEX(i) (((i) >= image_bg) && ((i) < image_max))
#define RESET_AND_ASSIGN(var, val) do {if ((var) != NULL) FREE(var); (var) = (val);} while (0)
/************ Structures ************/
/************ Variables ************/
extern unsigned long Options, image_toggles;
extern char *theme_dir, *user_dir;
extern char **rs_exec_args; /* Args to exec (-e or --exec) */
extern char *rs_title; /* Window title */
extern char *rs_iconName; /* Icon name */
extern char *rs_geometry; /* Geometry string */
extern int rs_desktop; /* Startup desktop */
extern int rs_saveLines; /* Lines in the scrollback buffer */
extern unsigned short rs_min_anchor_size; /* Minimum size, in pixels, of the scrollbar anchor */
extern char *rs_finished_title; /* Text added to window title (--pause) */
extern char *rs_finished_text; /* Text added to scrollback (--pause) */
extern char *rs_term_name;
extern char *rs_icon;
extern char *rs_scrollbar_type;
extern unsigned long rs_scrollbar_width;
extern char *rs_scrollbar_type;
extern char *rs_anim_pixmap_list;
extern char **rs_anim_pixmaps;
extern time_t rs_anim_delay;
extern char *rs_path;
extern char *rs_no_cursor;
#ifdef USE_XIM
extern char *rs_input_method;
extern char *rs_preedit_type;
#endif
extern char *rs_name;
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org> This is the first public availability of the work thus far on Eterm 0.9.1. There's quite a bit of new stuff here. * Added scrollbar thumb support. * Completely redid the terminfo/termcap stuff. The terminfo file is now compiled (by tic) and installed by default (unless you specify --without-terminfo). The config files still say xterm, though, because some programs (like SLang and GNU mc) use the silly algorithm of "Is $TERM set to xterm?" to detect mouse reporting support in a terminal. =P But if you don't ever use xterm, you can use Eterm's termcap and just name it "xterm" instead. Thanks to Marius Gedminas <mgedmin@takas.lt> for his patch that started this whole revamp. * Added the kEsetroot script for KDE users from Dax Games <dgames@isoc.net>. * You can now configure the Home and End emulation via --with-home= and --with-end= options to configure. The --with-terminfo option is also new, and --enable-xim is now the default. * Added a new image state, disabled, for when Eterm loses focus. This is supported by all widgets (well, all those that could possibly be on screen when Eterm lost focus), even the background image. So you could actually have all your images darken on focus out and restore to normal on focus in. * Widget colors formerly dealt with as colors (menu text color, scrollbar color, etc.) are now handled by the imageclasses. Each image state can have a foreground and background color defined. The current exception is the background image; I hope to add that later. The foreground is the text color and the background is the object color (for solid color mode). So menu text color is set by the menu imageclass. And again, for unfocused colors, use the disabled state of the imageclass. * Proportionally-spaced fonts are now handled much better. They are still forced into evenly-spaced columns (it's a terminal for crying out loud!) but at least you don't end up with Eterm's wider than your screen. :-) * Home on refresh is gone, as is home on echo. It's now much simpler. There are two options: home on output, and home on input, the former being a combination of echo and refresh. Also, keypresses that don't necessarily have corresonding output can trigger a home on input, like Ctrl-End or whatever...ones that don't have special meaning. Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out this issue and the one with "m-" in font names. * I finally got around to re-merging the new parser stuff from my work on the Not Game. Closed up some old potential behavior quirks with theme parsing. * Added a new escape sequence to fork-and-exec a program. Also added a scrollback search capability to highlight all occurances of a string in your scrollback buffer. Use the new "Etsearch" utility to access it. "Etsearch string" to search for a string, then "Etsearch" by itself to reset the highlighting. * And of course, the biggie. Eterm now supports a completely- customizeable buttonbar. Not a menubar, a buttonbar. It can have an arbitrary number of buttons, and each button can perform an action, just like a menuitem. So a button could bring up a menu (like a menubar) or launch a program (like a launchbar) or perform an operation (like a toolbar). Each button can have an icon, text, or both. And you can have buttons left- or right-justified in the buttonbar. You will eventually be able to have an arbitrary number of buttonbars, but I'm still working on that. As with any change this big, things could very easily be broken. So beware. :-) I have tested this myself, and everything seems to work, but I can't test every possibility. Let me know if you find anything that's broken, and enjoy! SVN revision: 2048
2000-02-10 16:25:07 -08:00
extern char *rs_theme;
extern char *rs_config_file;
#ifdef ESCREEN
extern char *rs_url;
extern char *rs_hop;
#endif
extern unsigned int rs_line_space;
extern unsigned int rs_meta_mod, rs_alt_mod, rs_numlock_mod;
#ifndef NO_BOLDFONT
extern char *rs_boldFont;
#endif
#ifdef PRINTPIPE
extern char *rs_print_pipe;
#endif
extern char *rs_cutchars;
#ifdef CUTCHAR_OPTION
extern char *rs_cutchars;
#endif
extern const char *true_vals[];
extern const char *false_vals[];
#ifdef KEYSYM_ATTRIBUTE
extern unsigned char *KeySym_map[256];
#endif
#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
extern KeySym ks_bigfont;
extern KeySym ks_smallfont;
#endif
/************ Function Prototypes ************/
_XFUNCPROTOBEGIN
unsigned long num_words(const char *str);
extern void get_initial_options(int, char **);
extern void get_options(int, char **);
extern char *conf_parse_theme(char **theme, char *conf_name, unsigned char fallback);
extern void init_defaults(void);
extern void post_parse(void);
unsigned char save_config(char *, unsigned char);
_XFUNCPROTOEND
#endif /* _OPTIONS_H_ */