www.pudn.com > d4psp31.zip > fmStepMode.pas, change:1997-01-25,size:1946b


unit fmStepMode; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  Buttons; 
 
type 
  TStepModeForm = class(TForm) 
    SpeedButton1: TSpeedButton; 
    SpeedButton2: TSpeedButton; 
    SpeedButton3: TSpeedButton; 
    SpeedButton4: TSpeedButton; 
    SpeedButton5: TSpeedButton; 
    SpeedButton6: TSpeedButton; 
    SpeedButton7: TSpeedButton; 
    SpeedButton8: TSpeedButton; 
    SpeedButton9: TSpeedButton; 
    SpeedButton10: TSpeedButton; 
    SpeedButton11: TSpeedButton; 
    SpeedButton12: TSpeedButton; 
    procedure FormClose(Sender: TObject; var Action: TCloseAction); 
    procedure FormDestroy(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    function AdjustNoteLen (PPQN : Integer; var dotted, quantize : boolean) : Integer; 
    { Public declarations } 
  end; 
 
var 
  StepModeForm: TStepModeForm; 
 
implementation 
 
{$R *.DFM} 
 
uses fmMainForm; 
 
procedure TStepModeForm.FormClose(Sender: TObject; 
  var Action: TCloseAction); 
begin 
  Action := caFree; 
end; 
 
procedure TStepModeForm.FormDestroy(Sender: TObject); 
begin 
  MainForm.SetStepModeState (false); 
end; 
 
function TStepModeForm.AdjustNoteLen (PPQN : Integer; var dotted, quantize : boolean) : Integer; 
begin 
  if SpeedButton1.Down then 
    PPQN := PPQN * 8 
  else 
    if SpeedButton2.Down then 
      PPQN := PPQN * 4 
    else 
      if SpeedButton3.Down then 
        PPQN := PPQN * 2; 
 
  if SpeedButton9.Down then PPQN := PPQN * 3 div 2; 
  if SpeedButton10.Down then PPQN := PPQN * 2 div 3; 
 
  if SpeedButton5.Down then 
    PPQN := PPQN div 2 
  else 
    if SpeedButton6.Down then 
      PPQN := PPQN div 4 
    else 
      if SpeedButton7.Down then 
       PPQN := PPQN div 8 
      else 
        if SpeedButton8.Down then 
          PPQN := PPQN div 16; 
 
  dotted := SpeedButton11.Down; 
  quantize := SpeedButton12.Down; 
  result := PPQN; 
end; 
 
end.