mmenvdlg.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:6k
- {========================================================================}
- {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
- {========================================================================}
- {= All Rights Reserved =}
- {========================================================================}
- {= D 01099 Dresden = Tel.: +0351-8012255 =}
- {= Loewenstr.7a = info@swiftsoft.de =}
- {========================================================================}
- {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
- {========================================================================}
- {= This code is for reference purposes only and may not be copied or =}
- {= distributed in any format electronic or otherwise except one copy =}
- {= for backup purposes. =}
- {= =}
- {= No Delphi Component Kit or Component individually or in a collection=}
- {= subclassed or otherwise from the code in this unit, or associated =}
- {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
- {= without express permission from SwiftSoft. =}
- {= =}
- {= For more licence informations please refer to the associated =}
- {= HelpFile. =}
- {========================================================================}
- {= $Date: 20.01.1998 - 18:00:00 $ =}
- {========================================================================}
- unit MMEnvDlg;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinTypes,
- WinProcs,
- {$ENDIF}
- SysUtils,
- Messages,
- Consts,
- Classes,
- Dialogs,
- StdCtrls,
- Controls,
- ExtCtrls,
- Forms,
- MMObj,
- MMPanel,
- MMEnvelp,
- MMScroll;
- type
- {-- TMMEnvelopeDlg ----------------------------------------------------}
- TMMEnvelopeDlg = class(TForm)
- Envelope: TMMEnvelope;
- MMPanel1: TMMPanel;
- btnOK: TButton;
- btnCancel: TButton;
- MMPanel2: TMMPanel;
- MMPanel3: TMMPanel;
- HorizScrollPanel: TMMScrollPanel;
- VerticScrollPanel: TMMScrollPanel;
- btnReset: TButton;
- btnClear: TButton;
- OpenDialog: TOpenDialog;
- SaveDialog: TSaveDialog;
- btnLoad: TButton;
- brnSave: TButton;
- procedure HorizScrollPanelTrack(Sender: TObject; Min, Max: Longint);
- procedure VerticScrollPanelTrack(Sender: TObject; Min, Max: Longint);
- procedure btnResetClick(Sender: TObject);
- procedure btnClearClick(Sender: TObject);
- procedure btnLoadClick(Sender: TObject);
- procedure brnSaveClick(Sender: TObject);
- private
- procedure WMGetMinMaxInfo(Var Msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
- public
- procedure SetAllRanges(MinX, MaxX, MinY, MaxY, BaseY: Longint);
- end;
- var
- MMEnvelopeDlg: TMMEnvelopeDlg;
- implementation
- {$R *.DFM}
- {-- TMMEnvelopeDlg ------------------------------------------------------}
- procedure TMMEnvelopeDlg.WMGetMinMaxInfo(Var Msg: TWMGetMinMaxInfo);
- begin
- with Msg.MinMaxInfo^ do
- begin
- ptMaxSize.X := Screen.Width;
- ptMaxSize.Y := Screen.Height;
- ptMaxPosition.X := 0;
- ptMaxPosition.Y := 0;
- ptMinTrackSize.X := 390; { Minimum width }
- ptMinTrackSize.Y := 270; { Minimum height }
- ptMaxTrackSize.X := Screen.Width; { Maximum width }
- ptMaxTrackSize.Y := Screen.Height;{ Maximum height }
- end;
- Msg.Result := 0; { Tell windows you have changed minmaxinfo }
- inherited;
- end;
- {-- TMMEnvelopeDlg ------------------------------------------------------}
- procedure TMMEnvelopeDlg.SetAllRanges(MinX, MaxX, MinY, MaxY, BaseY: Longint);
- begin
- Envelope.SetRangeAll(MinX,MaxX,MinY,MaxY,BaseY);
- Envelope.SetDispAll(MinX,MaxX,MinY,MaxY);
- HorizScrollPanel.SetRangeAll(MinX,MaxX);
- HorizScrollPanel.SetSliderAll(MinX,MaxX);
- VerticScrollPanel.SetRangeAll(MinY,MaxY);
- VerticScrollPanel.SetSliderAll(MinY,MaxY);
- end;
- {-- TMMEnvelopeDlg ------------------------------------------------------}
- procedure TMMEnvelopeDlg.HorizScrollPanelTrack(Sender: TObject; Min, Max: Longint);
- begin
- Envelope.DispMinX := Min;
- Envelope.DispMaxX := Max;
- end;
- {-- TMMEnvelopeDlg ------------------------------------------------------}
- procedure TMMEnvelopeDlg.VerticScrollPanelTrack(Sender: TObject; Min, Max: Longint);
- begin
- with Envelope do
- begin
- if RangeMinY >= 0 then
- begin
- Envelope.DispMinY := RangeMaxY-Max;
- Envelope.DispMaxY := RangeMaxY-Min
- end
- else
- begin
- Envelope.DispMinY := RangeMinY-Max;
- Envelope.DispMaxY := RangeMinY-Min;
- end;
- end;
- end;
- {-- TMMEnvelopeDlg ------------------------------------------------------}
- procedure TMMEnvelopeDlg.btnResetClick(Sender: TObject);
- begin
- Envelope.Reset;
- end;
- {-- TMMEnvelopeDlg ------------------------------------------------------}
- procedure TMMEnvelopeDlg.btnClearClick(Sender: TObject);
- begin
- Envelope.Clear;
- end;
- {-- TMMEnvelopeDlg ------------------------------------------------------}
- procedure TMMEnvelopeDlg.btnLoadClick(Sender: TObject);
- begin
- if OpenDialog.Execute then
- Envelope.Points.LoadFromFile(OpenDialog.FileName);
- end;
- {-- TMMEnvelopeDlg ------------------------------------------------------}
- procedure TMMEnvelopeDlg.brnSaveClick(Sender: TObject);
- begin
- if SaveDialog.Execute then
- Envelope.Points.SaveToFile(SaveDialog.FileName);
- end;
- end.