home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / ME22-OS2.ZIP / MACROS.ZIP / BOX.M < prev    next >
Text File  |  1988-03-22  |  923b  |  42 lines

  1. #define CTRL_B          2
  2. #define BOXCHAR         "*"
  3.  
  4.  
  5. init()
  6. {
  7.   assign_key("box",    CTRL_B);   /* <CTRL> B */
  8. }
  9.  
  10. /* box() - this macro draws a comment box around a marked region */
  11. box()
  12. {
  13.   int col1, col2;      /* starting and ending columns of the marked region */
  14.   int line1, line2;    /* starting and ending lines of the marked region   */
  15.   int width;           /* number of characters across (really col2-col1+1) */
  16.  
  17.   col1 = marked_col();    col2 = currcol();
  18.   line1 = marked_line();  line2 = currlinenum();
  19.   width = col2 - col1 + 1;
  20.   goline(line1);
  21.  
  22.   insline();
  23.   setcol(col1);
  24.   insert(strcat("/", repstr(BOXCHAR, width)));
  25.   down();
  26.  
  27.   while (currlinenum() <= line2 + 1)
  28.   {
  29.     setcol(col1);
  30.     insert("*");
  31.     setcol(col2+1);
  32.     insert(BOXCHAR);
  33.     down();
  34.   }
  35.  
  36.   insline();
  37.   setcol(col1);
  38.   insert(strcat(repstr(BOXCHAR, width), "/"));
  39.   clear_mark();
  40. }
  41.  
  42.