iphonelazext: automatic update project's nib files for the iPhoneSim

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1206 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2010-04-25 11:54:36 +00:00
parent 9941cd6ca4
commit 438fe286a0
4 changed files with 53 additions and 32 deletions

View File

@ -103,15 +103,16 @@ var
bundlepath : WideString;
exepath : WideString;
nm : String;
symlink : String;
dstpath : String;
Space : WideString;
RealSpace : WideString;
Info : TiPhoneBundleInfo;
xiblist : TStringList;
i : Integer;
begin
Space:=ProjOptions.SpaceName; // LazarusIDE.ActiveProject.CustomData.;
{todo:}
bundleName:=ExtractFileName(LazarusIDE.ActiveProject.ProjectInfoFile);
bundleName:=Copy(bundleName, 1, length(bundleName)-length(ExtractFileExt(bundleName)));
@ -126,14 +127,30 @@ begin
CopySymLinks(
ResolveProjectPath(ProjOptions.ResourceDir),
bundlepath,
ProjOptions.ExcludeMask
// don't copy .xib files, they're replaced by compiled nibs
'*.xib; '+ ProjOptions.ExcludeMask
);
if nm<>'' then begin
symlink:=UTF8Encode(exepath);
FpUnlink(symlink);
fpSymlink(PChar(nm), PChar(symlink));
dstpath:=UTF8Encode(exepath);
FpUnlink(dstpath);
fpSymlink(PChar(nm), PChar(dstpath));
end;
xiblist := TStringList.Create;
try
EnumFilesAtDir(ResolveProjectPath(ProjOptions.ResourceDir), '*.xib', xiblist);
for i:=0 to xiblist.Count-1 do begin
dstpath:=IncludeTrailingPathDelimiter(bundlepath)+ChangeFileExt(ExtractFileName(xiblist[i]), '.nib');
ExecCmdLineNoWait(Format('ibtool --compile "%s" "%s"', [dstpath, xiblist[i]]));
writeln('compile from: ', xiblist[i]);
writeln(' to: ', dstpath);
end;
finally
xiblist.free;
end;
//todo: compile .xib files to .nibs
end;
function FindParam(const Source, ParamKey: String; var idx: Integer; var Content: String): Boolean;

View File

@ -4,8 +4,8 @@ inherited iPhoneProjectOptionsEditor: TiPhoneProjectOptionsEditor
ClientHeight = 474
ClientWidth = 620
OnClick = FrameClick
DesignLeft = 246
DesignTop = 121
DesignLeft = 611
DesignTop = 128
object chkisPhone: TCheckBox[0]
Left = 16
Height = 18

View File

@ -3,26 +3,26 @@
LazarusResources.Add('TiPhoneProjectOptionsEditor','FORMDATA',[
'TPF0'#241#27'TiPhoneProjectOptionsEditor'#26'iPhoneProjectOptionsEditor'#6'H'
+'eight'#3#218#1#5'Width'#3'l'#2#12'ClientHeight'#3#218#1#11'ClientWidth'#3'l'
+#2#7'OnClick'#7#10'FrameClick'#10'DesignLeft'#3#246#0#9'DesignTop'#2'y'#0#242
+#2#0#9'TCheckBox'#10'chkisPhone'#4'Left'#2#16#6'Height'#2#18#3'Top'#2#16#5'W'
+'idth'#3#199#0#7'Caption'#6#29'is iPhone application project'#8'TabOrder'#2#0
+#0#0#242#2#1#6'TLabel'#8'lblAppID'#4'Left'#2#16#6'Height'#2#18#3'Top'#2'X'#5
+'Width'#2'W'#7'Caption'#6#14'Application ID'#11'ParentColor'#8#0#0#242#2#2#5
+'TEdit'#8'edtAppID'#4'Left'#2'p'#6'Height'#2#22#3'Top'#2'U'#5'Width'#3#234#1
+#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#1#4'Text'#6#19
+'com.mycompany.myapp'#0#0#242#2#3#6'TLabel'#12'lblAppIDHint'#4'Left'#2#16#6
+'Height'#2#14#3'Top'#2'u'#5'Width'#3#237#1#7'Caption'#6'_It''s recommended b'
+'y Apple to use domain-structured name, i.e. com.mycompany.myApplication as '
+'ID'#11'Font.Height'#2#246#11'ParentColor'#8#10'ParentFont'#8#0#0#242#2#4#6
+'TLabel'#9'lblSDKVer'#4'Left'#2#16#6'Height'#2#18#3'Top'#2'3'#5'Width'#2'P'#7
+'Caption'#6#12'SDK version:'#11'ParentColor'#8#0#0#242#2#5#9'TComboBox'#7'cm'
+'bSDKs'#4'Left'#2'p'#6'Height'#2#20#3'Top'#2'0'#5'Width'#3#184#0#10'ItemHeig'
+'ht'#2#0#8'OnChange'#7#13'cmbSDKsChange'#5'Style'#7#14'csDropDownList'#8'Tab'
+'Order'#2#2#0#0#242#2#6#5'TEdit'#9'edtResDir'#4'Left'#2'x'#6'Height'#2#22#3
+'Top'#3#176#0#5'Width'#3#226#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0
+#8'OnChange'#7#15'edtResDirChange'#6'OnExit'#7#13'edtResDirExit'#8'TabOrder'
+#2#3#4'Text'#6#9'Resources'#0#0#242#2#7#6'TLabel'#6'Label1'#4'Left'#2#16#6'H'
+'eight'#2#18#3'Top'#3#176#0#5'Width'#2'Y'#7'Caption'#6#14'Resources dir:'#11
+#2#7'OnClick'#7#10'FrameClick'#10'DesignLeft'#3'c'#2#9'DesignTop'#3#128#0#0
+#242#2#0#9'TCheckBox'#10'chkisPhone'#4'Left'#2#16#6'Height'#2#18#3'Top'#2#16
+#5'Width'#3#199#0#7'Caption'#6#29'is iPhone application project'#8'TabOrder'
+#2#0#0#0#242#2#1#6'TLabel'#8'lblAppID'#4'Left'#2#16#6'Height'#2#18#3'Top'#2
+'X'#5'Width'#2'W'#7'Caption'#6#14'Application ID'#11'ParentColor'#8#0#0#242#2
+#2#5'TEdit'#8'edtAppID'#4'Left'#2'p'#6'Height'#2#22#3'Top'#2'U'#5'Width'#3
+#234#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#1#4'Text'
+#6#19'com.mycompany.myapp'#0#0#242#2#3#6'TLabel'#12'lblAppIDHint'#4'Left'#2
+#16#6'Height'#2#14#3'Top'#2'u'#5'Width'#3#237#1#7'Caption'#6'_It''s recommen'
+'ded by Apple to use domain-structured name, i.e. com.mycompany.myApplicatio'
+'n as ID'#11'Font.Height'#2#246#11'ParentColor'#8#10'ParentFont'#8#0#0#242#2
+#4#6'TLabel'#9'lblSDKVer'#4'Left'#2#16#6'Height'#2#18#3'Top'#2'3'#5'Width'#2
+'P'#7'Caption'#6#12'SDK version:'#11'ParentColor'#8#0#0#242#2#5#9'TComboBox'
+#7'cmbSDKs'#4'Left'#2'p'#6'Height'#2#20#3'Top'#2'0'#5'Width'#3#184#0#10'Item'
+'Height'#2#0#8'OnChange'#7#13'cmbSDKsChange'#5'Style'#7#14'csDropDownList'#8
+'TabOrder'#2#2#0#0#242#2#6#5'TEdit'#9'edtResDir'#4'Left'#2'x'#6'Height'#2#22
+#3'Top'#3#176#0#5'Width'#3#226#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'
+#0#8'OnChange'#7#15'edtResDirChange'#6'OnExit'#7#13'edtResDirExit'#8'TabOrde'
+'r'#2#3#4'Text'#6#9'Resources'#0#0#242#2#7#6'TLabel'#6'Label1'#4'Left'#2#16#6
+'Height'#2#18#3'Top'#3#176#0#5'Width'#2'Y'#7'Caption'#6#14'Resources dir:'#11
+'ParentColor'#8#0#0#242#2#8#5'TEdit'#10'edtExclude'#4'Left'#2'x'#6'Height'#2
+#22#3'Top'#3#224#0#5'Width'#3#226#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRig'
+'ht'#0#8'OnChange'#7#16'edtExcludeChange'#8'TabOrder'#2#4#4'Text'#6#4'.svn'#0

View File

@ -20,7 +20,8 @@ interface
uses
Classes,SysUtils,FileUtil,LResources,Forms,StdCtrls,Masks,CheckLst,Buttons,
Menus,IDEOptionsIntf,ProjectIntf,LazIDEIntf,iPhoneExtStr,iPhoneExtOptions, process, Controls;
Menus,IDEOptionsIntf,ProjectIntf,LazIDEIntf,iPhoneExtStr,
iPhoneExtOptions, process, Controls;
type
@ -75,6 +76,9 @@ type
property OnChanged: TNotifyEvent read fOnChanged write fOnChanged;
end;
procedure EnumFilesAtDir(const PathUtf8, AMask : AnsiString; Dst: TStrings);
procedure ExecCmdLineNoWait(const CmdLineUtf8: AnsiString);
implementation
procedure EnumFilesAtDir(const PathUtf8, AMask : AnsiString; Dst: TStrings);
@ -99,7 +103,7 @@ begin
end;
end;
procedure ExecCmdLine(const CmdLineUtf8: AnsiString; WaitExit: Boolean);
procedure ExecCmdLineNoWait(const CmdLineUtf8: AnsiString);
var
proc : TProcess;
begin
@ -169,7 +173,7 @@ var
begin
path:=ChangeFileExt(IncludeTrailingPathDelimiter(edtResDir.Text)+SelXibFile,'.xib');
LazarusIDE.ActiveProject.LongenFilename(path);
ExecCmdLine('open ' + path, false);
ExecCmdLineNoWait('open ' + path);
end;
procedure TiPhoneProjectOptionsEditor.nibFilesBoxClickCheck(Sender:TObject);