/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2015 I-maginer This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ var iWinW = 400;; var iWinH = 435;; typeof sLastDir = S;; var sExportDirectory = "export";; var lConfidentialMarks = "ftpHost"::"ftpPort"::"ftpLogin"::"ftpRoot"::"ftpDir"::"ftpWWW"::"ftpIntegrated"::"ftpUpload"::nil;; fun cbDsMainWin(winstr)= _closemachine; 0;; fun cbMkAndroidCancelBtn(ctrlbtn, winstr)= dsEdWindow winstr; _closemachine; 0;; // convert scol file into master.pkg content fun getScolScript(file)= let _getpack _checkpack file -> data in let strextr data -> ldata in let nil -> loadfuncs in let nil -> deff in ( while (ldata != nil) do ( let hd ldata -> line in if (!strcmpi hd line "_load") then ( set loadfuncs = lcat loadfuncs ("_load"::(strcat (hd tl line) ";")::nil)::nil; ) else if ((!strcmpi (strtrim hd line) "") || (hd line) == nil) then nil else ( let "defcom"::(strcat "Smain=" (hd line))::nil -> ndeff in ( let 1 -> i in let sizelist line -> size in while (i < size) do ( let nth_list line i -> w in if ((!strcmpi (strtrim w) "") || (w == nil)) then nil else set ndeff = lcat ndeff if ((atoi w) == nil) then "S"::nil else "I"::nil; set i = i + 1; ); set ndeff = lcat ndeff ";;"::nil; set deff = ndeff::nil; ); let lcat (lcat "_script"::"mkscript"::"Smain"::"["::nil tl line) "];"::nil -> mainfunc in set loadfuncs = lcat loadfuncs mainfunc::nil; ); set ldata = tl ldata; ); [deff loadfuncs]; );; fun fileExist(l, file)= if l ==nil then 0 else if (!strcmp (hd l) file) then 1 else fileExist (tl l) file;; fun findExcluFile(lfiles)= let sizelist lfiles -> size in let nil -> nlist in let 0 -> i in ( while i < size do ( let nth_list lfiles i -> file in let getFileExt file -> ext in if (!strcmpi "bak" ext) || (!strcmpi "scol" ext) || (!strcmpi "max" ext) || (!strcmpi "psd" ext) || (!strcmpi "exe" ext) || (!strcmpi "php" ext) || (!strcmpi "db" ext) || (fileExist nlist file) then nil else set nlist = file::nlist; set i = i + 1; ); nlist; );; fun getFileContent(file)= //test for xos file and remove private content let getFileExt file -> ext in if (!strcmpi ext "xos") then ( let XMLload file -> xmlstr in ( let XMLgetMarkByValue xmlstr "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in let sizelist lConfidentialMarks -> size in let 0 -> i in ( while (i < size) do ( let nth_list lConfidentialMarks i -> key in let XMLgetMarkByValueFromMarkSons srcsettingmark key -> mark in if (mark == nil) then nil else XMLdelMark xmlstr mark; set i = i + 1; ); ); XMLserializeZipped xmlstr; ); ) else ( _getpack _checkpack file; );; fun getAndroidShortName(name)= let strToWordList (strreplace name "_" "") -> lw in let "" -> nname in ( while (lw != nil) do ( //no number after a dot! let hd lw -> word in if ((atoi (substr word 0 1)) == nil) then set nname = strcatn nname::"."::word::nil else set nname = strcat nname word; set lw = tl lw; ); //do strlowercase on the copied string, this modify the original string otherwise strlowercase nname; );; fun makeAndroidSigninKey(storefile, keyname, password, lp)= _MAKEandroidSigningKey storefile password keyname lp;; fun makeAndroidAPK(appname, manifestpath)= _MAKEandroidUnsignedAPK appname (_checkpack manifestpath);; fun signAndroidAPK(apkfile, storefile, keyname, password)= _SIGNandroidAPK apkfile storefile password keyname;; fun installAndroidAPK(apkfile)= _INSTALLandroidAPK apkfile;; fun cbDlgAndroidGetScolPath(dlg, p, pfile)= let p -> [ctrlbtn ctrltext ctrlprjname] in ( if pfile == nil then nil else let _PtoScol pfile -> fname in let getPathFile fname "" -> [dir filename] in let getFilePathWithoutExt filename -> prjname in ( set sLastDir = dir; setEdCtrlTextLineValue ctrltext fname; setEdCtrlTextLineValue ctrlprjname prjname; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnAndroidScolPath(ctrlbtn, p)= let p -> [winstr ctrltext ctrlprjname] in ( setEdCtrlButtonEnable ctrlbtn 0; _DLGrflopen _DLGOpenFile _channel winstr.EDW_win sLastDir nil "Scol\0*.scol\0All\0*.*\0\0" @cbDlgAndroidGetScolPath [ctrlbtn ctrltext ctrlprjname]; ); 0;; fun cbDlgAndroidGetProjectPath(dlg, p, dir)= let p -> [ctrlbtn ctrllist] in ( set sLastDir = dir; addEdCtrlList ctrllist dir nil 1; setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnAndroidProjectPath(ctrlbtn, p)= let p -> [winstr ctrllist] in ( setEdCtrlButtonEnable ctrlbtn 0; _DLGrflopenDir _DLGOpenDir _channel winstr.EDW_win nil "Project directory" @cbDlgAndroidGetProjectPath [ctrlbtn ctrllist]; ); 0;; fun cbDlgAndroidGetProjectFile(dlg, p, pfile)= let p -> [ctrlbtn ctrllist] in ( if pfile == nil then nil else let _PtoScol pfile -> fname in let getPathFile fname "" -> [dir filename] in ( set sLastDir = dir; addEdCtrlList ctrllist fname nil 0; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnAndroidProjectFile(ctrlbtn, p)= let p -> [winstr ctrllist] in ( setEdCtrlButtonEnable ctrlbtn 0; _DLGrflopen _DLGOpenFile _channel winstr.EDW_win sLastDir nil "All\0*.*\0\0" @cbDlgAndroidGetProjectFile [ctrlbtn ctrllist]; ); 0;; fun cbDlgAndroidGetIconPath(dlg, p, pfile)= let p -> [ctrlbtn ctrltext] in ( if pfile == nil then nil else let _PtoScol pfile -> fname in let getPathFile fname "" -> [dir filename] in ( set sLastDir = dir; setEdCtrlTextLineValue ctrltext fname; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnAndroidPickIconPath(ctrlbtn, p)= let p -> [winstr ctrltext] in ( setEdCtrlButtonEnable ctrlbtn 0; _DLGrflopen _DLGOpenFile _channel winstr.EDW_win sLastDir nil "Bitmaps\0*.bmp;*.jpg;*.png;*.tga;\0Bitmap\0*.bmp\0Jpeg\0*.jpg\0Png\0*.png\0All\0*.*\0\0" @cbDlgAndroidGetIconPath [ctrlbtn ctrltext]; ); 0;; fun cbBtnClearValue(ctrlbtn, p)= let p -> [winstr ctrltext] in setEdCtrlTextLineValue ctrltext nil; 0;; fun cbBtnClearList(ctrlbtn, p)= let p -> [winstr ctrllist] in resetEdCtrlList ctrllist; 0;; fun cbDlgAndroidGetKeyStorePath(dlg, p, pfile)= let p -> [ctrlbtn ctrltext] in ( if pfile == nil then nil else let _PtoScol pfile -> fname in let getPathFile fname "" -> [dir filename] in ( set sLastDir = dir; setEdCtrlTextLineValue ctrltext fname; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnAndroidPickKeyStorePath(ctrlbtn, p)= let p -> [winstr ctrltext] in ( setEdCtrlButtonEnable ctrlbtn 0; _DLGrflopen _DLGOpenFile _channel winstr.EDW_win sLastDir nil "Key Store (*.keystore)\0*.keystore\0All\0*.*\0\0" @cbDlgAndroidGetKeyStorePath [ctrlbtn ctrltext]; ); 0;; fun cbMkAndroidCancelKeyStoreBtn(ctrlbtn, p)= let p -> [winstr ctrlbtn] in ( dsEdWindow winstr; setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbAndroidCreateKeyStoreOk(ctrlbtn, p)= let p -> [pwinstr winstr ctrltext wfile ctrlbtn1 ctrlcn ctrlo ctrlcity ctrlcountry ctrlpass ctrlpass2 ctrlprjname ctrlkeystorepass] in let _WtoP wfile -> pfile in let getEdCtrlTextLineValue ctrlprjname -> projname in let if !strcmp projname "" then "project" else projname -> projname in let getAndroidShortName projname -> shortname in let getEdCtrlTextLineValue ctrlpass -> pass in let getEdCtrlTextLineValue ctrlpass2 -> pass2 in let getEdCtrlTextLineValue ctrlcn -> author in let getEdCtrlTextLineValue ctrlo -> compagny in let getEdCtrlTextLineValue ctrlcountry -> country in let getEdCtrlTextLineValue ctrlcity -> city in if (!strcmp pass pass2) && (strcmp strtrim pass "") && (strcmp strtrim country "") then ( let makeAndroidSigninKey wfile shortname pass ["CN" author]::["O" compagny]::["C" country]::["L" city]::nil -> [keystore output] in if (keystore != nil) then ( dsEdWindow winstr; let _PtoScol pfile -> fname in setEdCtrlTextLineValue ctrltext fname; setEdCtrlTextLineValue ctrlkeystorepass pass; setEdCtrlButtonEnable ctrlbtn1 1; setEdWindowFocus pwinstr; 0; ) else ( // error _DLGMessageBox _channel pwinstr.EDW_win "Error" strcat "Error during keystore generation.\n\n" output 0; 0; ); ) else ( //error password or country empty _DLGMessageBox _channel pwinstr.EDW_win "Error" "Passwords do not match or the field \"country code\" is empty." 0; 0; ); 0;; fun cbDlgAndroidSetKeyStorePath(dlg, p, wfile)= let p -> [pwinstr ctrlbtn ctrltext ctrlprjname ctrlkeystorepass] in ( if wfile == nil then nil else ( let _WtoP wfile -> pfile in if ((_PtoScol pfile) == nil) then nil else ( let getFileExt _PtoScol pfile -> ext in if (!strcmpi ext "keystore") then nil else set wfile = _getmodifypack strcat _PtoScol pfile ".keystore"; ); let _GETscreenSize -> [sw sh] in let [430 205] -> [iw ih] in let 10 -> ypos in ( let crEdModalDialogWindow _channel pwinstr ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil "Create a signing keystore" -> winstr in let crEdCtrlLabel winstr 10 ypos + 2 200 20 "Author name" nil -> labelcn in let crEdCtrlTextLine winstr 220 ypos (iw - 230) 20 "" nil EDWIN_RESIZE_MW -> ctrlcn in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 200 20 "Company" nil -> labelo in let crEdCtrlTextLine winstr 220 ypos (iw - 230) 20 "" nil EDWIN_RESIZE_MW -> ctrlo in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 200 20 "City" nil -> labelcity in let crEdCtrlTextLine winstr 220 ypos (iw - 230) 20 "" nil EDWIN_RESIZE_MW -> ctrlcity in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 200 20 "Country code (US)" nil -> labelcountry in let crEdCtrlTextLine winstr 220 ypos (iw - 230) 20 "" nil EDWIN_RESIZE_MW -> ctrlcountry in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 200 20 "Password" nil -> labelpass in let crEdCtrlTextLine winstr 220 ypos (iw - 230) 20 "" ET_BORDER|ET_AHSCROLL|ET_TABFOCUS|ET_PASSWORD EDWIN_RESIZE_MW -> ctrlpass in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 200 20 "Password verification" nil -> labelpass2 in let crEdCtrlTextLine winstr 220 ypos (iw - 230) 20 "" ET_BORDER|ET_AHSCROLL|ET_TABFOCUS|ET_PASSWORD EDWIN_RESIZE_MW -> ctrlpass2 in let crEdCtrlButton winstr 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_MW -> ctrlok in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_MW -> ctrlcancel in ( setEdCtrlButtonCb ctrlok mkfun2 @cbAndroidCreateKeyStoreOk [pwinstr winstr ctrltext wfile ctrlbtn ctrlcn ctrlo ctrlcity ctrlcountry ctrlpass ctrlpass2 ctrlprjname ctrlkeystorepass]; setEdCtrlButtonCb ctrlcancel mkfun2 @cbMkAndroidCancelKeyStoreBtn [winstr ctrlbtn]; ); ); ); ); 0;; fun cbBtnAndroidCreateKeyStore(ctrlbtn, p)= let p -> [winstr ctrltext ctrlprjname ctrlkeystorepass] in ( setEdCtrlButtonEnable ctrlbtn 0; _DLGrflsave _DLGSaveFile _channel winstr.EDW_win nil nil "Key Store (*.keystore)\0*.keystore\0All\0*.*\0\0" @cbDlgAndroidSetKeyStorePath [winstr ctrlbtn ctrltext ctrlprjname ctrlkeystorepass]; ); 0;; fun copyAndroidFilesToExportDirectory(dir, lfiles, projname, iconpath, scriptpath, keystorepath, pass)= let getAndroidShortName projname -> shortname in ( //copy scol base let getFilesFromDirRecursive "bin" -> lbase in while lbase != nil do ( let hd lbase -> file in _storepack (_getpack _checkpack file) strcatn dir::"/"::file::nil; set lbase = tl lbase; ); let getFilesFromDirRecursive "dex" -> lbase in while lbase != nil do ( let hd lbase -> file in _storepack (_getpack _checkpack file) strcatn dir::"/"::file::nil; set lbase = tl lbase; ); let getFilesFromDirRecursive "package" -> lbase in while lbase != nil do ( let hd lbase -> file in _storepack (_getpack _checkpack file) strcatn dir::"/"::file::nil; set lbase = tl lbase; ); let getFilesFromDirRecursive "res" -> lbase in while lbase != nil do ( let hd lbase -> file in _storepack (_getpack _checkpack file) strcatn dir::"/"::file::nil; set lbase = tl lbase; ); while lfiles != nil do ( let hd lfiles -> file in _storepack (getFileContent file) strcatn dir::"/package/assets/partition/"::file::nil; set lfiles = tl lfiles; ); if (iconpath == nil) then nil else ( let G2DloadAlphaBmp _channel iconpath -> icon_src in ( // XHDPI ICON let _CRbitmap _channel 96 96 -> bmp in let _CRbitmap8 _channel 96 96 -> bmp8 in let _CRalphaBitmap _channel bmp bmp8 nil nil -> abmp in let _BTSCALEalphaBitmap abmp icon_src 2 -> icon_xhdpi in ( _BTSAVEalphaBitmap icon_xhdpi _getmodifypack strcatn dir::"/res/drawable-xhdpi/ic_launcher.png"::nil; _DSbitmap bmp; _DSbitmap8 bmp8; _DSalphaBitmap abmp; ); // HDPI ICON let _CRbitmap _channel 72 72 -> bmp in let _CRbitmap8 _channel 72 72 -> bmp8 in let _CRalphaBitmap _channel bmp bmp8 nil nil -> abmp in let _BTSCALEalphaBitmap abmp icon_src 2 -> icon_hdpi in ( _BTSAVEalphaBitmap icon_hdpi _getmodifypack strcatn dir::"/res/drawable-hdpi/ic_launcher.png"::nil; _DSbitmap bmp; _DSbitmap8 bmp8; _DSalphaBitmap abmp; ); // MDPI ICON let _CRbitmap _channel 48 48 -> bmp in let _CRbitmap8 _channel 48 48 -> bmp8 in let _CRalphaBitmap _channel bmp bmp8 nil nil -> abmp in let _BTSCALEalphaBitmap abmp icon_src 2 -> icon_mdpi in ( _BTSAVEalphaBitmap icon_mdpi _getmodifypack strcatn dir::"/res/drawable-mdpi/ic_launcher.png"::nil; _DSbitmap bmp; _DSbitmap8 bmp8; _DSalphaBitmap abmp; ); // LDPI ICON let _CRbitmap _channel 36 36 -> bmp in let _CRbitmap8 _channel 36 36 -> bmp8 in let _CRalphaBitmap _channel bmp bmp8 nil nil -> abmp in let _BTSCALEalphaBitmap abmp icon_src 2 -> icon_ldpi in ( _BTSAVEalphaBitmap icon_ldpi _getmodifypack strcatn dir::"/res/drawable-ldpi/ic_launcher.png"::nil; _DSbitmap bmp; _DSbitmap8 bmp8; _DSalphaBitmap abmp; ); _DSalphaBitmap icon_src; ); ); //let _checkpack (getProjectSetting "splashpath") -> psplash in //if (psplash == nil) then nil else // _storepack (_getpack psplash) strcatn dir::"/package/assets/partition/"::APPBASEDIR::"os3dplayer/splash.png"::nil; //make manifest let _getpack _checkpack "AndroidManifest.xml.in" -> manifest in ( set manifest = strreplace manifest "@ANDROID_PKG_NAME@" strcat "os3d.app." shortname; set manifest = strreplace manifest "@ANDROID_APP_NAME@" projname; _storepack manifest strcatn dir::"/AndroidManifest.xml"::nil; ); let getScolScript scriptpath -> [deff loadfuncs] in //make master.pkg let ("typeof"::"env_ref=Env;;"::nil):: //("defcom"::"Smain=main"::"S"::"S"::"S"::"S"::"I;;"::nil):: ("fun"::"multiress(res)="::nil):: ("if"::"res==nil"::"then"::nil):: ("0"::nil):: ("else"::nil):: ("let"::"res"::"->"::"[l"::"nxt]"::"in"::nil):: ("("::nil):: ("_setress"::"hd"::"l"::"hd"::"tl"::"l;"::nil):: ("multiress"::"nxt;"::nil):: (");;"::nil):: ("fun"::"main(p)="::nil):: ("set"::"env_ref=_envchannel"::"_channel;"::nil):: ("multiress"::"strextr"::"_loadressini;"::nil):: ("srand"::"time;"::nil):: //("_load"::(strcatn "\""::APPBASEDIR::"os3dplayer/os3dload.pkg\";"::nil)::nil):: //("_script"::"mkscript"::"Smain"::(strcatn "[\""::xmlpath::"\""::nil)::(strcatn "\""::projname::"\""::nil)::(strcatn "\""::(itoa 1280)::"\""::nil)::(strcatn "\""::(itoa 720)::"\""::nil)::"0];"::nil):: //("0;;"::nil)::nil nil -> pmaster in let lcat deff (lcat (lcat pmaster loadfuncs) ("0;;"::nil)::nil) -> pmaster in _storepack (strbuild pmaster) strcatn dir::"/package/assets/partition/locked/master.pkg"::nil; if (keystorepath != nil) then nil else let makeAndroidSigninKey _getmodifypack "keystores/default.keystore" shortname "password" ["CN" "I-Maginer"]::["C" "FR"]::nil -> [keystore output] in set keystorepath = keystore; if (pass != nil && strcmp pass "") then nil else set pass = "password"; let makeAndroidAPK shortname (strcat dir "/AndroidManifest.xml") -> [unsignedapk output] in if unsignedapk == nil then [unsignedapk output] else signAndroidAPK unsignedapk keystorepath shortname pass; );; fun cbMkAndroidDoneBtn(ctrlbtn, p)= let p -> [winstr scriptpath exportdir projname] in ( dsEdWindow winstr; let _checkpack scriptpath -> pscript in let _PtoScol pscript -> sscript in let _PtoS pscript -> fscript in let substr fscript 0 ((strlen fscript) - (strlen sscript)) -> cpath in let strcatn cpath::(strreplace exportdir "/" "\\")::nil -> fullpath in ( _startExe "launch" "openExplorer" strcatn "\""::fullpath::"\""::nil; ); ); 0;; fun mkStandAloneListFiles(lres)= let getFilesFromDir "locked" nil -> locked in let getFilesFromDirRecursive "locked/etc" -> etc in let getFilesFromDirRecursive "locked/lib" -> lcklib in //let getFilesFromDirRecursive strcat APPBASEDIR "os3dlib" -> lib in //let getFilesFromDirRecursive strcat APPBASEDIR "os3dplayer" -> player in //let getMkAppletXmlResources xmlpath -> lres in let nil -> nres in ( while (lres != nil) do ( let hd lres -> path in if ((_checkpack path) != nil) then ( set nres = path::nres; ) else if ((path == nil) || (!strcmpi (strtrim path) "")) then nil else ( set nres = lcat nres (getFilesFromDirRecursive path); ); set lres = tl lres; ); listLowercase findExcluFile (lcat (lcat (lcat locked etc) lcklib) nres); );; fun cbMkAndroidOk(ctrlbtn, p)= let p -> [pwinstr ctrlprjname ctrlfileslist ctrlscolfile ctrliconpath ctrlkeystorepath ctrlkeystorepass ctrldeploy] in let getEdCtrlTextLineValue ctrlprjname -> projname in let if !strcmp projname "" then "project" else projname -> projname in let getEdCtrlListElems ctrlfileslist -> resfiles in let getEdCtrlTextLineValue ctrlscolfile -> scriptpath in let getEdCtrlTextLineValue ctrliconpath -> iconpath in let getEdCtrlTextLineValue ctrlkeystorepath -> keystorepath in let getEdCtrlTextLineValue ctrlkeystorepass -> pass in let getEdCtrlCheckState ctrldeploy -> deploy in let _GETscreenSize -> [sw sh] in let [430 120] -> [iw ih] in let (strcatn sExportDirectory::"/Android"::"/"::projname::nil) -> exportdir in ( let crEdModalDialogWindow _channel pwinstr ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil "Export to Android application" -> winstr in let crEdCtrlLabelEx winstr 10 12 iw-20 50 "Exporting, please wait ..." ET_ALIGN_CENTER nil -> labelport in let crEdCtrlButton winstr ((iw /2) - 45) (ih - 30) 90 20 "Done" EDWIN_RESIZE_MW -> ctrldone in ( setEdCtrlButtonEnable ctrldone 0; _addPartition "./androidDeployerTools/scolbase" 2; let mkStandAloneListFiles iconpath::resfiles -> lfiles in ( cleanDirectory exportdir; let copyAndroidFilesToExportDirectory exportdir lfiles projname iconpath scriptpath (_checkpack keystorepath) pass -> [signedapk output] in if (signedapk != nil) then ( if (!deploy) then nil else installAndroidAPK signedapk; setEdCtrlButtonCb ctrldone mkfun2 @cbMkAndroidDoneBtn [winstr scriptpath exportdir projname]; setEdWindowFocus winstr; 0; ) else ( dsEdWindow winstr; _DLGMessageBox _channel pwinstr.EDW_win "Error" strcat "The APK file was not generated, check the signing password and file.\n Also check to project files names and avoid special char (accent, ...)\n\n" output 0; 0; ); ); _removeLastPartition; setEdCtrlLabelValue labelport strcatn "Export complete in \""::exportdir::"\" directory"::nil; setEdCtrlButtonEnable ctrldone 1; ); ); 0;; fun main()= _refreshExe; //_showconsole; let _GETdesktopSize -> [sw sh] in set mainWindow = crEdMainWindow _channel nil ((sw / 2) - (iWinW / 2)) ((sh / 2) - (iWinH / 2)) iWinW iWinH nil "Scol Android APK generator"; set mainWindow.EDW_modeFlag = mainWindow.EDW_modeFlag|EDWIN_GROUP; setEdwindowCbDestroy mainWindow @cbDsMainWin; let 10 -> ipos in let iWinW -> iw in let iWinH -> ih in let crEdFrameWindow _channel mainWindow 0 0 iw 210 EDWIN_RESIZE_MW nil "Paths" "Minimize / Restore" -> winfrm in let crEdWindow _channel winfrm 0 18 iw 205 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ipos + 2 160 20 "Scol file" nil -> labelscolfile in let crEdCtrlTextLine winstr 180 ipos (iw - 270) 20 nil nil EDWIN_RESIZE_MW -> ctrlscolfile in let crEdCtrlButton winstr (iw - 85) ipos 35 20 "..." nil -> pickscolfilebtn in let crEdCtrlLabel winstr 10 ((set ipos = ipos + 25) + 2) 160 20 "Project files" nil -> labelprjdir in let crEdCtrlList winstr 10 (set ipos = ipos + 25) (iw - 20) 100 nil EDWIN_RESIZE_MW -> ctrlfileslist in let crEdCtrlButton winstr 10 (set ipos = ipos + 105) 55 20 "Add file" nil -> pickprjfilebtn in let crEdCtrlButton winstr 75 ipos 55 20 "Add dir" nil -> pickprjdirbtn in let crEdCtrlButton winstr (iw - 45) ipos 35 20 "X" nil -> refresprjbtn in let crEdFrameWindow _channel mainWindow 0 0 iw 80 EDWIN_RESIZE_MW nil "Settings" "Minimize / Restore" -> winfrm in let crEdWindow _channel winfrm 0 18 iw 70 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ipos = 10) + 2) 160 20 "Project name" nil -> labelname in let crEdCtrlTextLine winstr 180 ipos (iw - 270) 20 nil nil EDWIN_RESIZE_MW -> ctrlprjname in let crEdCtrlLabel winstr 10 ((set ipos = ipos + 25) + 2) 160 20 "Icon path" nil -> labelicon in let crEdCtrlTextLine winstr 180 ipos (iw - 270) 20 nil nil EDWIN_RESIZE_MW -> ctrliconpath in let crEdCtrlButton winstr (iw - 85) ipos 35 20 "..." nil -> pickiconbtn in let crEdCtrlButton winstr (iw - 45) ipos 35 20 "X" nil -> refreshiconbtn in let crEdFrameWindow _channel mainWindow 0 0 iw 110 EDWIN_RESIZE_MW nil "File sign" "Minimize / Restore" -> winfrm in let crEdWindow _channel winfrm 0 18 iw 95 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ipos = 10) + 2) 160 20 "Signing keystore file" nil -> labelkeystore in let crEdCtrlTextLine winstr 180 ipos (iw - 270) 20 nil nil EDWIN_RESIZE_MW -> ctrlkeystorepath in let crEdCtrlButton winstr (iw - 85) ipos 35 20 "..." nil -> pickkeystorebtn in let crEdCtrlButton winstr (iw - 45) ipos 35 20 "+" nil -> newkeystorebtn in let crEdCtrlLabel winstr 10 ((set ipos = ipos + 25) + 2) 160 20 "Keystore password" nil -> labelpass in let crEdCtrlTextLine winstr 180 ipos (iw - 270) 20 nil ET_BORDER|ET_AHSCROLL|ET_TABFOCUS|ET_PASSWORD EDWIN_RESIZE_MW -> ctrlkeystorepass in let crEdCtrlCheck winstr 10 (set ipos = ipos + 25) (iw - 20) 20 "Install on connected device" EDWIN_RESIZE_MW -> ctrldeploy in let crEdCtrlButton mainWindow 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_MW -> ctrlok in let crEdCtrlButton mainWindow (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_MW -> ctrlcancel in let [winstr ctrlprjname ctrlfileslist ctrlscolfile ctrliconpath ctrlkeystorepath ctrlkeystorepass ctrldeploy] -> p in ( //setEdCtrlTextLineEnable ctrlprjdir 0; setEdCtrlTextLineEnable ctrlscolfile 0; setEdCtrlTextLineEnable ctrliconpath 0; setEdCtrlButtonCb pickscolfilebtn mkfun2 @cbBtnAndroidScolPath [winstr ctrlscolfile ctrlprjname]; setEdCtrlButtonCb pickprjdirbtn mkfun2 @cbBtnAndroidProjectPath [winstr ctrlfileslist]; setEdCtrlButtonCb pickprjfilebtn mkfun2 @cbBtnAndroidProjectFile [winstr ctrlfileslist]; setEdCtrlButtonCb refresprjbtn mkfun2 @cbBtnClearList [winstr ctrlfileslist]; setEdCtrlButtonCb pickiconbtn mkfun2 @cbBtnAndroidPickIconPath [winstr ctrliconpath]; setEdCtrlButtonCb refreshiconbtn mkfun2 @cbBtnClearValue [winstr ctrliconpath]; setEdCtrlTextLineEnable ctrlkeystorepath 0; setEdCtrlButtonCb pickkeystorebtn mkfun2 @cbBtnAndroidPickKeyStorePath [winstr ctrlkeystorepath]; setEdCtrlButtonCb newkeystorebtn mkfun2 @cbBtnAndroidCreateKeyStore [winstr ctrlkeystorepath ctrlprjname ctrlkeystorepass]; setEdCtrlButtonCb ctrlok mkfun2 @cbMkAndroidOk p; setEdCtrlButtonCb ctrlcancel mkfun2 @cbMkAndroidCancelBtn winstr; ); 0;;