/[emacs]/emacs/src/scroll.c
ViewVC logotype

Diff of /emacs/src/scroll.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26.4.1 by miles, Fri Apr 4 06:21:03 2003 UTC revision 1.26.4.2 by miles, Tue Oct 14 23:22:46 2003 UTC
# Line 96  calculate_scrolling (frame, matrix, wind Line 96  calculate_scrolling (frame, matrix, wind
96       int free_at_end;       int free_at_end;
97  {  {
98    register int i, j;    register int i, j;
99    int frame_height = FRAME_HEIGHT (frame);    int frame_lines = FRAME_LINES (frame);
100    register struct matrix_elt *p, *p1;    register struct matrix_elt *p, *p1;
101    register int cost, cost1;    register int cost, cost1;
102    
# Line 105  calculate_scrolling (frame, matrix, wind Line 105  calculate_scrolling (frame, matrix, wind
105       at the i'th line of the lines we are considering,       at the i'th line of the lines we are considering,
106       where I is origin 1 (as it is below).  */       where I is origin 1 (as it is below).  */
107    int *first_insert_cost    int *first_insert_cost
108      = &FRAME_INSERT_COST (frame)[frame_height - 1 - lines_moved];      = &FRAME_INSERT_COST (frame)[frame_lines - 1 - lines_moved];
109    int *first_delete_cost    int *first_delete_cost
110      = &FRAME_DELETE_COST (frame)[frame_height - 1 - lines_moved];      = &FRAME_DELETE_COST (frame)[frame_lines - 1 - lines_moved];
111    int *next_insert_cost    int *next_insert_cost
112      = &FRAME_INSERTN_COST (frame)[frame_height - 1 - lines_moved];      = &FRAME_INSERTN_COST (frame)[frame_lines - 1 - lines_moved];
113    int *next_delete_cost    int *next_delete_cost
114      = &FRAME_DELETEN_COST (frame)[frame_height - 1 - lines_moved];      = &FRAME_DELETEN_COST (frame)[frame_lines - 1 - lines_moved];
115    
116    /* Discourage long scrolls on fast lines.    /* Discourage long scrolls on fast lines.
117       Don't scroll nearly a full frame height unless it saves       Don't scroll nearly a full frame height unless it saves
118       at least 1/4 second.  */       at least 1/4 second.  */
119    int extra_cost = baud_rate / (10 * 4 * FRAME_HEIGHT (frame));    int extra_cost = baud_rate / (10 * 4 * FRAME_LINES (frame));
120    
121    if (baud_rate <= 0)    if (baud_rate <= 0)
122      extra_cost = 1;      extra_cost = 1;
# Line 438  calculate_direct_scrolling (frame, matri Line 438  calculate_direct_scrolling (frame, matri
438       int free_at_end;       int free_at_end;
439  {  {
440    register int i, j;    register int i, j;
441    int frame_height = FRAME_HEIGHT (frame);    int frame_lines = FRAME_LINES (frame);
442    register struct matrix_elt *p, *p1;    register struct matrix_elt *p, *p1;
443    register int cost, cost1, delta;    register int cost, cost1, delta;
444    
445    /* first_insert_cost[-I] is the cost of doing the first insert-line    /* first_insert_cost[-I] is the cost of doing the first insert-line
446       at a position I lines above the bottom line in the scroll window. */       at a position I lines above the bottom line in the scroll window. */
447    int *first_insert_cost    int *first_insert_cost
448      = &FRAME_INSERT_COST (frame)[frame_height - 1];      = &FRAME_INSERT_COST (frame)[frame_lines - 1];
449    int *first_delete_cost    int *first_delete_cost
450      = &FRAME_DELETE_COST (frame)[frame_height - 1];      = &FRAME_DELETE_COST (frame)[frame_lines - 1];
451    int *next_insert_cost    int *next_insert_cost
452      = &FRAME_INSERTN_COST (frame)[frame_height - 1];      = &FRAME_INSERTN_COST (frame)[frame_lines - 1];
453    int *next_delete_cost    int *next_delete_cost
454      = &FRAME_DELETEN_COST (frame)[frame_height - 1];      = &FRAME_DELETEN_COST (frame)[frame_lines - 1];
455    
456    int scroll_overhead;    int scroll_overhead;
457    
458    /* Discourage long scrolls on fast lines.    /* Discourage long scrolls on fast lines.
459       Don't scroll nearly a full frame height unless it saves       Don't scroll nearly a full frame height unless it saves
460       at least 1/4 second.  */       at least 1/4 second.  */
461    int extra_cost = baud_rate / (10 * 4 * FRAME_HEIGHT (frame));    int extra_cost = baud_rate / (10 * 4 * FRAME_LINES (frame));
462    
463    if (baud_rate <= 0)    if (baud_rate <= 0)
464      extra_cost = 1;      extra_cost = 1;
# Line 909  scroll_cost (frame, from, to, amount) Line 909  scroll_cost (frame, from, to, amount)
909       will not be involved in actual motion.  */       will not be involved in actual motion.  */
910    int limit = to;    int limit = to;
911    int offset;    int offset;
912    int height = FRAME_HEIGHT (frame);    int height = FRAME_LINES (frame);
913    
914    if (amount == 0)    if (amount == 0)
915      return 0;      return 0;
# Line 947  line_ins_del (frame, ov1, pf1, ovn, pfn, Line 947  line_ins_del (frame, ov1, pf1, ovn, pfn,
947       register int *ov, *mf;       register int *ov, *mf;
948  {  {
949    register int i;    register int i;
950    register int frame_height = FRAME_HEIGHT (frame);    register int frame_lines = FRAME_LINES (frame);
951    register int insert_overhead = ov1 * 10;    register int insert_overhead = ov1 * 10;
952    register int next_insert_cost = ovn * 10;    register int next_insert_cost = ovn * 10;
953    
954    for (i = frame_height-1; i >= 0; i--)    for (i = frame_lines-1; i >= 0; i--)
955      {      {
956        mf[i] = next_insert_cost / 10;        mf[i] = next_insert_cost / 10;
957        next_insert_cost += pfn;        next_insert_cost += pfn;
# Line 1000  ins_del_costs (frame, Line 1000  ins_del_costs (frame,
1000     only) and those that must repeatedly insert one line.     only) and those that must repeatedly insert one line.
1001    
1002     The cost to insert N lines at line L is     The cost to insert N lines at line L is
1003              [tt.t_ILov  + (frame_height + 1 - L) * tt.t_ILpf] +              [tt.t_ILov  + (frame_lines + 1 - L) * tt.t_ILpf] +
1004          N * [tt.t_ILnov + (frame_height + 1 - L) * tt.t_ILnpf]          N * [tt.t_ILnov + (frame_lines + 1 - L) * tt.t_ILnpf]
1005    
1006     ILov represents the basic insert line overhead.  ILpf is the padding     ILov represents the basic insert line overhead.  ILpf is the padding
1007     required to allow the terminal time to move a line: insertion at line     required to allow the terminal time to move a line: insertion at line
1008     L changes (frame_height + 1 - L) lines.     L changes (frame_lines + 1 - L) lines.
1009    
1010     The first bracketed expression above is the overhead; the second is     The first bracketed expression above is the overhead; the second is
1011     the multiply factor.  Both are dependent only on the position at     the multiply factor.  Both are dependent only on the position at
# Line 1035  do_line_insertion_deletion_costs (frame, Line 1035  do_line_insertion_deletion_costs (frame,
1035      {      {
1036        FRAME_INSERT_COST (frame) =        FRAME_INSERT_COST (frame) =
1037          (int *) xrealloc (FRAME_INSERT_COST (frame),          (int *) xrealloc (FRAME_INSERT_COST (frame),
1038                            FRAME_HEIGHT (frame) * sizeof (int));                            FRAME_LINES (frame) * sizeof (int));
1039        FRAME_DELETEN_COST (frame) =        FRAME_DELETEN_COST (frame) =
1040          (int *) xrealloc (FRAME_DELETEN_COST (frame),          (int *) xrealloc (FRAME_DELETEN_COST (frame),
1041                            FRAME_HEIGHT (frame) * sizeof (int));                            FRAME_LINES (frame) * sizeof (int));
1042        FRAME_INSERTN_COST (frame) =        FRAME_INSERTN_COST (frame) =
1043          (int *) xrealloc (FRAME_INSERTN_COST (frame),          (int *) xrealloc (FRAME_INSERTN_COST (frame),
1044                            FRAME_HEIGHT (frame) * sizeof (int));                            FRAME_LINES (frame) * sizeof (int));
1045        FRAME_DELETE_COST (frame) =        FRAME_DELETE_COST (frame) =
1046          (int *) xrealloc (FRAME_DELETE_COST (frame),          (int *) xrealloc (FRAME_DELETE_COST (frame),
1047                            FRAME_HEIGHT (frame) * sizeof (int));                            FRAME_LINES (frame) * sizeof (int));
1048      }      }
1049    else    else
1050      {      {
1051        FRAME_INSERT_COST (frame) =        FRAME_INSERT_COST (frame) =
1052          (int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int));          (int *) xmalloc (FRAME_LINES (frame) * sizeof (int));
1053        FRAME_DELETEN_COST (frame) =        FRAME_DELETEN_COST (frame) =
1054          (int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int));          (int *) xmalloc (FRAME_LINES (frame) * sizeof (int));
1055        FRAME_INSERTN_COST (frame) =        FRAME_INSERTN_COST (frame) =
1056          (int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int));          (int *) xmalloc (FRAME_LINES (frame) * sizeof (int));
1057        FRAME_DELETE_COST (frame) =        FRAME_DELETE_COST (frame) =
1058          (int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int));          (int *) xmalloc (FRAME_LINES (frame) * sizeof (int));
1059      }      }
1060    
1061    ins_del_costs (frame,    ins_del_costs (frame,
# Line 1069  do_line_insertion_deletion_costs (frame, Line 1069  do_line_insertion_deletion_costs (frame,
1069                   FRAME_DELETE_COST (frame), FRAME_DELETEN_COST (frame),                   FRAME_DELETE_COST (frame), FRAME_DELETEN_COST (frame),
1070                   coefficient);                   coefficient);
1071  }  }
1072    
1073    /* arch-tag: cdb7149c-48e7-4793-a948-2786c8e45485
1074       (do not change this comment) */

Legend:
Removed from v.1.26.4.1  
changed lines
  Added in v.1.26.4.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26