home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / pcmag / v14n14 / wcomp.exe / WCOMPSRC.ZIP / MAIN.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-09  |  3KB  |  139 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, Menus, Child, About, StdCtrls, ExtCtrls, IniFiles;
  8.  
  9. type
  10.   TFrameForm = class(TForm)
  11.     MainMenu1: TMainMenu;
  12.     New1: TMenuItem;
  13.     Open1: TMenuItem;
  14.     N1: TMenuItem;
  15.     Exit1: TMenuItem;
  16.     New2: TMenuItem;
  17.     OpenFileDialog: TOpenDialog;
  18.     Help1: TMenuItem;
  19.     Contents1: TMenuItem;
  20.     N2: TMenuItem;
  21.     About1: TMenuItem;
  22.     procedure NewChild(Sender: TObject);
  23.     procedure Tile1Click(Sender: TObject);
  24.     procedure Cascade1Click(Sender: TObject);
  25.     procedure OpenChild(Sender: TObject);
  26.     procedure MainSetup(Sender: TObject);
  27.     procedure Exit1Click(Sender: TObject);
  28.     procedure About1Click(Sender: TObject);
  29.     procedure Contents1Click(Sender: TObject);
  30.     procedure SetWindows;
  31.   private
  32.     { Private declarations }
  33.   public
  34.     { Public declarations }
  35.     SyncReach: word;
  36.     MatchReach: word;
  37.     WinOption: word;
  38.   end;
  39.  
  40. var
  41.   FrameForm: TFrameForm;
  42.  
  43. implementation
  44.  
  45. {$R *.DFM}
  46.  
  47. procedure TFrameForm.NewChild(Sender: TObject);
  48. var
  49.   EditForm: TEditForm;
  50. begin
  51.   EditForm:= TEditForm.Create(Self);
  52.   EditForm.Memo1.Text:= '';
  53.   EditForm.Caption:= 'Untitled';
  54.   SetWindows;
  55. end;
  56.  
  57. procedure TFrameForm.Tile1Click(Sender: TObject);
  58. begin
  59.   Tile;
  60. end;
  61.  
  62. procedure TFrameForm.Cascade1Click(Sender: TObject);
  63. begin
  64.   Cascade;
  65. end;
  66.  
  67. procedure TFrameForm.OpenChild(Sender: TObject);
  68. var
  69.   F: file;
  70.   FileS: longint;
  71.   EditForm: TEditForm;
  72. begin
  73.   if OpenFileDialog.Execute then
  74.   begin
  75.     AssignFile(F, OpenFileDialog.Filename);
  76.     FileS:= -1;
  77.     {$I-} Reset(F, 1); FileS:= FileSize(F); CloseFile(F); {$I+}
  78.      if  FileS > ((32 * 1024) - 1) then
  79.     begin
  80.       messagedlg('Maximum file size is 32K.', mtinformation, [mbok], 0);
  81.       exit;
  82.     end;
  83.  
  84.     if FileS = 0 then
  85.     begin
  86.       messagedlg('Can'#39't open ' + OpenFileDialog.Filename, mtinformation, [mbok], 0);
  87.       exit;
  88.     end;
  89.  
  90.     EditForm:= TEditForm.Create(Self);
  91.     EditForm.Open(OpenFileDialog.Filename);
  92.     OpenFileDialog.HistoryList.Add(OpenFileDialog.Filename);
  93.     SetWindows;
  94.   end;
  95. end;
  96.  
  97. procedure TFrameForm.MainSetup(Sender: TObject);
  98. var
  99.   WinIni: TIniFile;
  100.   TempString: string;
  101.   code: integer;
  102. begin
  103.      FrameForm.Width:= GetSystemMetrics (SM_CXSCREEN);
  104.   FrameForm.Height:= GetSystemMetrics (SM_CYSCREEN);
  105.  
  106.   WinIni:= TIniFile.Create('WCOMPARE.INI');
  107.   With TIniFile.Create('WCOMPARE.INI') Do
  108.     try
  109.       SyncReach:= ReadInteger('WCOMPARE', 'SyncReach', 400);
  110.       MatchReach:= ReadInteger('WCOMPARE', 'MatchReach', 10);
  111.       WinOption:= ReadInteger('WCOMPARE', 'WindowOption', 0);
  112.     finally
  113.       Free;
  114.     end;
  115. end;
  116.  
  117. procedure TFrameForm.Exit1Click(Sender: TObject);
  118. begin
  119.   Close;
  120. end;
  121.  
  122. procedure TFrameForm.About1Click(Sender: TObject);
  123. begin
  124.   AboutBox.ShowModal;
  125. end;
  126.  
  127. procedure TFrameForm.Contents1Click(Sender: TObject);
  128. begin
  129.   Application.HelpCommand(HELP_CONTENTS,0);
  130. end;
  131.  
  132. procedure TFrameForm.SetWindows;
  133. begin
  134.   if WinOption = 0 then Tile;
  135.   if WinOption = 1 then Cascade;
  136. end;
  137.  
  138. end.
  139.