* Added option to open xib in XCode

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2631 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
loesje_
2013-01-19 09:15:31 +00:00
parent a7c7a1f7a5
commit 8727566e64

View File

@ -5,7 +5,7 @@ unit iOSIdeIntf;
interface interface
uses uses
Classes, Forms, ProjectIntf, iPhoneExtOptions; Classes, Forms, ProjectIntf, iPhoneExtOptions, ComponentEditors;
type type
@ -53,17 +53,35 @@ type
function CreateSource(const Filename, SourceName, ResourceName: string): string; override; function CreateSource(const Filename, SourceName, ResourceName: string): string; override;
end; end;
{ TiOSShowInXCode }
TiOSShowInXCode = Class(TComponentEditor)
private
FStartIndex : Integer;
Public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
var var
GiOSApplicationDescriptor: TiOSApplicationDescriptor; GiOSApplicationDescriptor: TiOSApplicationDescriptor;
GiOSAppDelegateWindowFileDesc: TiOSAppDelegateWindowFileDesc; GiOSAppDelegateWindowFileDesc: TiOSAppDelegateWindowFileDesc;
GiOSInfo_PlistFileDesc: TiOSInfo_PlistFileDesc; GiOSInfo_PlistFileDesc: TiOSInfo_PlistFileDesc;
GiOSObjectDelegateWindowFileDesc: TiOSObjectDelegateWindowFileDesc; GiOSObjectDelegateWindowFileDesc: TiOSObjectDelegateWindowFileDesc;
resourcestring
SShowInXCode = 'Show in XCode';
procedure register; procedure register;
implementation implementation
uses LazIDEIntf, Controls, iOS_Views, iOSXIBResource, UnitResources; uses
LazIDEIntf, Controls, iOS_Views, iOSXIBResource, UnitResources,
LazFilesUtils,
FileUtil;
procedure register; procedure register;
begin begin
@ -76,9 +94,44 @@ begin
GiOSObjectDelegateWindowFileDesc:=TiOSObjectDelegateWindowFileDesc.Create; GiOSObjectDelegateWindowFileDesc:=TiOSObjectDelegateWindowFileDesc.Create;
RegisterProjectFileDescriptor(GiOSObjectDelegateWindowFileDesc); RegisterProjectFileDescriptor(GiOSObjectDelegateWindowFileDesc);
RegisterComponentEditor(NSObject, TiOSShowInXCode);
RegisterUnitResourcefileFormat(TXIBResourcefileFormat); RegisterUnitResourcefileFormat(TXIBResourcefileFormat);
end; end;
{ TiOSShowInXCode }
procedure TiOSShowInXCode.ExecuteVerb(Index: Integer);
var
s: string;
begin
If Index<FStartIndex then
inherited ExecuteVerb(Index)
else
case (Index-FstartIndex) of
0 : begin
s := '/Users/joost/svn/testlrs/onzin/appdelegate_iphoneu.xib';
if FileExistsUTF8(s) then ExecCmdLineNoWait('open "'+s +'"');
end;
end;
end;
function TiOSShowInXCode.GetVerb(Index: Integer): string;
begin
If Index<FStartIndex then
Result:=inherited GetVerb(Index)
else
case (Index-FstartIndex) of
0 : Result:=SShowInXCode;
end;
end;
function TiOSShowInXCode.GetVerbCount: Integer;
begin
FStartIndex:=inherited GetVerbCount;
Result:=FStartIndex+1;
end;
{ TiOSObjectDelegateWindowFileDesc } { TiOSObjectDelegateWindowFileDesc }
function TiOSObjectDelegateWindowFileDesc.GetDelegateProtocols: string; function TiOSObjectDelegateWindowFileDesc.GetDelegateProtocols: string;