Changeset ef56a67
- Timestamp:
- Jun 22, 2003, 9:38:21 AM (22 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- f1cbb7a
- Parents:
- 3723f31
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r73624b4 ref56a67 12 12 New 'sepbar_disable' variable can turn off sepbar info 13 13 Updated contributor info 14 added the 'show view' command. 15 removed 'set style' 16 A style is now part of a view, the view command has been revamped 14 17 15 18 2.0.4-pre-1 -
commands.c
r0c502e9 ref56a67 486 486 OWLCMD_ARGS("view", owl_command_view, OWL_CTX_INTERACTIVE, 487 487 "view messages matching a filter", 488 "view [<viewname>] [-f <filter> | --home ] [-s <style>]\n" 488 489 "view <filter>\n" 489 490 "view -d <expression>\n" 490 491 "view --home", 491 "In the first usage, The view command sets the current view to\n" 492 "the specified filter. This causes only messages matching\n" 493 "that filter to be displayed.\n" 492 "The view command sets information associated with a particular view,\n" 493 "such as view's filter or style. In the first general usage listed\n" 494 "above <viewname> is the name of the view to be changed. If not\n" 495 "specified the default view 'main' will be used. A filter can be set\n" 496 "for the view by listing a named filter after the -f argument. If\n" 497 "the --home argument is used the filter will be set to the filter named\n" 498 "by the\n 'view_home' variable. The style can be set by listing the\n" 499 "name style after the -s argument.\n" 494 500 "\n" 495 "In the second usage a filter expression\n" 496 "and be specified directly\n" 497 "after -d. Owl will build an internal filter based on this\n" 498 "filter and change the current view to use it.\n\n" 499 "If --home is specified, switches to the view specified by\n" 500 "the 'view_home' variable.\n\n" 501 "The other usages listed above are abbreivated forms that simply set\n" 502 "the filter of the current view. The -d option allows you to write a\n" 503 "filter expression that will be dynamically created by owl and then\n" 504 "applied as the view's filter\n" 501 505 "SEE ALSO: filter, viewclass, viewuser\n"), 502 506 … … 558 562 "show terminal\n" 559 563 "show version\n" 564 "show view [<view>]\n" 560 565 "show status\n", 561 566 … … 1651 1656 1652 1657 char *owl_command_view(int argc, char **argv, char *buff) { 1653 if (argc<2) { 1654 owl_function_makemsg("Wrong number of arguments to view command"); 1655 return NULL; 1656 } 1657 1658 1659 /* Backwards compatability has made this kind of complicated: 1660 * view [<viewname>] [-f <filter> | -d <expression> | --home ] [-s <style>] 1661 * view <filter> 1662 * view -d <expression> 1663 * view --home 1664 */ 1665 1666 /* First take the 'view --home' case */ 1658 1667 if (argc == 2 && !strcmp(argv[1], "--home")) { 1659 1668 owl_function_change_view(owl_global_get_view_home(&g)); 1660 return NULL; 1661 } 1662 1663 /* is it a dynamic filter? */ 1664 if (!strcmp(argv[1], "-d")) { 1669 return(NULL); 1670 } 1671 1672 /* Now look for 'view <filter>' */ 1673 if (argc==2) { 1674 owl_function_change_view(argv[1]); 1675 return(NULL); 1676 } 1677 1678 /* Now get 'view -d <expression>' */ 1679 if (argc==3 && !strcmp(argv[1], "-d")) { 1665 1680 char **myargv; 1666 1681 int i; … … 1678 1693 } 1679 1694 1680 /* otherwise it's a normal view command */ 1681 if (argc>2) { 1682 owl_function_makemsg("Wrong number of arguments to view command"); 1683 return NULL; 1684 } 1685 owl_function_change_view(argv[1]); 1686 return NULL; 1695 /* Finally handle the general case */ 1696 if (argc<3) { 1697 owl_function_makemsg("Too few arguments to the view command."); 1698 return(NULL); 1699 } 1700 argc--; 1701 argv++; 1702 if (strcmp(argv[0], "-f") && strcmp(argv[0], "-d") && strcmp(argv[0], "--home") && strcmp(argv[0], "-s")) { 1703 if (strcmp(argv[0], "main")) { 1704 owl_function_makemsg("No view named '%s'", argv[0]); 1705 return(NULL); 1706 } 1707 argc--; 1708 argv++; 1709 } 1710 while (argc) { 1711 if (!strcmp(argv[0], "-f")) { 1712 if (argc<2) { 1713 owl_function_makemsg("Too few argments to the view command"); 1714 return(NULL); 1715 } 1716 owl_function_change_view(argv[1]); 1717 argc-=2; 1718 argv+=2; 1719 } else if (!strcmp(argv[0], "--home")) { 1720 owl_function_change_view(owl_global_get_view_home(&g)); 1721 argc--; 1722 argv++; 1723 } else if (!strcmp(argv[0], "-s")) { 1724 if (argc<2) { 1725 owl_function_makemsg("Too few argments to the view command"); 1726 return(NULL); 1727 } 1728 owl_function_change_style(owl_global_get_current_view(&g), argv[1]); 1729 argc-=2; 1730 argv+=2; 1731 } else { 1732 owl_function_makemsg("Too few argments to the view command"); 1733 return(NULL); 1734 } 1735 1736 } 1737 return(NULL); 1687 1738 } 1688 1739 … … 1722 1773 owl_function_show_keymap(argv[2]); 1723 1774 } 1775 } else if (!strcmp(argv[1], "view")) { 1776 if (argc==3) { 1777 owl_function_show_view(argv[2]); 1778 } else { 1779 owl_function_show_view(NULL); 1780 } 1724 1781 } else if (!strcmp(argv[1], "colors")) { 1725 1782 owl_function_show_colors(); -
functions.c
r9381782 ref56a67 59 59 owl_fmtext_free(&fm); 60 60 } 61 62 63 void owl_function_show_view(char *viewname) 64 { 65 owl_view *v; 66 owl_fmtext fm; 67 68 /* we only have the one view right now */ 69 v=owl_global_get_current_view(&g); 70 if (viewname && strcmp(viewname, owl_view_get_name(v))) { 71 owl_function_makemsg("No view named '%s'", viewname); 72 return; 73 } 74 75 owl_fmtext_init_null(&fm); 76 owl_view_to_fmtext(v, &fm); 77 owl_function_popless_fmtext(&fm); 78 owl_fmtext_free(&fm); 79 } 80 61 81 62 82 char *owl_function_cmd_describe(void *name) … … 3019 3039 } 3020 3040 3041 3042 void owl_function_change_style(owl_view *v, char *stylename) 3043 { 3044 owl_view_set_style(v, owl_global_get_style_by_name(&g, stylename)); 3045 owl_messagelist_invalidate_formats(owl_global_get_msglist(&g)); 3046 owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS); 3047 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 3048 3049 } 3050 3021 3051 void owl_function_toggleoneline() 3022 3052 { 3023 char *style; 3024 3025 style=owl_global_get_style(&g); 3026 3027 if (strcmp(style, "oneline")) { 3028 owl_global_set_style(&g, "oneline"); 3053 owl_view *v; 3054 owl_style *s; 3055 3056 v=owl_global_get_current_view(&g); 3057 s=owl_view_get_style(v); 3058 3059 if (!owl_style_matches_name(s, "oneline")) { 3060 owl_function_change_style(v, "oneline"); 3029 3061 } else { 3030 owl_global_set_style(&g, owl_global_get_default_style(&g)); 3031 } 3032 } 3062 owl_function_change_style(v, owl_global_get_default_style(&g)); 3063 } 3064 3065 owl_messagelist_invalidate_formats(owl_global_get_msglist(&g)); 3066 owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS); 3067 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 3068 } -
global.c
rbd3f232 ref56a67 748 748 } 749 749 750 owl_style *owl_global_get_current_style(owl_global *g) {751 return(owl_global_get_style_by_name(g, owl_global_get_style(g)));752 }753 754 750 void owl_global_add_style(owl_global *g, owl_style *s) { 755 751 owl_list_append_element(&(g->stylelist), s); -
message.c
rbe0a79f ref56a67 114 114 { 115 115 owl_style *s; 116 owl_view *v; 116 117 117 118 if (m->invalid_format) { 119 /* for now we assume there's jsut the one view and use that style */ 120 v=owl_global_get_current_view(&g); 121 s=owl_view_get_style(v); 122 118 123 owl_fmtext_free(&(m->fmtext)); 119 124 owl_fmtext_init_null(&(m->fmtext)); 120 s=owl_global_get_current_style(&g);121 125 owl_style_get_formattext(s, &(m->fmtext), m); 122 126 m->invalid_format=0; -
owl.c
r3723f31 ref56a67 271 271 * formatting function */ 272 272 if (owl_global_is_config_format(&g)) { 273 owl_ global_set_style(&g, "perl");273 owl_view_set_style(owl_global_get_current_view(&g), owl_global_get_style_by_name(&g, "perl")); 274 274 } else if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { 275 owl_ global_set_style(&g, "default");275 owl_view_set_style(owl_global_get_current_view(&g), owl_global_get_style_by_name(&g, "default")); 276 276 } else { 277 owl_ global_set_style(&g, "basic");277 owl_view_set_style(owl_global_get_current_view(&g), owl_global_get_style_by_name(&g, "basic")); 278 278 } 279 279 -
style.c
r5639bf2 ref56a67 23 23 if (!strcmp(s->name, name)) return(1); 24 24 return(0); 25 } 26 27 char *owl_style_get_name(owl_style *s) 28 { 29 return(s->name); 25 30 } 26 31 … … 50 55 } 51 56 52 char *owl_style_get_name(owl_style *s)53 {54 return(s->name);55 }56 57 57 void owl_style_free(owl_style *s) 58 58 { -
variable.c
r73624b4 ref56a67 201 201 OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "tty name for zephyr location", "", 202 202 NULL, owl_variable_tty_set, NULL), 203 204 OWLVAR_STRING_FULL( "style" /* %OwlVarStub */, "default", "name of the current formatting style",205 "This sets the current message formatting style. Possbile\n"206 "values include 'default' 'basic' 'oneline' and if\n"207 "available, 'perl'\n",208 NULL, owl_variable_style_set, NULL),209 203 210 204 OWLVAR_STRING( "default_style" /* %OwlVarStub */, "default", -
view.c
rc3ab155 ref56a67 13 13 } 14 14 15 char *owl_view_get_name(owl_view *v) 16 { 17 return(v->name); 18 } 15 19 16 20 /* if the message matches the filter then add to view */ … … 58 62 { 59 63 v->style=s; 64 } 65 66 owl_style *owl_view_get_style(owl_view *v) 67 { 68 return(v->style); 60 69 } 61 70 … … 113 122 } 114 123 124 /* fmtext should already be initialized */ 125 void owl_view_to_fmtext(owl_view *v, owl_fmtext *fm) 126 { 127 owl_fmtext_append_normal(fm, "Name: "); 128 owl_fmtext_append_normal(fm, v->name); 129 owl_fmtext_append_normal(fm, "\n"); 130 131 owl_fmtext_append_normal(fm, "Filter: "); 132 owl_fmtext_append_normal(fm, owl_filter_get_name(v->filter)); 133 owl_fmtext_append_normal(fm, "\n"); 134 135 owl_fmtext_append_normal(fm, "Style: "); 136 owl_fmtext_append_normal(fm, owl_style_get_name(v->style)); 137 owl_fmtext_append_normal(fm, "\n"); 138 } 139 115 140 char *owl_view_get_filtname(owl_view *v) 116 141 {
Note: See TracChangeset
for help on using the changeset viewer.