From aabbec4c2d2f0a6353320cec9f53bd05d00d1dc3 Mon Sep 17 00:00:00 2001 From: Vinicius Sanchez Date: Sat, 15 Jun 2019 16:14:44 -0300 Subject: [PATCH] Removed warning and hints; Created session to Boss menu in IDE; --- src/IDE/Boss.IDE.BossInstall.pas | 98 +++++++++++++--------- src/core/Boss.Modules.PackageProcessor.pas | 1 - src/core/wrapper/Boss.EventWrapper.pas | 8 +- src/providers/Providers.Logo.pas | 9 +- src/providers/Providers.Message.pas | 11 +-- src/thrid/Boss.Ide.OpenToolApi.Tools.pas | 20 ++--- 6 files changed, 73 insertions(+), 74 deletions(-) diff --git a/src/IDE/Boss.IDE.BossInstall.pas b/src/IDE/Boss.IDE.BossInstall.pas index 01b0c59..abc5477 100644 --- a/src/IDE/Boss.IDE.BossInstall.pas +++ b/src/IDE/Boss.IDE.BossInstall.pas @@ -2,11 +2,9 @@ interface -uses - ToolsAPI, Vcl.ActnList, System.Classes; +uses ToolsAPI, Vcl.ActnList, System.Classes; type - TMenuNotifierBossInstall = class(TNotifierObject, IOTANotifier, IOTAProjectMenuItemCreatorNotifier) public function CanHandle(const Ident: string): Boolean; @@ -14,7 +12,7 @@ TMenuNotifierBossInstall = class(TNotifierObject, IOTANotifier, IOTAProjectMen const ProjectManagerMenuList: IInterfaceList; IsMultiSelect: Boolean); end; - TButtonBossInstall = class(TNotifierObject, IOTALocalMenu, IOTAProjectManagerMenu) + TButtonBoss = class(TNotifierObject, IOTALocalMenu, IOTAProjectManagerMenu) private FCaption: string; FChecked: Boolean; @@ -25,9 +23,9 @@ TButtonBossInstall = class(TNotifierObject, IOTALocalMenu, IOTAProjectManagerM FPosition: Integer; FVerb: string; FOnExecute: TNotifyEvent; - FProject: IOTAProject; public + { IOTALocalMenu } function GetCaption: string; function GetChecked: Boolean; function GetEnabled: Boolean; @@ -54,137 +52,140 @@ TButtonBossInstall = class(TNotifierObject, IOTALocalMenu, IOTAProjectManagerM property Verb: string read GetVerb write SetVerb; property OnExute: TNotifyEvent read FOnExecute write FOnExecute; - // IOTAProjectManagerMenu + { IOTAProjectManagerMenu } function GetIsMultiSelectable: Boolean; procedure SetIsMultiSelectable(Value: Boolean); procedure Execute(const MenuContextList: IInterfaceList); overload; function PreExecute(const MenuContextList: IInterfaceList): Boolean; function PostExecute(const MenuContextList: IInterfaceList): Boolean; property IsMultiSelectable: Boolean read GetIsMultiSelectable write SetIsMultiSelectable; - constructor Create(aProject: IOTAProject); + + constructor Create(aProject: IOTAProject); virtual; + end; + + TButtonBossSeparator = class(TButtonBoss) + public + constructor Create(aProject: IOTAProject); override; + end; + + TButtonBossInstall = class(TButtonBoss) + public + constructor Create(aProject: IOTAProject); override; end; implementation -uses - System.SysUtils, Boss.Modules.PackageProcessor, Boss.Commands, Boss.Ide.CnOTAUtils; +uses System.SysUtils, Boss.Modules.PackageProcessor, Boss.Commands, Boss.Ide.CnOTAUtils; -constructor TButtonBossInstall.Create(aProject: IOTAProject); +constructor TButtonBoss.Create(aProject: IOTAProject); begin - Self.Caption := 'Boss install'; Self.Enabled := True; - Self.Position := pmmpInstall + 10; - FProject := aProject; end; -procedure TButtonBossInstall.Execute(const MenuContextList: IInterfaceList); +procedure TButtonBoss.Execute(const MenuContextList: IInterfaceList); begin - if CnOtaGetCurrentProject = FProject then - TBossPackageProcessor - .GetInstance - .UnloadOlds; - + TBossPackageProcessor.GetInstance.UnloadOlds; RunBossInstall(ExtractFilePath(FProject.FileName), CnOtaGetCurrentProject = FProject); end; -function TButtonBossInstall.GetCaption: string; +function TButtonBoss.GetCaption: string; begin Result := FCaption; end; -function TButtonBossInstall.GetChecked: Boolean; +function TButtonBoss.GetChecked: Boolean; begin Result := FChecked; end; -function TButtonBossInstall.GetEnabled: Boolean; +function TButtonBoss.GetEnabled: Boolean; begin Result := FEnabled; end; -function TButtonBossInstall.GetHelpContext: Integer; +function TButtonBoss.GetHelpContext: Integer; begin Result := FHelpContext; end; -function TButtonBossInstall.GetIsMultiSelectable: Boolean; +function TButtonBoss.GetIsMultiSelectable: Boolean; begin Result := False; end; -function TButtonBossInstall.GetName: string; +function TButtonBoss.GetName: string; begin Result := FName; end; -function TButtonBossInstall.GetParent: string; +function TButtonBoss.GetParent: string; begin Result := FParent; end; -function TButtonBossInstall.GetPosition: Integer; +function TButtonBoss.GetPosition: Integer; begin Result := FPosition; end; -function TButtonBossInstall.GetVerb: string; +function TButtonBoss.GetVerb: string; begin Result := FVerb; end; -function TButtonBossInstall.PostExecute(const MenuContextList: IInterfaceList): Boolean; +function TButtonBoss.PostExecute(const MenuContextList: IInterfaceList): Boolean; begin Result := True; end; -function TButtonBossInstall.PreExecute(const MenuContextList: IInterfaceList): Boolean; +function TButtonBoss.PreExecute(const MenuContextList: IInterfaceList): Boolean; begin Result := True; end; -procedure TButtonBossInstall.SetCaption(const Value: string); +procedure TButtonBoss.SetCaption(const Value: string); begin FCaption := Value; end; -procedure TButtonBossInstall.SetChecked(Value: Boolean); +procedure TButtonBoss.SetChecked(Value: Boolean); begin FChecked := Value; end; -procedure TButtonBossInstall.SetEnabled(Value: Boolean); +procedure TButtonBoss.SetEnabled(Value: Boolean); begin FEnabled := Value; end; -procedure TButtonBossInstall.SetHelpContext(Value: Integer); +procedure TButtonBoss.SetHelpContext(Value: Integer); begin FHelpContext := Value; end; -procedure TButtonBossInstall.SetIsMultiSelectable(Value: Boolean); +procedure TButtonBoss.SetIsMultiSelectable(Value: Boolean); begin IsMultiSelectable := Value; end; -procedure TButtonBossInstall.SetName(const Value: string); +procedure TButtonBoss.SetName(const Value: string); begin FName := Value; end; -procedure TButtonBossInstall.SetParent(const Value: string); +procedure TButtonBoss.SetParent(const Value: string); begin FParent := Value; end; -procedure TButtonBossInstall.SetPosition(Value: Integer); +procedure TButtonBoss.SetPosition(Value: Integer); begin FPosition := Value; end; -procedure TButtonBossInstall.SetVerb(const Value: string); +procedure TButtonBoss.SetVerb(const Value: string); begin FVerb := Value; end; @@ -197,6 +198,7 @@ procedure TMenuNotifierBossInstall.AddMenu(const Project: IOTAProject; const Ide if CanHandle(Project.ApplicationType) and (not IsMultiSelect) and Assigned(Project) and (IdentList.IndexOf(sProjectContainer) <> -1) and Assigned(ProjectManagerMenuList) then begin + ProjectManagerMenuList.Add(TButtonBossSeparator.Create(Project)); ProjectManagerMenuList.Add(TButtonBossInstall.Create(Project)); end; end; @@ -206,4 +208,22 @@ function TMenuNotifierBossInstall.CanHandle(const Ident: string): Boolean; Result := (Ident = sApplication) or (Ident = sConsole) or (Ident = sPackage); end; +{ TButtonBossSeparator } + +constructor TButtonBossSeparator.Create(aProject: IOTAProject); +begin + inherited Create(aProject); + Self.Caption := '-'; + Self.Position := pmmpRunNoDebug + 10; +end; + +{ TButtonBossInstall } + +constructor TButtonBossInstall.Create(aProject: IOTAProject); +begin + inherited Create(aProject); + Self.Caption := 'Boss install'; + Self.Position := pmmpRunNoDebug + 20; +end; + end. diff --git a/src/core/Boss.Modules.PackageProcessor.pas b/src/core/Boss.Modules.PackageProcessor.pas index d908138..0140ec7 100644 --- a/src/core/Boss.Modules.PackageProcessor.pas +++ b/src/core/Boss.Modules.PackageProcessor.pas @@ -151,7 +151,6 @@ class procedure TBossPackageProcessor.OnActiveProjectChanged(AProject: string); procedure TBossPackageProcessor.UnloadOlds; var LBpl: string; - LFlag: Integer; LMenu: TMenuItem; LMenuItem: TMenuItem; LIndex: Integer; diff --git a/src/core/wrapper/Boss.EventWrapper.pas b/src/core/wrapper/Boss.EventWrapper.pas index edd731f..5b76060 100644 --- a/src/core/wrapper/Boss.EventWrapper.pas +++ b/src/core/wrapper/Boss.EventWrapper.pas @@ -2,15 +2,14 @@ interface -uses - System.Classes, System.SysUtils; +uses System.Classes, System.SysUtils; type TNotifyEventWrapper = class(TComponent) private FPath: string; public - constructor Create(APath: String); + constructor Create(APath: String); reintroduce; published procedure Event(Sender: TObject); end; @@ -19,8 +18,7 @@ function GetOpenEvent(APath: String): TNotifyEvent; implementation -uses - Winapi.ShellAPI, Boss.Ide.OpenToolApi.Tools, Winapi.Windows; +uses Winapi.ShellAPI, Boss.Ide.OpenToolApi.Tools, Winapi.Windows; constructor TNotifyEventWrapper.Create(APath: String); begin diff --git a/src/providers/Providers.Logo.pas b/src/providers/Providers.Logo.pas index 993def3..2da4e8b 100644 --- a/src/providers/Providers.Logo.pas +++ b/src/providers/Providers.Logo.pas @@ -2,16 +2,11 @@ interface -uses - System.SysUtils, System.Classes, System.ImageList, Vcl.ImgList, Vcl.Controls; +uses System.SysUtils, System.Classes, System.ImageList, Vcl.ImgList, Vcl.Controls; type TDataModuleLogo = class(TDataModule) ImageList: TImageList; - private - { Private declarations } - public - { Public declarations } end; var @@ -19,8 +14,6 @@ TDataModuleLogo = class(TDataModule) implementation -{%CLASSGROUP 'Vcl.Controls.TControl'} - {$R *.dfm} end. diff --git a/src/providers/Providers.Message.pas b/src/providers/Providers.Message.pas index 6c8e309..d29e8fc 100644 --- a/src/providers/Providers.Message.pas +++ b/src/providers/Providers.Message.pas @@ -2,8 +2,7 @@ interface -uses - ToolsAPI; +uses ToolsAPI; type TProviderMessage = class @@ -11,10 +10,9 @@ TProviderMessage = class FGroup: IOTAMessageGroup; public class function GetInstance: TProviderMessage; - Procedure Initialize(AService: IOTAMessageServices); + procedure Initialize(AService: IOTAMessageServices); procedure WriteLn(ALine: string); procedure Clear; - end; implementation @@ -53,8 +51,7 @@ procedure TProviderMessage.WriteLn(ALine: string); initialization finalization - -if Assigned(FInstance) then - FInstance.Free; + if Assigned(FInstance) then + FInstance.Free; end. diff --git a/src/thrid/Boss.Ide.OpenToolApi.Tools.pas b/src/thrid/Boss.Ide.OpenToolApi.Tools.pas index f0f872f..ae4d211 100644 --- a/src/thrid/Boss.Ide.OpenToolApi.Tools.pas +++ b/src/thrid/Boss.Ide.OpenToolApi.Tools.pas @@ -544,13 +544,8 @@ **) Procedure OutputText(Writer : IOTAEditWriter; iIndent : Integer; strText : String); - Begin - {$IFNDEF D2009} - Writer.Insert(PAnsiChar(StringOfChar(#32, iIndent) + strText)); - {$ELSE} Writer.Insert(PAnsiChar(AnsiString(StringOfChar(#32, iIndent) + strText))); - {$ENDIF} End; { TCustomMessage Methods } @@ -706,16 +701,12 @@ Begin SetLength(FMsg, Length(strMsg)); iLength := 0; - For i := 1 To Length(strMsg) Do - {$IFDEF D2009} - If CharInSet(strMsg[i], strValidChars) Then - {$ELSE} - If strMsg[i] In strValidChars Then - {$ENDIF} - Begin + for i := 1 To Length(strMsg) Do + if CharInSet(strMsg[i], strValidChars) Then + begin FMsg[iLength + 1] := strMsg[i]; Inc(iLength); - End; + end; SetLength(FMsg, iLength); FFontName := FontName; FForeColour := ForeColour; @@ -1131,7 +1122,6 @@ function FindMenuItem(strParentMenu : String): TMenuItem; {$ENDIF} End; - function NativeServices: INTAServices; begin Result := (BorlandIDEServices as INTAServices); @@ -1141,8 +1131,10 @@ function NativeServices: INTAServices; removed from the IDE. **) Initialization FOTAActions := TObjectList.Create(True); + (** Frees the actions and in doing so removes them from the IDE. **) Finalization RemoveToolbarButtonsAssociatedWithActions; FOTAActions.Free; + End.