home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a065 / 1.img / TBLIB.EXE / TBUTILS.CH < prev    next >
Encoding:
Text File  |  1992-01-05  |  6.7 KB  |  148 lines

  1. // Tbutils.ch
  2. //
  3. // Utility commands, translates, and constants for tbrowse and tbcolumn
  4. // classes
  5. //
  6. // Defines:
  7. //    DEF_HSEP   Default heading separator characters
  8. //    DEF_CSEP   Default column separator characters
  9. //    DEF_FSEP   Default column footing characters
  10. //
  11. // Macros:
  12. //    INCLAST   Increment last character of a string
  13. //
  14. // Translates:
  15. //    myTBColumnNew  Allows keywords in myTBColumnNew() call
  16. //    myTBRowseNew   Allows keywords in myTBRowseNew() call
  17. //
  18. // Commands:
  19. //    CREATE TBROWSE  OBJECT  Allows keywords to create tbrowse object
  20. //    CREATE TBCOLUMN OBJECT  Allows keywords to create tbcolumn object
  21.  
  22.     // Default column separator
  23.     #define DEF_CSEP  " " + chr(179) + " "
  24.  
  25.     // Default heading separator
  26.     #define DEF_HSEP chr(205) + chr(209) + chr(205)
  27.  
  28.     // Default footing separator
  29.     #define DEF_FSEP chr(205) + chr(207) + chr(205)
  30.  
  31.  
  32.     // Increment last character of a string. Useful for scoped tbrowses
  33.     #define INCLAST(c) substr(c, 1, len(c) - 1) + ;
  34.                        chr( asc( substr( c, len(c) ) ) + 1)
  35.  
  36.  
  37.     #xtranslate APPEND_MODE(<oTbr>) ;
  38.                 =>                  ;
  39.                 DictAt(<oTbr>:cargo, "Append Mode")
  40.  
  41.     #xtranslate APPEND_MODE(<oTbr>, <lAppend>) ;
  42.                 =>                 ;
  43.                 DictPut(<oTbr>:cargo, "Append Mode", <lAppend>)
  44.  
  45.  
  46.     #command CREATE TBCOLUMN OBJECT <oTbc> ;
  47.              [BLOCK      <block>      ] ;
  48.              [CARGO      <cargo>      ] ;
  49.              [COLORBLOCK <colorBlock> ] ;
  50.              [COLSEP     <colSep>     ] ;
  51.              [DEFCOLOR   <defColor>   ] ;
  52.              [FOOTING    <footing>    ] ;
  53.              [FOOTSEP    <footSep>    ] ;
  54.              [HEADING    <heading>    ] ;
  55.              [HEADSEP    <headSep>    ] ;
  56.              [WIDTH      <width>      ] ;
  57.     => ;
  58.     <oTbc> := myTBColumnNew(<block>,   <cargo>,   <colorBlock>, ;
  59.                             <colSep>,  <defColor>,<footing>,    ;
  60.                             <footSep>, <heading>, <headSep>,    ;
  61.                             <width>)
  62.  
  63.     #xtranslate myTBColumnNew(                             ;
  64.                               [ BLOCK      <block>      [,] ] ;
  65.                               [ CARGO      <cargo>      [,] ] ;
  66.                               [ COLORBLOCK <colorBlock> [,] ] ;
  67.                               [ COLSEP     <colSep>     [,] ] ;
  68.                               [ DEFCOLOR   <defColor>   [,] ] ;
  69.                               [ FOOTING    <footing>    [,] ] ;
  70.                               [ FOOTSEP    <footSep>    [,] ] ;
  71.                               [ HEADING    <heading>    [,] ] ;
  72.                               [ HEADSEP    <headSep>    [,] ] ;
  73.                               [ WIDTH      <width>      [,] ] ;
  74.                              )                                 ;
  75.     => ;
  76.     myTBColumnNew(<block>,   <cargo>,    <colorBlock>, ;
  77.                   <colSep>,  <defColor>, <footing>,    ;
  78.                   <footSep>, <heading>,  <headSep>,    ;
  79.                   <width>)
  80.  
  81.  
  82.     #command CREATE TBROWSE OBJECT <oTbr> ;
  83.              [AUTOLITE             <autoLite>      ] ;
  84.              [CARGO                <cargo>         ] ;
  85.              [COLORSPEC            <colorSpec>     ] ;
  86.              [COLPOS               <colPos>        ] ;
  87.              [COLSEP               <colSep>        ] ;
  88.              [FOOTSEP              <footSep>       ] ;
  89.              [FREEZE               <freeze>        ] ;
  90.              [GOBOTTOMBLOCK        <goBottomBlock> ] ;
  91.              [GOTOPBLOCK           <goTopBlock>    ] ;
  92.              [HEADSEP              <headSep>       ] ;
  93.              [HITBOTTOM            <hitBottom>     ] ;
  94.              [HITTOP               <hitTop>        ] ;
  95.              [NBOTTOM              <nBottom>       ] ;
  96.              [NLEFT                <nLeft>         ] ;
  97.              [NRIGHT               <nRight>        ] ;
  98.              [NTOP                 <nTop>          ] ;
  99.              [ROWPOS               <rowPos>        ] ;
  100.              [SKIPBLOCK            <skipBlock>     ] ;   
  101.              [STABLE               <stable>        ] ;
  102.     => ;
  103.     <oTbr> := MyTBrowseNew(<autoLite>, <cargo>,         <colorSpec>,  ;
  104.                            <colPos>,   <colSep>,        <footSep>,    ;
  105.                            <freeze>,   <goBottomBlock>, <goTopBlock>, ;
  106.                            <headSep>,  <hitBottom>,     <hitTop>,     ;
  107.                            <nBottom>,  <nLeft>,         <nRight>,     ;
  108.                            <nTop>,     <rowPos>,        <skipBlock>,  ;
  109.                            <stable> )
  110.  
  111.  
  112.     #xtranslate myTbrowseNew( ;
  113.                              [AUTOLITE      <autoLite>        [,] ] ;
  114.                              [CARGO         <cargo>           [,] ] ;
  115.                              [COLORSPEC     <colorSpec>       [,] ] ;
  116.                              [COLPOS        <colPos>          [,] ] ;
  117.                              [COLSEP        <colSep>          [,] ] ;
  118.                              [FOOTSEP       <footSep>         [,] ] ;
  119.                              [FREEZE        <freeze>          [,] ] ;
  120.                              [GOBOTTOMBLOCK <goBottomBlock>   [,] ] ;
  121.                              [GOTOPBLOCK    <goTopBlock>      [,] ] ;
  122.                              [HEADSEP       <headSep>         [,] ] ;
  123.                              [HITBOTTOM     <hitBottom>       [,] ] ;
  124.                              [HITTOP        <hitTop>          [,] ] ;
  125.                              [NBOTTOM       <nBottom>         [,] ] ;
  126.                              [NLEFT         <nLeft>           [,] ] ;
  127.                              [NRIGHT        <nRight>          [,] ] ;
  128.                              [NTOP          <nTop>            [,] ] ;
  129.                              [ROWPOS        <rowPos>          [,] ] ;
  130.                              [SKIPBLOCK     <skipBlock>       [,] ] ;
  131.                              [STABLE        <stable>          [,] ] ;
  132.                             ) ;
  133.     => ;
  134.     MyTBrowseNew(<autoLite>, <cargo>,         <colorSpec>,  ;
  135.                  <colPos>,   <colSep>,        <footSep>,    ;
  136.                  <freeze>,   <goBottomBlock>, <goTopBlock>, ;
  137.                  <headSep>,  <hitBottom>,     <hitTop>,     ;
  138.                  <nBottom>,  <nLeft>,         <nRight>,     ;
  139.                  <nTop>,     <rowPos>,        <skipBlock>,  ;
  140.                  <stable> )
  141.  
  142.     #define ARRAY_SKIPPER(i, a) {|n, nSavei|  ;
  143.                                  nSavei := i, ;
  144.                                  i := iif (n > 0, ;
  145.                                            Min(Len(a), i + n), ;
  146.                                            Max(1, i + n)),     ;
  147.                                  i - nSavei}
  148.