www.pudn.com > d4psp31.zip > fmEventList.pas, change:1998-09-01,size:4980b


unit fmEventList; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  fmPower, Grids, cmpMidiGrid, cmpMidiData, ComCtrls, Menus, Buttons, 
  ExtCtrls, unitMidiTrackStream; 
 
type 
  TEventListForm = class(TPowerForm) 
    PopupMenu1: TPopupMenu; 
    poSelectTrack: TMenuItem; 
    N1: TMenuItem; 
    poEdit: TMenuItem; 
    poInsert: TMenuItem; 
    poDelete: TMenuItem; 
    MidiGrid1: TMidiGrid; 
    HeaderControl1: THeaderControl; 
    procedure FormShow(Sender: TObject); 
    procedure poSelectTrackClick(Sender: TObject); 
    procedure FormResize(Sender: TObject); 
    procedure HeaderControl1SectionResize(HeaderControl: THeaderControl; 
      Section: THeaderSection); 
    procedure poEditClick(Sender: TObject); 
    procedure MidiGrid1DblClick(Sender: TObject); 
  private 
    fCurrentTrack : TMidiTrackStream; 
    procedure SetRowForPosition (position : Integer); 
    procedure EditSelectedEvent; 
 
  protected 
    procedure AdjustHeader; 
    procedure AdjustGrid; 
 
  public 
    procedure Notify (tp : TActiveFormNotify); override; 
  end; 
 
var 
  EventListForm: TEventListForm; 
 
implementation 
 
{$R *.DFM} 
 
uses fmMainForm, commctrl, fmEventProperties; 
 
procedure TEventListForm.FormShow(Sender: TObject); 
begin 
  inherited; 
  with HeaderControl1 do 
    SetWindowLong (Handle, GWL_STYLE, GetWindowLong (HeaderControl1.Handle, GWL_STYLE) and not HDS_BUTTONS); 
  AdjustHeader; 
  MidiGrid1.MidiData := MainForm.MidiData; 
  MidiGrid1.Track := MainForm.CurrentTrackNo; 
  fCurrentTrack := MainForm.MidiData.Tracks [MainForm.CurrentTrackNo]; 
  SetCaption ('Event List', MidiGrid1.Track); 
end; 
 
const 
  Sections = 6; 
  SectionLoadings : array [0..Sections - 1] of Integer = (12, 13, 10, 30, 20, 10); 
  MaxLoadings = 95; 
 
procedure TEventListForm.AdjustHeader; 
var i, width : Integer; 
begin 
  width := MidiGrid1.ClientWidth; 
  for i := 0 to Sections - 2 do 
    HeaderControl1.Sections [i].Width := width * SectionLoadings [i] div MaxLoadings; 
 
  AdjustGrid; 
end; 
 
procedure TEventListForm.AdjustG