Changeset f9c43ae for functions.c
- Timestamp:
- Sep 21, 2002, 7:52:22 PM (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:
- bde7714
- Parents:
- 1583c90
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r1583c90 rf9c43ae 759 759 recwinlines=owl_global_get_recwin_lines(&g); 760 760 761 /* 761 762 if (owl_view_get_size(v) < 1) { 762 763 return; 763 764 } 765 */ 764 766 765 767 switch (owl_global_get_scrollmode(&g)) { 766 768 case OWL_SCROLLMODE_TOP: 767 topmsg = owl_function_calculate_topmsg_top(direction, v, curmsg, 768 topmsg, recwinlines); 769 topmsg = owl_function_calculate_topmsg_top(direction, v, curmsg, topmsg, recwinlines); 769 770 break; 770 771 case OWL_SCROLLMODE_NEARTOP: 771 topmsg = owl_function_calculate_topmsg_neartop(direction, v, curmsg, 772 topmsg, recwinlines); 772 topmsg = owl_function_calculate_topmsg_neartop(direction, v, curmsg, topmsg, recwinlines); 773 773 break; 774 774 case OWL_SCROLLMODE_CENTER: 775 topmsg = owl_function_calculate_topmsg_center(direction, v, curmsg, 776 topmsg, recwinlines); 775 topmsg = owl_function_calculate_topmsg_center(direction, v, curmsg, topmsg, recwinlines); 777 776 break; 778 777 case OWL_SCROLLMODE_PAGED: 779 topmsg = owl_function_calculate_topmsg_paged(direction, v, curmsg, 780 topmsg, recwinlines, 0); 778 topmsg = owl_function_calculate_topmsg_paged(direction, v, curmsg, topmsg, recwinlines, 0); 781 779 break; 782 780 case OWL_SCROLLMODE_PAGEDCENTER: 783 topmsg = owl_function_calculate_topmsg_paged(direction, v, curmsg, 784 topmsg, recwinlines, 1); 781 topmsg = owl_function_calculate_topmsg_paged(direction, v, curmsg, topmsg, recwinlines, 1); 785 782 break; 786 783 case OWL_SCROLLMODE_NORMAL: 787 784 default: 788 topmsg = owl_function_calculate_topmsg_normal(direction, v, curmsg, 789 topmsg, recwinlines); 785 topmsg = owl_function_calculate_topmsg_normal(direction, v, curmsg, topmsg, recwinlines); 790 786 } 791 787 owl_function_debugmsg("Calculated a topmsg of %i", topmsg); … … 801 797 */ 802 798 int owl_function_calculate_topmsg_top(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) { 803 return curmsg;799 return(curmsg); 804 800 } 805 801 … … 808 804 && (owl_message_get_numlines(owl_view_get_element(v, curmsg-1)) 809 805 < recwinlines/2)) { 810 return curmsg-1;806 return(curmsg-1); 811 807 } else { 812 return curmsg;808 return(curmsg); 813 809 } 814 810 } … … 824 820 last = i; 825 821 } 826 return last;822 return(last); 827 823 } 828 824 … … 841 837 } 842 838 if (center_on_page) { 843 return owl_function_calculate_topmsg_center(direction, v, curmsg, 0, recwinlines);839 return(owl_function_calculate_topmsg_center(direction, v, curmsg, 0, recwinlines)); 844 840 } else { 845 return last;841 return(last); 846 842 } 847 843 } … … 856 852 if (savey > recwinlines) { 857 853 if (center_on_page) { 858 return owl_function_calculate_topmsg_center(direction, v, curmsg, 0, recwinlines);854 return(owl_function_calculate_topmsg_center(direction, v, curmsg, 0, recwinlines)); 859 855 } else { 860 return curmsg;856 return(curmsg); 861 857 } 862 858 } 863 859 864 860 /* else just stay as we are... */ 865 return topmsg;861 return(topmsg); 866 862 } 867 863 … … 869 865 int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) { 870 866 int savey, j, i, foo, y; 871 867 868 /* If we're off the top of the screen then center */ 869 if (curmsg<topmsg) { 870 topmsg=owl_function_calculate_topmsg_center(direction, v, curmsg, 0, recwinlines); 871 } 872 872 873 /* Find number of lines from top to bottom of curmsg (store in savey) */ 873 874 savey=0; … … 876 877 } 877 878 878 /* If the direction is DOWNWARDS but we're off the bottom of the 879 * screen, then set the topmsg to curmsg and scroll UPWARDS 880 */ 881 if (direction == OWL_DIRECTION_DOWNWARDS) { 882 if (savey > recwinlines) { 883 topmsg=curmsg; 884 savey=owl_message_get_numlines(owl_view_get_element(v, i)); 885 direction=OWL_DIRECTION_UPWARDS; 886 } 887 } 888 879 /* If we're off the bottom of the screen, set the topmsg to curmsg 880 * and scroll upwards */ 881 if (savey > recwinlines) { 882 topmsg=curmsg; 883 savey=owl_message_get_numlines(owl_view_get_element(v, i)); 884 direction=OWL_DIRECTION_UPWARDS; 885 } 886 889 887 /* If our bottom line is less than 1/4 down the screen then scroll up */ 890 888 if (direction == OWL_DIRECTION_UPWARDS || direction == OWL_DIRECTION_NONE) { … … 904 902 } 905 903 if (j<0) j=0; 906 return j;904 return(j); 907 905 } 908 906 } … … 920 918 j--; 921 919 } 922 return j+1;923 } 924 } 925 926 return topmsg;920 return(j+1); 921 } 922 } 923 924 return(topmsg); 927 925 } 928 926 … … 1554 1552 } 1555 1553 1556 1557 1554 /* first check if we catch the reply-lockout filter */ 1558 1555 f=owl_global_get_filter(&g, "reply-lockout"); … … 1568 1565 owl_global_set_buffercommand(&g, owl_message_get_zwriteline(m)); 1569 1566 } else if (owl_message_is_type_admin(m)) { 1570 owl_function_makemsg("You cannot reply to thisadmin message");1567 owl_function_makemsg("You cannot reply to an admin message"); 1571 1568 } else { 1572 1569 if (owl_message_is_login(m)) { … … 1603 1600 } 1604 1601 if (*to != '\0') { 1605 char *tmp, *oldtmp; 1606 tmp=short_zuser(to); 1602 char *tmp, *oldtmp, *tmp2; 1607 1603 if (cc) { 1608 1604 tmp = owl_util_uniq(oldtmp=tmp, cc, "-"); … … 1612 1608 } else { 1613 1609 tmp=short_zuser(to); 1610 if (owl_global_is_smartstrip(&g)) { 1611 tmp2=tmp; 1612 tmp=smartstripped_user(tmp2); 1613 owl_free(tmp2); 1614 } 1614 1615 buff = owl_sprintf("%s %s", oldbuff=buff, tmp); 1615 1616 owl_free(oldbuff); … … 1748 1749 owl_view *v; 1749 1750 owl_filter *f; 1750 int curid=-1, newpos ;1751 owl_message *curm ;1751 int curid=-1, newpos, curmsg; 1752 owl_message *curm=NULL; 1752 1753 1753 1754 v=owl_global_get_current_view(&g); 1754 curm=owl_view_get_element(v, owl_global_get_curmsg(&g)); 1755 if (curm) { 1756 curid = owl_message_get_id(curm); 1757 owl_view_save_curmsgid(v, curid); 1758 } 1759 1755 curmsg=owl_global_get_curmsg(&g); 1756 if (curmsg==-1) { 1757 owl_function_debugmsg("Hit the curmsg==-1 case in change_view"); 1758 } else { 1759 curm=owl_view_get_element(v, curmsg); 1760 if (curm) { 1761 curid=owl_message_get_id(curm); 1762 owl_view_save_curmsgid(v, curid); 1763 } 1764 } 1765 1766 /* grab the filter */; 1760 1767 f=owl_global_get_filter(&g, filtname); 1761 1768 if (!f) { … … 1764 1771 } 1765 1772 1773 /* free the existing view and create a new one based on the filter */ 1766 1774 owl_view_free(v); 1767 1775 owl_view_create(v, f); 1768 1776 1769 /* Figure out wh ereto set the current message to.1770 * - If the previous view hadmessages in it, go to the closest message1771 * to the last message in that view.1772 * - If the previous view was empty, attemptsto restore the position1773 * from the last time we were in th atview. */1777 /* Figure out what to set the current message to. 1778 * - If the view we're leaving has messages in it, go to the closest message 1779 * to the last message pointed to in that view. 1780 * - If the view we're leaving is empty, try to restore the position 1781 * from the last time we were in the new view. */ 1774 1782 if (curm) { 1775 1783 newpos = owl_view_get_nearest_to_msgid(v, curid); … … 1780 1788 owl_global_set_curmsg(&g, newpos); 1781 1789 1782 owl_global_set_curmsg_vert_offset(&g, 0); 1790 owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS); 1791 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 1783 1792 owl_global_set_direction_downwards(&g); 1784 owl_function_calculate_topmsg(OWL_DIRECTION_NONE);1785 owl_mainwin_redisplay(owl_global_get_mainwin(&g));1786 1793 } 1787 1794
Note: See TracChangeset
for help on using the changeset viewer.