Ejemplo n.º 1
0
void
dlg_dump_keys(FILE *fp)
{
    LIST_BINDINGS *p;
    const char *last = "";
    unsigned n;
    unsigned count = 0;

    for (p = all_bindings; p != 0; p = p->link) {
	if (p->win == 0) {
	    ++count;
	}
    }
    if (count != 0) {
	for (p = all_bindings, n = 0; p != 0; p = p->link) {
	    if (p->win == 0) {
		if (dlg_strcmp(last, p->name)) {
		    fprintf(fp, "\n# key bindings for %s widgets\n",
			    !strcmp(p->name, "*") ? "all" : p->name);
		    last = p->name;
		}
		dump_one_binding(fp, p->name, p->binding);
	    }
	}
    }
}
Ejemplo n.º 2
0
/*
 * Dump bindings for the given window.  If it is a null, then this dumps the
 * initial bindings which were loaded from the rc-file that are used as
 * overall defaults.
 */
void
dlg_dump_window_keys(FILE *fp, WINDOW *win)
{
    if (fp != 0) {
	LIST_BINDINGS *p;
	DLG_KEYS_BINDING *q;
	const char *last = "";

	for (p = all_bindings; p != 0; p = p->link) {
	    if (p->win == win) {
		if (dlg_strcmp(last, p->name)) {
		    fprintf(fp, "\n# key bindings for %s widgets\n",
			    !strcmp(p->name, WILDNAME) ? "all" : p->name);
		    last = p->name;
		}
		for (q = p->binding; q->is_function_key >= 0; ++q) {
		    dump_one_binding(fp, p->name, q);
		}
	    }
	}
    }
}