home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / navody / DICOMSRC.ZIP / Raw.pas < prev    next >
Pascal/Delphi Source File  |  2001-04-07  |  2KB  |  91 lines

  1. unit Raw;
  2.         
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Buttons, StdCtrls, Spin;
  8.  
  9. type
  10.   TRawForm = class(TForm)
  11.     Label1: TLabel;
  12.     WidEdit: TSpinEdit;
  13.     Label2: TLabel;
  14.     HtEdit: TSpinEdit;
  15.     Label3: TLabel;
  16.     SliceEdit: TSpinEdit;
  17.     Label4: TLabel;
  18.     OffsetEdit: TSpinEdit;
  19.     Label5: TLabel;
  20.     BitsEdit: TSpinEdit;
  21.     LittleEndCheck: TCheckBox;
  22.     SzLabel: TLabel;
  23.     CancelBtn: TSpeedButton;
  24.     OKBtn: TSpeedButton;
  25.     SpeedButton1: TSpeedButton;
  26.     SpeedButton2: TSpeedButton;
  27.     SpeedButton3: TSpeedButton;
  28.     Label6: TLabel;
  29.     procedure WidEditChange(Sender: TObject);
  30.     procedure OKBtnClick(Sender: TObject);
  31.     procedure CancelBtnClick(Sender: TObject);
  32.     procedure FormShow(Sender: TObject);
  33.   private
  34.     { Private declarations }
  35.   public
  36.     { Public declarations }
  37.   end;
  38.  
  39. var
  40.   RawForm: TRawForm;
  41.   gRawOK: integer = 0;
  42.   gRawWid : integer = 256;
  43. gRawHt : integer = 256;
  44. gRawSlice : integer = 1;
  45. gRawOffset : integer = 0;
  46. gRawBits : integer = 8;
  47. gRawLittleEnd: boolean = false;
  48.  
  49. implementation
  50.  
  51. {$R *.DFM}
  52.  
  53. procedure TRawForm.WidEditChange(Sender: TObject);
  54. begin
  55.      if BitsEdit.value in [8,12,16] then begin
  56.         SzLabel.caption := 'File size: '+inttostr(
  57.         (((WidEdit.value*HtEdit.value*SliceEdit.value*BitsEdit.value )+7) div 8) +offsetedit.value);
  58.      end else
  59.          BitsEdit.value := 8;
  60. end;
  61.  
  62. procedure TRawForm.OKBtnClick(Sender: TObject);
  63. begin
  64.      gRawOK := (Sender as TSpeedbutton).tag;
  65.       gRawWid:= WidEdit.value;
  66.       gRawHt:= HtEdit.value;
  67.       gRawSlice:= SliceEdit.value ;
  68.       gRawOffset:= OffsetEdit.value;
  69.       gRawBits:= BitsEdit.value;
  70.       gRawLittleEnd:= LittleEndCheck.checked;
  71.      RawForm.close;
  72. end;
  73.  
  74. procedure TRawForm.CancelBtnClick(Sender: TObject);
  75. begin
  76.      gRawOK := 0;
  77.      RawForm.close;
  78. end;
  79.  
  80. procedure TRawForm.FormShow(Sender: TObject);
  81. begin
  82.      WidEdit.value := gRawWid;
  83.      HtEdit.value := gRawHt;
  84.      SliceEdit.value := gRawSlice;
  85.      OffsetEdit.value := gRawOffset;
  86.      BitsEdit.value := gRawBits;
  87.      LittleEndCheck.checked := gRawLittleEnd;
  88. end;
  89.  
  90. end.
  91.