home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 March
/
Chip_1999-03_cd.bin
/
zkuste
/
delphi
/
D234C13
/
RALIB.ZIP
/
RALib
/
Lib
/
Zoom.pas
< prev
Wrap
Pascal/Delphi Source File
|
1998-08-15
|
3KB
|
118 lines
{***********************************************************
R&A Library
Copyright (C) 1996-98 R&A
components : none
description : Dephi IDE enhancement tool
programer : black
e-mail : blacknbs@chat.ru
www : www.chat.ru\~blacknbs\ralib
************************************************************}
{$INCLUDE RA.INC}
unit Zoom;
interface
uses
Windows,
ToolIntf, ExptIntf, VirtIntf, EditIntf,
Classes, Forms, Dialogs, Menus, SysUtils;
procedure RegisterZoom;
implementation
type
TEEditorZoom = class
private
procedure Zoom(Sender : TObject);
end;
procedure TEEditorZoom.Zoom(Sender : TObject);
var
F : TForm;
i : integer;
begin
F := Screen.ActiveForm;
if not F.ClassNameIs('TEditWindow') then begin
F := nil;
for i := 0 to Screen.FormCount - 1 do
if Screen.Forms[i].ClassNameIs('TEditWindow') then begin
F := Screen.Forms[i];
break;
end;
end;
if F <> nil then begin
if F.WindowState <> wsMaximized then
F.WindowState := wsMaximized
else
F.WindowState := wsNormal;
end;
end;
procedure Unregister;
var
F : TForm;
MenuItem : TMenuItem;
begin
F := Application.FindComponent('AppBuilder') as TForm;
if F <> nil then begin
MenuItem := F.FindComponent('RAZoomEditor') as TMenuItem;
if MenuItem <> nil then MenuItem.Free;
MenuItem := F.FindComponent('RAZoomEditor2') as TMenuItem;
if MenuItem <> nil then MenuItem.Free;
end;
end;
procedure RegisterZoom;
var
F : TForm;
ViewsMenu, ViewNewEditorItem : TMenuItem;
MenuItem : TMenuItem;
Zoom : TEEditorZoom;
begin
Unregister;
Zoom := nil; {avoid warning}
F := Application.FindComponent('AppBuilder') as TForm;
if F <> nil then
begin
// ShowMessage('Found AppBuilder');
ViewsMenu := F.FindComponent('ViewsMenu') as TMenuItem;
if ViewsMenu = nil then exit; {error}
MenuItem := TMenuItem.Create(F);
with MenuItem do
begin
Caption := 'Zoom Edit Window';
ShortCut := Menus.ShortCut(ord('Z'), [ssAlt]);
Name := 'RAZoomEditor';
OnClick := Zoom.Zoom;
end;
ViewNewEditorItem := F.FindComponent('ViewNewEditorItem') as TMenuItem;
if ViewNewEditorItem <> nil then
ViewsMenu.Insert(ViewNewEditorItem.MenuIndex+1, MenuItem)
else
ViewsMenu.Add(MenuItem);
{Additional shortcut}
{ MenuItem := TMenuItem.Create(F);
with MenuItem do
begin
ShortCut := Menus.ShortCut(VK_F11, [ssAlt]);
Name := 'RAZoomEditor2';
OnClick := Zoom.Zoom;
Visible := false;
end;
ViewsMenu.Add(MenuItem);
}
end;
end;
initialization
finalization
Unregister;
end.