Skip to content

Commit

Permalink
Merge pull request #3 from viniciussanchez/master
Browse files Browse the repository at this point in the history
Created session
  • Loading branch information
hunsche authored Jun 15, 2019
2 parents dd2eed7 + aabbec4 commit 5ce450d
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 74 deletions.
98 changes: 59 additions & 39 deletions src/IDE/Boss.IDE.BossInstall.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

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;
procedure AddMenu(const Project: IOTAProject; const IdentList: TStrings;
const ProjectManagerMenuList: IInterfaceList; IsMultiSelect: Boolean);
end;

TButtonBossInstall = class(TNotifierObject, IOTALocalMenu, IOTAProjectManagerMenu)
TButtonBoss = class(TNotifierObject, IOTALocalMenu, IOTAProjectManagerMenu)
private
FCaption: string;
FChecked: Boolean;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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.
1 change: 0 additions & 1 deletion src/core/Boss.Modules.PackageProcessor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class procedure TBossPackageProcessor.OnActiveProjectChanged(AProject: string);
procedure TBossPackageProcessor.UnloadOlds;
var
LBpl: string;
LFlag: Integer;
LMenu: TMenuItem;
LMenuItem: TMenuItem;
LIndex: Integer;
Expand Down
8 changes: 3 additions & 5 deletions src/core/wrapper/Boss.EventWrapper.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
9 changes: 1 addition & 8 deletions src/providers/Providers.Logo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,18 @@

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
DataModuleLogo: TDataModuleLogo;

implementation

{%CLASSGROUP 'Vcl.Controls.TControl'}

{$R *.dfm}

end.
11 changes: 4 additions & 7 deletions src/providers/Providers.Message.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

interface

uses
ToolsAPI;
uses ToolsAPI;

type
TProviderMessage = class
FService: IOTAMessageServices;
FGroup: IOTAMessageGroup;
public
class function GetInstance: TProviderMessage;
Procedure Initialize(AService: IOTAMessageServices);
procedure Initialize(AService: IOTAMessageServices);
procedure WriteLn(ALine: string);
procedure Clear;

end;

implementation
Expand Down Expand Up @@ -53,8 +51,7 @@ procedure TProviderMessage.WriteLn(ALine: string);
initialization

finalization

if Assigned(FInstance) then
FInstance.Free;
if Assigned(FInstance) then
FInstance.Free;

end.
20 changes: 6 additions & 14 deletions src/thrid/Boss.Ide.OpenToolApi.Tools.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1131,7 +1122,6 @@ function FindMenuItem(strParentMenu : String): TMenuItem;
{$ENDIF}
End;


function NativeServices: INTAServices;
begin
Result := (BorlandIDEServices as INTAServices);
Expand All @@ -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.

0 comments on commit 5ce450d

Please sign in to comment.