home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / thesrc15.zip / show.c < prev    next >
C/C++ Source or Header  |  1993-11-17  |  27KB  |  746 lines

  1. /***********************************************************************/
  2. /* SHOW.C - Functions involving displaying the data.                   */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991-1993 Mark Hessling
  7.  *
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License as
  10.  * published by the Free Software Foundation; either version 2 of
  11.  * the License, or any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to:
  20.  *
  21.  *    The Free Software Foundation, Inc.
  22.  *    675 Mass Ave,
  23.  *    Cambridge, MA 02139 USA.
  24.  *
  25.  *
  26.  * If you make modifications to this software that you feel increases
  27.  * it usefulness for the rest of the community, please email the
  28.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  29.  * This software is going to be maintained and enhanced as deemed
  30.  * necessary by the community.
  31.  *
  32.  * Mark Hessling                     email: M.Hessling@gu.edu.au
  33.  * 36 David Road                     Phone: +61 7 849 7731
  34.  * Holland Park                      Fax:   +61 7 875 5314
  35.  * QLD 4121
  36.  * Australia
  37.  */
  38.  
  39. /*
  40. $Header: C:\THE\RCS\show.c 1.4 1993/09/01 16:27:15 MH Interim MH $
  41. */
  42.  
  43. #include <stdio.h>
  44. #include <time.h>
  45.  
  46. #include "the.h"
  47. #include "proto.h"
  48.  
  49. /*#define TRACEE*/
  50. /*-------------------------- external data ----------------------------*/
  51. extern LINE *next_line,*curr_line;
  52. extern VIEW_DETAILS *vd_current,*vd_first,*vd_mark;
  53. extern char current_screen;
  54. extern SCREEN_DETAILS screen[MAX_SCREENS];        /* screen structures */
  55. extern char current_file;         /* pointer to current file */
  56. extern char number_of_views;                        /* number of views */
  57. extern char number_of_files;                   /* number of open files */
  58. extern char display_screens;                      /* number of screens */
  59. extern bool horizontal;
  60. extern WINDOW *foot,*error_window;
  61. extern bool error_on_screen;
  62. extern char mode_insert;        /* defines insert mode toggle */
  63. extern char in_profile;    /* indicates if processing profile */
  64. extern char file_disposition;
  65. /*------------------------ function definitions -----------------------*/
  66. #ifdef PROTO
  67. static void show_line(int direction,LINE *curr,
  68.                          short rows,short start_row);
  69. #else
  70. static void show_line();
  71. #endif
  72. /***********************************************************************/
  73. #ifdef PROTO
  74. void show_heading(void)
  75. #else
  76. void show_heading()
  77. #endif
  78. /***********************************************************************/
  79. {
  80. /*--------------------------- local data ------------------------------*/
  81.  short y,x,fpath_len,fname_len,max_name;
  82.  char buffer[60];
  83.  char display_path[MAX_FILE_NAME+1];
  84.  char *fpath = display_path;
  85.  register int i;
  86. /*--------------------------- processing ------------------------------*/
  87. #ifdef TRACE
  88.  trace_function("show.c:    show_heading");
  89. #endif
  90. /*---------------------------------------------------------------------*/
  91. /* Reset idline to blank.                                              */
  92. /*---------------------------------------------------------------------*/
  93.  wmove(CURRENT_WINDOW_IDLINE,0,0);
  94.  my_wclrtoeol(CURRENT_WINDOW_IDLINE);
  95. /*---------------------------------------------------------------------*/
  96. /* Calculate line,col values.                                          */
  97. /*---------------------------------------------------------------------*/
  98.  getyx(CURRENT_WINDOW,y,x);
  99.  if (CURRENT_VIEW->current_window == WINDOW_COMMAND)
  100.    {
  101.     y = (short)CURRENT_VIEW->current_line;
  102.     x++;
  103.    }
  104.  else
  105.    {
  106.     y = (short)CURRENT_VIEW->focus_line;
  107.     x += CURRENT_VIEW->verify_col;
  108.    }
  109. /*---------------------------------------------------------------------*/
  110. /* Set up buffer for line,col,size and alt values for vertical screens.*/
  111. /*---------------------------------------------------------------------*/
  112.  if (display_screens != 1 && !horizontal)
  113.    {
  114.     sprintf(buffer,"L=%-.1d C=%-.1d S=%-.1d A=%d,%d",
  115.                     y,x,
  116.                     CURRENT_FILE->number_lines,
  117.                     CURRENT_FILE->autosave_alt,
  118.                     CURRENT_FILE->save_alt);
  119.     max_name = (CURRENT_SCREEN.screen_cols-1) - strlen(buffer);
  120.    }
  121.  else
  122.     max_name = (CURRENT_SCREEN.screen_cols-48);
  123. /*---------------------------------------------------------------------*/
  124. /* Determine which portion of filename can be displayed.               */
  125. /*---------------------------------------------------------------------*/
  126.  strcpy(display_path,CURRENT_FILE->fpath);
  127.  fpath = strtrans(display_path,ISLASH,ESLASH);
  128.  fpath_len = strlen(fpath);
  129.  fname_len = strlen(CURRENT_FILE->fname);
  130.  if (fpath_len + fname_len > max_name)
  131.    {
  132.     fpath_len = (fpath_len + fname_len + 3) - max_name;
  133.     wmove(CURRENT_WINDOW_IDLINE,0,0);
  134.     wprintw(CURRENT_WINDOW_IDLINE,"...%s%s",fpath+fpath_len,CURRENT_FILE->fname);
  135.    }
  136.  else
  137.   {
  138.    wmove(CURRENT_WINDOW_IDLINE,0,0);
  139.    wprintw(CURRENT_WINDOW_IDLINE,"%s%s",fpath,CURRENT_FILE->fname);
  140.   }
  141.  if (display_screens != 1 && !horizontal)
  142.    {
  143.     wmove(CURRENT_WINDOW_IDLINE,0,max_name+1);
  144.     wprintw(CURRENT_WINDOW_IDLINE,"%-s",buffer);
  145.    }
  146.  else
  147.    {
  148. /*  wmove(CURRENT_WINDOW_IDLINE,0,34);*/
  149.     wmove(CURRENT_WINDOW_IDLINE,0,CURRENT_SCREEN.screen_cols-46);
  150.     wprintw(CURRENT_WINDOW_IDLINE,"Line=%-6.1d Col=%-5.1d",y,x);
  151. /*  wmove(CURRENT_WINDOW_IDLINE,0,54);*/
  152.     wmove(CURRENT_WINDOW_IDLINE,0,CURRENT_SCREEN.screen_cols-46+20);
  153.     wprintw(CURRENT_WINDOW_IDLINE,"Size=%-6.1d",CURRENT_FILE->number_lines);
  154. /*  wmove(CURRENT_WINDOW_IDLINE,0,66);*/
  155.     wmove(CURRENT_WINDOW_IDLINE,0,CURRENT_SCREEN.screen_cols-46+32);
  156.     wprintw(CURRENT_WINDOW_IDLINE,"Alt=          ");
  157. /*  wmove(CURRENT_WINDOW_IDLINE,0,70);*/
  158.     wmove(CURRENT_WINDOW_IDLINE,0,CURRENT_SCREEN.screen_cols-46+36);
  159.     wprintw(CURRENT_WINDOW_IDLINE,"%d,%d",CURRENT_FILE->autosave_alt,
  160.                              CURRENT_FILE->save_alt);
  161.    }
  162.  wnoutrefresh(CURRENT_WINDOW_IDLINE);
  163. #ifdef TRACE
  164.  trace_return();
  165. #endif
  166.  return;
  167. }
  168. /***********************************************************************/
  169. #ifdef PROTO
  170. void show_footing(void)
  171. #else
  172. void show_footing()
  173. #endif
  174. /***********************************************************************/
  175. {
  176. /*------------------------- external data -----------------------------*/
  177.  extern char *rec;
  178.  extern char *cmd_rec;
  179.  extern char *pre_rec;
  180.  extern bool extended_display_mode;
  181.  extern bool colour_support;
  182.  extern char pending_prefix_command[PREFIX_WIDTH+1];
  183.  extern char *the_version;
  184.  extern bool CLOCKx;
  185.  extern bool HEXDISPLAYx;
  186. /*--------------------------- local data ------------------------------*/
  187.  short y,x;
  188.  int key;
  189.  WINDOW *w;
  190.  time_t timer;
  191.  struct tm *tblock;
  192. /*--------------------------- processing ------------------------------*/
  193. #ifdef TRACE
  194.  trace_function("show.c:    show_footing");
  195. #endif
  196.  w = CURRENT_WINDOW;
  197. /*---------------------------------------------------------------------*/
  198. /* Display THE version.                                                */
  199. /*---------------------------------------------------------------------*/
  200.  mvwaddstr(foot,0,0,"THE");
  201.  mvwaddstr(foot,0,4,the_version);
  202. /*---------------------------------------------------------------------*/
  203. /* Display number of files.                                            */
  204. /*---------------------------------------------------------------------*/
  205.  wmove(foot,0,11);
  206.  wprintw(foot,"Files=%d ",number_of_files);
  207. /*---------------------------------------------------------------------*/
  208. /* Display any pending prefix command warning                          */
  209. /*---------------------------------------------------------------------*/
  210.  wmove(foot,0,20);
  211.  if (strcmp(pending_prefix_command,""))
  212.     wprintw(foot,"'%s' pending...",pending_prefix_command);
  213.  else
  214.     wprintw(foot,"                 ");
  215. /*---------------------------------------------------------------------*/
  216. /* Display CLOCK.                                                      */
  217. /*---------------------------------------------------------------------*/
  218.  if (CLOCKx)
  219.    {
  220.     timer = time(NULL);
  221.     tblock = localtime(&timer);
  222.     wmove(foot,0,53);
  223.    
  224.     wprintw(foot,"%2d:%02.2d%s",
  225.            (tblock->tm_hour > 12) ? (tblock->tm_hour-12) : (tblock->tm_hour),
  226.             tblock->tm_min,
  227.            (tblock->tm_hour >= 12) ? ("pm") : ("am"));
  228.    }
  229. /*---------------------------------------------------------------------*/
  230. /* Display HEXDISPLAY.                                                 */
  231. /*---------------------------------------------------------------------*/
  232.  if (HEXDISPLAYx)
  233.    {
  234.     getyx(CURRENT_WINDOW,y,x);
  235.     switch(CURRENT_VIEW->current_window)
  236.       {
  237.        case WINDOW_MAIN:
  238.             key = (int)(*(rec+CURRENT_VIEW->verify_col-1+x) & A_CHARTEXT);
  239.             break;
  240.        case WINDOW_COMMAND:
  241.             key = (int)(*(cmd_rec+x) & A_CHARTEXT);
  242.             break;
  243.        case WINDOW_PREFIX:
  244.             key = (int)(*(pre_rec+x) & A_CHARTEXT);
  245.             break;
  246.       }
  247.     wmove(foot,0,61);
  248.     if (key == '\0')
  249.        wprintw(foot,"' '=00/000 ");
  250.     else
  251.       {
  252.        if (extended_display_mode)
  253.           wprintw(foot,"'%1.1c'=%2.2X/%3.3d ",key,key,key);
  254.        else
  255. #ifdef USE_EXTCURSES
  256.           wprintw(foot,"'%1.1c'=%2.2X/%3.3d ",key,key,key);
  257. #else
  258.           wprintw(foot,"'%s'=%2.2X/%3.3d ",(key >127) ? " " : unctrl(key),key,key);
  259. #endif
  260.       }
  261.    }
  262. /*---------------------------------------------------------------------*/
  263. /* Display colour setting.                                             */
  264. /*---------------------------------------------------------------------*/
  265.  wmove(foot,0,73);
  266. #ifdef A_COLOR
  267.  if (colour_support)
  268.     waddch(foot,'C');
  269.  else
  270.     waddch(foot,'c');
  271. #else
  272.  waddch(foot,'M');
  273. #endif
  274. /*---------------------------------------------------------------------*/
  275. /* Display REXX support character.                                     */
  276. /*---------------------------------------------------------------------*/
  277.  wmove(foot,0,74);
  278. #if defined(NOREXX)
  279.  waddch(foot,' ');
  280. #else
  281.  waddch(foot,'R');
  282. #endif
  283. /*---------------------------------------------------------------------*/
  284. /* Display INSERTMODE toggle.                                          */
  285. /*---------------------------------------------------------------------*/
  286.  wmove(foot,0,76);
  287.  if (mode_insert)
  288.     waddstr(foot,"Ins");
  289.  else
  290.     waddstr(foot,"   ");
  291. /*---------------------------------------------------------------------*/
  292. /* Refresh the STATUS LINE.                                            */
  293. /*---------------------------------------------------------------------*/
  294.  wnoutrefresh(foot);
  295. #ifdef TRACE
  296.  trace_return();
  297. #endif
  298.  return;
  299. }
  300. /***********************************************************************/
  301. #ifdef PROTO
  302. void clear_footing(void)
  303. #else
  304. void clear_footing()
  305. #endif
  306. /***********************************************************************/
  307. {
  308. /*------------------------- external data -----------------------------*/
  309. /*--------------------------- local data ------------------------------*/
  310. /*--------------------------- processing ------------------------------*/
  311. #ifdef TRACE
  312.  trace_function("show.c:    clear_footing");
  313. #endif
  314.  wmove(foot,0,0);
  315.  my_wclrtoeol(foot);
  316. #ifdef TRACE
  317.  trace_return();
  318. #endif
  319.  return;
  320. }
  321. /***********************************************************************/
  322. #ifdef PROTO
  323. void show_page(void)
  324. #else
  325. void show_page()
  326. #endif
  327. /***********************************************************************/
  328. {
  329. /*-------------------------- external data ----------------------------*/
  330. extern char in_macro;
  331. /*--------------------------- local data ------------------------------*/
  332.  register int i,row;
  333.  LINE *curr,*save_curr;
  334.  short crow = CURRENT_VIEW->current_row;
  335.  unsigned long cline = CURRENT_VIEW->current_line;
  336.  unsigned short x,y;
  337. /*--------------------------- processing ------------------------------*/
  338. #ifdef TRACE
  339.  trace_function("show.c:    show_page");
  340. #endif
  341.  if (in_profile || in_macro)
  342.    {
  343. #ifdef TRACE
  344.     trace_return();
  345. #endif
  346.     return;
  347.    }
  348. /*---------------------------------------------------------------------*/
  349. /* First thing, turn off the cursor.                                   */
  350. /*---------------------------------------------------------------------*/
  351.  draw_cursor(OFF);
  352.  
  353. #ifdef USE_VOID
  354.  save_curr = curr = (LINE *)ll_find((void *)CURRENT_FILE->first_line,cline);
  355. #else
  356.  save_curr = curr = lll_find(CURRENT_FILE->first_line,cline);
  357. #endif
  358.  if (curr->display < CURRENT_VIEW->display_low
  359.  &&  curr->display > CURRENT_VIEW->display_high)
  360.    {
  361.     save_curr = curr = CURRENT_FILE->first_line;
  362.     CURRENT_VIEW->current_line = 0L;
  363.    }
  364.  
  365.  getyx(CURRENT_WINDOW,y,x);
  366. /*---------------------------------------------------------------------*/
  367. /* Display the file contents from the current line to the bottom of the*/
  368. /* window.                                                             */
  369. /*---------------------------------------------------------------------*/
  370.  show_line(DIRECTION_FORWARD,curr,CURRENT_SCREEN.rows-crow,crow);
  371. /*---------------------------------------------------------------------*/
  372. /* Display the file contents from the current line to the top of the   */
  373. /* window.                                                             */
  374. /*---------------------------------------------------------------------*/
  375.  curr = save_curr->prev;
  376.  show_line(DIRECTION_BACKWARD,curr,crow,crow-1);
  377. /*---------------------------------------------------------------------*/
  378. /* Highlight the current line. If the current line is inside the marked*/
  379. /* LINE block, use a different colour. If the current line is the top  */
  380. /* or bottom lines, use another colour again.                          */
  381. /*---------------------------------------------------------------------*/
  382.  if (CURRENT_VIEW->current_line == 0L
  383.  ||  CURRENT_VIEW->current_line == CURRENT_FILE->number_lines + 1L)
  384.     highlight_line(CURRENT_VIEW->current_row,colour[ATTR_CTOFEOF],colour[ATTR_CTOFEOF]);
  385.  else
  386.     highlight_line(CURRENT_VIEW->current_row,colour[ATTR_CURLINE],colour[ATTR_CURLINE]);
  387. /*---------------------------------------------------------------------*/
  388. /* Display any lines in the marked block if any.                       */
  389. /*---------------------------------------------------------------------*/
  390.  if (MARK_VIEW != (VIEW_DETAILS *)NULL
  391.  &&  MARK_VIEW == CURRENT_VIEW)
  392.     show_marked_block();
  393.  
  394.  if (CURRENT_VIEW->prefix)
  395.      wnoutrefresh(CURRENT_WINDOW_PREFIX);
  396.  wrefresh(CURRENT_WINDOW_MAIN);
  397.  
  398. /*---------------------------------------------------------------------*/
  399. /* Lastly, turn the cursor back on again.                              */
  400. /*---------------------------------------------------------------------*/
  401.  draw_cursor(ON);
  402.  
  403.  wmove(CURRENT_WINDOW,y,x);
  404. #ifdef TRACE
  405.  trace_return();
  406. #endif
  407.  return;
  408. }
  409. /***********************************************************************/
  410. #ifdef PROTO
  411. static void show_line(int direction,LINE *curr,
  412.                          short rows,short start_row)
  413. #else
  414. static void show_line(direction,curr,rows,start_row)
  415. int direction;
  416. LINE *curr;
  417. short rows,start_row;
  418. #endif
  419. /***********************************************************************/
  420. {
  421. /*-------------------------- external data ----------------------------*/
  422.  extern char *rec;
  423.  extern unsigned short rec_len;
  424.  extern bool extended_display_mode;
  425. /*--------------------------- local data ------------------------------*/
  426.  long cline = CURRENT_VIEW->current_line;
  427.  short y;
  428. /*--------------------------- processing ------------------------------*/
  429. #ifdef TRACE
  430.  trace_function("show.c:    show_line");
  431. #endif
  432. /*---------------------------------------------------------------------*/
  433. /* Determine the row that is the focus line.                           */
  434. /*---------------------------------------------------------------------*/
  435.  if (direction == DIRECTION_BACKWARD)
  436.     cline--;
  437.  y = get_row_for_focus_line(CURRENT_VIEW->current_row,
  438.                             CURRENT_VIEW->focus_line,
  439.                             CURRENT_VIEW->current_line);
  440.  
  441.  while(rows)
  442.    {
  443.     if (curr == NULL)
  444.       {
  445.        wmove(CURRENT_WINDOW_MAIN,start_row,0);
  446.        my_wclrtoeol(CURRENT_WINDOW_MAIN);
  447.        if (CURRENT_VIEW->prefix) /* display prefix if on */
  448.          {
  449.           wattrset(CURRENT_WINDOW_PREFIX,colour[ATTR_PREFIX]);
  450.           wmove(CURRENT_WINDOW_PREFIX,start_row,0);
  451.           my_wclrtoeol(CURRENT_WINDOW_PREFIX);
  452.           wattrset(CURRENT_WINDOW_PREFIX,colour[ATTR_PENDING]);
  453.          }
  454.        start_row += direction;
  455.        rows--;
  456.       }
  457.     else
  458.       {
  459.        if (curr->next == NULL      /* Bottom of file */
  460.        ||  curr->prev == NULL      /* Top of file */
  461.        || (curr->display >= CURRENT_VIEW->display_low
  462.           &&  curr->display <= CURRENT_VIEW->display_high))
  463.          {
  464. /*---------------------------------------------------------------------*/
  465. /* If the current row to be displayed is the focus line, display       */
  466. /* the working area, rec and rec_len instead of the entry in the LL.   */
  467. /*---------------------------------------------------------------------*/
  468.           if (start_row == y)
  469.              show_one_row(rec,rec_len,start_row,curr);
  470.           else
  471.              show_one_row(curr->line,curr->length,start_row,curr);
  472. /*---------------------------------------------------------------------*/
  473. /* If the prefix area is ON display it.                                */
  474. /*---------------------------------------------------------------------*/
  475.           if (CURRENT_VIEW->prefix)
  476.             {
  477.              wmove(CURRENT_WINDOW_PREFIX,start_row,0);
  478.              my_wclrtoeol(CURRENT_WINDOW_PREFIX);
  479.              if (curr->pre != (-1))          /* prefix command pending */
  480.                {
  481.                 if (extended_display_mode)
  482.                    waddstr(CURRENT_WINDOW_PREFIX,CURRENT_VIEW->ppc[curr->pre].ppc_command);
  483.                 else
  484.                    put_string(CURRENT_WINDOW_PREFIX,start_row,0,
  485.                               CURRENT_VIEW->ppc[curr->pre].ppc_command,
  486.                               strlen(CURRENT_VIEW->ppc[curr->pre].ppc_command));
  487.                }
  488.              else                    /* no prefix command on this line */
  489.                {
  490.                 wattrset(CURRENT_WINDOW_PREFIX,colour[ATTR_PREFIX]);
  491.                 if (CURRENT_VIEW->number)
  492.                    wprintw(CURRENT_WINDOW_PREFIX,"%6.6d",cline);
  493.                 else
  494.                    waddstr(CURRENT_WINDOW_PREFIX,"======");
  495.                }
  496.              wattrset(CURRENT_WINDOW_PREFIX,colour[ATTR_PENDING]);
  497.             }
  498.           start_row += direction;
  499.           rows--;
  500.          }
  501.         cline += (long)direction;
  502.         if (direction == DIRECTION_FORWARD)
  503.            curr = curr->next;
  504.         else
  505.            curr = curr->prev;
  506.        }
  507.    }
  508. #ifdef TRACE
  509.  trace_return();
  510. #endif
  511.  return;
  512. }
  513. /***********************************************************************/
  514. #ifdef PROTO
  515. void show_one_row(char *line,unsigned short length,
  516.                   unsigned short row,LINE *curr)
  517. #else
  518. void show_one_row(line,length,row,curr)
  519. char *line;
  520. unsigned short length,row;
  521. LINE *curr;
  522. #endif
  523. /***********************************************************************/
  524. {
  525. /*------------------------- external data -----------------------------*/
  526.  extern bool extended_display_mode;
  527. /*--------------------------- local data ------------------------------*/
  528.  short col1,col2;
  529.  register int i;
  530. /*--------------------------- processing ------------------------------*/
  531. #ifdef TRACE
  532.  trace_function("show.c:    show_one_row");
  533. #endif
  534.  col1 = CURRENT_VIEW->verify_col - 1;
  535.  col2 = min(length-1,CURRENT_VIEW->verify_end-1);
  536. /*---------------------------------------------------------------------*/
  537. /* If we are displaying the top or bottom line marker, then force the  */
  538. /* function to display the beginning of the line and to display the    */
  539. /* whole line when VERIFY is in effect.                                */
  540. /*---------------------------------------------------------------------*/
  541.  if (curr->prev == NULL || curr->next == NULL)
  542.    {
  543.     col1 = 0;
  544.     col2 = curr->length-1;
  545.     wattrset(CURRENT_WINDOW_MAIN,colour[ATTR_TOFEOF]);
  546.    }
  547. /*---------------------------------------------------------------------*/
  548. /* If the first column to be displayed is after the length of the line */
  549. /* then just clear to end of line and exit.                            */
  550. /*---------------------------------------------------------------------*/
  551.  if (col1 >= length)
  552.    {
  553.      wmove(CURRENT_WINDOW_MAIN,row,0);
  554.      my_wclrtoeol(CURRENT_WINDOW_MAIN);
  555.      wattrset(CURRENT_WINDOW_MAIN,colour[ATTR_FILEAREA]);
  556. #ifdef TRACE
  557.      trace_return();
  558. #endif
  559.      return;
  560.    }
  561.  for (i=0;i<CURRENT_SCREEN.cols;i++)
  562.      {
  563.       if (i+col1 > col2)
  564.         {
  565.          wmove(CURRENT_WINDOW_MAIN,row,i);
  566.          my_wclrtoeol(CURRENT_WINDOW_MAIN);
  567.          break;
  568.         }
  569.       else
  570.         {
  571.          wmove(CURRENT_WINDOW_MAIN,row,i);
  572.          if (extended_display_mode)
  573.             waddch(CURRENT_WINDOW_MAIN,*(line+i+col1));
  574.          else
  575.             put_char(CURRENT_WINDOW_MAIN,*(line+i+col1),ADDCHAR);
  576.         }
  577.      }
  578.  wattrset(CURRENT_WINDOW_MAIN,colour[ATTR_FILEAREA]);
  579. #ifdef TRACE
  580.  trace_return();
  581. #endif
  582.  return;
  583. }
  584. /***********************************************************************/
  585. #ifdef PROTO
  586. void highlight_line(char line,chtype normal,chtype block)
  587. #else
  588. void highlight_line(line,normal,block)
  589. char line;
  590. chtype normal;
  591. chtype block;
  592. #endif
  593. /***********************************************************************/
  594. {
  595. /*------------------------- external data -----------------------------*/
  596.  extern bool extended_display_mode;
  597. /*--------------------------- local data ------------------------------*/
  598.  register int i;
  599.  WINDOW *w;
  600.  chtype ch;
  601.  short real_col;
  602. /*--------------------------- processing ------------------------------*/
  603. #ifdef TRACE
  604.  trace_function("show.c:    highlight_line");
  605. #endif
  606.  for (i=0;i<CURRENT_SCREEN.cols;i++)
  607.     {
  608.      w = CURRENT_WINDOW_MAIN;
  609.      real_col = i + CURRENT_VIEW->verify_col;
  610.      wmove(CURRENT_WINDOW_MAIN,line,i);
  611.      ch = winch(w) & A_CHARTEXT;
  612.      if ((real_col >= CURRENT_VIEW->mark_start_col && real_col <= CURRENT_VIEW->mark_end_col)
  613.      ||  (CURRENT_VIEW->mark_start_col == (-1) && CURRENT_VIEW->mark_end_col == (-1)))
  614.        {
  615.         if (extended_display_mode)
  616.            waddch(CURRENT_WINDOW_MAIN,ch | block);
  617.         else
  618.            put_char(CURRENT_WINDOW_MAIN,ch | block,ADDCHAR);
  619.        }
  620.      else
  621.        {
  622.         if (extended_display_mode)
  623.            waddch(CURRENT_WINDOW_MAIN,ch | normal);
  624.         else
  625.            put_char(CURRENT_WINDOW_MAIN,ch | normal,ADDCHAR);
  626.        }
  627.     }
  628. #ifdef TRACE
  629.  trace_return();
  630. #endif
  631.  return;
  632. }
  633. /***********************************************************************/
  634. #ifdef PROTO
  635. void show_marked_block(void)
  636. #else
  637. void show_marked_block()
  638. #endif
  639. /***********************************************************************/
  640. {
  641. /*--------------------------- local data ------------------------------*/
  642.  register int i;
  643.  short num_rows,top_row;
  644.  long top_line,bottom_line,temp;
  645. /*--------------------------- processing ------------------------------*/
  646. #ifdef TRACE
  647.  trace_function("show.c:    show_marked_block");
  648. #endif
  649.  top_line = max(CURRENT_VIEW->mark_start_line,
  650.                 CURRENT_VIEW->current_line-(long)CURRENT_VIEW->current_row);
  651.  temp = CURRENT_VIEW->current_line-(long)CURRENT_VIEW->current_row+(long)CURRENT_SCREEN.rows;
  652.  if (top_line >= CURRENT_VIEW->current_line-(long)CURRENT_VIEW->current_row+(long)CURRENT_SCREEN.rows)
  653.    {
  654. #ifdef TRACE
  655.     trace_return();
  656. #endif
  657.     return;
  658.    }
  659.  
  660.  bottom_line = min(CURRENT_VIEW->mark_end_line,
  661.                    CURRENT_VIEW->current_line-(long)CURRENT_VIEW->current_row+(long)CURRENT_SCREEN.rows);
  662.  top_row = get_row_for_focus_line(CURRENT_VIEW->current_row,
  663.                                   top_line,
  664.                                   CURRENT_VIEW->current_line);
  665.  num_rows = (short)(bottom_line - top_line + 1);
  666.  for (i=0;i<num_rows;i++)
  667.     {
  668.      if (CURRENT_VIEW->current_row == i+top_row)
  669.         highlight_line((char)(i+top_row),colour[ATTR_CURLINE],colour[ATTR_CBLOCK]);
  670.      else
  671.         highlight_line((char)(i+top_row),colour[ATTR_FILEAREA],colour[ATTR_BLOCK]);
  672.     }
  673. #ifdef TRACE
  674.  trace_return();
  675. #endif
  676.  return;
  677. }
  678. /***********************************************************************/
  679. #ifdef PROTO
  680. void redraw_window(WINDOW *win)
  681. #else
  682. void redraw_window(win)
  683. WINDOW *win;
  684. #endif
  685. /***********************************************************************/
  686. {
  687. /*------------------------- external data -----------------------------*/
  688.  extern bool extended_display_mode;
  689. /*--------------------------- local data ------------------------------*/
  690.  register int i,j;
  691.  int key;
  692.  short y,x;
  693. /*--------------------------- processing ------------------------------*/
  694. #ifdef TRACE
  695.  trace_function("show.c:    redraw_window");
  696. #endif
  697.  getyx(win,y,x);
  698.  for (i=0;i<getmaxx(win);i++)
  699.      for (j=0;j<getmaxy(win);j++)
  700.         {
  701.          wmove(win,j,i);
  702.          key = (int)(winch(win) & A_CHARTEXT);
  703.          if (extended_display_mode)
  704.             waddch(win,key);
  705.          else
  706.             put_char(win,key,ADDCHAR);
  707.         }
  708.  wmove(win,y,x);
  709. #ifdef TRACE
  710.  trace_return();
  711. #endif
  712.  return;
  713. }
  714. /***********************************************************************/
  715. #ifdef PROTO
  716. void repaint_screen(void)
  717. #else
  718. void repaint_screen()
  719. #endif
  720. /***********************************************************************/
  721. {
  722. /*--------------------------- local data ------------------------------*/
  723.  short y,x;
  724. /*--------------------------- processing ------------------------------*/
  725. #ifdef TRACE
  726.  trace_function("show.c:    repaint_screen");
  727. #endif
  728.  
  729.  getyx(CURRENT_WINDOW,y,x);
  730.  y = get_row_for_focus_line(CURRENT_VIEW->current_row,
  731.                             CURRENT_VIEW->focus_line,
  732.                             CURRENT_VIEW->current_line);
  733.  if (x > CURRENT_SCREEN.cols)
  734.     x = 0;
  735.  pre_process_line(CURRENT_VIEW->focus_line);
  736.  show_page();
  737.  cleanup_command_line();
  738.  show_heading();
  739.  wmove(CURRENT_WINDOW,y,x);
  740.  
  741. #ifdef TRACE
  742.  trace_return();
  743. #endif
  744.  return;
  745. }
  746.