Changeset f1e629d for global.c


Ignore:
Timestamp:
Jul 6, 2003, 6:42:06 PM (18 years ago)
Author:
Erik Nygren <nygren@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
5d9c664
Parents:
675ce49
Message:
	New API for perl message formatting functions.
	        Legacy variables are still supported for owl::format_msg
		and owl::receive_msg, but these functions are now also
		passed an owl::Message object which contains methods
		for accessing the contents of the message.  See perlwrap.pm
		(and docs TBD) for the available methods.
		*** WARNING:  The exact API for owl::Message has
		*** not yet stabilized.
	Added "style" command for creating new styles.
	        Usage:  style <name> perl <function_name>
	Added support for "show styles".  Changed global style table
	        from list to dictionary.
	Changed AIM password prompt from "Password:" to "AIM Password:".
	Messages are reformatted after a window resize to allow styles
	        to take into account the width of the window.
	When perl throws an error, the message is put in the msgwin
	        if possible.
	Added perl functions for:
	        owl::getcurmsg() -- returns an owl::Message object for
		                    the active message
		                    in the current view.
	        owl::getnumcols() -- returns the column width of the window
		owl::zephyr_getrealm() -- returns the zephyr realm
	        owl::zephyr_getsender() -- returns the zephyr sender
	Made owl::COMMAND("foo"); be syntactic sugar for
	        owl::command("COMMAND foo");
		*** Is this a good or bad idea?
		*** This feature may be taken out before release.
	Added perlwrap.pm to contain perl code to be compiled into
	        the binary.  This is transformed into perlwrap.c by
		encapsulate.pl.
	Renamed readconfig.c to perlconfig.c and changed variables accordingly.
	Minor bugfixes in cmd.c and commands.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.c

    ra352335c rf1e629d  
    5353  owl_list_create(&(g->puntlist));
    5454  owl_list_create(&(g->messagequeue));
    55   owl_list_create(&(g->stylelist));
     55  owl_dict_create(&(g->styledict));
    5656  g->curmsg_vert_offset=0;
    5757  g->resizepending=0;
     
    390390  _owl_global_setup_windows(g);
    391391
     392  /* in case any styles rely on the current width */
     393  owl_messagelist_invalidate_formats(owl_global_get_msglist(g));
     394
    392395  /* refresh stuff */
    393396  g->needrefresh=1;
     
    774777owl_style *owl_global_get_style_by_name(owl_global *g, char *name)
    775778{
    776   int i, j;
    777   owl_style *s;
    778  
    779   j=owl_list_get_size(&(g->stylelist));
    780   for (i=0; i<j; i++) {
    781     s=owl_list_get_element(&(g->stylelist), i);
    782     if (owl_style_matches_name(s, name)) {
    783       return(s);
    784     }
    785   }
    786   return(NULL);
     779  return owl_dict_find_element(&(g->styledict), name);
     780}
     781
     782/* creates a list and fills it in with keys.  duplicates the keys,
     783 * so they will need to be freed by the caller. */
     784int owl_global_get_style_names(owl_global *g, owl_list *l) {
     785  return owl_dict_get_keys(&(g->styledict), l);
    787786}
    788787
    789788void owl_global_add_style(owl_global *g, owl_style *s)
    790789{
    791   owl_list_append_element(&(g->stylelist), s);
     790  owl_dict_insert_element(&(g->styledict), owl_style_get_name(s),
     791                          s, (void(*)(void*))owl_style_free);
    792792}
    793793
Note: See TracChangeset for help on using the changeset viewer.