Last active
March 20, 2019 02:39
-
-
Save owlsperspective/8a6a86f7ca4804fbd7a0a6c5cf36bb20 to your computer and use it in GitHub Desktop.
RAD Studio IDEのクイックアクションパネルを非表示にする/Hide quick action panel on RAD Studio IDE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hide Quick Action Panel from Delphi 2010 or later | |
// Delphi 2010以降のクイックアクションパネルを非表示にする | |
// original by MartynA from https://stackoverflow.com/questions/41501400/delphi-xe4-ide-how-to-always-hide-the-bottom-panes-of-the-object-inspector | |
// | |
// How to use this package: | |
// Open HideQuickActionPanel.dpk and change project option/description page below, and select 'install' on project pane's context menu. | |
// 1.Set description 'Hide quick action panel' or something. | |
// 2.Set LIB suffix, for example '330'(compiler version) or '260'(Delphi version) or '200'(studio version) or 'Rio'(codename) or etc. | |
// 3.Set 'Design time only'. | |
// | |
// このパッケージの使用方法: | |
// HideQuickActionPanel.dpkを開き、プロジェクトオプションの説明ページで以下の設定を変更し、プロジェクトペインのコンテキストメニューで'インストール'とする | |
// 1.説明を'Hide quick action panel'などとする | |
// 2.LIB サフィックスに例えば'330'(コンパイラバージョン)、'260'(Delphiのバージョン)、'200'(RAD Studioのバージョン)、'Rio'(コードネーム)などを設定する | |
// 3.用途に関するオプションを'設計時のみ使用可能'にする | |
package HideQuickActionPanel; | |
{$R *.res} | |
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} | |
{$ALIGN 8} | |
{$ASSERTIONS ON} | |
{$BOOLEVAL OFF} | |
{$DEBUGINFO OFF} | |
{$EXTENDEDSYNTAX ON} | |
{$IMPORTEDDATA ON} | |
{$IOCHECKS ON} | |
{$LOCALSYMBOLS OFF} | |
{$LONGSTRINGS ON} | |
{$OPENSTRINGS ON} | |
{$OPTIMIZATION ON} | |
{$OVERFLOWCHECKS OFF} | |
{$RANGECHECKS OFF} | |
{$REFERENCEINFO OFF} | |
{$SAFEDIVIDE OFF} | |
{$STACKFRAMES OFF} | |
{$TYPEDADDRESS OFF} | |
{$VARSTRINGCHECKS ON} | |
{$WRITEABLECONST OFF} | |
{$MINENUMSIZE 1} | |
{$IMAGEBASE $400000} | |
{$DEFINE RELEASE} | |
{$ENDIF IMPLICITBUILDING} | |
{$IMPLICITBUILD ON} | |
requires | |
rtl, | |
designide; | |
contains | |
UHideQuickActionPanel in 'UHideQuickActionPanel.pas'; | |
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit UHideQuickActionPanel; | |
interface | |
uses | |
{$IF RTLVersion >= 23.0} | |
System.SysUtils, System.Classes, | |
Vcl.Controls, Vcl.Forms, Vcl.ExtCtrls, | |
{$ELSE} | |
SysUtils, Classes, | |
Controls, Forms, ExtCtrls, | |
{$IFEND} | |
ToolsApi, DesignIntf; | |
type | |
TDesignNotification = class(TInterfacedObject, IDesignNotification) | |
procedure ItemDeleted(const ADesigner: IDesigner; AItem: TPersistent); | |
procedure ItemInserted(const ADesigner: IDesigner; AItem: TPersistent); | |
procedure ItemsModified(const ADesigner: IDesigner); | |
procedure SelectionChanged(const ADesigner: IDesigner; | |
const ASelection: IDesignerSelections); | |
procedure DesignerOpened(const ADesigner: IDesigner; AResurrecting: Boolean); | |
procedure DesignerClosed(const ADesigner: IDesigner; AGoingDormant: Boolean); | |
constructor Create; | |
destructor Destroy; override; | |
private | |
procedure HideItems; | |
procedure HideFormItems(Form: TForm); | |
end; | |
var | |
DesignNotification : TDesignNotification; | |
implementation | |
procedure SetUp; | |
begin | |
DesignNotification := TDesignNotification.Create; | |
RegisterDesignNotification(DesignNotification); | |
end; | |
constructor TDesignNotification.Create; | |
begin | |
inherited Create; | |
end; | |
procedure TDesignNotification.DesignerClosed(const ADesigner: IDesigner; | |
AGoingDormant: Boolean); | |
begin | |
end; | |
procedure TDesignNotification.HideFormItems(Form : TForm); | |
var | |
j, | |
l : Integer; | |
Panel : TPanel; | |
C : TComponent; | |
HideCount : Integer; | |
procedure HideControl(AControl : TControl); | |
begin | |
AControl.Height := 0; // This is necessary because the IDE seems to reset | |
// Visible to True when the Object Inspector is refreshed. | |
AControl.Visible := False; | |
end; | |
begin | |
HideCount := 0; | |
for j := 0 to Form.ComponentCount - 1 do begin | |
C := Form.Components[j]; | |
if C is TPanel then begin | |
Panel := TPanel(C); | |
for l := 0 to Panel.ControlCount - 1 do begin | |
if CompareText(Panel.Controls[l].ClassName, 'TDescriptionPane') = 0 then begin | |
HideControl(Panel.Controls[l]); | |
Inc(HideCount); | |
end | |
else | |
if CompareText(Panel.Controls[l].ClassName, 'THotCommands') = 0 then begin | |
HideControl(Panel.Controls[l]); | |
Inc(HideCount); | |
end; | |
if HideCount >= 2 then // we're done | |
exit; | |
end; | |
end; | |
end; | |
end; | |
procedure TDesignNotification.HideItems; | |
var | |
i : Integer; | |
Form : TForm; | |
begin | |
for i := 0 to Screen.FormCount - 1 do begin | |
Form := Screen.Forms[i]; | |
if CompareText(Form.ClassName, 'TPropertyInspector') = 0 then begin | |
HideFormItems(Form); | |
Break; | |
end; | |
end; | |
end; | |
procedure TDesignNotification.DesignerOpened(const ADesigner: IDesigner; | |
AResurrecting: Boolean); | |
begin | |
end; | |
var | |
DestroyCount : Integer; | |
destructor TDesignNotification.Destroy; | |
begin | |
Inc(DestroyCount); | |
inherited; | |
end; | |
procedure TDesignNotification.ItemDeleted(const ADesigner: IDesigner; | |
AItem: TPersistent); | |
begin | |
end; | |
procedure TDesignNotification.ItemInserted(const ADesigner: IDesigner; | |
AItem: TPersistent); | |
begin | |
end; | |
procedure TDesignNotification.ItemsModified(const ADesigner: IDesigner); | |
begin | |
end; | |
procedure TDesignNotification.SelectionChanged(const ADesigner: IDesigner; | |
const ASelection: IDesignerSelections); | |
var | |
C : TComponent; | |
begin | |
// This can get called with ADesigner = Nil | |
if ADesigner = Nil then | |
exit; | |
C := ADesigner.Root; | |
if C <> Nil then begin | |
HideItems; | |
end | |
end; | |
initialization | |
SetUp; | |
finalization | |
if DesignNotification <> Nil then begin | |
UnRegisterDesignNotification(DesignNotification); | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment