home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Multimed / Multimed.zip / mp3osr05.zip / src / editchd.pas < prev    next >
Pascal/Delphi Source File  |  1999-12-07  |  1KB  |  68 lines

  1. (*
  2.  * part of MPEG searcher project
  3.  *  (c) 1999 by Alexander Trunov, 2:5069/10, jnc@mail.ru
  4.  *)
  5.  
  6. unit EditChD;
  7.  
  8. { the source code below comed from FreeVision package }
  9.  
  10. interface
  11.  
  12. uses
  13.   StdDlg, DOS;
  14.  
  15. {$IFNDEF virtualpascal}
  16.   {$IFNDEF fpc}
  17.     {$DEFINE bp}
  18.   {$ENDIF}
  19. {$ENDIF}
  20.  
  21. type
  22.   PEditChDirDialog = ^TEditChDirDialog;
  23.   TEditChDirDialog = object(TChDirDialog)
  24.     function DataSize: {$IFNDEF bp}Longint{$ELSE}Word{$ENDIF}; virtual;
  25.     procedure GetData(var Rec); virtual;
  26.     procedure SetData(var Rec); virtual;
  27.   end;
  28.  
  29. implementation
  30.  
  31. function TEditChDirDialog.DataSize: {$IFNDEF bp}Longint{$ELSE}Word{$ENDIF};
  32. begin
  33.   DataSize := SizeOf(DirStr);
  34. end;
  35.  
  36. procedure TEditChDirDialog.GetData(var Rec);
  37. var
  38.   CurDir: DirStr absolute Rec;
  39. begin
  40.   if (DirInput = nil) then
  41.     CurDir := ''
  42.   else
  43.   begin
  44.     CurDir := DirInput^.Data^;
  45.     if (CurDir[Length(CurDir)] <> '\') then
  46.       CurDir := CurDir + '\';
  47.   end;
  48. end;
  49.  
  50. procedure TEditChDirDialog.SetData(var Rec);
  51. var
  52.   CurDir: DirStr absolute Rec;
  53. begin
  54.   if DirList <> nil then
  55.   begin
  56.     DirList^.NewDirectory(CurDir);
  57.     if DirInput <> nil then
  58.     begin
  59.       if (Length(CurDir) > 3) and (CurDir[Length(CurDir)] = '\') then
  60.         DirInput^.Data^ := Copy(CurDir, 1, Length(CurDir) - 1)
  61.       else
  62.         DirInput^.Data^ := CurDir;
  63.       DirInput^.DrawView;
  64.     end;
  65.   end;
  66. end;
  67.  
  68. end.