Wed May 9 17:18:11 PDT 2001 Michael Jennings <mej@eterm.org>

Fixed several bugs in the saving of settings and the support of
	scripts in menus.  Also fixed the definition of term_name in the theme
	files as pointed out by Laurence J. Lane <ljlane@debian.org>.


SVN revision: 4750
This commit is contained in:
Michael Jennings 2001-05-10 00:20:15 +00:00
parent 0291d6b7a1
commit a286152df9
14 changed files with 53 additions and 35 deletions

View File

@ -4126,3 +4126,10 @@ Tue May 8 19:53:56 PDT 2001 Michael Jennings <mej@eterm.org>
You will also need to update your themes.
-------------------------------------------------------------------------------
Wed May 9 17:18:11 PDT 2001 Michael Jennings <mej@eterm.org>
Fixed several bugs in the saving of settings and the support of
scripts in menus. Also fixed the definition of term_name in the theme
files as pointed out by Laurence J. Lane <ljlane@debian.org>.
-------------------------------------------------------------------------------

View File

@ -56,6 +56,8 @@ Eterm-base|Eterm basic terminal capabilities,
bold=\e[1m, rev=\e[7m, blink=\e[5m,
# Start/stop underline, standout (reverse video)
smul=\e[4m, rmul=\e[24m, smso=\e[7m, rmso=\e[27m,
# Turn off all attributes (exit_attribute_mode)
sgr0=\e[m^O,
# Flash the screen (sets and resets reverse video for the whole screen)
flash=\e[?5h\e[?5l,
@ -135,7 +137,6 @@ Eterm-ansi|Eterm with ANSI color (X Window System),
use=Eterm-base,
sgr=\e[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;,
## sgr=\e[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m,
sgr0=\e[m^O,
###### Add mouse reporting
Eterm-mouse|Eterm with X11 mouse reporting,

View File

@ -39,6 +39,7 @@ static const char cvs_ident[] = "$Id$";
#include "options.h"
#include "pixmap.h"
#include "screen.h"
#include "script.h"
#include "term.h"
#include "windows.h"
@ -712,6 +713,8 @@ menuitem_delete(menuitem_t *item)
}
if (item->type == MENUITEM_STRING || item->type == MENUITEM_ECHO) {
FREE(item->action.string);
} else if (item->type == MENUITEM_SCRIPT) {
FREE(item->action.script);
}
if (item->text) {
FREE(item->text);
@ -756,6 +759,9 @@ menuitem_set_action(menuitem_t *item, unsigned char type, char *action)
case MENUITEM_SUBMENU:
item->action.submenu = find_menu_by_title(menu_list, action);
break;
case MENUITEM_SCRIPT:
item->action.script = STRDUP(action);
break;
case MENUITEM_STRING:
case MENUITEM_ECHO:
item->action.string = (char *) MALLOC(strlen(action) + 2);
@ -1164,6 +1170,9 @@ menu_action(menuitem_t *item)
case MENUITEM_ECHO:
tt_write((unsigned char *) item->action.string, strlen(item->action.string));
break;
case MENUITEM_SCRIPT:
script_parse((char *) item->action.script);
break;
default:
fatal_error("Internal Program Error: Unknown menuitem type: %u\n", item->type);
break;

View File

@ -33,6 +33,7 @@
#define MENUITEM_SUBMENU (1UL << 1)
#define MENUITEM_STRING (1UL << 2)
#define MENUITEM_ECHO (1UL << 3)
#define MENUITEM_SCRIPT (1UL << 4)
#define MENU_STATE_IS_MAPPED (1UL << 0)
#define MENU_STATE_IS_CURRENT (1UL << 1)
@ -61,6 +62,7 @@ typedef struct {
union {
menu_t *submenu;
char *string;
char *script;
} action;
char *text, *rtext;
unsigned short len, rlen;

View File

@ -3129,6 +3129,9 @@ parse_menuitem(char *buff, void *state)
} else if (!BEG_STRCASECMP(type, "string ")) {
menuitem_set_action(curitem, MENUITEM_STRING, action);
} else if (!BEG_STRCASECMP(type, "script ")) {
menuitem_set_action(curitem, MENUITEM_SCRIPT, action);
} else if (!BEG_STRCASECMP(type, "echo ")) {
menuitem_set_action(curitem, MENUITEM_ECHO, action);
@ -3295,7 +3298,8 @@ parse_multichar(char *buff, void *state)
&& BEG_STRCASECMP(rs_multichar_encoding, "sjis")
&& BEG_STRCASECMP(rs_multichar_encoding, "euckr")
&& BEG_STRCASECMP(rs_multichar_encoding, "big5")
&& BEG_STRCASECMP(rs_multichar_encoding, "gb")) {
&& BEG_STRCASECMP(rs_multichar_encoding, "gb")
&& BEG_STRCASECMP(rs_multichar_encoding, "iso-10646")) {
print_error("Parse error in file %s, line %lu: Invalid multichar encoding mode \"%s\"\n",
file_peek_path(), file_peek_line(), rs_multichar_encoding);
return NULL;
@ -4602,6 +4606,8 @@ save_config(char *path, unsigned char save_theme)
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);
} else if (item->type == MENUITEM_SCRIPT) {
fprintf(fp, "script \"%s\"\n", item->action.script);
}
fprintf(fp, " end\n");
}
@ -4648,30 +4654,21 @@ save_config(char *path, unsigned char save_theme)
if (action->mod & MOD_MOD5) {
fprintf(fp, "mod5 ");
}
if (action->keysym) {
fprintf(fp, "0x%04x", (unsigned int) action->keysym);
} else {
fprintf(fp, "button");
if (action->button == Button5) {
fprintf(fp, "5");
} else if (action->button == Button4) {
fprintf(fp, "4");
} else if (action->button == Button3) {
fprintf(fp, "3");
} else if (action->button == Button2) {
fprintf(fp, "2");
} else {
fprintf(fp, "1");
}
}
fprintf(fp, " to ");
if (action->type == ACTION_STRING) {
fprintf(fp, "string \"%s\"\n", safe_print_string(action->param.string, -1));
} else if (action->type == ACTION_ECHO) {
fprintf(fp, "echo \"%s\"\n", safe_print_string(action->param.string, -1));
} else if (action->type == ACTION_MENU) {
fprintf(fp, "menu \"%s\"\n", (action->param.menu)->title);
}
}
if (action->keysym) {
fprintf(fp, "0x%04x", (unsigned int) action->keysym);
} else {
fprintf(fp, "button%d", (int) action->button);
}
fprintf(fp, " to ");
if (action->type == ACTION_STRING) {
fprintf(fp, "string \"%s\"\n", safe_print_string(action->param.string, -1));
} else if (action->type == ACTION_ECHO) {
fprintf(fp, "echo \"%s\"\n", safe_print_string(action->param.string, -1));
} else if (action->type == ACTION_MENU) {
fprintf(fp, "menu \"%s\"\n", (action->param.menu)->title);
} else if (action->type == ACTION_SCRIPT) {
fprintf(fp, "script \"%s\"\n", action->param.script);
}
}
fprintf(fp, " end actions\n\n");
@ -4745,7 +4742,7 @@ save_config(char *path, unsigned char save_theme)
}
for (i = 0; i < 256; i++) {
if (KeySym_map[i]) {
fprintf(fp, " keysym 0xff%02x \"%s\"\n", i, (KeySym_map[i] + 1));
fprintf(fp, " keysym 0xff%02x \'%s\'\n", i, safe_print_string((char *) (KeySym_map[i] + 1), (unsigned long) KeySym_map[i][0]));
}
}
#ifdef GREEK_SUPPORT

View File

@ -248,6 +248,8 @@ script_parse(char *s)
return;
}
param_list = split(", \t", params);
} else {
param_list = NULL;
}
D_SCRIPT(("Calling function %s with parameters: %s\n", func_name, NONULL(params)));
if ((func = script_find_handler(func_name)) != NULL) {

View File

@ -404,7 +404,7 @@ begin main
# line_space 2
# Value to use for $TERM
term_name xterm
term_name Eterm
# Program to exec (intended for use with themes)
# exec foo

View File

@ -399,7 +399,7 @@ begin main
# line_space 2
# Value to use for $TERM
term_name xterm
term_name Eterm
# Program to exec (intended for use with themes)
# exec foo

View File

@ -393,7 +393,7 @@ begin main
# line_space 2
# Value to use for $TERM
term_name xterm
term_name Eterm
# Program to exec (intended for use with themes)
# exec foo

View File

@ -395,7 +395,7 @@ begin main
# line_space 2
# Value to use for $TERM
term_name xterm
term_name Eterm
# Program to exec (intended for use with themes)
# exec foo

View File

@ -396,7 +396,7 @@ begin main
# line_space 2
# Value to use for $TERM
term_name xterm
term_name Eterm
# Program to exec (intended for use with themes)
exec emacs -nw

View File

@ -401,7 +401,7 @@ begin main
# line_space 2
# Value to use for $TERM
term_name xterm
term_name Eterm
# Program to exec (intended for use with themes)
exec irc

View File

@ -397,7 +397,7 @@ begin main
# line_space 2
# Value to use for $TERM
term_name xterm
term_name Eterm
# Program to exec (intended for use with themes)
exec mutt

View File

@ -394,7 +394,7 @@ begin main
# line_space 2
# Value to use for $TERM
term_name xterm
term_name Eterm
# Program to exec (intended for use with themes)
# exec foo