Changeset c3ab155 for functions.c


Ignore:
Timestamp:
Jun 17, 2003, 9:46:10 PM (18 years ago)
Author:
James M. Kretchmar <kretch@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:
b1299da
Parents:
65e3901
Message:
Really use just one view now, named 'main' and recalculate
  messages when its filter is changed.  This is in preperation for
  other design changes
Added the 'default_style' variable
Added the 'toggle-oneline' command
the 'o' key is bound to 'toggle-oneline'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    rd559df9 rc3ab155  
    19551955}
    19561956
    1957 
    1958 void owl_function_change_view(char *filtname)
     1957#if 0
     1958void owl_function_change_view_old(char *filtname)
    19591959{
    19601960  owl_view *v;
     
    19991999  owl_global_set_curmsg(&g, newpos);
    20002000
     2001  owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS);
     2002  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     2003  owl_global_set_direction_downwards(&g);
     2004}
     2005#endif
     2006
     2007void owl_function_change_view(char *filtname)
     2008{
     2009  owl_view *v;
     2010  owl_filter *f;
     2011  int curid=-1, newpos, curmsg;
     2012  owl_message *curm=NULL;
     2013
     2014  v=owl_global_get_current_view(&g);
     2015
     2016  curmsg=owl_global_get_curmsg(&g);
     2017  if (curmsg==-1) {
     2018    owl_function_debugmsg("Hit the curmsg==-1 case in change_view");
     2019  } else {
     2020    curm=owl_view_get_element(v, curmsg);
     2021    if (curm) {
     2022      curid=owl_message_get_id(curm);
     2023      owl_view_save_curmsgid(v, curid);
     2024    }
     2025  }
     2026
     2027  f=owl_global_get_filter(&g, filtname);
     2028  if (!f) {
     2029    owl_function_makemsg("Unknown filter");
     2030    return;
     2031  }
     2032
     2033  owl_view_new_filter(v, f);
     2034
     2035  /* Figure out what to set the current message to.
     2036   * - If the view we're leaving has messages in it, go to the closest message
     2037   *   to the last message pointed to in that view.
     2038   * - If the view we're leaving is empty, try to restore the position
     2039   *   from the last time we were in the new view.  */
     2040  if (curm) {
     2041    newpos = owl_view_get_nearest_to_msgid(v, curid);
     2042  } else {
     2043    newpos = owl_view_get_nearest_to_saved(v);
     2044  }
     2045
     2046  owl_global_set_curmsg(&g, newpos);
    20012047  owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS);
    20022048  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     
    29663012  fclose(file);
    29673013}
     3014
     3015void owl_function_toggleoneline()
     3016{
     3017  char *style;
     3018
     3019  style=owl_global_get_style(&g);
     3020
     3021  if (strcmp(style, "oneline")) {
     3022    owl_global_set_style(&g, "oneline");
     3023  } else {
     3024    owl_global_set_style(&g, owl_global_get_default_style(&g));
     3025  }
     3026}
Note: See TracChangeset for help on using the changeset viewer.