home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / BABEL2.ZIP / BABEL.INC < prev    next >
Encoding:
Text File  |  1993-01-01  |  7.9 KB  |  176 lines

  1. {$I OpenWild.inc }           { Command line open }
  2.    {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  3.  
  4.    UTILITY
  5.  
  6.    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  7. CONST
  8.    PLanguage                 : PString = NIL ;
  9.    {===================================================================
  10.    ===================================================================}
  11. procedure CalcHelp ( NameOnly : string ) ;
  12. begin
  13.    Names.HLP                 := Names.EXE ;
  14.    while Names.HLP [ length ( Names.HLP ) ] <> '\' do
  15.       dec ( Names.HLP [ 0 ] ) ;
  16.    Names.HLP                 := Names.HLP + NameOnly + '.HLP' ;
  17. end ;
  18.    {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  19.  
  20.    CONFIG - Current Language
  21.  
  22.    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  23.    {===================================================================
  24.  
  25.    SAVE
  26.  
  27.    ===================================================================}
  28. procedure SaveConfig ;
  29. var
  30.    Strm                      : PStream ;
  31.    Description               : string ;
  32. begin
  33.    if Names.DAT = '' then EXIT ;
  34.    Strm                      := New ( PDosStream ,
  35.                                       Init ( Names.DAT ,
  36.                                              stCreate ) ) ;
  37.    Description               := 'BABEL.EXE  Multi-Language Editor - Configuration File' + #26 ;
  38.    Strm^.Write ( Description[1] , length ( Description ) ) ;
  39.    Strm^.WriteStr ( PLanguage ) ;
  40.    if Strm^.Status <> stOk then
  41.    begin
  42.       FileErase ( Names.DAT ) ;
  43.       MessageBox ( ^C'Could not create'#13
  44.                     + Names.DAT ,
  45.                       NIL ,
  46.                       mfError + mfOkButton ) ;
  47.    end ;
  48.    Dispose ( Strm , Done ) ;
  49. end ;
  50.    {===================================================================
  51.  
  52.    LOAD
  53.  
  54.    ===================================================================}
  55. procedure LoadConfig ;
  56. var
  57.    Strm                      : PStream ;
  58.    Ch                        : char ;
  59. begin
  60.    if not FileExist ( Names.DAT ) then EXIT ;
  61.    Strm                      := New ( PDosStream ,
  62.                                       Init ( Names.DAT ,
  63.                                              stOpenRead ) ) ;
  64.    Ch                        := #0 ;
  65.    while ( Ch <> ^Z ) and ( Strm^.Status = stOK ) do
  66.       Strm^.Read ( Ch , 1 ) ;
  67.    PLanguage                 := Strm^.ReadStr  ;
  68.    if Strm^.Status <> stOk then
  69.       MessageBox ( ^C'Error reading desktop file'#13
  70.                    + Names.DAT ,
  71.                    NIL ,
  72.                    mfError + mfOkButton ) ;
  73.    Dispose ( Strm , Done ) ;
  74. end ;
  75.    {===================================================================
  76.  
  77.    EXECUTE
  78.  
  79.    ===================================================================}
  80. function EditorDialog ( Dialog : Integer ;
  81.                         Info : Pointer ) : word ;
  82. var
  83.    R                         : TRect ;
  84.    T                         : TPoint ;
  85. begin
  86.    case Dialog of
  87.    edOutOfMemory :
  88.       EditorDialog           := MessageBox ( ^C'Not enough memory for this operation.' ,
  89.                                              NIL ,
  90.                                              mfError + mfOkButton ) ;
  91.    edReadError :
  92.       EditorDialog           := MessageBox ( ^C'Error reading file %s.' ,
  93.                                              @Info ,
  94.                                              mfError + mfOkButton ) ;
  95.    edWriteError :
  96.       EditorDialog           := MessageBox ( ^C'Error writing file %s.' ,
  97.                                              @Info ,
  98.                                              mfError + mfOkButton ) ;
  99.    edCreateError :
  100.       EditorDialog           := MessageBox ( ^C'Error creating file %s.' ,
  101.                                              @Info ,
  102.                                              mfError + mfOkButton ) ;
  103.    edSaveModify :
  104.       EditorDialog           := MessageBox ( ^C'%s has been modified. Save?' ,
  105.                                              @Info ,
  106.                                              mfInformation + mfYesNoCancel ) ;
  107.    edSaveUntitled :
  108.       EditorDialog           := MessageBox ( ^C'Save untitled file?' ,
  109.                                              NIL ,
  110.                                              mfInformation + mfYesNoCancel ) ;
  111.    edSaveAs :
  112.       EditorDialog           := ExecDialog ( New ( PFileDialog , Init ( '*.*' ,
  113.                                              'Save file as' ,
  114.                                              '~N~ame' ,
  115.                                              fdOkButton ,
  116.                                              101 ) ) , Info ) ;
  117.    edFind :
  118.       EditorDialog           := ExecDialog ( CreateFindDialog , Info ) ;
  119.    edSearchFailed:
  120.       EditorDialog           := MessageBox ( ^C'Search string not found.' ,
  121.                                              NIL ,
  122.                                              mfError + mfOkButton ) ;
  123.    edReplace :
  124.       EditorDialog           := ExecDialog ( CreateReplaceDialog , Info ) ;
  125.    edReplacePrompt :
  126.       begin
  127.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  128.    Avoid placing the dialog on the same line as the cursor
  129.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  130.          R.Assign ( 0 , 1 , 40 , 8 ) ;
  131.          R.Move ( ( Desktop^.Size.X - R.B.X ) div 2 , 0 ) ;
  132.          Desktop^.MakeGlobal ( R.B , T ) ;
  133.          Inc ( T.Y ) ;
  134.          if TPoint(Info).Y <= T.Y then
  135.             R.Move ( 0 , Desktop^.Size.Y - R.B.Y - 2 ) ;
  136.          EditorDialog        := MessageBoxRect ( R ,
  137.                                                  ^C'Replace this occurence?' ,
  138.                                                  NIL ,
  139.                                                  mfYesNoCancel
  140.                                                  + mfInformation ) ;
  141.       end ;
  142.    else
  143.       MessageBox ( ^C'Unknown DIALOG requested!' ,
  144.                    NIL ,
  145.                    mfError + mfOkButton ) ;
  146.    end ;
  147. end ;
  148.    {===================================================================
  149.  
  150.    COPYRIGHT
  151.  
  152.    ===================================================================}
  153. procedure CopyrightMsg ;
  154. begin
  155.    writeln ( '▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▌' ) ;
  156.    writeln ( '▐ ░▒▓█ BABEL Multi-Lingual Editor █▓▒░                      Version ' + VersionCode + ' ▌' ) ;
  157.    writeln ( '▐──────────────────────────────────────────────────────────────────────────▌' ) ;
  158.    writeln ( '▐ Copyright (c) 1992 Johnathan J. Stein      All Rights Reserved Worldwide ▌' ) ;
  159.    writeln ( '▐                                                                          ▌' ) ;
  160.    writeln ( '▐ STEIN RESEARCH & ENGINEERING                          Voice 419.666.7103 ▌' ) ;
  161.    writeln ( '▐ Post Office Box 346                                     Fax 419.874.4922 ▌' ) ;
  162.    writeln ( '▐ Perrysburg, OH 43552                                CompuServe 76576.470 ▌' ) ;
  163.    writeln ( '▐ USA                                    INTERNET 76576.470@compuserve.com ▌' ) ;
  164.    writeln ( '▐▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▌' ) ;
  165.    writeln ;
  166.    writeln ;
  167.    writeln ( 'Translation Services by' ) ;
  168.    writeln ( '┌──────────────────────────────────────────────────────────────────────────┐' ) ;
  169.    writeln ( '│ Thomas Davidson                                                          │' ) ;
  170.    writeln ( '│ PASO del NORTE LENGUAJE                               Voice 915.564.0990 │' ) ;
  171.    writeln ( '│ 2713 Hamilton Ave                                       Fax 915.564.5293 │' ) ;
  172.    writeln ( '│ El Paso, TX 79930-3639                             CompuServe 75540.1022 │' ) ;
  173.    writeln ( '│ USA                                   INTERNET 75540.1022@compuserve.com │' ) ;
  174.    writeln ( '└──────────────────────────────────────────────────────────────────────────┘' ) ;
  175. end ;
  176.