Выбор материала и расчет параметров обделок вертикальных стволов метрополитеновСтраница 28
private
procedure SetUserLevel;
procedure UpdateMenuItems(Sender: TObject);
function ShowForm(FormClass: TFormClass): TForm;
end;
var
StaftForm: TStaftForm;
implementation
uses
About, rxIni, VCLUtils, Global, AppUtils, EditUser, UserList,
EditTub, Calc1;
{$R *.DFM}
const
siMDIChilds = 'OpenMDIChilds';
procedure TStaftForm.SetUserLevel;
begin
case glUserLevel of
ulOperator:
begin
DictSetupMenu.Visible := False;
DictSetupMenu.Enabled := False;
UserMenuItem.Visible := False;
UserMenuItem.Enabled := False;
end;
ulManager:
begin
DictSetupMenu.Visible := True;
DictSetupMenu.Enabled := True;
UserMenuItem.Visible := False;
UserMenuItem.Enabled := False;
end;
ulAdministrator:
begin
DictSetupMenu.Visible := True;
DictSetupMenu.Enabled := True;
UserMenuItem.Visible := True;
UserMenuItem.Enabled := True;
end;
end;
end;
procedure TStaftForm.TileMenuItemClick(Sender: TObject);
begin
Tile;
end;
procedure TStaftForm.CascadeMenuItemClick(Sender: TObject);
begin
Cascade;
end;
procedure TStaftForm.MinimizeAllMenuItemClick(Sender: TObject);
var
I: Integer;
begin
for I := MDIChildCount - 1 downto 0 do
MDIChildren[I].WindowState := wsMinimized;
end;
procedure TStaftForm.ArrangeAllMenuItemClick(Sender: TObject);
begin
ArrangeIcons;
end;
procedure TStaftForm.AboutMenuItemClick(Sender: TObject);
begin
ShowAboutDialog('Расчет тюбинговой обделки', 'Королев А.В.',
'МГГУ', nil, 1, 0, 1996);
end;
procedure TStaftForm.PrinterSetupMenuItemClick(Sender: TObject);
begin
PrinterSetup.Execute;
end;
procedure TStaftForm.ExitMenuItemClick(Sender: TObject);
begin
Close;
end;
function TStaftForm.ShowForm(FormClass: TFormClass): TForm;
var
Form: TForm;
begin
Result := nil;
StartWait;
try
Form := FindForm(FormClass);
if Form = nil then
Application.CreateForm(FormClass, Form);
with Form do begin
if WindowState = wsMinimized then WindowState := wsNormal;
Show;
end;
Result := Form;
finally
StopWait;
end;
end;
procedure TStaftForm.FormStorageRestorePlacement(Sender: TObject);
var
IniFile: TrxIniFile;
List: TStrings;
I: Integer;
FormClass: TFormClass;
Form: TForm;
begin
StartWait;
try
SpeedBar.Visible := True;
IniFile := TrxIniFile.Create(FormPlacement.IniFileName);
try
if (glUserLevel in [ulManager, ulAdministrator]) then begin
List := TStringList.Create;
try
IniFile.ReadList(siMDIChilds, List);
for I := 0 to List.Count - 1 do begin
FormClass := TFormClass(GetClass(List[I]));
if FormClass <> nil then ShowForm(FormClass);