From: <enl...@li...> - 2002-04-25 02:28:58
|
Enlightenment CVS committal Author : mej Project : eterm Module : Eterm Dir : eterm/Eterm/src Modified Files: font.c font.h options.c Log Message: Wed Apr 24 22:27:51 2002 Michael Jennings (mej) Save buttonbar info when we save theme settings. =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/font.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- font.c 3 Feb 2002 20:53:06 -0000 1.30 +++ font.c 25 Apr 2002 02:28:57 -0000 1.31 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: font.c,v 1.30 2002/02/03 20:53:06 mej Exp $"; +static const char cvs_ident[] = "$Id: font.c,v 1.31 2002/04/25 02:28:57 mej Exp $"; #include "config.h" #include "feature.h" @@ -309,6 +309,31 @@ case FONT_TYPE_FNLIB: return (NULL); break; default: return (NULL); break; } + } + } + D_FONT(("No matches found. =(\n")); + return (NULL); +} + +const char * +get_font_name(void *info) +{ + cachefont_t *current; + + REQUIRE_RVAL(info != NULL, NULL); + + D_FONT(("get_font_name(%8p) called.\n", info)); + + /* This is also a simple search, but it returns the fontinfo rather than the cache entry. */ + for (current = font_cache; current; current = current->next) { + D_FONT((" -> Checking current (%8p), type == %d, name == %s\n", current, current->type, NONULL(current->name))); + if ((current->type == FONT_TYPE_X) && (((void *) current->fontinfo.xfontinfo) == info)) { + D_FONT((" -> Match!\n")); + return current->name; +#if UNUSED_BLOCK + } else if ((current->type == FONT_TYPE_TTF) && (0)) { + } else if ((current->type == FONT_TYPE_FNLIB) && (0)) { +#endif } } D_FONT(("No matches found. =(\n")); =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/font.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- font.h 3 Feb 2002 20:53:06 -0000 1.13 +++ font.h 25 Apr 2002 02:28:57 -0000 1.14 @@ -94,6 +94,7 @@ extern void *load_font(const char *, const char *, unsigned char); extern void free_font(const void *); extern void change_font(int, const char *); +extern const char *get_font_name(void *); extern void set_shadow_color_by_name(unsigned char, const char *); extern void set_shadow_color_by_pixel(unsigned char, Pixel); extern unsigned char parse_font_fx(const char *line); =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/options.c,v retrieving revision 1.100 retrieving revision 1.101 diff -u -3 -r1.100 -r1.101 --- options.c 24 Apr 2002 20:58:00 -0000 1.100 +++ options.c 25 Apr 2002 02:28:57 -0000 1.101 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: options.c,v 1.100 2002/04/24 20:58:00 mej Exp $"; +static const char cvs_ident[] = "$Id: options.c,v 1.101 2002/04/25 02:28:57 mej Exp $"; #include "config.h" #include "feature.h" @@ -2546,7 +2546,7 @@ if (text == icon) { text = NULL; } else { - text = get_word(1, text); + text = get_word(2, buff); } if (!text && !icon) { print_error("Parse error in file %s, line %lu: Missing button specifications\n", file_peek_path(), file_peek_line()); @@ -3287,6 +3287,7 @@ struct stat fst; simage_t *simg; action_t *action; + buttonbar_t *bbar; D_OPTIONS(("Saving %s config to \"%s\"\n", (save_theme ? "theme" : "user"), NONULL(path))); @@ -3817,6 +3818,67 @@ } fprintf(fp, "end xim\n\n"); #endif + + if (save_theme) { + for (bbar = buttonbar; bbar; bbar = bbar->next) { + unsigned long tmp; + button_t *b; + + fprintf(fp, "begin button_bar\n"); + fprintf(fp, " font '%s'\n", NONULL(get_font_name(bbar->font))); + if (bbar_is_top_docked(bbar)) { + fprintf(fp, " dock top\n"); + } else if (bbar_is_bottom_docked(bbar)) { + fprintf(fp, " dock bottom\n"); + } else { + fprintf(fp, " dock none\n"); + } + fprintf(fp, " visible %s\n", (bbar_is_visible(bbar) ? "yes" : "no")); + for (b = bbar->buttons; b; b = b->next) { + if (b->len) { + fprintf(fp, " button \"%s\" ", safe_print_string(b->text, b->len)); + } else { + fprintf(fp, " button "); + } + if (b->icon && b->icon->iml) { + imlib_context_set_image(b->icon->iml->im); + fprintf(fp, "icon \"%s\" ", NONULL(imlib_image_get_filename())); + } + fprintf(fp, "action "); + if (b->type == ACTION_STRING) { + fprintf(fp, "string '%s'\n", safe_print_string(b->action.string, -1)); + } else if (b->type == ACTION_ECHO) { + fprintf(fp, "echo '%s'\n", safe_print_string(b->action.string, -1)); + } else if (b->type == ACTION_MENU) { + fprintf(fp, "menu \"%s\"\n", (b->action.menu)->title); + } else if (b->type == ACTION_SCRIPT) { + fprintf(fp, "script '%s'\n", b->action.script); + } + } + for (b = bbar->rbuttons; b; b = b->next) { + if (b->len) { + fprintf(fp, " rbutton \"%s\" ", safe_print_string(b->text, b->len)); + } else { + fprintf(fp, " rbutton "); + } + if (b->icon && b->icon->iml) { + imlib_context_set_image(b->icon->iml->im); + fprintf(fp, "icon \"%s\" ", NONULL(imlib_image_get_filename())); + } + fprintf(fp, "action "); + if (b->type == ACTION_STRING) { + fprintf(fp, "string '%s'\n", safe_print_string(b->action.string, -1)); + } else if (b->type == ACTION_ECHO) { + fprintf(fp, "echo '%s'\n", safe_print_string(b->action.string, -1)); + } else if (b->type == ACTION_MENU) { + fprintf(fp, "menu \"%s\"\n", (b->action.menu)->title); + } else if (b->type == ACTION_SCRIPT) { + fprintf(fp, "script '%s'\n", b->action.script); + } + } + } + fprintf(fp, "end button_bar\n\n"); + } fprintf(fp, "begin toggles\n"); fprintf(fp, " map_alert %d\n", (Options & Opt_map_alert ? 1 : 0)); |