Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
There are now two different sets of settings you can save. You can save user settings, which are the things that one would generally consider to be user-specific (toggles, text colors, etc.). You can also save theme settings, which saves *everything*, including the stuff that user settings don't include (like imageclasses, menus, etc.). Settings are saved to user.cfg and theme.cfg, respectively. Also, Eterm will now detect if it cannot write to the location from which it got the theme (i.e., a system-wide directory), and will fall back on ~/.Eterm/themes/<theme>. It WILL create this directory tree if it does not already exist. Hopefully this will make more people happy. :-) SVN revision: 2440
This commit is contained in:
parent
d922e2ce53
commit
ac4f703548
17
ChangeLog
17
ChangeLog
|
@ -3414,3 +3414,20 @@ Mon Apr 3 16:42:06 PDT 2000 Michael Jennings <mej@eterm.org>
|
||||||
Added a --buttonbar option to force on/off all your buttonbars.
|
Added a --buttonbar option to force on/off all your buttonbars.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
Wed Apr 5 21:48:39 PDT 2000 Michael Jennings <mej@eterm.org>
|
||||||
|
|
||||||
|
There are now two different sets of settings you can save. You can
|
||||||
|
save user settings, which are the things that one would generally
|
||||||
|
consider to be user-specific (toggles, text colors, etc.). You can
|
||||||
|
also save theme settings, which saves *everything*, including the
|
||||||
|
stuff that user settings don't include (like imageclasses, menus,
|
||||||
|
etc.). Settings are saved to user.cfg and theme.cfg, respectively.
|
||||||
|
|
||||||
|
Also, Eterm will now detect if it cannot write to the location from
|
||||||
|
which it got the theme (i.e., a system-wide directory), and will fall
|
||||||
|
back on ~/.Eterm/themes/<theme>. It WILL create this directory tree
|
||||||
|
if it does not already exist.
|
||||||
|
|
||||||
|
Hopefully this will make more people happy. :-)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
|
@ -329,6 +329,7 @@
|
||||||
#undef KS_HOME
|
#undef KS_HOME
|
||||||
#undef KS_END
|
#undef KS_END
|
||||||
#undef CONFIG_BUFF
|
#undef CONFIG_BUFF
|
||||||
|
#undef PKGDATADIR
|
||||||
|
|
||||||
|
|
||||||
/* Leave that blank line there!! Autoheader needs it.
|
/* Leave that blank line there!! Autoheader needs it.
|
||||||
|
|
19
configure.in
19
configure.in
|
@ -655,6 +655,9 @@ AC_PREFIX(gcc)
|
||||||
if test "$prefix" = "NONE"; then
|
if test "$prefix" = "NONE"; then
|
||||||
prefix=$ac_default_prefix
|
prefix=$ac_default_prefix
|
||||||
fi
|
fi
|
||||||
|
if test "$exec_prefix" = "NONE"; then
|
||||||
|
exec_prefix=$prefix
|
||||||
|
fi
|
||||||
|
|
||||||
dnl Stack Tracing toys
|
dnl Stack Tracing toys
|
||||||
AC_ARG_ENABLE(stack-trace, [ --disable-stack-trace disable stack trace on abnormal termination],
|
AC_ARG_ENABLE(stack-trace, [ --disable-stack-trace disable stack trace on abnormal termination],
|
||||||
|
@ -708,7 +711,15 @@ AC_CHECK_LIB(Kenny, life_signs, , [
|
||||||
])
|
])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(CONFIG_SEARCH_PATH, "~/.Eterm/themes:~/.Eterm:${prefix}/share/Eterm/themes:${prefix}/share/Eterm")
|
CONFIG_SEARCH_PATH=`eval eval eval eval eval echo "${datadir}/$PACKAGE/themes:${datadir}/$PACKAGE"`
|
||||||
|
AC_DEFINE_UNQUOTED(CONFIG_SEARCH_PATH, "~/.Eterm/themes:~/.Eterm:$CONFIG_SEARCH_PATH")
|
||||||
|
# Do replacements on theme files and such. All variables to be replaced
|
||||||
|
# by this routine MUST be exported before the awk script runs.
|
||||||
|
if test "X$PKGDATADIR" = "X" ; then
|
||||||
|
PKGDATADIR=`eval eval eval eval echo "$datadir/$PACKAGE"`
|
||||||
|
fi
|
||||||
|
export PKGDATADIR
|
||||||
|
AC_DEFINE_UNQUOTED(PKGDATADIR, "$PKGDATADIR")
|
||||||
|
|
||||||
CFLAGS=${CFLAGS--O}
|
CFLAGS=${CFLAGS--O}
|
||||||
LDFLAGS=${LDFLAGS--O}
|
LDFLAGS=${LDFLAGS--O}
|
||||||
|
@ -729,12 +740,6 @@ AM_CONFIG_HEADER(config.h)
|
||||||
AC_OUTPUT(Makefile bg/Makefile doc/Makefile utils/Makefile libmej/Makefile
|
AC_OUTPUT(Makefile bg/Makefile doc/Makefile utils/Makefile libmej/Makefile
|
||||||
pix/Makefile src/Makefile themes/Makefile Eterm.spec)
|
pix/Makefile src/Makefile themes/Makefile Eterm.spec)
|
||||||
|
|
||||||
# Do replacements on theme files and such. All variables to be replaced
|
|
||||||
# by this routine MUST be exported before the awk script runs.
|
|
||||||
if test "X$PKGDATADIR" = "X" ; then
|
|
||||||
PKGDATADIR=`eval eval eval eval echo "$datadir/$PACKAGE"`
|
|
||||||
fi
|
|
||||||
export PKGDATADIR
|
|
||||||
# Mega evals to make sure all the relative variables get resolved.
|
# Mega evals to make sure all the relative variables get resolved.
|
||||||
BINDIR=`eval eval eval eval echo ${bindir}`
|
BINDIR=`eval eval eval eval echo ${bindir}`
|
||||||
export BINDIR bindir prefix exec_prefix datadir PACKAGE
|
export BINDIR bindir prefix exec_prefix datadir PACKAGE
|
||||||
|
|
|
@ -154,10 +154,24 @@ action_add(unsigned short mod, unsigned char button, KeySym keysym, action_type_
|
||||||
action->type = type;
|
action->type = type;
|
||||||
action->keysym = keysym;
|
action->keysym = keysym;
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case ACTION_STRING: action->handler = (action_handler_t) action_handle_string; action->param.string = StrDup((char *) param); break;
|
case ACTION_STRING:
|
||||||
case ACTION_ECHO: action->handler = (action_handler_t) action_handle_echo; action->param.string = StrDup((char *) param); break;
|
action->handler = (action_handler_t) action_handle_string;
|
||||||
case ACTION_MENU: action->handler = (action_handler_t) action_handle_menu; action->param.menu = (menu_t *) param; break;
|
action->param.string = (char *) MALLOC(strlen((char *) param) + 2);
|
||||||
default: break;
|
strcpy(action->param.string, (char *) param);
|
||||||
|
parse_escaped_string(action->param.string);
|
||||||
|
break;
|
||||||
|
case ACTION_ECHO:
|
||||||
|
action->handler = (action_handler_t) action_handle_echo;
|
||||||
|
action->param.string = (char *) MALLOC(strlen((char *) param) + 2);
|
||||||
|
strcpy(action->param.string, (char *) param);
|
||||||
|
parse_escaped_string(action->param.string);
|
||||||
|
break;
|
||||||
|
case ACTION_MENU:
|
||||||
|
action->handler = (action_handler_t) action_handle_menu;
|
||||||
|
action->param.menu = (menu_t *) param;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
action->next = NULL;
|
action->next = NULL;
|
||||||
D_ACTIONS(("Added action. mod == 0x%08x, button == %d, keysym == 0x%08x\n", action->mod, action->button, action->keysym));
|
D_ACTIONS(("Added action. mod == 0x%08x, button == %d, keysym == 0x%08x\n", action->mod, action->button, action->keysym));
|
||||||
|
|
54
src/misc.c
54
src/misc.c
|
@ -30,7 +30,11 @@ static const char cvs_ident[] = "$Id$";
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "../libmej/debug.h"
|
#include "../libmej/debug.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
@ -298,6 +302,8 @@ safe_print_string(char *str, unsigned long len)
|
||||||
unsigned long n = 0, i;
|
unsigned long n = 0, i;
|
||||||
|
|
||||||
if (len == ((unsigned long) -1)) {
|
if (len == ((unsigned long) -1)) {
|
||||||
|
len = strlen(str);
|
||||||
|
} else if (len == ((unsigned long) -2)) {
|
||||||
FREE(ret_buff);
|
FREE(ret_buff);
|
||||||
rb_size = 0;
|
rb_size = 0;
|
||||||
return ((char *) NULL);
|
return ((char *) NULL);
|
||||||
|
@ -346,3 +352,51 @@ add_carriage_returns(unsigned char *buff, unsigned long cnt)
|
||||||
D_CMD(("buff == %8p \"%s\", i == %lu\n", buff, safe_print_string(buff, i), i));
|
D_CMD(("buff == %8p \"%s\", i == %lu\n", buff, safe_print_string(buff, i), i));
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
mkdirhier(const char *path)
|
||||||
|
{
|
||||||
|
char *str, *pstr;
|
||||||
|
struct stat dst;
|
||||||
|
|
||||||
|
D_CMD(("path == %s\n", path));
|
||||||
|
str = StrDup(path); /* We need to modify it. */
|
||||||
|
pstr = str;
|
||||||
|
if (*pstr == '/') {
|
||||||
|
pstr++;
|
||||||
|
}
|
||||||
|
for (; (pstr = strchr(pstr, '/'));) {
|
||||||
|
*pstr = 0;
|
||||||
|
D_CMD(("Looking at \"%s\"\n", str));
|
||||||
|
if (stat(str, &dst)) {
|
||||||
|
/* It's not there. Create it. */
|
||||||
|
D_CMD(("stat() failed. Attempting to create it.\n"));
|
||||||
|
if (mkdir(str, 0755)) {
|
||||||
|
/* Couldn't create it. Return failure. */
|
||||||
|
D_CMD(("mkdir(%s, 0755) failed -- %s\n", str, strerror(errno)));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else if (!S_ISDIR(dst.st_mode)) {
|
||||||
|
/* It's there, but it's not a directory. Fail. */
|
||||||
|
D_CMD(("\"%s\" exists, but it's not a directory.\n", str));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*pstr++ = '/';
|
||||||
|
}
|
||||||
|
D_CMD(("Looking at \"%s\"\n", str));
|
||||||
|
if (stat(str, &dst)) {
|
||||||
|
/* It's not there. Create it. */
|
||||||
|
D_CMD(("stat() failed. Attempting to create it.\n"));
|
||||||
|
if (mkdir(str, 0755)) {
|
||||||
|
/* Couldn't create it. Return failure. */
|
||||||
|
D_CMD(("mkdir(%s, 0755) failed -- %s\n", str, strerror(errno)));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else if (!S_ISDIR(dst.st_mode)) {
|
||||||
|
/* It's there, but it's not a directory. Fail. */
|
||||||
|
D_CMD(("\"%s\" exists, but it's not a directory.\n", str));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
D_CMD(("Done!\n"));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
/************ Macros and Definitions ************/
|
/************ Macros and Definitions ************/
|
||||||
#define MAKE_CTRL_CHAR(c) ((c) == '?' ? 127 : ((toupper(c)) - '@'))
|
#define MAKE_CTRL_CHAR(c) ((c) == '?' ? 127 : ((toupper(c)) - '@'))
|
||||||
|
|
||||||
|
#define CAN_READ(s) (((s.st_mode) & S_IROTH) || ((my_ruid == (int)(s.st_uid)) && ((s.st_mode) & S_IRUSR)) || ((my_rgid == (int)(s.st_gid)) && ((s.st_mode) & S_IRGRP)))
|
||||||
|
#define CAN_WRITE(s) (((s.st_mode) & S_IWOTH) || ((my_ruid == (int)(s.st_uid)) && ((s.st_mode) & S_IWUSR)) || ((my_rgid == (int)(s.st_gid)) && ((s.st_mode) & S_IWGRP)))
|
||||||
|
|
||||||
/************ Function Prototypes ************/
|
/************ Function Prototypes ************/
|
||||||
_XFUNCPROTOBEGIN
|
_XFUNCPROTOBEGIN
|
||||||
|
|
||||||
|
@ -44,6 +47,7 @@ extern const char *search_path(const char *pathlist, const char *file, const cha
|
||||||
extern const char *find_file(const char *file, const char *ext);
|
extern const char *find_file(const char *file, const char *ext);
|
||||||
extern char *safe_print_string(char *buff, unsigned long len);
|
extern char *safe_print_string(char *buff, unsigned long len);
|
||||||
extern unsigned long add_carriage_returns(unsigned char *buff, unsigned long cnt);
|
extern unsigned long add_carriage_returns(unsigned char *buff, unsigned long cnt);
|
||||||
|
extern unsigned char mkdirhier(const char *);
|
||||||
|
|
||||||
_XFUNCPROTOEND
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
|
612
src/options.c
612
src/options.c
|
@ -3997,9 +3997,8 @@ post_parse(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char
|
unsigned char
|
||||||
save_config(char *path)
|
save_config(char *path, unsigned char save_theme)
|
||||||
{
|
{
|
||||||
|
|
||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
register short i;
|
register short i;
|
||||||
char *tmp_str, dt_stamp[50];
|
char *tmp_str, dt_stamp[50];
|
||||||
|
@ -4009,12 +4008,68 @@ save_config(char *path)
|
||||||
simage_t *simg;
|
simage_t *simg;
|
||||||
action_t *action;
|
action_t *action;
|
||||||
|
|
||||||
|
D_OPTIONS(("Saving %s config to \"%s\"\n", (save_theme ? "theme" : "user"), NONULL(path)));
|
||||||
|
|
||||||
cur_tm = localtime(&cur_time);
|
cur_tm = localtime(&cur_time);
|
||||||
|
|
||||||
if (!path) {
|
if (save_theme) {
|
||||||
path = (char *) MALLOC(PATH_MAX + 1);
|
if (!path) {
|
||||||
snprintf(path, PATH_MAX, "%s/%s", getenv("ETERM_THEME_ROOT"), (rs_config_file ? rs_config_file : USER_CFG));
|
path = (char *) MALLOC(PATH_MAX + 1);
|
||||||
path[PATH_MAX] = 0;
|
strncpy(path, (theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm"), PATH_MAX - sizeof("/" THEME_CFG));
|
||||||
|
path[PATH_MAX] = 0;
|
||||||
|
if (stat(path, &fst) || !S_ISDIR(fst.st_mode) || !CAN_WRITE(fst)) {
|
||||||
|
char *tmp = NULL;
|
||||||
|
|
||||||
|
D_OPTIONS(("Problem with \"%s\". S_ISDIR == %d, CAN_WRITE == %d\n", path, S_ISDIR(fst.st_mode), CAN_WRITE(fst)));
|
||||||
|
if (theme_dir) {
|
||||||
|
tmp = strrchr(theme_dir, '/');
|
||||||
|
if (tmp) {
|
||||||
|
*tmp++ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snprintf(path, PATH_MAX, "%s/.Eterm/themes/%s", getenv("HOME"), (tmp ? tmp : "Eterm"));
|
||||||
|
D_OPTIONS(("Trying \"%s\" instead, tmp == \"%s\"\n", path, tmp));
|
||||||
|
if (tmp) {
|
||||||
|
*(--tmp) = '/';
|
||||||
|
}
|
||||||
|
if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) {
|
||||||
|
print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm"), path);
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strcat(path, "/" THEME_CFG);
|
||||||
|
D_OPTIONS(("Final path is \"%s\"\n", path));
|
||||||
|
path[PATH_MAX] = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!path) {
|
||||||
|
path = (char *) MALLOC(PATH_MAX + 1);
|
||||||
|
strncpy(path, (user_dir ? user_dir : PKGDATADIR "/themes/Eterm"), PATH_MAX - sizeof("/" USER_CFG));
|
||||||
|
path[PATH_MAX] = 0;
|
||||||
|
if (stat(path, &fst) || !S_ISDIR(fst.st_mode) || !CAN_WRITE(fst)) {
|
||||||
|
char *tmp = NULL;
|
||||||
|
|
||||||
|
D_OPTIONS(("Problem with \"%s\". S_ISDIR == %d, CAN_WRITE == %d\n", path, S_ISDIR(fst.st_mode), CAN_WRITE(fst)));
|
||||||
|
if (user_dir) {
|
||||||
|
tmp = strrchr(user_dir, '/');
|
||||||
|
if (tmp) {
|
||||||
|
*tmp++ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snprintf(path, PATH_MAX, "%s/.Eterm/themes/%s", getenv("HOME"), (tmp ? tmp : "Eterm"));
|
||||||
|
D_OPTIONS(("Trying \"%s\" instead, tmp == \"%s\"\n", path, tmp));
|
||||||
|
if (tmp) {
|
||||||
|
*(--tmp) = '/';
|
||||||
|
}
|
||||||
|
if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) {
|
||||||
|
print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (user_dir ? user_dir : PKGDATADIR "/themes/Eterm"), path);
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strcat(path, "/" USER_CFG);
|
||||||
|
D_OPTIONS(("Final path is \"%s\"\n", path));
|
||||||
|
path[PATH_MAX] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!lstat(path, &fst)) {
|
if (!lstat(path, &fst)) {
|
||||||
char bak_path[PATH_MAX], timestamp[16];
|
char bak_path[PATH_MAX], timestamp[16];
|
||||||
|
@ -4070,16 +4125,18 @@ save_config(char *path)
|
||||||
fprintf(fp, " end color\n\n");
|
fprintf(fp, " end color\n\n");
|
||||||
|
|
||||||
fprintf(fp, " begin attributes\n");
|
fprintf(fp, " begin attributes\n");
|
||||||
if (rs_geometry) {
|
if (save_theme) {
|
||||||
fprintf(fp, " geometry %s\n", rs_geometry);
|
if (rs_geometry) {
|
||||||
}
|
fprintf(fp, " geometry %s\n", rs_geometry);
|
||||||
XFetchName(Xdisplay, TermWin.parent, &tmp_str);
|
}
|
||||||
fprintf(fp, " title %s\n", tmp_str);
|
XFetchName(Xdisplay, TermWin.parent, &tmp_str);
|
||||||
fprintf(fp, " name %s\n", rs_name);
|
fprintf(fp, " title %s\n", tmp_str);
|
||||||
XGetIconName(Xdisplay, TermWin.parent, &tmp_str);
|
fprintf(fp, " name %s\n", rs_name);
|
||||||
fprintf(fp, " iconname %s\n", tmp_str);
|
XGetIconName(Xdisplay, TermWin.parent, &tmp_str);
|
||||||
if (rs_desktop != -1) {
|
fprintf(fp, " iconname %s\n", tmp_str);
|
||||||
fprintf(fp, " desktop %d\n", rs_desktop);
|
if (rs_desktop != -1) {
|
||||||
|
fprintf(fp, " desktop %d\n", rs_desktop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fprintf(fp, " scrollbar_type %s\n", (scrollbar_get_type() == SCROLLBAR_XTERM ? "xterm" : (scrollbar_get_type() == SCROLLBAR_MOTIF ? "motif" : "next")));
|
fprintf(fp, " scrollbar_type %s\n", (scrollbar_get_type() == SCROLLBAR_XTERM ? "xterm" : (scrollbar_get_type() == SCROLLBAR_MOTIF ? "motif" : "next")));
|
||||||
fprintf(fp, " scrollbar_width %d\n", scrollbar_anchor_width());
|
fprintf(fp, " scrollbar_width %d\n", scrollbar_anchor_width());
|
||||||
|
@ -4096,17 +4153,18 @@ save_config(char *path)
|
||||||
#endif
|
#endif
|
||||||
fprintf(fp, " end attributes\n\n");
|
fprintf(fp, " end attributes\n\n");
|
||||||
|
|
||||||
fprintf(fp, " begin imageclasses\n");
|
if (save_theme) {
|
||||||
fprintf(fp, " path \"%s\"\n", rs_path);
|
fprintf(fp, " begin imageclasses\n");
|
||||||
if (rs_icon != NULL) {
|
fprintf(fp, " path \"%s\"\n", rs_path);
|
||||||
fprintf(fp, " icon %s\n", rs_icon);
|
if (rs_icon != NULL) {
|
||||||
}
|
fprintf(fp, " icon %s\n", rs_icon);
|
||||||
if (rs_anim_delay) {
|
}
|
||||||
/* FIXME: Do something here! */
|
if (rs_anim_delay) {
|
||||||
}
|
/* FIXME: Do something here! */
|
||||||
for (i = 0; i < image_max; i++) {
|
}
|
||||||
fprintf(fp, " begin image\n");
|
for (i = 0; i < image_max; i++) {
|
||||||
switch (i) {
|
fprintf(fp, " begin image\n");
|
||||||
|
switch (i) {
|
||||||
case image_bg: fprintf(fp, " type background\n"); break;
|
case image_bg: fprintf(fp, " type background\n"); break;
|
||||||
case image_sb: fprintf(fp, " type trough\n"); break;
|
case image_sb: fprintf(fp, " type trough\n"); break;
|
||||||
case image_sa: fprintf(fp, " type anchor\n"); break;
|
case image_sa: fprintf(fp, " type anchor\n"); break;
|
||||||
|
@ -4122,263 +4180,265 @@ save_config(char *path)
|
||||||
case image_bbar: fprintf(fp, " type button_bar\n"); break;
|
case image_bbar: fprintf(fp, " type button_bar\n"); break;
|
||||||
case image_gbar: fprintf(fp, " type grab_bar\n"); break;
|
case image_gbar: fprintf(fp, " type grab_bar\n"); break;
|
||||||
case image_dialog: fprintf(fp, " type dialog_box\n"); break;
|
case image_dialog: fprintf(fp, " type dialog_box\n"); break;
|
||||||
}
|
}
|
||||||
fprintf(fp, " mode ");
|
fprintf(fp, " mode ");
|
||||||
switch (images[i].mode & MODE_MASK) {
|
switch (images[i].mode & MODE_MASK) {
|
||||||
case MODE_IMAGE: fprintf(fp, "image"); break;
|
case MODE_IMAGE: fprintf(fp, "image"); break;
|
||||||
case MODE_TRANS: fprintf(fp, "trans"); break;
|
case MODE_TRANS: fprintf(fp, "trans"); break;
|
||||||
case MODE_VIEWPORT: fprintf(fp, "viewport"); break;
|
case MODE_VIEWPORT: fprintf(fp, "viewport"); break;
|
||||||
case MODE_AUTO: fprintf(fp, "auto"); break;
|
case MODE_AUTO: fprintf(fp, "auto"); break;
|
||||||
default: fprintf(fp, "solid"); break;
|
default: fprintf(fp, "solid"); break;
|
||||||
|
}
|
||||||
|
if (images[i].mode & ALLOW_MASK) {
|
||||||
|
fprintf(fp, " allow");
|
||||||
|
if (image_mode_is(i, ALLOW_IMAGE)) {
|
||||||
|
fprintf(fp, " image");
|
||||||
|
}
|
||||||
|
if (image_mode_is(i, ALLOW_TRANS)) {
|
||||||
|
fprintf(fp, " trans");
|
||||||
|
}
|
||||||
|
if (image_mode_is(i, ALLOW_VIEWPORT)) {
|
||||||
|
fprintf(fp, " viewport");
|
||||||
|
}
|
||||||
|
if (image_mode_is(i, ALLOW_AUTO)) {
|
||||||
|
fprintf(fp, " auto");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
|
||||||
|
/* Now save each state. */
|
||||||
|
simg = images[i].norm;
|
||||||
|
fprintf(fp, " state normal\n");
|
||||||
|
if (simg->fg || simg->bg) {
|
||||||
|
fprintf(fp, " color 0x%08x 0x%08x\n", (unsigned int) simg->fg, (unsigned int) simg->bg);
|
||||||
|
}
|
||||||
|
if (simg->iml->im) {
|
||||||
|
fprintf(fp, " file %s\n", NONULL(simg->iml->im->filename));
|
||||||
|
}
|
||||||
|
fprintf(fp, " geom %hdx%hd+%hd+%hd", simg->pmap->w, simg->pmap->h, simg->pmap->x, simg->pmap->y);
|
||||||
|
if (simg->pmap->op & OP_TILE) {
|
||||||
|
fprintf(fp, ":tiled");
|
||||||
|
}
|
||||||
|
if ((simg->pmap->op & OP_SCALE) || ((simg->pmap->op & OP_HSCALE) && (simg->pmap->op & OP_VSCALE))) {
|
||||||
|
fprintf(fp, ":scaled");
|
||||||
|
} else if (simg->pmap->op & OP_HSCALE) {
|
||||||
|
fprintf(fp, ":hscaled");
|
||||||
|
} else if (simg->pmap->op & OP_VSCALE) {
|
||||||
|
fprintf(fp, ":vscaled");
|
||||||
|
}
|
||||||
|
if (simg->pmap->op & OP_PROPSCALE) {
|
||||||
|
fprintf(fp, ":propscaled");
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
if (simg->iml->mod) {
|
||||||
|
fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->rmod) {
|
||||||
|
fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->gmod) {
|
||||||
|
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->bmod) {
|
||||||
|
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->border) {
|
||||||
|
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom);
|
||||||
|
}
|
||||||
|
if (simg->iml->bevel) {
|
||||||
|
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
|
||||||
|
}
|
||||||
|
if (simg->iml->pad) {
|
||||||
|
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Selected state */
|
||||||
|
if (images[i].selected != images[i].norm) {
|
||||||
|
simg = images[i].selected;
|
||||||
|
fprintf(fp, " state selected\n");
|
||||||
|
if (simg->fg || simg->bg) {
|
||||||
|
fprintf(fp, " color 0x%08x 0x%08x\n", (unsigned int) simg->fg, (unsigned int) simg->bg);
|
||||||
|
}
|
||||||
|
if (simg->iml->im) {
|
||||||
|
fprintf(fp, " file %s\n", NONULL(simg->iml->im->filename));
|
||||||
|
}
|
||||||
|
fprintf(fp, " geom %hdx%hd+%hd+%hd", simg->pmap->w, simg->pmap->h, simg->pmap->x, simg->pmap->y);
|
||||||
|
if (simg->pmap->op & OP_TILE) {
|
||||||
|
fprintf(fp, ":tiled");
|
||||||
|
}
|
||||||
|
if ((simg->pmap->op & OP_SCALE) || ((simg->pmap->op & OP_HSCALE) && (simg->pmap->op & OP_VSCALE))) {
|
||||||
|
fprintf(fp, ":scaled");
|
||||||
|
} else if (simg->pmap->op & OP_HSCALE) {
|
||||||
|
fprintf(fp, ":hscaled");
|
||||||
|
} else if (simg->pmap->op & OP_VSCALE) {
|
||||||
|
fprintf(fp, ":vscaled");
|
||||||
|
}
|
||||||
|
if (simg->pmap->op & OP_PROPSCALE) {
|
||||||
|
fprintf(fp, ":propscaled");
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
if (simg->iml->mod) {
|
||||||
|
fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->rmod) {
|
||||||
|
fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->gmod) {
|
||||||
|
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->bmod) {
|
||||||
|
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->border) {
|
||||||
|
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom);
|
||||||
|
}
|
||||||
|
if (simg->iml->bevel) {
|
||||||
|
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
|
||||||
|
}
|
||||||
|
if (simg->iml->pad) {
|
||||||
|
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clicked state */
|
||||||
|
if (images[i].clicked != images[i].norm) {
|
||||||
|
simg = images[i].clicked;
|
||||||
|
fprintf(fp, " state clicked\n");
|
||||||
|
if (simg->fg || simg->bg) {
|
||||||
|
fprintf(fp, " color 0x%08x 0x%08x\n", (unsigned int) simg->fg, (unsigned int) simg->bg);
|
||||||
|
}
|
||||||
|
if (simg->iml->im) {
|
||||||
|
fprintf(fp, " file %s\n", NONULL(simg->iml->im->filename));
|
||||||
|
}
|
||||||
|
fprintf(fp, " geom %hdx%hd+%hd+%hd", simg->pmap->w, simg->pmap->h, simg->pmap->x, simg->pmap->y);
|
||||||
|
if (simg->pmap->op & OP_TILE) {
|
||||||
|
fprintf(fp, ":tiled");
|
||||||
|
}
|
||||||
|
if ((simg->pmap->op & OP_SCALE) || ((simg->pmap->op & OP_HSCALE) && (simg->pmap->op & OP_VSCALE))) {
|
||||||
|
fprintf(fp, ":scaled");
|
||||||
|
} else if (simg->pmap->op & OP_HSCALE) {
|
||||||
|
fprintf(fp, ":hscaled");
|
||||||
|
} else if (simg->pmap->op & OP_VSCALE) {
|
||||||
|
fprintf(fp, ":vscaled");
|
||||||
|
}
|
||||||
|
if (simg->pmap->op & OP_PROPSCALE) {
|
||||||
|
fprintf(fp, ":propscaled");
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
if (simg->iml->mod) {
|
||||||
|
fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->rmod) {
|
||||||
|
fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->gmod) {
|
||||||
|
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->bmod) {
|
||||||
|
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->border) {
|
||||||
|
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom);
|
||||||
|
}
|
||||||
|
if (simg->iml->bevel) {
|
||||||
|
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
|
||||||
|
}
|
||||||
|
if (simg->iml->pad) {
|
||||||
|
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disabled state */
|
||||||
|
if (images[i].disabled != images[i].norm) {
|
||||||
|
simg = images[i].disabled;
|
||||||
|
fprintf(fp, " state disabled\n");
|
||||||
|
if (simg->fg || simg->bg) {
|
||||||
|
fprintf(fp, " color 0x%08x 0x%08x\n", (unsigned int) simg->fg, (unsigned int) simg->bg);
|
||||||
|
}
|
||||||
|
if (simg->iml->im) {
|
||||||
|
fprintf(fp, " file %s\n", NONULL(simg->iml->im->filename));
|
||||||
|
}
|
||||||
|
fprintf(fp, " geom %hdx%hd+%hd+%hd", simg->pmap->w, simg->pmap->h, simg->pmap->x, simg->pmap->y);
|
||||||
|
if (simg->pmap->op & OP_TILE) {
|
||||||
|
fprintf(fp, ":tiled");
|
||||||
|
}
|
||||||
|
if ((simg->pmap->op & OP_SCALE) || ((simg->pmap->op & OP_HSCALE) && (simg->pmap->op & OP_VSCALE))) {
|
||||||
|
fprintf(fp, ":scaled");
|
||||||
|
} else if (simg->pmap->op & OP_HSCALE) {
|
||||||
|
fprintf(fp, ":hscaled");
|
||||||
|
} else if (simg->pmap->op & OP_VSCALE) {
|
||||||
|
fprintf(fp, ":vscaled");
|
||||||
|
}
|
||||||
|
if (simg->pmap->op & OP_PROPSCALE) {
|
||||||
|
fprintf(fp, ":propscaled");
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
if (simg->iml->mod) {
|
||||||
|
fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->rmod) {
|
||||||
|
fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->gmod) {
|
||||||
|
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->bmod) {
|
||||||
|
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma);
|
||||||
|
}
|
||||||
|
if (simg->iml->border) {
|
||||||
|
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom);
|
||||||
|
}
|
||||||
|
if (simg->iml->bevel) {
|
||||||
|
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right,
|
||||||
|
simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
|
||||||
|
}
|
||||||
|
if (simg->iml->pad) {
|
||||||
|
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(fp, " end image\n");
|
||||||
}
|
}
|
||||||
if (images[i].mode & ALLOW_MASK) {
|
fprintf(fp, " end imageclasses\n\n");
|
||||||
fprintf(fp, " allow");
|
|
||||||
if (image_mode_is(i, ALLOW_IMAGE)) {
|
for (i = 0; i < menu_list->nummenus; i++) {
|
||||||
fprintf(fp, " image");
|
menu_t *menu = menu_list->menus[i];
|
||||||
|
unsigned short j;
|
||||||
|
|
||||||
|
fprintf(fp, " begin menu\n");
|
||||||
|
fprintf(fp, " title \"%s\"\n", menu->title);
|
||||||
|
if (menu->font) {
|
||||||
|
unsigned long tmp;
|
||||||
|
|
||||||
|
if ((XGetFontProperty(menu->font, XA_FONT_NAME, &tmp)) == True) {
|
||||||
|
fprintf(fp, " font \"%s\"\n", ((char *) tmp));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (image_mode_is(i, ALLOW_TRANS)) {
|
for (j = 0; j < menu->numitems; j++) {
|
||||||
fprintf(fp, " trans");
|
menuitem_t *item = menu->items[j];
|
||||||
}
|
|
||||||
if (image_mode_is(i, ALLOW_VIEWPORT)) {
|
if (item->type == MENUITEM_SEP) {
|
||||||
fprintf(fp, " viewport");
|
fprintf(fp, " -\n");
|
||||||
}
|
} else {
|
||||||
if (image_mode_is(i, ALLOW_AUTO)) {
|
fprintf(fp, " begin menuitem\n");
|
||||||
fprintf(fp, " auto");
|
fprintf(fp, " text \"%s\"\n", item->text);
|
||||||
|
if (item->rtext) {
|
||||||
|
fprintf(fp, " rtext \"%s\"\n", item->rtext);
|
||||||
|
}
|
||||||
|
fprintf(fp, " action ");
|
||||||
|
if (item->type == MENUITEM_STRING) {
|
||||||
|
fprintf(fp, "string \"%s\"\n", safe_print_string(item->action.string, -1));
|
||||||
|
} else if (item->type == MENUITEM_ECHO) {
|
||||||
|
fprintf(fp, "echo \"%s\"\n", safe_print_string(item->action.string, -1));
|
||||||
|
} else if (item->type == MENUITEM_SUBMENU) {
|
||||||
|
fprintf(fp, "submenu \"%s\"\n", (item->action.submenu)->title);
|
||||||
|
}
|
||||||
|
fprintf(fp, " end\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
fprintf(fp, " end menu\n");
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
|
|
||||||
/* Now save each state. */
|
|
||||||
simg = images[i].norm;
|
|
||||||
fprintf(fp, " state normal\n");
|
|
||||||
if (simg->fg || simg->bg) {
|
|
||||||
fprintf(fp, " color 0x%08x 0x%08x\n", (unsigned int) simg->fg, (unsigned int) simg->bg);
|
|
||||||
}
|
|
||||||
if (simg->iml->im) {
|
|
||||||
fprintf(fp, " file %s\n", NONULL(simg->iml->im->filename));
|
|
||||||
}
|
|
||||||
fprintf(fp, " geom %hdx%hd+%hd+%hd", simg->pmap->w, simg->pmap->h, simg->pmap->x, simg->pmap->y);
|
|
||||||
if (simg->pmap->op & OP_TILE) {
|
|
||||||
fprintf(fp, ":tiled");
|
|
||||||
}
|
|
||||||
if ((simg->pmap->op & OP_SCALE) || ((simg->pmap->op & OP_HSCALE) && (simg->pmap->op & OP_VSCALE))) {
|
|
||||||
fprintf(fp, ":scaled");
|
|
||||||
} else if (simg->pmap->op & OP_HSCALE) {
|
|
||||||
fprintf(fp, ":hscaled");
|
|
||||||
} else if (simg->pmap->op & OP_VSCALE) {
|
|
||||||
fprintf(fp, ":vscaled");
|
|
||||||
}
|
|
||||||
if (simg->pmap->op & OP_PROPSCALE) {
|
|
||||||
fprintf(fp, ":propscaled");
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
if (simg->iml->mod) {
|
|
||||||
fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->rmod) {
|
|
||||||
fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->gmod) {
|
|
||||||
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->bmod) {
|
|
||||||
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->border) {
|
|
||||||
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom);
|
|
||||||
}
|
|
||||||
if (simg->iml->bevel) {
|
|
||||||
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
|
|
||||||
}
|
|
||||||
if (simg->iml->pad) {
|
|
||||||
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Selected state */
|
|
||||||
if (images[i].selected != images[i].norm) {
|
|
||||||
simg = images[i].selected;
|
|
||||||
fprintf(fp, " state selected\n");
|
|
||||||
if (simg->fg || simg->bg) {
|
|
||||||
fprintf(fp, " color 0x%08x 0x%08x\n", (unsigned int) simg->fg, (unsigned int) simg->bg);
|
|
||||||
}
|
|
||||||
if (simg->iml->im) {
|
|
||||||
fprintf(fp, " file %s\n", NONULL(simg->iml->im->filename));
|
|
||||||
}
|
|
||||||
fprintf(fp, " geom %hdx%hd+%hd+%hd", simg->pmap->w, simg->pmap->h, simg->pmap->x, simg->pmap->y);
|
|
||||||
if (simg->pmap->op & OP_TILE) {
|
|
||||||
fprintf(fp, ":tiled");
|
|
||||||
}
|
|
||||||
if ((simg->pmap->op & OP_SCALE) || ((simg->pmap->op & OP_HSCALE) && (simg->pmap->op & OP_VSCALE))) {
|
|
||||||
fprintf(fp, ":scaled");
|
|
||||||
} else if (simg->pmap->op & OP_HSCALE) {
|
|
||||||
fprintf(fp, ":hscaled");
|
|
||||||
} else if (simg->pmap->op & OP_VSCALE) {
|
|
||||||
fprintf(fp, ":vscaled");
|
|
||||||
}
|
|
||||||
if (simg->pmap->op & OP_PROPSCALE) {
|
|
||||||
fprintf(fp, ":propscaled");
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
if (simg->iml->mod) {
|
|
||||||
fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->rmod) {
|
|
||||||
fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->gmod) {
|
|
||||||
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->bmod) {
|
|
||||||
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->border) {
|
|
||||||
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom);
|
|
||||||
}
|
|
||||||
if (simg->iml->bevel) {
|
|
||||||
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
|
|
||||||
}
|
|
||||||
if (simg->iml->pad) {
|
|
||||||
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clicked state */
|
|
||||||
if (images[i].clicked != images[i].norm) {
|
|
||||||
simg = images[i].clicked;
|
|
||||||
fprintf(fp, " state clicked\n");
|
|
||||||
if (simg->fg || simg->bg) {
|
|
||||||
fprintf(fp, " color 0x%08x 0x%08x\n", (unsigned int) simg->fg, (unsigned int) simg->bg);
|
|
||||||
}
|
|
||||||
if (simg->iml->im) {
|
|
||||||
fprintf(fp, " file %s\n", NONULL(simg->iml->im->filename));
|
|
||||||
}
|
|
||||||
fprintf(fp, " geom %hdx%hd+%hd+%hd", simg->pmap->w, simg->pmap->h, simg->pmap->x, simg->pmap->y);
|
|
||||||
if (simg->pmap->op & OP_TILE) {
|
|
||||||
fprintf(fp, ":tiled");
|
|
||||||
}
|
|
||||||
if ((simg->pmap->op & OP_SCALE) || ((simg->pmap->op & OP_HSCALE) && (simg->pmap->op & OP_VSCALE))) {
|
|
||||||
fprintf(fp, ":scaled");
|
|
||||||
} else if (simg->pmap->op & OP_HSCALE) {
|
|
||||||
fprintf(fp, ":hscaled");
|
|
||||||
} else if (simg->pmap->op & OP_VSCALE) {
|
|
||||||
fprintf(fp, ":vscaled");
|
|
||||||
}
|
|
||||||
if (simg->pmap->op & OP_PROPSCALE) {
|
|
||||||
fprintf(fp, ":propscaled");
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
if (simg->iml->mod) {
|
|
||||||
fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->rmod) {
|
|
||||||
fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->gmod) {
|
|
||||||
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->bmod) {
|
|
||||||
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->border) {
|
|
||||||
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom);
|
|
||||||
}
|
|
||||||
if (simg->iml->bevel) {
|
|
||||||
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
|
|
||||||
}
|
|
||||||
if (simg->iml->pad) {
|
|
||||||
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Disabled state */
|
|
||||||
if (images[i].disabled != images[i].norm) {
|
|
||||||
simg = images[i].disabled;
|
|
||||||
fprintf(fp, " state disabled\n");
|
|
||||||
if (simg->fg || simg->bg) {
|
|
||||||
fprintf(fp, " color 0x%08x 0x%08x\n", (unsigned int) simg->fg, (unsigned int) simg->bg);
|
|
||||||
}
|
|
||||||
if (simg->iml->im) {
|
|
||||||
fprintf(fp, " file %s\n", NONULL(simg->iml->im->filename));
|
|
||||||
}
|
|
||||||
fprintf(fp, " geom %hdx%hd+%hd+%hd", simg->pmap->w, simg->pmap->h, simg->pmap->x, simg->pmap->y);
|
|
||||||
if (simg->pmap->op & OP_TILE) {
|
|
||||||
fprintf(fp, ":tiled");
|
|
||||||
}
|
|
||||||
if ((simg->pmap->op & OP_SCALE) || ((simg->pmap->op & OP_HSCALE) && (simg->pmap->op & OP_VSCALE))) {
|
|
||||||
fprintf(fp, ":scaled");
|
|
||||||
} else if (simg->pmap->op & OP_HSCALE) {
|
|
||||||
fprintf(fp, ":hscaled");
|
|
||||||
} else if (simg->pmap->op & OP_VSCALE) {
|
|
||||||
fprintf(fp, ":vscaled");
|
|
||||||
}
|
|
||||||
if (simg->pmap->op & OP_PROPSCALE) {
|
|
||||||
fprintf(fp, ":propscaled");
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
if (simg->iml->mod) {
|
|
||||||
fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->rmod) {
|
|
||||||
fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->gmod) {
|
|
||||||
fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->bmod) {
|
|
||||||
fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma);
|
|
||||||
}
|
|
||||||
if (simg->iml->border) {
|
|
||||||
fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom);
|
|
||||||
}
|
|
||||||
if (simg->iml->bevel) {
|
|
||||||
fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom);
|
|
||||||
}
|
|
||||||
if (simg->iml->pad) {
|
|
||||||
fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(fp, " end image\n");
|
|
||||||
}
|
}
|
||||||
fprintf(fp, " end imageclasses\n\n");
|
|
||||||
|
|
||||||
for (i = 0; i < menu_list->nummenus; i++) {
|
|
||||||
menu_t *menu = menu_list->menus[i];
|
|
||||||
unsigned short j;
|
|
||||||
|
|
||||||
fprintf(fp, " begin menu\n");
|
|
||||||
fprintf(fp, " title \"%s\"\n", menu->title);
|
|
||||||
if (menu->font) {
|
|
||||||
unsigned long tmp;
|
|
||||||
|
|
||||||
if ((XGetFontProperty(menu->font, XA_FONT_NAME, &tmp)) == True) {
|
|
||||||
fprintf(fp, " font \"%s\"\n", ((char *) tmp));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (j = 0; j < menu->numitems; j++) {
|
|
||||||
menuitem_t *item = menu->items[j];
|
|
||||||
|
|
||||||
if (item->type == MENUITEM_SEP) {
|
|
||||||
fprintf(fp, " -\n");
|
|
||||||
} else {
|
|
||||||
fprintf(fp, " begin menuitem\n");
|
|
||||||
fprintf(fp, " text \"%s\"\n", item->text);
|
|
||||||
if (item->rtext) {
|
|
||||||
fprintf(fp, " rtext \"%s\"\n", item->rtext);
|
|
||||||
}
|
|
||||||
fprintf(fp, " action ");
|
|
||||||
if (item->type == MENUITEM_STRING) {
|
|
||||||
fprintf(fp, "string \"%s\"\n", item->action.string);
|
|
||||||
} else if (item->type == MENUITEM_ECHO) {
|
|
||||||
fprintf(fp, "echo \"%s\"\n", item->action.string);
|
|
||||||
} else if (item->type == MENUITEM_SUBMENU) {
|
|
||||||
fprintf(fp, "submenu \"%s\"\n", (item->action.submenu)->title);
|
|
||||||
}
|
|
||||||
fprintf(fp, " end\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(fp, " end menu\n");
|
|
||||||
}
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
|
|
||||||
fprintf(fp, " begin actions\n");
|
fprintf(fp, " begin actions\n");
|
||||||
for (action = action_list; action; action = action->next) {
|
for (action = action_list; action; action = action->next) {
|
||||||
|
@ -4435,9 +4495,9 @@ save_config(char *path)
|
||||||
}
|
}
|
||||||
fprintf(fp, " to ");
|
fprintf(fp, " to ");
|
||||||
if (action->type == ACTION_STRING) {
|
if (action->type == ACTION_STRING) {
|
||||||
fprintf(fp, "string \"%s\"\n", action->param.string);
|
fprintf(fp, "string \"%s\"\n", safe_print_string(action->param.string, -1));
|
||||||
} else if (action->type == ACTION_ECHO) {
|
} else if (action->type == ACTION_ECHO) {
|
||||||
fprintf(fp, "echo \"%s\"\n", action->param.string);
|
fprintf(fp, "echo \"%s\"\n", safe_print_string(action->param.string, -1));
|
||||||
} else if (action->type == ACTION_MENU) {
|
} else if (action->type == ACTION_MENU) {
|
||||||
fprintf(fp, "menu \"%s\"\n", (action->param.menu)->title);
|
fprintf(fp, "menu \"%s\"\n", (action->param.menu)->title);
|
||||||
}
|
}
|
||||||
|
@ -4538,7 +4598,7 @@ save_config(char *path)
|
||||||
fprintf(fp, " border_width %d\n", TermWin.internalBorder);
|
fprintf(fp, " border_width %d\n", TermWin.internalBorder);
|
||||||
fprintf(fp, " term_name %s\n", getenv("TERM"));
|
fprintf(fp, " term_name %s\n", getenv("TERM"));
|
||||||
fprintf(fp, " debug %d\n", debug_level);
|
fprintf(fp, " debug %d\n", debug_level);
|
||||||
if (rs_execArgs) {
|
if (save_theme && rs_execArgs) {
|
||||||
fprintf(fp, " exec ");
|
fprintf(fp, " exec ");
|
||||||
for (i = 0; rs_execArgs[i]; i++) {
|
for (i = 0; rs_execArgs[i]; i++) {
|
||||||
fprintf(fp, "'%s' ", rs_execArgs[i]);
|
fprintf(fp, "'%s' ", rs_execArgs[i]);
|
||||||
|
|
|
@ -84,6 +84,9 @@
|
||||||
|
|
||||||
# define BBAR_FORCE_TOGGLE (0x03)
|
# define BBAR_FORCE_TOGGLE (0x03)
|
||||||
|
|
||||||
|
# define SAVE_THEME_CONFIG ((unsigned char) 1)
|
||||||
|
# define SAVE_USER_CONFIG ((unsigned char) 0)
|
||||||
|
|
||||||
#define BOOL_OPT_ISTRUE(s) (!strcasecmp((s), true_vals[0]) || !strcasecmp((s), true_vals[1]) \
|
#define BOOL_OPT_ISTRUE(s) (!strcasecmp((s), true_vals[0]) || !strcasecmp((s), true_vals[1]) \
|
||||||
|| !strcasecmp((s), true_vals[2]) || !strcasecmp((s), true_vals[3]))
|
|| !strcasecmp((s), true_vals[2]) || !strcasecmp((s), true_vals[3]))
|
||||||
#define BOOL_OPT_ISFALSE(s) (!strcasecmp((s), false_vals[0]) || !strcasecmp((s), false_vals[1]) \
|
#define BOOL_OPT_ISFALSE(s) (!strcasecmp((s), false_vals[0]) || !strcasecmp((s), false_vals[1]) \
|
||||||
|
@ -256,7 +259,7 @@ extern char *conf_parse(char *conf_name, const char *dir, const char *path);
|
||||||
extern char *conf_parse_theme(char *theme, char *conf_name, unsigned char fallback);
|
extern char *conf_parse_theme(char *theme, char *conf_name, unsigned char fallback);
|
||||||
extern void init_defaults(void);
|
extern void init_defaults(void);
|
||||||
extern void post_parse(void);
|
extern void post_parse(void);
|
||||||
unsigned char save_config(char *);
|
unsigned char save_config(char *, unsigned char);
|
||||||
|
|
||||||
_XFUNCPROTOEND
|
_XFUNCPROTOEND
|
||||||
|
|
||||||
|
|
|
@ -2170,9 +2170,14 @@ xterm_seq(int op, const char *str)
|
||||||
/* Save current config */
|
/* Save current config */
|
||||||
nstr = (char *) strsep(&tnstr, ";");
|
nstr = (char *) strsep(&tnstr, ";");
|
||||||
if (nstr && *nstr) {
|
if (nstr && *nstr) {
|
||||||
save_config(nstr);
|
valptr = (char *) strsep(&tnstr, ";");
|
||||||
|
if (!strcasecmp(nstr, "theme")) {
|
||||||
|
save_config(valptr, SAVE_THEME_CONFIG);
|
||||||
|
} else {
|
||||||
|
save_config(valptr, SAVE_USER_CONFIG);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
save_config(NULL);
|
save_config(NULL, SAVE_USER_CONFIG);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 72:
|
case 72:
|
||||||
|
|
|
@ -917,9 +917,13 @@ begin menu
|
||||||
end
|
end
|
||||||
separator
|
separator
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Save Settings..."
|
text "Save User Settings..."
|
||||||
action string "\e]6;71\a"
|
action string "\e]6;71\a"
|
||||||
end
|
end
|
||||||
|
begin menuitem
|
||||||
|
text "Save Theme Settings..."
|
||||||
|
action string "\e]6;71;theme\a"
|
||||||
|
end
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Exit"
|
text "Exit"
|
||||||
action string "\e]6;70\a"
|
action string "\e]6;70\a"
|
||||||
|
|
|
@ -903,6 +903,10 @@ begin menu
|
||||||
action submenu Terminal
|
action submenu Terminal
|
||||||
end
|
end
|
||||||
-
|
-
|
||||||
|
begin menuitem
|
||||||
|
text "New Window..."
|
||||||
|
action string "\e]6;73;Eterm\a"
|
||||||
|
end
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Version"
|
text "Version"
|
||||||
action string "\e[8n"
|
action string "\e[8n"
|
||||||
|
@ -913,9 +917,13 @@ begin menu
|
||||||
end
|
end
|
||||||
separator
|
separator
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Save Settings..."
|
text "Save User Settings..."
|
||||||
action string "\e]6;71\a"
|
action string "\e]6;71\a"
|
||||||
end
|
end
|
||||||
|
begin menuitem
|
||||||
|
text "Save Theme Settings..."
|
||||||
|
action string "\e]6;71;theme\a"
|
||||||
|
end
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Exit"
|
text "Exit"
|
||||||
action string "\e]6;70\a"
|
action string "\e]6;70\a"
|
||||||
|
|
|
@ -917,9 +917,13 @@ begin menu
|
||||||
end
|
end
|
||||||
separator
|
separator
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Save Settings..."
|
text "Save User Settings..."
|
||||||
action string "\e]6;71\a"
|
action string "\e]6;71\a"
|
||||||
end
|
end
|
||||||
|
begin menuitem
|
||||||
|
text "Save Theme Settings..."
|
||||||
|
action string "\e]6;71;theme\a"
|
||||||
|
end
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Exit"
|
text "Exit"
|
||||||
action string "\e]6;70\a"
|
action string "\e]6;70\a"
|
||||||
|
|
|
@ -983,6 +983,7 @@ begin menu
|
||||||
STRING_ITEM(`Version', `\e[8n')
|
STRING_ITEM(`Version', `\e[8n')
|
||||||
STRING_ITEM(`Status', `\e[9n')
|
STRING_ITEM(`Status', `\e[9n')
|
||||||
separator
|
separator
|
||||||
STRING_ITEM(`Save Settings...', `\e]6;71\a')
|
STRING_ITEM(`Save User Settings...', `\e]6;71\a')
|
||||||
|
STRING_ITEM(`Save Theme Settings...', `\e]6;71;theme\a')
|
||||||
STRING_ITEM(`Exit', `\e]6;70\a')
|
STRING_ITEM(`Exit', `\e]6;70\a')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1127,9 +1127,13 @@ begin menu
|
||||||
end
|
end
|
||||||
separator
|
separator
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Save Settings..."
|
text "Save User Settings..."
|
||||||
action string "\e]6;71\a"
|
action string "\e]6;71\a"
|
||||||
end
|
end
|
||||||
|
begin menuitem
|
||||||
|
text "Save Theme Settings..."
|
||||||
|
action string "\e]6;71;theme\a"
|
||||||
|
end
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Exit"
|
text "Exit"
|
||||||
action string "\e]6;70\a"
|
action string "\e]6;70\a"
|
||||||
|
|
|
@ -917,9 +917,13 @@ begin menu
|
||||||
end
|
end
|
||||||
separator
|
separator
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Save Settings..."
|
text "Save User Settings..."
|
||||||
action string "\e]6;71\a"
|
action string "\e]6;71\a"
|
||||||
end
|
end
|
||||||
|
begin menuitem
|
||||||
|
text "Save Theme Settings..."
|
||||||
|
action string "\e]6;71;theme\a"
|
||||||
|
end
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Exit"
|
text "Exit"
|
||||||
action string "\e]6;70\a"
|
action string "\e]6;70\a"
|
||||||
|
|
|
@ -1061,9 +1061,13 @@ begin menu
|
||||||
end
|
end
|
||||||
separator
|
separator
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Save Settings..."
|
text "Save User Settings..."
|
||||||
action string "\e]6;71\a"
|
action string "\e]6;71\a"
|
||||||
end
|
end
|
||||||
|
begin menuitem
|
||||||
|
text "Save Theme Settings..."
|
||||||
|
action string "\e]6;71;theme\a"
|
||||||
|
end
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Exit"
|
text "Exit"
|
||||||
action string "\e]6;70\a"
|
action string "\e]6;70\a"
|
||||||
|
|
|
@ -917,9 +917,13 @@ begin menu
|
||||||
end
|
end
|
||||||
separator
|
separator
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Save Settings..."
|
text "Save User Settings..."
|
||||||
action string "\e]6;71\a"
|
action string "\e]6;71\a"
|
||||||
end
|
end
|
||||||
|
begin menuitem
|
||||||
|
text "Save Theme Settings..."
|
||||||
|
action string "\e]6;71;theme\a"
|
||||||
|
end
|
||||||
begin menuitem
|
begin menuitem
|
||||||
text "Exit"
|
text "Exit"
|
||||||
action string "\e]6;70\a"
|
action string "\e]6;70\a"
|
||||||
|
|
Loading…
Reference in New Issue