*/}}

la_operators.c 117 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624
  1. /*
  2. * LaGUI: A graphical application framework.
  3. * Copyright (C) 2022-2023 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "../la_5.h"
  19. extern LA MAIN;
  20. extern struct _tnsMain *T;
  21. void la_PanelActiviatorParser(laStringSplitor *ss, uint32_t *IconID, char *DisplayString){
  22. char *StrArg;
  23. if (ss && ss->parts.pFirst){
  24. if (StrArg = strGetArgumentString(ss, "text")){
  25. strCopyFull(DisplayString, StrArg);
  26. }else if (StrArg = strGetArgumentString(ss, "panel_id")){
  27. laUiTemplate* uit = laFindUiTemplate(StrArg);
  28. strCopyFull(DisplayString, transLate("Show "));
  29. strAppend(DisplayString, uit->Title->Ptr);
  30. }
  31. }else{
  32. strCopyFull(DisplayString, transLate("Activate A Panel"));
  33. }
  34. }
  35. void la_DefaultOperatorParser(laStringSplitor *ss, uint32_t *IconID, char *DisplayString){
  36. char *StrArg;
  37. laStringPart *sp;
  38. if (ss && ss->parts.pFirst){
  39. if (StrArg = strGetArgumentString(ss, "text")){
  40. strCopyFull(DisplayString, StrArg);
  41. }
  42. if (StrArg = strGetArgumentString(ss, "icon")){
  43. int adv=0; *IconID = laToUnicode(StrArg, &adv);
  44. }
  45. }
  46. }
  47. laProp *la_PropLookup(laListHandle *lst, char *ID);
  48. void la_EnsurePanelSnapping(laPanel *p, int CW, int CH);
  49. void la_RecalcBlockRecursive(laBlock *b, int X, int Y, int W, int H);
  50. void la_ConditionNodeFreeRecursive(laUiConditionNode *ucn);
  51. int OPMOD_FinishOnData(laOperator* a, laEvent* e){
  52. if(a->ConfirmData){
  53. return LA_FINISHED_PASS;
  54. }
  55. return LA_RUNNING;
  56. }
  57. void OPEXT_FreeUserData(laOperator* a, int mark_unused){
  58. if(a->CustomData) memFree(a->CustomData);
  59. }
  60. int OPCHK_AlwaysTrue(laPropPack *pp, laStringSplitor *ss){
  61. return 1;
  62. }
  63. int OPINV_DoNothing(laOperator *a, laEvent *e){
  64. return LA_FINISHED;
  65. }
  66. int OPINV_PureYesNo(laOperator *a, laEvent *e){
  67. laEnableYesNoPanel(a, 0, "Please Consider:", "Are You Sure?", 80, 80, 250, e);
  68. return LA_FINISHED;
  69. }
  70. #define DEFINE_FORMAT(str, type) \
  71. if (!strcmp(format, str)) return type;
  72. int la_DetectFileItemType(char* format){
  73. for(laExtensionType* et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){ DEFINE_FORMAT(et->Extension, et->FileType); }
  74. DEFINE_FORMAT("lasdexchange", LA_FILETYPE_LASDEXCHANGE);
  75. DEFINE_FORMAT("odt", LA_FILETYPE_DOCUMENT);
  76. DEFINE_FORMAT("ods", LA_FILETYPE_DOCUMENT);
  77. DEFINE_FORMAT("odp", LA_FILETYPE_DOCUMENT);
  78. DEFINE_FORMAT("txt", LA_FILETYPE_DOCUMENT);
  79. DEFINE_FORMAT("c", LA_FILETYPE_DOCUMENT);
  80. DEFINE_FORMAT("cpp", LA_FILETYPE_DOCUMENT);
  81. DEFINE_FORMAT("cxx", LA_FILETYPE_DOCUMENT);
  82. DEFINE_FORMAT("cs", LA_FILETYPE_DOCUMENT);
  83. DEFINE_FORMAT("pas", LA_FILETYPE_DOCUMENT);
  84. DEFINE_FORMAT("h", LA_FILETYPE_DOCUMENT);
  85. DEFINE_FORMAT("hpp", LA_FILETYPE_DOCUMENT);
  86. DEFINE_FORMAT("hxx", LA_FILETYPE_DOCUMENT);
  87. DEFINE_FORMAT("inl", LA_FILETYPE_DOCUMENT);
  88. DEFINE_FORMAT("doc", LA_FILETYPE_DOCUMENT);
  89. DEFINE_FORMAT("docx", LA_FILETYPE_DOCUMENT);
  90. DEFINE_FORMAT("xls", LA_FILETYPE_DOCUMENT);
  91. DEFINE_FORMAT("xlsx", LA_FILETYPE_DOCUMENT);
  92. DEFINE_FORMAT("ppt", LA_FILETYPE_DOCUMENT);
  93. DEFINE_FORMAT("pptx", LA_FILETYPE_DOCUMENT);
  94. DEFINE_FORMAT("rtf", LA_FILETYPE_DOCUMENT);
  95. DEFINE_FORMAT("md", LA_FILETYPE_DOCUMENT);
  96. DEFINE_FORMAT("jpg", LA_FILETYPE_IMAGE);
  97. DEFINE_FORMAT("jpeg", LA_FILETYPE_IMAGE);
  98. DEFINE_FORMAT("png", LA_FILETYPE_IMAGE);
  99. DEFINE_FORMAT("tga", LA_FILETYPE_IMAGE);
  100. DEFINE_FORMAT("bmp", LA_FILETYPE_IMAGE);
  101. DEFINE_FORMAT("exr", LA_FILETYPE_IMAGE);
  102. DEFINE_FORMAT("psd", LA_FILETYPE_IMAGE);
  103. DEFINE_FORMAT("kra", LA_FILETYPE_IMAGE);
  104. DEFINE_FORMAT("dng", LA_FILETYPE_IMAGE);
  105. DEFINE_FORMAT("cr2", LA_FILETYPE_IMAGE);
  106. DEFINE_FORMAT("dds", LA_FILETYPE_IMAGE);
  107. DEFINE_FORMAT("mp3", LA_FILETYPE_AUDIO);
  108. DEFINE_FORMAT("wav", LA_FILETYPE_AUDIO);
  109. DEFINE_FORMAT("ape", LA_FILETYPE_AUDIO);
  110. DEFINE_FORMAT("flac", LA_FILETYPE_AUDIO);
  111. DEFINE_FORMAT("cue", LA_FILETYPE_AUDIO);
  112. DEFINE_FORMAT("wma", LA_FILETYPE_AUDIO);
  113. DEFINE_FORMAT("aac", LA_FILETYPE_AUDIO);
  114. DEFINE_FORMAT("m4a", LA_FILETYPE_AUDIO);
  115. DEFINE_FORMAT("ogg", LA_FILETYPE_AUDIO);
  116. DEFINE_FORMAT("mp4", LA_FILETYPE_VIDEO);
  117. DEFINE_FORMAT("mov", LA_FILETYPE_VIDEO);
  118. DEFINE_FORMAT("avi", LA_FILETYPE_VIDEO);
  119. DEFINE_FORMAT("avchd", LA_FILETYPE_VIDEO);
  120. DEFINE_FORMAT("mkv", LA_FILETYPE_VIDEO);
  121. DEFINE_FORMAT("qt", LA_FILETYPE_VIDEO);
  122. DEFINE_FORMAT("flv", LA_FILETYPE_VIDEO);
  123. DEFINE_FORMAT("zip", LA_FILETYPE_COMPRESSED);
  124. DEFINE_FORMAT("rar", LA_FILETYPE_COMPRESSED);
  125. DEFINE_FORMAT("gz", LA_FILETYPE_COMPRESSED);
  126. DEFINE_FORMAT("bz", LA_FILETYPE_COMPRESSED);
  127. DEFINE_FORMAT("7z", LA_FILETYPE_COMPRESSED);
  128. DEFINE_FORMAT("iso", LA_FILETYPE_COMPRESSED);
  129. DEFINE_FORMAT("dmg", LA_FILETYPE_COMPRESSED);
  130. DEFINE_FORMAT("ttf", LA_FILETYPE_FONT);
  131. DEFINE_FORMAT("otf", LA_FILETYPE_FONT);
  132. DEFINE_FORMAT("woff", LA_FILETYPE_FONT);
  133. DEFINE_FORMAT("svg", LA_FILETYPE_VECTOR);
  134. DEFINE_FORMAT("dwg", LA_FILETYPE_VECTOR);
  135. DEFINE_FORMAT("dxf", LA_FILETYPE_VECTOR);
  136. DEFINE_FORMAT("cdr", LA_FILETYPE_VECTOR);
  137. DEFINE_FORMAT("htm", LA_FILETYPE_WEBPAGE);
  138. DEFINE_FORMAT("html", LA_FILETYPE_WEBPAGE);
  139. DEFINE_FORMAT("xhtml", LA_FILETYPE_WEBPAGE);
  140. DEFINE_FORMAT("xml", LA_FILETYPE_META);
  141. DEFINE_FORMAT("dat", LA_FILETYPE_META);
  142. DEFINE_FORMAT("json", LA_FILETYPE_META);
  143. DEFINE_FORMAT("blend", LA_FILETYPE_BLEND);
  144. DEFINE_FORMAT("pdf", LA_FILETYPE_PDF);
  145. DEFINE_FORMAT("exe", LA_FILETYPE_EXEC);
  146. DEFINE_FORMAT("dll", LA_FILETYPE_SYS);
  147. DEFINE_FORMAT("sys", LA_FILETYPE_SYS);
  148. return 0;
  149. }
  150. int la_AcceptFileFormat(laFileBrowser* fb, char* format){
  151. if(!format || !format[0]) return 1;
  152. char buf[2048];
  153. if(fb->FilterType){
  154. for(laExtensionType* et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){
  155. if(et->FileType==fb->FilterType && strSame(format, et->Extension)) return 1;
  156. if(fb->ShowBackups){
  157. sprintf(buf,"%s~",et->Extension);
  158. if(strSame(format,buf)) return 1;
  159. }
  160. }
  161. return 0;
  162. }
  163. if(!fb->ss_filter_extensions) return 1;
  164. for(laStringPart* sp=fb->ss_filter_extensions->parts.pFirst;sp;sp=sp->Item.pNext){
  165. if(!strcmp(sp->Content, format)) return 1;
  166. if(fb->ShowBackups){
  167. sprintf(buf,"%s~",sp->Content);
  168. if(strSame(format,buf)) return 1;
  169. }
  170. }
  171. return 0;
  172. }
  173. typedef int (*FileSortCompF)(laFileItem* f1,laFileItem* f2);
  174. #if defined (_WIN32) || defined (LAGUI_ANDROID)
  175. #define strverscmp strcmp
  176. #endif
  177. int la_filecompname(laFileItem* f1,laFileItem* f2){ return strverscmp(f2->Name, f1->Name); }
  178. int la_filecompnamerev(laFileItem* f1,laFileItem* f2){ return strverscmp(f1->Name, f2->Name); }
  179. int la_filecomptime(laFileItem* f1,laFileItem* f2){ return f1->Timestamp - f2->Timestamp; }
  180. int la_filecomptimerev(laFileItem* f1,laFileItem* f2){ return f2->Timestamp - f1->Timestamp; }
  181. int la_filecompsize(laFileItem* f1,laFileItem* f2){ return f1->Size - f2->Size; }
  182. int la_filecompsizerev(laFileItem* f1,laFileItem* f2){ return f2->Size - f1->Size; }
  183. #ifdef _WIN32
  184. #undef strverscmp
  185. #endif
  186. void la_SortFiles(laFileBrowser* fb, laListHandle* files){
  187. laListHandle tmp={0}; laFileItem* fi;
  188. FileSortCompF comp = 0;
  189. switch(fb->SortBy){
  190. case LA_FILE_SORT_NAME: default: comp=la_filecompname; break;
  191. case LA_FILE_SORT_NAME_REV: comp=la_filecompnamerev; break;
  192. case LA_FILE_SORT_TIME: comp=la_filecomptime; break;
  193. case LA_FILE_SORT_TIME_REV: comp=la_filecomptimerev; break;
  194. case LA_FILE_SORT_SIZE: comp=la_filecompsize; break;
  195. case LA_FILE_SORT_SIZE_REV: comp=la_filecompsizerev; break;
  196. }
  197. while(fi=lstPopItem(files)){ int inserted=0;
  198. for(laFileItem* fii=tmp.pFirst;fii;fii=fii->Hyper.pNext){
  199. int a=comp(fii,fi);
  200. if(a<0){ lstInsertItemBefore(&tmp,fi,fii); inserted=1; break; }
  201. }
  202. if(!inserted){ lstAppendItem(&tmp, fi); }
  203. }
  204. files->pFirst=tmp.pFirst; files->pLast=tmp.pLast;
  205. }
  206. void la_FileBrowserRebuildList(laFileBrowser *fb){
  207. laFileItem *fi = 0;
  208. laDiskItem *dl = 0;
  209. laListHandle Files = {0};
  210. char Lookup[2048]={0};
  211. char Final[2048]={0};
  212. char DiskLabels[256] = {0};
  213. char *pd = DiskLabels;
  214. int len = strlen(fb->Path);
  215. int NumDisks = 0;
  216. u64bit FreeAvailable = 0;
  217. u64bit FreeSpace_UNUSED = 0;
  218. u64bit TotalSpace = 0;
  219. real Ratio = 0;
  220. #ifdef __linux__
  221. #ifdef LAGUI_ANDROID
  222. #define versionsort alphasort
  223. #endif
  224. if (fb->Path[len - 1] != U'/') strcat(fb->Path, "/");
  225. struct dirent **NameList=0;
  226. int NumFiles=scandir(fb->Path,&NameList,0,versionsort);
  227. while (fi = lstPopItem(&fb->FileList)) memFree(fi);
  228. for(int i=0;i<NumFiles;i++){
  229. struct dirent* d = NameList[i];
  230. if(!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")){continue;}
  231. if(fb->FilterName[0] && !strcasestr(d->d_name,fb->FilterName)){continue;}
  232. struct stat s;
  233. sprintf(Final, "%s%s",fb->Path,d->d_name);
  234. stat(Final, &s);
  235. if (S_ISDIR(s.st_mode)){
  236. fi = memAcquireSimple(sizeof(laFileItem));
  237. strcpy(fi->Name, d->d_name);
  238. fi->IsFolder = 1;
  239. fi->Type = LA_FILETYPE_FOLDER;
  240. lstAppendItem(&fb->FileList, fi);
  241. }elif (!fb->SelectFolder){
  242. char *format = strGetLastSegment(d->d_name, '.');
  243. if(!la_AcceptFileFormat(fb,format)){ continue; }
  244. fi = memAcquireSimple(sizeof(laFileItem));
  245. strcpy(fi->Name, d->d_name);
  246. fi->Size = s.st_size;
  247. fi->Type = la_DetectFileItemType(format);
  248. fi->Timestamp = s.st_ctime;
  249. struct tm *t = localtime(&s.st_ctime);
  250. fi->TimeModified.Year = t->tm_year+1900;
  251. fi->TimeModified.Month = t->tm_mon+1;;
  252. fi->TimeModified.Day = t->tm_mday;
  253. fi->TimeModified.Hour = t->tm_hour;
  254. fi->TimeModified.Minute = t->tm_min;
  255. fi->TimeModified.Second = t->tm_sec;
  256. lstAppendItem(&Files, fi);
  257. //lstAppendItem(&fb->FileList, fi);
  258. }
  259. }
  260. for (int i = 0; i < NumFiles; i++) { free(NameList[i]); } free(NameList);
  261. #endif
  262. #ifdef _WIN32
  263. WIN32_FIND_DATA FindFileData;
  264. HANDLE hFind;
  265. SYSTEMTIME stUTC, stLocal;
  266. strCopyFull(Lookup, fb->Path);
  267. if (Lookup[len - 1] != U'\\') strcat(Lookup, "\\*.*"); else strcat(Lookup, "*.*");
  268. hFind = FindFirstFile(Lookup, &FindFileData);
  269. while (fi = lstPopItem(&fb->FileList)) memFree(fi);
  270. if (hFind == INVALID_HANDLE_VALUE){ return; }
  271. char buf[1024]; if (fb->FilterName[0]) { strToLower(fb->FilterName); }
  272. while (1) {
  273. if (fb->FilterName[0]) {
  274. strcpy(buf, FindFileData.cFileName); strToLower(buf);
  275. if (!strstr(buf, fb->FilterName)) { goto findnext; }
  276. }
  277. if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
  278. if (FindFileData.cFileName[0] != '.') {
  279. fi = memAcquireSimple(sizeof(laFileItem));
  280. strcpy(fi->Name, FindFileData.cFileName);
  281. fi->IsFolder = 1;
  282. fi->Type = LA_FILETYPE_FOLDER;
  283. lstAppendItem(&fb->FileList, fi);
  284. }
  285. }elif(!fb->SelectFolder) {
  286. fi = memAcquireSimple(sizeof(laFileItem));
  287. strCopyFull(fi->Name, FindFileData.cFileName);
  288. fi->Size = FindFileData.nFileSizeLow;
  289. fi->Type = la_DetectFileItemType(fi);
  290. FileTimeToSystemTime(&(FindFileData.ftLastWriteTime), &stUTC);
  291. SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
  292. fi->Timestamp = (uint64_t)FindFileData.ftLastWriteTime.dwHighDateTime|((uint64_t)(FindFileData.ftLastWriteTime.dwLowDateTime)<<32);
  293. fi->TimeModified.Year = stLocal.wYear;
  294. fi->TimeModified.Month = stLocal.wMonth;
  295. fi->TimeModified.Day = stLocal.wDay;
  296. fi->TimeModified.Hour = stLocal.wHour;
  297. fi->TimeModified.Minute = stLocal.wMinute;
  298. fi->TimeModified.Second = stLocal.wSecond;
  299. lstAppendItem(&Files, fi);
  300. //lstAppendItem(&fb->FileList, fi);
  301. }
  302. findnext:
  303. if (!FindNextFile(hFind, &FindFileData))
  304. break;
  305. }
  306. #endif
  307. la_SortFiles(fb, &Files);
  308. lstCombineLists(&fb->FileList, &Files);
  309. while (dl = lstPopItem(&fb->Disks)) memFree(dl);
  310. #ifdef _WIN32
  311. NumDisks = GetLogicalDriveStrings(256, DiskLabels) / 4;
  312. while (*pd){
  313. char Name[3] = "*:";
  314. Name[0] = *pd;
  315. if (GetDiskFreeSpaceEx(Name, &FreeAvailable, &TotalSpace, &FreeSpace_UNUSED)){
  316. dl = memAcquire(sizeof(laDiskItem));
  317. dl->ID = *pd;
  318. dl->Total_GB = (real)TotalSpace / 1073741824.0f; //B->GB
  319. dl->Free_GB = (real)FreeAvailable / 1073741824.0f; //B->GB
  320. if (Name[0] == fb->Path[0])
  321. fb->RootDisk = dl;
  322. lstAppendItem(&fb->Disks, dl);
  323. }
  324. pd += 4;
  325. }
  326. #endif
  327. fb->Active = 0;
  328. }
  329. laFileBrowser *la_FileBrowserInit(laOperator *a){
  330. laFileBrowser *fb = memAcquire(sizeof(laFileBrowser));
  331. char* arg=0;
  332. #ifdef LAGUI_ANDROID
  333. strcpy(fb->Path, MAIN.ExternalDataPath);
  334. laBookmarkedFolder* bf=memAcquireSimple(sizeof(laBookmarkedFolder));
  335. strcpy(bf->Path,fb->Path); strcpy(bf->Name,strGetLastSegment(fb->Path,"External")); lstAppendItem(&fb->Bookmarks,bf);
  336. bf=memAcquireSimple(sizeof(laBookmarkedFolder));
  337. strcpy(bf->Path,MAIN.InternalDataPath); strcpy(bf->Name,"Internal"); lstAppendItem(&fb->Bookmarks,bf);
  338. if(!MAIN.GotFilePermission){
  339. MAIN.GotFilePermission = la_check_permission("android.permission.WRITE_EXTERNAL_STORAGE");
  340. if(!MAIN.GotFilePermission){
  341. la_request_permission("android.permission.WRITE_EXTERNAL_STORAGE");
  342. }
  343. }
  344. #else
  345. strcpy(fb->Path, SSTR(MAIN.WorkingDirectory));
  346. #endif
  347. if (strArgumentMatch(a->ExtraInstructionsP, "select", "folder")){ fb->SelectFolder = LA_FILE_SELECT_FOLDER; }
  348. if (strArgumentMatch(a->ExtraInstructionsP, "warn_file_exists", "true")){ fb->WarnFileExists = 1; }
  349. if ((arg=strGetArgumentString(a->ExtraInstructionsP, "filter_extensions"))){ fb->ss_filter_extensions=strSplitPath(arg,','); }
  350. if ((arg=strGetArgumentString(a->ExtraInstructionsP, "use_extension"))){ strcpy(fb->UseExtension, arg); }
  351. if ((arg=strGetArgumentString(a->ExtraInstructionsP, "filter_type"))){ sscanf(arg,"%d",&fb->FilterType); }
  352. if ((arg=strGetArgumentString(a->ExtraInstructionsP, "use_type"))){ sscanf(arg,"%d",&fb->UseType); }
  353. #ifdef LA_LINUX
  354. char BookmarkPath[1024];
  355. strcat(strcpy(BookmarkPath, getenv("HOME")), "/.config/gtk-3.0/bookmarks");
  356. FILE* f=fopen(BookmarkPath, "r");
  357. if(f){ char entry[1024]={0};
  358. while(fgets(entry,1024,f)){ laBookmarkedFolder* bf=memAcquireSimple(sizeof(laBookmarkedFolder));
  359. entry[strlen(entry)-1]=0;
  360. strcpy(bf->Path,&entry[7]);
  361. strcpy(bf->Name,strGetLastSegment(&entry[7],'/')); lstAppendItem(&fb->Bookmarks,bf);
  362. }
  363. fclose(f);
  364. }
  365. #endif
  366. la_FileBrowserRebuildList(fb);
  367. fb->FileName[0] = 0;
  368. memAssignRef(fb, &fb->Thumbnail, tnsNewImage(0));
  369. fb->ShowThumbnail = 1;
  370. return fb;
  371. }
  372. void la_FileBrowserGetFullPath(laFileBrowser *fb,char* buf){
  373. buf[0]=0; int plen;
  374. if (!fb->SelectFolder && fb->FileName[0] == U'\0') return;
  375. plen = strlen(fb->Path);
  376. if (fb->Path[plen - 1] != LA_PATH_SEP) strcat(fb->Path, LA_PATH_SEPSTR);
  377. strCopyFull(buf, fb->Path);
  378. strcat(buf, fb->FileName);
  379. }
  380. void la_FileBrowserRefreshThumbnail(laFileBrowser* fb){
  381. if(MAIN.ThumbnailProp && fb->Active && fb->Active->Type==LA_FILETYPE_UDF){
  382. char* prop=SSTR(MAIN.ThumbnailProp); if(prop[0]){
  383. char fbuf[2048];la_FileBrowserGetFullPath(fb,fbuf);
  384. FILE* fpudf=fopen(fbuf,"rb"); if(fpudf){
  385. void* data=0; size_t size=0;
  386. if(laExtractQuickRaw(fpudf,prop,&data,&size)){
  387. tnsRefreshImage(fb->Thumbnail,data);
  388. fclose(fpudf); return;
  389. }
  390. fclose(fpudf);
  391. }
  392. }
  393. }
  394. #ifdef LA_LINUX
  395. char buf[2048]="file://"; char md5[128];
  396. la_FileBrowserGetFullPath(fb,buf+strlen(buf));
  397. md5String(buf,md5); toHexString(md5,fb->MD5);
  398. sprintf(buf,"%s/.cache/thumbnails/normal/%s.png", getenv("HOME"),fb->MD5);
  399. FILE *fp=fopen(buf,"rb"); char* data=0;
  400. if(fp){
  401. fseek(fp, 0, SEEK_END); u64bit SeekEnd = ftell(fp); fseek(fp, 0, SEEK_SET);
  402. data = calloc(1, SeekEnd); fread(data, SeekEnd, 1, fp);
  403. tnsRefreshImage(fb->Thumbnail,data);
  404. }else{
  405. tnsRefreshImage(fb->Thumbnail,0);
  406. }
  407. #endif
  408. }
  409. void laset_FileBrowserSelectFile(laFileBrowser *fb, laFileItem *fi, int State){
  410. int len;
  411. if (fb->Active == fi){
  412. if (fi->IsFolder){
  413. len = strlen(fb->Path);
  414. if (fb->Path[len - 1] != LA_PATH_SEP) strcat(fb->Path, LA_PATH_SEPSTR);
  415. strcat(fb->Path, fi->Name);
  416. la_FileBrowserRebuildList(fb);
  417. fb->FileName[0] = 0; fb->FilterName[0]=0;
  418. laRecalcCurrentPanelImmediate();
  419. }
  420. }else{
  421. if (!fi->IsFolder){
  422. strCopyFull(fb->FileName, fi->Name);
  423. }
  424. fb->Active = fi;
  425. la_FileBrowserRefreshThumbnail(fb);
  426. }
  427. }
  428. int la_FileBrowserConfirm(laOperator *a, laFileBrowser *fb){
  429. char buf[2048];
  430. la_FileBrowserGetFullPath(fb,buf);
  431. laConfirmString(a, buf, LA_CONFIRM_OK);
  432. return 1;
  433. }
  434. void *laget_FileBrowserFirstFile(laFileBrowser *fb, void* unused){
  435. return fb->FileList.pFirst;
  436. }
  437. void *laget_FileBrowserActiveFile(laFileBrowser *fb){
  438. return fb->Active;
  439. }
  440. void laget_FileBrowserDiskID(laDiskItem *di, char *result){
  441. result[0] = di->ID;
  442. result[1] = U':';
  443. result[2] = LA_PATH_SEP;
  444. result[3] = U'\0';
  445. }
  446. void *laset_FileBrowserActiveDisk(laFileBrowser *fb, laDiskItem *di, int UNUSED_State){
  447. fb->RootDisk = di;
  448. laget_FileBrowserDiskID(di, fb->Path);
  449. la_FileBrowserRebuildList(fb);
  450. fb->FileName[0] = 0;
  451. }
  452. void laset_FileBrowserPath(laFileBrowser *fb, char *content){
  453. if(!strSame(content, fb->Path)){
  454. strCopyFull(fb->Path, content); la_FileBrowserRebuildList(fb); fb->FileName[0] = 0; laRecalcCurrentPanel();
  455. }
  456. }
  457. void *laset_FileBrowserBookmark(laFileBrowser *fb, laBookmarkedFolder *bf){
  458. strcpy(fb->Path,bf->Path); la_FileBrowserRebuildList(fb); fb->FileName[0] = 0;
  459. }
  460. void laset_FileBrowserFileName(laFileBrowser *fb, char *content){
  461. strCopyFull(fb->FileName, content); int file_okay=0;
  462. char* ext=strGetLastSegment(fb->FileName,'.');
  463. if(fb->UseExtension[0] && strcmp(ext,fb->UseExtension)){ strcat(fb->FileName,"."); strcat(fb->FileName,fb->UseExtension); }
  464. else if(fb->UseType){ int file_okay=0; laExtensionType* FirstET=0;
  465. for(laExtensionType*et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){
  466. if((!FirstET) && et->FileType==fb->UseType) FirstET=et;
  467. if(et->FileType==fb->UseType && strSame(ext,et->Extension)){ file_okay=1; break; }
  468. }
  469. if((!file_okay) && FirstET){ strcat(fb->FileName,"."); strcat(fb->FileName,FirstET->Extension); }
  470. }
  471. la_FileBrowserRebuildList(fb);
  472. laRecalcCurrentPanel();
  473. }
  474. void laset_FileBrowserFilterName(laFileBrowser *fb, char *content){
  475. strCopyFull(fb->FilterName, content); int file_okay=0;
  476. la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
  477. }
  478. void* laget_FileBrowserAcceptedExtensionsFrist(laFileBrowser* fb, laPropIterator* pi){
  479. if(!fb->UseType){ return 0; }
  480. for(laExtensionType*et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){
  481. if(et->FileType==fb->UseType){ return et; }
  482. }
  483. return 0;
  484. }
  485. void* laget_FileBrowserAcceptedExtensionsNext(laExtensionType* et, laPropIterator* pi){
  486. for(laExtensionType*iet=et->Item.pNext;iet;iet=iet->Item.pNext){
  487. if(et->FileType==iet->FileType){ return iet; }
  488. }
  489. return 0;
  490. }
  491. void* laset_FileBrowserExtension(laFileBrowser* fb, laExtensionType* et){
  492. if(fb->UseType && fb->FileName[0] && et){ char* ext=strGetLastSegment(fb->FileName,'.');
  493. if(!ext){ sprintf(fb->FileName,".%s",ext); }
  494. elif(strcmp(et->Extension,ext)){ sprintf(ext,"%s",et->Extension); }
  495. la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
  496. }
  497. return 0;
  498. }
  499. void laset_FileBrowserShowBackups(laFileBrowser* fb, int show){
  500. fb->ShowBackups = show; la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
  501. }
  502. void laset_FileBrowserShowThumbnail(laFileBrowser* fb, int show){
  503. fb->ShowThumbnail = show; if(show){ la_FileBrowserRefreshThumbnail(fb); } laRecalcCurrentPanel();
  504. }
  505. void laset_FileBrowserSortName(laFileBrowser* fb, int s){
  506. if(fb->SortBy==LA_FILE_SORT_NAME) fb->SortBy=LA_FILE_SORT_NAME_REV;
  507. else fb->SortBy=LA_FILE_SORT_NAME; la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
  508. }
  509. int laget_FileBrowserSortName(laFileBrowser*fb){
  510. if(fb->SortBy==LA_FILE_SORT_NAME) return 1; if(fb->SortBy==LA_FILE_SORT_NAME_REV) return 2; return 0;
  511. }
  512. void laset_FileBrowserSortTime(laFileBrowser* fb, int s){
  513. if(fb->SortBy==LA_FILE_SORT_TIME) fb->SortBy=LA_FILE_SORT_TIME_REV;
  514. else fb->SortBy=LA_FILE_SORT_TIME; la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
  515. }
  516. int laget_FileBrowserSortTime(laFileBrowser*fb){
  517. if(fb->SortBy==LA_FILE_SORT_TIME) return 1; if(fb->SortBy==LA_FILE_SORT_TIME_REV) return 2; return 0;
  518. }
  519. void laset_FileBrowserSortSize(laFileBrowser* fb, int s){
  520. if(fb->SortBy==LA_FILE_SORT_SIZE) fb->SortBy=LA_FILE_SORT_SIZE_REV;
  521. else fb->SortBy=LA_FILE_SORT_SIZE; la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
  522. }
  523. int laget_FileBrowserSortSize(laFileBrowser*fb){
  524. if(fb->SortBy==LA_FILE_SORT_SIZE) return 1; if(fb->SortBy==LA_FILE_SORT_SIZE_REV) return 2; return 0;
  525. }
  526. void laget_FileBrowserFileSizeString(laFileItem* fi, char* content, char** move){
  527. if(fi->Size >= (1<<30)){
  528. sprintf(content, "%.3lf GB", (real)fi->Size/(1<<30));
  529. }elif(fi->Size >= (1<<20)){
  530. sprintf(content, "%.3lf MB", (real)fi->Size/(1<<20));
  531. }elif(fi->Size >= (1<<10)){
  532. sprintf(content, "%.3lf KB", (real)fi->Size/(1<<10));
  533. }else{
  534. sprintf(content, "%d %s", fi->Size, transLate("Bytes"));
  535. }
  536. }
  537. void la_FileBrowserUpLevel(laFileBrowser *fb){
  538. char *p = fb->Path;
  539. char *LastP = 0;
  540. int Count = 0;
  541. for (p; *p; p++){
  542. if (*p && *p == LA_PATH_SEP && p[1]!=0){
  543. LastP = p;
  544. Count++;
  545. }
  546. }
  547. if (Count > 1) *LastP = 0;
  548. else if(LastP) *(LastP + 1) = 0;
  549. la_FileBrowserRebuildList(fb); fb->FileName[0] = 0;
  550. }
  551. void la_FileBrowserNewDirectory(laFileBrowser* fb,char* path){
  552. char* p=fb->Path;
  553. int len =strlen(p);
  554. #ifdef LA_LINUX
  555. if (p[len - 1] != U'/') strcat(p, "/");
  556. char usepath[2048]; sprintf(usepath,"%s%s",p,path);
  557. if(!mkdir(usepath,S_IRWXU | S_IRWXG | S_IRWXO)){
  558. strcpy(fb->Path,usepath);
  559. }
  560. #endif
  561. #ifdef _WIN32
  562. if (p[len - 1] != U'\\' && p[len - 1] != U'/') strcat(p, "\\");
  563. char usepath[2048]; sprintf(usepath,"%s%s",p,path);
  564. if(!_mkdir(usepath)){
  565. strcpy(fb->Path,usepath);
  566. }
  567. #endif
  568. la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
  569. }
  570. int OPINV_FileBrowser(laOperator *a, laEvent *e){
  571. a->CustomData = la_FileBrowserInit(a);
  572. laEnableOperatorPanel(a, 0, LA_RH2, LA_RH2, 500, 500, 0, 0, 0, 0, LA_RH2, LA_RH2, LA_RH2, LA_RH2, e);
  573. return LA_RUNNING;
  574. }
  575. void OPEXT_FileBrowser(laOperator *a, int mark){
  576. laFileBrowser *fb = a->CustomData;
  577. void* f;
  578. while (f=lstPopItem(&fb->Disks)) memFree(f);
  579. while (f=lstPopItem(&fb->FileList)) memFree(f);
  580. while (f=lstPopItem(&fb->Bookmarks)) memFree(f);
  581. strDestroyStringSplitor(&fb->ss_filter_extensions);
  582. tnsRemoveImage(fb->Thumbnail);
  583. memFree(fb);
  584. }
  585. int OPMOD_FileBrowser(laOperator *a, laEvent *e){
  586. laFileBrowser *fb = a->CustomData;
  587. if (a->ConfirmData){
  588. if (a->ConfirmData->Mode == LA_CONFIRM_CANCEL){
  589. if(fb->StatusWaitingWarning){ fb->StatusWaitingWarning=0; return LA_RUNNING; }
  590. laConfirmSameDataIfAny(a); return LA_FINISHED_PASS;
  591. }
  592. if (a->ConfirmData->Mode == LA_CONFIRM_OK){
  593. la_FileBrowserConfirm(a, fb); return LA_FINISHED_PASS;
  594. }
  595. }
  596. if (e->type == LA_ESCAPE_DOWN){
  597. laConfirmInt(a, 0, LA_CONFIRM_CANCEL);
  598. return LA_FINISHED;
  599. }
  600. return LA_RUNNING;
  601. }
  602. int OPCHK_IsFileBrowser(laPropPack *This, laStringSplitor *ss){
  603. if (This && This->LastPs->p->SubProp == _LA_PROP_FILE_BROWSER) return 1;
  604. return 0;
  605. }
  606. int OPINV_FileBrowserUpLevel(laOperator *a, laEvent *e){
  607. if (a->This){
  608. la_FileBrowserUpLevel(a->This->EndInstance);
  609. laNotifyUsersPPPath(a->This, "path");
  610. laRecalcCurrentPanel();
  611. }
  612. return LA_FINISHED_PASS;
  613. }
  614. int OPINV_FileBrowserRefresh(laOperator *a, laEvent *e){
  615. if (a->This){
  616. la_FileBrowserRebuildList(a->This->EndInstance); laRecalcCurrentPanel();
  617. laNotifyUsersPPPath(a->This, "path");
  618. }
  619. return LA_FINISHED_PASS;
  620. }
  621. int OPINV_FileBrowserNewDirectory(laOperator *a, laEvent *e){
  622. if (a->This){
  623. laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,400,400,0,0,0,0,0,0,e);
  624. return LA_RUNNING;
  625. }
  626. return LA_FINISHED;
  627. }
  628. int OPMOD_FileBrowserNewDirectory(laOperator *a, laEvent *e){
  629. laFileBrowser* fb=a->This->EndInstance;
  630. if (a->ConfirmData){
  631. if (a->ConfirmData->Mode == LA_CONFIRM_OK){
  632. la_FileBrowserNewDirectory(fb,fb->TempStr);
  633. }
  634. return LA_FINISHED;
  635. }
  636. return LA_RUNNING;
  637. }
  638. int OPCHK_FileBrowserCanConfirm(laPropPack *This, laStringSplitor *ss){
  639. if(!OPCHK_IsFileBrowser(This,ss)) return 0;
  640. laFileBrowser* fb=This->EndInstance;
  641. if(fb->SelectFolder) return 1;
  642. if(fb->FileName[0]) return 1;
  643. return 0;
  644. }
  645. int OPINV_FileBrowserConfirm(laOperator *a, laEvent *e){
  646. if (a->This){
  647. laFileBrowser* fb=a->This->EndInstance;
  648. if(fb->WarnFileExists){
  649. char path[2048]; la_FileBrowserGetFullPath(fb, path);
  650. #ifdef LA_LINUX
  651. if(access(path, F_OK)==0)
  652. #endif
  653. #ifdef _WIN32
  654. if (PathFileExists(path))
  655. #endif
  656. {
  657. laEnableYesNoPanel(a,0,"File exists","Selected file already exists. Overwrite the file?",e->x-LA_RH,e->y-LA_RH,200,e);
  658. fb->StatusWaitingWarning=1; return LA_RUNNING;
  659. }
  660. }
  661. laConfirmInt(a, 0, LA_CONFIRM_OK); return LA_FINISHED_PASS;
  662. }
  663. return LA_FINISHED_PASS;
  664. }
  665. int OPMOD_FileBrowserConfirm(laOperator *a, laEvent *e){
  666. laFileBrowser* fb=a->This->EndInstance;
  667. if (a->ConfirmData){
  668. if (a->ConfirmData->Mode == LA_CONFIRM_CANCEL){
  669. if(fb->StatusWaitingWarning){ fb->StatusWaitingWarning=0; return LA_FINISHED; }
  670. }
  671. if (a->ConfirmData->Mode == LA_CONFIRM_OK){
  672. laConfirmInt(a, 0, LA_CONFIRM_OK); return LA_FINISHED_PASS;
  673. }
  674. return LA_FINISHED;
  675. }
  676. return LA_RUNNING;
  677. }
  678. void laui_FileBrowserNewDirectory(laUiList *uil, laPropPack *This, laPropPack *Operator, laColumn *UNUSED, int context){
  679. laColumn* c=laFirstColumn(uil);
  680. laShowItem(uil,c,This,"temp_str");
  681. laUiItem* row=laBeginRow(uil,c,0,0);
  682. laShowSeparator(uil,c)->Expand=1;
  683. laShowItem(uil,c,0,"LA_confirm")->Flags|=LA_UI_FLAGS_HIGHLIGHT;
  684. laEndRow(uil,row);
  685. }
  686. void OPEXT_UDFOperation(laOperator *a, laEvent *e){
  687. laUDFPreviewExtra *upe = a->CustomData;
  688. memFree(upe);
  689. }
  690. int OPINV_UDFRead(laOperator *a, laEvent *e){
  691. laInvoke(a, "LA_file_dialog", e, 0, "filter_type=1;", 0);
  692. a->CustomData = memAcquireSimple(sizeof(laUDFPreviewExtra));
  693. laUDFPreviewExtra *upe = a->CustomData;
  694. if(strArgumentMatch(a->ExtraInstructionsP,"mode","append")){ upe->Append=1; }
  695. return LA_RUNNING;
  696. }
  697. int OPMOD_UDFRead(laOperator *a, laEvent *e){
  698. laUDFPreviewExtra *upe = a->CustomData;
  699. if (a->ConfirmData){
  700. if (a->ConfirmData->StrData){
  701. laManagedUDF* m;
  702. upe->UDF = laOpenUDF(a->ConfirmData->StrData, 1, 0, &m);
  703. if (upe->UDF){
  704. laFreeNewerDifferences();
  705. laFreeOlderDifferences(1);
  706. laExtractUDF(upe->UDF, m, upe->Append?LA_UDF_MODE_APPEND:LA_UDF_MODE_OVERWRITE);
  707. laCloseUDF(upe->UDF);
  708. laRecordEverythingAndPush(); laNotifyUsers("la.differences");
  709. return LA_FINISHED;
  710. }
  711. }
  712. return LA_FINISHED;
  713. }
  714. return LA_RUNNING;
  715. }
  716. int OPINV_UDFSaveInstance(laOperator *a, laEvent *e){
  717. laInvoke(a, "LA_file_dialog", e, 0, 0, 0);
  718. a->CustomData = memAcquireSimple(sizeof(laUDFPreviewExtra));
  719. return LA_RUNNING;
  720. }
  721. int OPMOD_UDFSaveInstance(laOperator *a, laEvent *e){
  722. laUDFPreviewExtra *upe = a->CustomData;
  723. laPropPack* pp=a->This; if(!pp||!pp->EndInstance) return LA_CANCELED;
  724. if (a->ConfirmData){
  725. if (a->ConfirmData->StrData){
  726. upe->UDF = laPrepareUDF(a->ConfirmData->StrData);
  727. if (upe->UDF){
  728. laWritePropP(upe->UDF, pp);
  729. laPackUDF(upe->UDF, 0, 0);
  730. return LA_FINISHED;
  731. }
  732. }
  733. }
  734. return LA_FINISHED;
  735. }
  736. void* laget_FirstManagedUDF(void* unused, void* unused_pi){ return MAIN.ManagedUDFs.pFirst; }
  737. void laset_ManagedSavePage(laManagedSaveExtra* mse, int p){
  738. mse->ShowPage=p;
  739. laRegisterModifications(0,0,0,0);
  740. }
  741. void OPEXT_ManagedSave(laOperator *a, laEvent *e){
  742. laManagedSaveExtra *upe = a->CustomData;
  743. memFree(upe);
  744. }
  745. int OPINV_ManagedSave(laOperator *a, laEvent *e){
  746. int OnExit=0;
  747. if(a->ExtraInstructionsP){
  748. if(strSame(strGetArgumentString(a->ExtraInstructionsP, "quiet"),"true")){
  749. int empty=0; laRegisterModifications(0,1,&empty,0);
  750. if(strSame(strGetArgumentString(a->ExtraInstructionsP, "ignore_unassigned"),"true")) empty=0;
  751. int modified_only=0; if(strSame(strGetArgumentString(a->ExtraInstructionsP, "modified_only"),"true")) modified_only=1;
  752. if(!empty){ laSaveManagedUDF(modified_only); return LA_FINISHED; }
  753. }
  754. if(strSame(strGetArgumentString(a->ExtraInstructionsP, "on_exit"),"true")){ OnExit=1; }
  755. }
  756. if(laOperatorExistsT(a->Type)) return LA_CANCELED;
  757. a->CustomData = memAcquire(sizeof(laManagedSaveExtra));
  758. laManagedSaveExtra* mse=a->CustomData;
  759. mse->OnExit=OnExit;
  760. mse->ShowPage = MAIN.ManagerDefaultView;
  761. laEnableOperatorPanel(a, 0, LA_RH2,LA_RH2,400,400,0,0,0,0,LA_RH2,LA_RH2,LA_RH2,LA_RH2,e);
  762. return LA_RUNNING;
  763. }
  764. int OPMOD_ManagedSave(laOperator *a, laEvent *e){
  765. laUDFPreviewExtra *upe = a->CustomData;
  766. if (a->ConfirmData){
  767. if(a->ConfirmData->Mode==LA_CONFIRM_CUSTOM_STRING && strSame(a->ConfirmData->StrData,"DISCARD_AND_QUIT")){
  768. return LA_OPERATOR_CALLS_SHUTOFF;
  769. }
  770. if(a->ConfirmData->Mode==LA_CONFIRM_CANCEL||a->ConfirmData->Mode==LA_CONFIRM_OK) return LA_FINISHED;
  771. return LA_RUNNING;
  772. }
  773. return LA_RUNNING;
  774. }
  775. int OPINV_ManagedSaveNewFile(laOperator *a, laEvent *e){
  776. if(MAIN.SetUDFPending) return LA_FINISHED;
  777. MAIN.SetUDFPending=1;
  778. a->CustomData = memAcquireSimple(sizeof(laUDFPreviewExtra));
  779. laInvoke(a, "LA_file_dialog", e, 0, "use_type=1;filter_type=1", 0);
  780. return LA_RUNNING;
  781. }
  782. int OPMOD_ManagedSaveNewFile(laOperator *a, laEvent *e){
  783. laUDFPreviewExtra *upe = a->CustomData;
  784. if (a->ConfirmData){
  785. if(a->ConfirmData->Mode==LA_CONFIRM_CANCEL){ MAIN.SetUDFPending=0; return LA_FINISHED; }
  786. if(a->ConfirmData->Mode==LA_CONFIRM_OK){
  787. if(a->ConfirmData->StrData){
  788. char* path=a->ConfirmData->StrData;
  789. if(la_FindManagedUDF(path)){
  790. laEnableMessagePanel(a, 0, "Duplicated files", "The file you chose already exists in the managed file list.",e->x,e->y,0,e);
  791. return LA_FINISHED;
  792. }
  793. laManagedUDF* m=MAIN.DummyManageUDF;
  794. m->udf = laPrepareUDF(path); strSafeSet(&m->BaseName, strGetLastSegment(path,LA_PATH_SEP));
  795. m->udf->Managed=1;
  796. la_MakeDummyManagedUDF();
  797. laNotifyUsers("la.managed_udfs"); laNotifyUsers("la.managed_props");
  798. }
  799. MAIN.SetUDFPending=0;
  800. return LA_FINISHED;
  801. }
  802. return LA_RUNNING;
  803. }
  804. return LA_RUNNING;
  805. }
  806. int OPINV_UDFManager(laOperator *a, laEvent *e){
  807. laRegisterModifications(0,0,0,0);
  808. laActivatePanel("LAUI_data_manager", e->x, e->y);
  809. return LA_FINISHED;
  810. }
  811. int OPINV_AddResourceFolder(laOperator *a, laEvent *e){
  812. laAddResourceFolder(0);
  813. laNotifyUsers("la.user_preferences.resource_folders");
  814. return LA_FINISHED;
  815. }
  816. int OPINV_RemoveResourceFolder(laOperator *a, laEvent *e){
  817. if(!a->This || !a->This->EndInstance) return LA_CANCELED;
  818. laResourceFolder* rf=a->This->EndInstance;
  819. laRemoveResourceFolder(rf);
  820. laRefreshUDFRegistries();
  821. laNotifyUsers("la.user_preferences.resource_folders");
  822. return LA_FINISHED;
  823. }
  824. int OPCHK_Undo(laPropPack *This, laStringSplitor *ss){
  825. laDiff* diff=MAIN.HeadDifference; if(!diff) return 0;
  826. diff=diff->Item.pPrev; if(!diff) return 0;
  827. }
  828. int OPCHK_Redo(laPropPack *This, laStringSplitor *ss){
  829. laDiff* diff=MAIN.HeadDifference; if(!diff) return 0;
  830. if(diff==MAIN.Differences.pLast) return 0;
  831. }
  832. int OPINV_Undo(laOperator *a, laEvent *e){
  833. laUndo();
  834. laPrintDBInstInfo();
  835. return LA_FINISHED;
  836. }
  837. int OPINV_Redo(laOperator *a, laEvent *e){
  838. laRedo();
  839. laPrintDBInstInfo();
  840. return LA_FINISHED;
  841. }
  842. int OPINV_UDFPropagate(laOperator *a, laEvent *e){
  843. laProp* p=a->This?a->This->LastPs->p:0; if(!p||p->PropertyType!=LA_PROP_SUB) return LA_FINISHED;
  844. void* instance=a->This->EndInstance; if(!instance) return LA_FINISHED;
  845. laPropContainer* pc=la_EnsureSubTarget(p,instance);
  846. int force=0;
  847. if(strSame(strGetArgumentString(a->ExtraInstructionsP,"force"),"true")){ force=1; }
  848. laPropagateUDF(pc, instance, force);
  849. laNotifyUsers("la.managed_props");
  850. return LA_FINISHED;
  851. }
  852. int OPINV_NewInputMapping(laOperator *a, laEvent *e){
  853. laNewInputMapping("New Mapping"); laNotifyUsers("la.input_mapping"); return LA_FINISHED;
  854. }
  855. int OPINV_RemoveInputMapping(laOperator *a, laEvent *e){
  856. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMapping* im=a->This->EndInstance;
  857. char* buf[256];sprintf(buf,"%s \"%s\".",transLate("Will remove input mapping"),SSTR(im->Name));
  858. laEnableYesNoPanel(0, 0, "Confirm?", buf, e->x, e->y, 200, e);
  859. return LA_RUNNING;
  860. }
  861. int OPINV_NewInputMappingEntry(laOperator *a, laEvent *e){
  862. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMapping* im=a->This->EndInstance;
  863. laInputMappingEntry* ime=laNewInputMappingEntry(im,0,0,"a",0,"none");
  864. if(strArgumentMatch(a->ExtraInstructionsP,"position","top")){
  865. lstRemoveItem(&im->Entries,ime);
  866. lstPushItem(&im->Entries,ime);
  867. }
  868. laNotifyUsers("la.input_mapping"); return LA_FINISHED;
  869. }
  870. int OPINV_RemoveInputMappingEntry(laOperator *a, laEvent *e){
  871. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ie=a->This->EndInstance;
  872. laEnableYesNoPanel(0, 0, "Confirm?", "Will remove this key map entry", e->x, e->y, 200, e);
  873. return LA_RUNNING;
  874. }
  875. int OPMOD_RemoveInputMapping(laOperator *a, laEvent *e){
  876. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMapping* im=a->This->EndInstance;
  877. if(a->ConfirmData){
  878. if(a->ConfirmData->Mode == LA_CONFIRM_OK){
  879. laRemoveInputMapping(im); laNotifyUsers("la.input_mapping");
  880. }
  881. return LA_FINISHED;
  882. }
  883. return LA_RUNNING;
  884. }
  885. int OPMOD_RemoveInputMappingEntry(laOperator *a, laEvent *e){
  886. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ie=a->This->EndInstance;
  887. if(a->ConfirmData){
  888. if(a->ConfirmData->Mode == LA_CONFIRM_OK){
  889. laRemoveInputMappingEntry(ie->Parent,ie); laNotifyUsers("la.input_mapping");
  890. }
  891. return LA_FINISHED;
  892. }
  893. return LA_RUNNING;
  894. }
  895. int OPINV_InputMappingEntrySelectSignal(laOperator *a, laEvent *e){
  896. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
  897. laEnableOperatorPanel(a,a->This,e->x-LA_RH*5,e->y-LA_RH,LA_RH*15,LA_RH*15,LA_RH*30,LA_RH*30,0,0,0,0,0,0,e);
  898. return LA_RUNNING;
  899. }
  900. int OPMOD_InputMappingEntrySelectSignal(laOperator *a, laEvent *e){
  901. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
  902. if(a->ConfirmData){
  903. if(a->ConfirmData->Mode == LA_CONFIRM_DATA && a->ConfirmData->PointerData && strSame(a->ConfirmData->PointerType->Identifier,"la_custom_signal")){
  904. laCustomSignal* cs=a->ConfirmData->PointerData;
  905. ime->SignalValue = cs->Signal; strSafeSet(&ime->Signal,SSTR(cs->Name));
  906. laNotifyUsers("la.input_mapping");
  907. }
  908. return LA_FINISHED;
  909. }
  910. return LA_RUNNING;
  911. }
  912. void laui_InputMappingEntrySignalSelector(laUiList *uil, laPropPack *Base, laPropPack *OperatorInst, laColumn *ExtraColumns, int context){
  913. laColumn* c=laFirstColumn(uil);
  914. laUiItem* b=laBeginRow(uil,c,0,0);
  915. laShowLabel(uil,c,"🔍",0,0);
  916. laUiItem* ui=laShowItem(uil,c,0,"la.signal_filter");ui->Expand=1;ui->Flags|=LA_UI_FLAGS_IMMEDIATE_INPUT;
  917. laEndRow(uil,b);
  918. laUiItem* g=laMakeEmptyGroup(uil,c,0,0); laUiList* guil=g->Page; laColumn* gc=laFirstColumn(guil); guil->HeightCoeff=10;
  919. laShowItemFull(guil,gc,0,"la.filtered_signals",LA_WIDGET_COLLECTION,0,0,0)->Flags|=LA_UI_FLAGS_NO_DECAL;
  920. }
  921. int OPINV_InputMappingEntrySelectOperator(laOperator *a, laEvent *e){
  922. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
  923. laEnableOperatorPanel(a,a->This,e->x-LA_RH*5,e->y-LA_RH,LA_RH*15,LA_RH*20,LA_RH*30,LA_RH*35,0,0,0,0,0,0,e);
  924. return LA_RUNNING;
  925. }
  926. int OPMOD_InputMappingEntrySelectOperator(laOperator *a, laEvent *e){
  927. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
  928. if(a->ConfirmData){
  929. if(a->ConfirmData->Mode == LA_CONFIRM_DATA && a->ConfirmData->PointerData && strSame(a->ConfirmData->PointerType->Identifier,"la_operator_type")){
  930. laOperatorType* at=a->ConfirmData->PointerData;
  931. strSafeSet(&ime->Operator,at->Identifier);
  932. strSafeSet(&ime->OperatorName,at->Name);
  933. laNotifyUsers("la.input_mapping");
  934. }
  935. return LA_FINISHED;
  936. }
  937. return LA_RUNNING;
  938. }
  939. void laui_InputMappingEntryOperatorSelector(laUiList *uil, laPropPack *Base, laPropPack *OperatorInst, laColumn *ExtraColumns, int context){
  940. laColumn* c=laFirstColumn(uil);
  941. laUiItem* b=laBeginRow(uil,c,0,0);
  942. laShowLabel(uil,c,"🔍",0,0);
  943. laUiItem* ui=laShowItem(uil,c,0,"la.operator_filter");ui->Expand=1;ui->Flags|=LA_UI_FLAGS_IMMEDIATE_INPUT;
  944. laEndRow(uil,b);
  945. laUiItem* g=laMakeEmptyGroup(uil,c,0,0); laUiList* guil=g->Page; laColumn* gc=laFirstColumn(guil); guil->HeightCoeff=20;
  946. laShowItemFull(guil,gc,0,"la.filtered_operators",LA_WIDGET_COLLECTION,0,laui_OperatorTypeEntry,0)->Flags|=LA_UI_FLAGS_NO_DECAL;
  947. }
  948. STRUCTURE(laKeyDetectorData){
  949. int pad;
  950. int IsController;
  951. int Key;
  952. int SpecialKeyBit;
  953. int Button, Axis, Device;
  954. laSafeString* Str;
  955. };
  956. int OPEXT_InputMappingEntrySelectKey(laOperator* a,int exitmode){
  957. laKeyDetectorData* kdd=a->CustomData;
  958. strSafeDestroy(&kdd->Str);
  959. memFree(kdd);
  960. }
  961. int OPINV_InputMappingEntrySelectKey(laOperator *a, laEvent *e){
  962. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
  963. a->CustomData = memAcquire(sizeof(laKeyDetectorData));
  964. laEnableOperatorPanel(a,a->This,e->x-LA_RH*5,e->y-LA_RH,LA_RH*10,LA_RH*10,LA_RH*20,LA_RH*20,LA_RH*20,0,0,0,0,0,e);
  965. laOperatorModalOver(a);
  966. return LA_RUNNING;
  967. }
  968. int OPMOD_InputMappingEntrySelectKey(laOperator *a, laEvent *e){
  969. if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
  970. laKeyDetectorData* kdd=a->CustomData; if(!kdd){ return LA_FINISHED; }
  971. char buf[64],*_next=buf;
  972. if(e->type == LA_KEY_DOWN){
  973. kdd->Key = e->key; la_InputMappingGetKeyName(kdd->Key,e->SpecialKeyBit,buf); strSafeSet(&kdd->Str,buf); kdd->IsController=0;
  974. laNotifyInstanceUsers(kdd); kdd->SpecialKeyBit=e->SpecialKeyBit;
  975. return LA_RUNNING;
  976. }elif(e->type == LA_EMPTY){
  977. if(MAIN.ControllerHasNewAxis){
  978. kdd->Axis = MAIN.LastControllerAxis; kdd->Device = MAIN.LastControllerAxisDevice; kdd->Button =-1; kdd->IsController=1;
  979. strSafeSet(&kdd->Str,laControllerIDGetAxisName(kdd->Device,kdd->Axis)); laNotifyInstanceUsers(kdd);
  980. }elif(MAIN.ControllerHasNewKey){
  981. kdd->Button = MAIN.LastControllerKey; kdd->Device = MAIN.LastControllerKeyDevice; kdd->Axis = -1; kdd->IsController=1;
  982. strSafeSet(&kdd->Str,laControllerIDGetButtonName(kdd->Device,kdd->Button)); laNotifyInstanceUsers(kdd);
  983. }
  984. }
  985. if(a->ConfirmData){
  986. if(a->ConfirmData->Mode == LA_CONFIRM_OK){
  987. strSafeSet(&ime->Key,SSTR(kdd->Str));
  988. if(kdd->IsController){ ime->DeviceType = LA_INPUT_DEVICE_JOYSTICK; ime->Axis=kdd->Axis; ime->Button=kdd->Button; ime->JoystickDevice = kdd->Device; }
  989. else{ ime->DeviceType = LA_INPUT_DEVICE_KEYBOARD; ime->KeyValue = kdd->Key; ime->SpecialKeyBits=kdd->SpecialKeyBit; }
  990. laNotifyInstanceUsers(ime);
  991. }
  992. return LA_FINISHED_PASS;
  993. }
  994. return LA_RUNNING_PASS;
  995. }
  996. void laui_InputMappingEntryKeySelector(laUiList *uil, laPropPack *Base, laPropPack *OperatorInst, laColumn *ExtraColumns, int context){
  997. laColumn* c=laFirstColumn(uil);
  998. laShowLabel(uil,c,"Press a key:",0,0);
  999. laShowItem(uil,c,OperatorInst,"pressed_string")->Flags|=LA_UI_FLAGS_PLAIN;
  1000. laUiItem* b=laBeginRow(uil,c,0,0);
  1001. laShowSeparator(uil,c)->Expand=1;
  1002. laShowItem(uil,c,0,"LA_confirm");
  1003. laEndRow(uil,b);
  1004. }
  1005. void laget_KeyDetectorPressedString(laKeyDetectorData* kdd, char* out, char** pivot){
  1006. if(kdd->IsController){
  1007. if(kdd->Axis>=0){ sprintf(out, "Controller %d axis \"%s\" (0x%0x)", kdd->Device, SSTR(kdd->Str), kdd->Axis); }
  1008. else{ sprintf(out, "Controller %d button \"%s\" (0x%0x)", kdd->Device, SSTR(kdd->Str), kdd->Button); }
  1009. }else{
  1010. sprintf(out, "Keyboard \"%s\" (0x%0x)", SSTR(kdd->Str), kdd->Key);
  1011. }
  1012. }
  1013. int OPINV_SaveUserPreferences(laOperator *a, laEvent *e){
  1014. laSaveUserPreferences(); return LA_FINISHED;
  1015. }
  1016. int OPMOD_RestoreFactorySettings(laOperator* a, laEvent* e){
  1017. if (a->ConfirmData){
  1018. if (a->ConfirmData->Mode == LA_CONFIRM_OK){
  1019. if (laRestoreFactorySettings()){
  1020. laEnableMessagePanel(0, 0, "Success", "Restart the program for changes to take effect.", e->x, e->y, 200, 0);
  1021. MAIN.SavePreferenceOnExit = 0;
  1022. }else{
  1023. laEnableMessagePanel(0, 0, "Problem", "Unable to remove preference file.", e->x, e->y, 200, 0);
  1024. }
  1025. }
  1026. return LA_FINISHED;
  1027. }
  1028. return LA_RUNNING;
  1029. }
  1030. int OPINV_RestoreFactorySettings(laOperator* a, laEvent* e){
  1031. laEnableYesNoPanel(0, 0, "Confirm?", "This will remove the preference file.\nChanges take effect on restating the program.", e->x, e->y, 200, e);
  1032. return LA_RUNNING;
  1033. }
  1034. int OPCHK_TerminateProgram(laPropPack *This, laStringSplitor *Instructions){
  1035. return 1;
  1036. }
  1037. int OPINV_TerminateProgram(laOperator *a, laEvent *e){
  1038. int empty=0; int mod=laRegisterModifications(1,1,&empty,0);
  1039. if(mod || empty){ laInvoke(0, "LA_managed_save", 0,0,"on_exit=true;",0); return LA_FINISHED; }
  1040. return LA_OPERATOR_CALLS_SHUTOFF;
  1041. }
  1042. int OPCHK_PropSetValue(laPropPack *This, laStringSplitor *Instructions){
  1043. if (This && (!This->LastPs->p->ReadOnly)) return 1;
  1044. else return 0;
  1045. }
  1046. int OPCHK_StringSetValue(laPropPack *This, laStringSplitor *Instructions){
  1047. if (This && (This->LastPs->p->PropertyType == LA_PROP_STRING) && (!This->LastPs->p->ReadOnly)) return 1;
  1048. else return 0;
  1049. }
  1050. int OPCHK_CollectionSetValue(laPropPack *This, laStringSplitor *Instructions){
  1051. laSubProp*sp=This->LastPs->p;
  1052. if (This && (This->LastPs->p->PropertyType == LA_PROP_SUB) && (!This->LastPs->p->ReadOnly) &&
  1053. (sp->Base.UDFIsRefer && (!sp->Base.UDFIsSingle) && (sp->Base.Offset>=0||sp->Set||sp->SetState))) return 1;
  1054. else return 0;
  1055. }
  1056. int OPINV_CollectionClearSelection(laOperator *a, laEvent *e){
  1057. if(!a->This) return LA_CANCELED; laSubProp* sp=a->This->LastPs->p;
  1058. laSetActiveInstance(sp, a->This->LastPs->UseInstance, 0);
  1059. return LA_FINISHED;
  1060. }
  1061. int OPINV_PropSetDefault(laOperator *a, laEvent *e){
  1062. if(!a->This) return LA_CANCELED; laProp* p=a->This->LastPs->p;
  1063. if (p->PropertyType==LA_PROP_ENUM){
  1064. laEnumProp *ep = a->This->LastPs->p; laSetEnum(a->This, ep->DefVal); }
  1065. elif (p->PropertyType==(LA_PROP_ENUM|LA_PROP_ARRAY)){
  1066. laEnumProp *ep = a->This->LastPs->p; laSetEnumArrayAll(a->This, ep->DefVal); }
  1067. elif (p->PropertyType==LA_PROP_INT){
  1068. laIntProp *ip = a->This->LastPs->p; laSetInt(a->This, ip->DefVal);}
  1069. elif (p->PropertyType==(LA_PROP_INT|LA_PROP_ARRAY)){ laIntProp *ip = a->This->LastPs->p;
  1070. if (ip->DefArr) laSetIntArrayAllArray(a->This, ip->DefArr); else laSetIntArrayAll(a->This, ip->DefVal); }
  1071. elif (p->PropertyType==LA_PROP_FLOAT){
  1072. laFloatProp *ip = a->This->LastPs->p; laSetFloat(a->This, ip->DefVal); }
  1073. elif (p->PropertyType==(LA_PROP_FLOAT|LA_PROP_ARRAY)){ laFloatProp *ip = a->This->LastPs->p;
  1074. if (ip->DefArr) laSetFloatArrayAllArray(a->This, ip->DefArr); else laSetFloatArrayAll(a->This, ip->DefVal); }
  1075. elif (p->PropertyType==LA_PROP_STRING){laStringProp *sp = a->This->LastPs->p;
  1076. if (sp->DefStr) laSetString(a->This, sp->DefStr); else laSetString(a->This, ""); }
  1077. return LA_FINISHED;
  1078. }
  1079. int OPINV_PropSetMax(laOperator *a, laEvent *e){
  1080. if(!a->This) return LA_CANCELED; laProp* p=a->This->LastPs->p;
  1081. if (p->PropertyType==LA_PROP_INT){
  1082. laIntProp *ip = a->This->LastPs->p; laSetInt(a->This, ip->Max); }
  1083. elif (p->PropertyType==(LA_PROP_INT|LA_PROP_ARRAY)){
  1084. laIntProp *ip = a->This->LastPs->p; laSetIntArrayAll(a->This, ip->Max); }
  1085. elif (p->PropertyType==LA_PROP_FLOAT){
  1086. laFloatProp *ip = a->This->LastPs->p; laSetFloat(a->This, ip->Max); }
  1087. elif (p->PropertyType==(LA_PROP_FLOAT|LA_PROP_ARRAY)){
  1088. laFloatProp *ip = a->This->LastPs->p; laSetFloatArrayAll(a->This, ip->Max); }
  1089. return LA_FINISHED;
  1090. }
  1091. int OPINV_PropSetMin(laOperator *a, laEvent *e){
  1092. if(!a->This) return LA_CANCELED; laProp* p=a->This->LastPs->p;
  1093. if (p->PropertyType==LA_PROP_INT){
  1094. laIntProp *ip = a->This->LastPs->p; laSetInt(a->This, ip->Min); }
  1095. elif (p->PropertyType==(LA_PROP_INT|LA_PROP_ARRAY)){
  1096. laIntProp *ip = a->This->LastPs->p; laSetIntArrayAll(a->This, ip->Min); }
  1097. elif (p->PropertyType==LA_PROP_FLOAT){
  1098. laFloatProp *ip = a->This->LastPs->p; laSetFloat(a->This, ip->Min); }
  1099. elif (p->PropertyType==(LA_PROP_FLOAT|LA_PROP_ARRAY)){
  1100. laFloatProp *ip = a->This->LastPs->p; laSetFloatArrayAll(a->This, ip->Min); }
  1101. return LA_FINISHED;
  1102. }
  1103. int OPINV_StringGetFolderPath(laOperator *a, laEvent *e){
  1104. if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_STRING)){
  1105. laInvoke(a, "LA_file_dialog", e, 0, "select=folder;", 0);
  1106. return LA_RUNNING;
  1107. }
  1108. return LA_FINISHED;
  1109. }
  1110. int OPINV_StringGetFilePath(laOperator *a, laEvent *e){
  1111. if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_STRING)){
  1112. laInvoke(a, "LA_file_dialog", e, 0, 0, 0);
  1113. return LA_RUNNING;
  1114. }
  1115. return LA_FINISHED;
  1116. }
  1117. int OPMOD_StringGetFolderOrFilePath(laOperator *a, laEvent *e){
  1118. if (a->ConfirmData){
  1119. if (a->ConfirmData->StrData){
  1120. laStringProp *sp = a->This->LastPs->p;
  1121. laSetString(a->This, a->ConfirmData->StrData);
  1122. return LA_FINISHED_PASS;
  1123. }
  1124. return LA_FINISHED_PASS;
  1125. }
  1126. return LA_RUNNING;
  1127. }
  1128. int OPINV_StringCopy(laOperator *a, laEvent *e){
  1129. laPropPack* pp=a->This; if(!a->This) return LA_FINISHED;
  1130. char _buf[256]={0}; char* buf=_buf;
  1131. laGetString(pp,_buf,&buf);
  1132. laCopyToClipboard(buf);
  1133. return LA_FINISHED;
  1134. }
  1135. int OPINV_StringPaste(laOperator *a, laEvent *e){
  1136. if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_STRING)){
  1137. laStringProp *sp = a->This->LastPs->p;
  1138. if (sp->DefStr) laSetString(a->This, sp->DefStr);
  1139. else laSetString(a->This, "");
  1140. }
  1141. return LA_FINISHED;
  1142. }
  1143. int OPCHK_CombineChildBlocks(laPropPack *This, laStringSplitor *Instructions){
  1144. laLayout *l = MAIN.CurrentWindow->CurrentLayout;
  1145. laBlock *b = l->OnBlockSeperator;
  1146. if (!(b)) return 0;
  1147. }
  1148. int OPINV_CombineChildBlocks(laOperator *a, laEvent *e){
  1149. laLayout *l = MAIN.CurrentWindow->CurrentLayout;
  1150. laBlock *b = l->OnBlockSeperator;
  1151. if (!b) b = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
  1152. if (b){
  1153. laCombineChildBlocks(b);
  1154. return LA_FINISHED;
  1155. }
  1156. return LA_CANCELED;
  1157. }
  1158. int OPCHK_PropInsertKey(laPropPack *This, laStringSplitor *Instructions){
  1159. if (MAIN.Animation->CurrentAction && This && This->LastPs->p->Keyable) return 1;
  1160. else return 0;
  1161. }
  1162. int OPINV_PropInsertKey(laOperator *a, laEvent *e){
  1163. int err; laAction* aa=MAIN.Animation->CurrentAction;
  1164. laAnimationInsertKeyFrame(aa,a->This->LastPs->UseInstance,a->This->LastPs->p,&err);
  1165. if(err==1){
  1166. laEnableMessagePanel(a,0,"Error","Action holder info missing.\nThis should not happen.",e->x,e->y,100,e);
  1167. }elif(err==2){
  1168. char msg[1024]; char _id[128]="unknown container",*id=_id,_idc[128]="unknown object",*idc=_idc;
  1169. laTryGetInstanceIdentifier(aa->HolderInstance,aa->HolderContainer,_id,&id);
  1170. laTryGetInstanceIdentifier(a->This->LastPs->UseInstance,a->This->LastPs->p->Container,_idc,&idc);
  1171. sprintf(msg,"Can't insert key frame into current action.\n\"%s\" doesn't belong to \"%s\".",idc,id);
  1172. laEnableMessagePanel(a,0,"Error",msg,e->x,e->y,100,e);
  1173. }
  1174. return LA_FINISHED;
  1175. }
  1176. STRUCTURE(laNewPanelData){
  1177. laUiTemplate* SelectedTemplate;
  1178. laBlock* b;
  1179. };
  1180. void laui_TitleOnly(laUiList *uil, laPropPack *This, laPropPack *OP_UNUSED, laColumn *Extra, int context){
  1181. laColumn *col = Extra, *c, *cl, *cr, *crl, *crr, *cll, *clr, *clrl, *clrr, *clrrl, *clrrr;
  1182. laUiItem *ui;
  1183. c = laFirstColumn(uil);
  1184. laShowItemFull(uil, c, This, "title", LA_WIDGET_STRING_PLAIN, 0, 0, 0);
  1185. }
  1186. laUiTemplate* laget_FirstPanelTemplate(void* unused1, void* unused2){
  1187. return MAIN.PanelTemplates.pFirst;
  1188. }
  1189. void laset_NewPanelSetTemplate(laNewPanelData *np, laUiTemplate *uit, int State){
  1190. np->SelectedTemplate = uit;
  1191. }
  1192. laUiTemplate* laget_NewPanelGetActiveTemplate(laNewPanelData* np, laUiTemplate* uit){
  1193. return np->SelectedTemplate;
  1194. }
  1195. void laui_PanelTemplateSelect(laUiList *uil, laPropPack *This, laPropPack *OperatorProps, laColumn *UNUSED, int context){
  1196. laColumn *c = laFirstColumn(uil);
  1197. laUiItem* ui=laShowItem(uil, c, OperatorProps, "template");ui->SymbolID=2; ui->Flags|=LA_UI_FLAGS_NO_DECAL;
  1198. }
  1199. int OPINV_Fullscreen(laOperator *a, laEvent *e){
  1200. laWindow* w=MAIN.CurrentWindow;
  1201. int full=1;
  1202. if(strArgumentMatch(a->ExtraInstructionsP,"restore","true")){ full=0; }
  1203. if(strArgumentMatch(a->ExtraInstructionsP,"toggle","true")){ full=w->IsFullScreen?0:1; }
  1204. #ifdef LA_LINUX
  1205. XClientMessageEvent msg = {
  1206. .type = ClientMessage, .display = MAIN.dpy, .window = w->win,
  1207. .message_type = XInternAtom(MAIN.dpy, "_NET_WM_STATE", True), .format = 32,
  1208. .data = {.l = {full, XInternAtom(MAIN.dpy, "_NET_WM_STATE_FULLSCREEN", True), None, 0, 1 }}
  1209. };
  1210. XSendEvent(MAIN.dpy, XRootWindow(MAIN.dpy, XDefaultScreen(MAIN.dpy)), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent*) &msg);
  1211. #endif
  1212. #ifdef _WIN32
  1213. DWORD dwStyle = GetWindowLong(w->win, GWL_STYLE);
  1214. static WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) };
  1215. if (full){
  1216. MONITORINFO mi = { sizeof(mi) };
  1217. if (GetWindowPlacement(w->win, &g_wpPrev) &&
  1218. GetMonitorInfo(MonitorFromWindow(w->win,
  1219. MONITOR_DEFAULTTOPRIMARY), &mi)) {
  1220. SetWindowLong(w->win, GWL_STYLE,
  1221. dwStyle & ~WS_OVERLAPPEDWINDOW);
  1222. SetWindowPos(w->win, HWND_TOP,
  1223. mi.rcMonitor.left, mi.rcMonitor.top,
  1224. mi.rcMonitor.right - mi.rcMonitor.left,
  1225. mi.rcMonitor.bottom - mi.rcMonitor.top,
  1226. SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
  1227. }
  1228. }else{
  1229. SetWindowLong(w->win, GWL_STYLE,dwStyle|WS_OVERLAPPEDWINDOW);
  1230. SetWindowPlacement(w->win, &g_wpPrev);
  1231. SetWindowPos(w->win,NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_FRAMECHANGED);
  1232. }
  1233. #endif
  1234. w->IsFullScreen=full;
  1235. laRedrawCurrentWindow();
  1236. return LA_FINISHED;
  1237. }
  1238. int OPINV_NewLayout(laOperator *a, laEvent *e){
  1239. laWindow* w=MAIN.CurrentWindow;
  1240. laDesignLayout(w, "New Layout");
  1241. laRedrawCurrentWindow();
  1242. return LA_FINISHED;
  1243. }
  1244. int OPCHK_RemoveLayout(laPropPack *This, laStringSplitor *Instructions){
  1245. laWindow* w=MAIN.CurrentWindow; if(w->Layouts.pFirst==w->Layouts.pLast) return 0;
  1246. return 1;
  1247. }
  1248. int OPINV_RemoveLayout(laOperator *a, laEvent *e){
  1249. laWindow* w=MAIN.CurrentWindow; if(w->Layouts.pFirst==w->Layouts.pLast) return LA_FINISHED;
  1250. laDestroyLayout(w,w->CurrentLayout); laRedrawCurrentWindow();
  1251. return LA_FINISHED;
  1252. }
  1253. int OPINV_NewPanel(laOperator *a, laEvent *e){
  1254. laNewPanelData* np= memAcquire(sizeof(laNewPanelData));
  1255. a->CustomData = np;
  1256. laEnableOperatorPanel(a, 0, e->x-50,e->y-50,500,500,10000,0,0,0,0,0,0,0,e);
  1257. return LA_RUNNING;
  1258. }
  1259. int OPMOD_NewPanel(laOperator *a, laEvent *e){
  1260. laLayout *l = MAIN.CurrentWindow->CurrentLayout;
  1261. laNewPanelData* np=a->CustomData;
  1262. if(!a->ConfirmData) return LA_RUNNING;
  1263. if(a->ConfirmData->Mode == LA_CONFIRM_CANCEL||a->ConfirmData->Mode == LA_CONFIRM_OK){ if(np) memFree(np); return LA_CANCELED; }
  1264. if(a->ConfirmData->Mode == LA_CONFIRM_DATA){
  1265. if (!np || !np->SelectedTemplate){ if(np) memFree(np); return LA_CANCELED; }
  1266. laPanel *p = la_FindFreePanelByTemplate(MAIN.CurrentWindow, np->SelectedTemplate);
  1267. if (!p){
  1268. p = laCreateTopPanel(MAIN.CurrentWindow, np->SelectedTemplate->Identifier->Ptr, e->x, e->y,0,0,0,0,0,0,0,0,0,0);
  1269. }
  1270. laShowPanelWithExpandEffect(p); laPopPanel(p); memFree(np);
  1271. return LA_FINISHED;
  1272. }
  1273. return LA_RUNNING;
  1274. }
  1275. int OPINV_BlockFoldTitle(laOperator *a, laEvent *e){
  1276. laBlock* b=a->This?a->This->EndInstance:0;
  1277. if(!b) return LA_CANCELED;
  1278. if(strSame(strGetArgumentString(a->ExtraInstructionsP, "show"), "true")) laUnfoldBlockTitle(b);
  1279. else laFoldBlockTitle(b);
  1280. return LA_FINISHED;
  1281. }
  1282. int OPINV_BlockMaximize(laOperator *a, laEvent *e){
  1283. laBlock* b=a->This?a->This->EndInstance:0;
  1284. if(!b || strSame(strGetArgumentString(a->ExtraInstructionsP, "restore"), "true")) laRestoreToLayout();
  1285. else laMaximizeBlock(b);
  1286. return LA_FINISHED;
  1287. }
  1288. int OPINV_CanvasUiMaximize(laOperator *a, laEvent *e){
  1289. laUiItem* ui=a->This?a->This->EndInstance:0;
  1290. laPanel* p=MAIN.CurrentPanel;
  1291. if(!ui || !p || (!ui->Type->Tag&LA_UI_TAG_IS_OFFSCREEN) || MAIN.CurrentWindow->MaximizedUi ||
  1292. strSame(strGetArgumentString(a->ExtraInstructionsP, "restore"), "true")) laRestoreCanvasUI();
  1293. else laMaximizeCanvasUI(ui,p);
  1294. return LA_FINISHED;
  1295. }
  1296. int OPINV_HideMenuBar(laOperator *a, laEvent *e){
  1297. if(!MAIN.CurrentWindow->MaximizedUi || strSame(strGetArgumentString(a->ExtraInstructionsP, "restore"), "true")) laShowMenuBar();
  1298. else laHideMenuBar();
  1299. return LA_FINISHED;
  1300. }
  1301. int OPINV_BlockTearOffPanel(laOperator *a, laEvent *e){
  1302. laLayout *l = MAIN.CurrentWindow->CurrentLayout;
  1303. laBlock* b = l->OperatingBlock;
  1304. if (!b) b = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
  1305. if(!b) return LA_CANCELED;
  1306. laTearOffPanel(b,0);
  1307. return LA_FINISHED;
  1308. }
  1309. int OPCHK_BlockHasMorePanels(laPropPack *This, laStringSplitor *Instructions){
  1310. laPanel*p = This?This->LastPs->UseInstance:0;
  1311. if(p && p->Mode == LA_PANEL_FLOATING_TOP) return 1;
  1312. laLayout *l = MAIN.CurrentWindow->CurrentLayout;
  1313. laBlock *b = l->OperatingBlock;
  1314. if (b && b->Panels.pFirst == b->Panels.pLast) return 0;
  1315. return 1;
  1316. }
  1317. int OPINV_BlockClosePanel(laOperator *a, laEvent *e){
  1318. laPanel*p = a->This?a->This->EndInstance:0;
  1319. if(p && p->Mode == LA_PANEL_FLOATING_TOP){
  1320. laDestroySinglePanel(p,0);
  1321. return LA_FINISHED;
  1322. }
  1323. laLayout *l = MAIN.CurrentWindow->CurrentLayout;
  1324. laBlock *b = l->OperatingBlock;
  1325. int x = e->x, y = e->y;
  1326. if (!b) b = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
  1327. if (b){
  1328. if (b->CurrentPanel){
  1329. //laLocalToWindow(a, MAIN.CurrentPanel, &x, &y);
  1330. laEnableYesNoPanel(a, 0, "Caution!", "Are you sure to destroy this panel?", e->x - 250, e->y, 250, e);
  1331. return LA_RUNNING;
  1332. }
  1333. }
  1334. return LA_CANCELED;
  1335. }
  1336. int OPMOD_BlockClosePanel(laOperator *a, laEvent *e){
  1337. laLayout *l = MAIN.CurrentWindow->CurrentLayout;
  1338. laBlock *b = l->OperatingBlock;
  1339. if (e->type == LA_ESCAPE_DOWN) return LA_FINISHED;
  1340. if (a->ConfirmData){
  1341. if (!b) b = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
  1342. if (!b) return LA_CANCELED;
  1343. if (a->ConfirmData->Mode == LA_CONFIRM_OK){
  1344. laDestroySinglePanel(b->CurrentPanel,1);
  1345. la_RecalcBlockRecursive(b, b->X, b->Y, b->W, b->H);
  1346. }
  1347. return LA_FINISHED;
  1348. }else
  1349. return LA_RUNNING;
  1350. }
  1351. int laui_BlockEdgeMenu(laOperator *WindowAct, laLayout *l, laBlock *b, laEvent *e){
  1352. laPanel *p;
  1353. laColumn *c, *cl, *cr;
  1354. laUiList *uil;
  1355. p = laDefineAndEnableMenuPanel(0, WindowAct, 0, e->x, e->y, 500, 200, e);
  1356. uil = laPrepareUi(p);
  1357. c = laFirstColumn(uil);
  1358. laSplitColumn(uil, c, 0.5);
  1359. cl = laLeftColumn(c, 0);
  1360. cr = laRightColumn(c, 0);
  1361. laShowItem(uil, c, 0, "LA_combine_child_blocks");
  1362. laEnclosePanelContent(p,uil);
  1363. }
  1364. laBlock* la_MakeDropBlock(laBlock* DropToBlock, int DropLocation){
  1365. switch (DropLocation){
  1366. case 0: return DropToBlock;
  1367. case LA_BLOCK_DROP_LOCATION_U:
  1368. laSplitBlockVertical(DropToBlock, 0.5); laSwapSubBlocks(DropToBlock);
  1369. return DropToBlock->B1;
  1370. case LA_BLOCK_DROP_LOCATION_B:
  1371. laSplitBlockVertical(DropToBlock, 0.5);
  1372. return DropToBlock->B2;
  1373. case LA_BLOCK_DROP_LOCATION_L:
  1374. laSplitBlockHorizon(DropToBlock, 0.5); laSwapSubBlocks(DropToBlock);
  1375. return DropToBlock->B1;
  1376. case LA_BLOCK_DROP_LOCATION_R:
  1377. laSplitBlockHorizon(DropToBlock, 0.5);
  1378. return DropToBlock->B2;
  1379. }
  1380. }
  1381. void la_StartDocking(laWindow* from, laPanel* p){
  1382. for(laWindow* w=MAIN.Windows.pFirst;w;w=w->Item.pNext){ w->DockingFrom = from; w->IsDocking=1; } MAIN.DockingPanel=p;
  1383. }
  1384. void la_StopDocking(){
  1385. for(laWindow* w=MAIN.Windows.pFirst;w;w=w->Item.pNext){ w->DockingFrom = 0; w->IsDocking=0; } MAIN.DockingPanel=0;
  1386. }
  1387. void la_ClearDockingTarget(){
  1388. for(laWindow* w=MAIN.Windows.pFirst;w;w=w->Item.pNext){ w->CurrentLayout->DropToBlock=0; }
  1389. }
  1390. int OPINV_DockPanel(laOperator* a, laEvent* e){
  1391. laPanel*p = a->This?a->This->EndInstance:0;
  1392. if(!p) return LA_CANCELED;
  1393. la_StartDocking(MAIN.CurrentWindow, p);
  1394. laRestoreToLayout();
  1395. laRestoreCanvasUI();
  1396. return LA_FINISHED;
  1397. }
  1398. int OPINV_NewWindow(laOperator* a, laEvent* e){
  1399. laWindow* w = a->This?a->This->EndInstance:MAIN.CurrentWindow;
  1400. laWindow* nw =laDesignWindow(w->X,w->Y,w->W,w->H);
  1401. laLayout* l=(w->Layouts.pFirst!=w->Layouts.pLast)?w->CurrentLayout:0;
  1402. if (l && !strSame(strGetArgumentString(a->ExtraInstructionsP, "clean"), "true")){
  1403. laLayout* nextl=l->Item.pPrev?l->Item.pPrev:l->Item.pNext;
  1404. memAssignRef(w, &w->CurrentLayout, nextl);
  1405. lstRemoveItem(&w->Layouts, l); lstAppendItem(&nw->Layouts, l);
  1406. memAssignRef(nw, &nw->CurrentLayout, l);
  1407. laRenameWindow(nw, l->ID->Ptr);
  1408. laRenameWindow(w, w->CurrentLayout->ID->Ptr);
  1409. }else{
  1410. laDesignLayout(nw, "Empty Layout");
  1411. }
  1412. laStartWindow(nw);
  1413. laRedrawAllWindows();
  1414. return LA_FINISHED;
  1415. }
  1416. void *la_OnBlockSeperator(laBlock *b, laEvent *e){
  1417. int at;
  1418. laBlock *bb;
  1419. if (!b->B1) return 0;
  1420. if (b->Vertical){
  1421. at = b->H * b->SplitRatio + b->Y;
  1422. if (e->x>=b->X && e->x<=b->X+b->W && e->y >= at - LA_SEAM_W && e->y <= at + LA_SEAM_W){
  1423. return b;
  1424. }
  1425. }else{
  1426. at = b->X + b->W * b->SplitRatio;
  1427. if (e->y>=b->Y && e->y<=b->Y+b->H && e->x >= at - LA_SEAM_W && e->x <= at + LA_SEAM_W){
  1428. return b;
  1429. }
  1430. }
  1431. if (bb = la_OnBlockSeperator(b->B1, e)) return bb;
  1432. else
  1433. return la_OnBlockSeperator(b->B2, e);
  1434. }
  1435. int la_DetectBlockDropLocation(laBlock *b, int X, int Y){
  1436. laPanel *p = b->Panels.pFirst;
  1437. if (!p) return 0;
  1438. real L = tnsGetRatiod(p->X, p->X + p->W, X);
  1439. real U = tnsGetRatiod(p->Y, p->Y + p->H, Y);
  1440. if (L > U){
  1441. if (U < 0.25){
  1442. if (L < 0.75) return LA_BLOCK_DROP_LOCATION_U;
  1443. else
  1444. return LA_BLOCK_DROP_LOCATION_R;
  1445. }else{
  1446. if (L < 0.75) return 0;
  1447. else
  1448. return LA_BLOCK_DROP_LOCATION_R;
  1449. }
  1450. }else{
  1451. if (U > 0.75){
  1452. if (L < 0.25) return LA_BLOCK_DROP_LOCATION_L;
  1453. else
  1454. return LA_BLOCK_DROP_LOCATION_B;
  1455. }else{
  1456. if (L < 0.25) return LA_BLOCK_DROP_LOCATION_L;
  1457. else
  1458. return 0;
  1459. }
  1460. }
  1461. }
  1462. int laui_BlockMenu(laOperator *WindowAct, laWindow* w, laLayout *l, laBlock *b, laEvent *e){
  1463. laPanel *p;
  1464. laColumn *c;
  1465. laUiList *uil;
  1466. p = laDefineAndEnableMenuPanel(0, WindowAct, 0, b->X, b->Y + LA_RH + 1, 500, 500, e);
  1467. uil = laPrepareUi(p);
  1468. c = laFirstColumn(uil);
  1469. laPanel* forp=b->CurrentPanel;
  1470. laUiItem* b1=laBeginRow(uil,c,0,0);
  1471. laShowItem(uil,c,&b->PP,"fold");
  1472. laUiItem* b2=laOnConditionThat(uil,c,laPropExpression(&w->PP, "maximized_block"));{
  1473. laShowItemFull(uil,c,&b->PP,"maximize",0,"restore=true;text=Restore;",0,0);
  1474. }laElse(uil,b2);{
  1475. laShowItem(uil,c,&b->PP,"maximize");
  1476. }laEndCondition(uil,b2);
  1477. laEndRow(uil,b1);
  1478. laShowSeparator(uil,c);
  1479. if(forp->PanelTemplate && forp->PanelTemplate->Header){
  1480. laShowLabel(uil, c, "Panel properties:", 0, 0);
  1481. forp->PanelTemplate->Header(uil, &forp->PP, &forp->PropLinkPP, c, 0);
  1482. }else{
  1483. if(forp->PropLinkPP.LastPs->p->SubProp->Props.pFirst){
  1484. for(laProp* p = forp->PropLinkPP.LastPs->p->SubProp->Props.pFirst;p;p=p->Item.pNext){
  1485. if(p->PropertyType&LA_PROP_SUB){
  1486. laShowItemFull(uil, c, &forp->PropLinkPP, p->Identifier, LA_WIDGET_COLLECTION_SELECTOR,0,laui_IdentifierOnly,0);
  1487. }else{ laShowItem(uil, c, &forp->PropLinkPP, p->Identifier); }
  1488. }
  1489. }else{
  1490. laShowLabel(uil, c, "Panel doesn't have configurable property.", 0, 0);
  1491. }
  1492. }
  1493. //laShowItem(uil, c, 0, "LA_new_panel");
  1494. //laShowItem(uil, c, 0, "LA_block_close_panel");
  1495. //laShowItem(uil, c, 0, "LA_block_tear_off_panel");
  1496. laEnclosePanelContent(p,uil);
  1497. }
  1498. int la_ProcessBlockEvent(laOperator *a, laBlock *b, laEvent *e){
  1499. int Executed = 0, Ret=1;
  1500. int L = LA_RH+LA_SEAM_W, R, tw = 0;
  1501. real ratio = 1.0f;
  1502. laPanel *p = b->Panels.pFirst;
  1503. laGeneralUiExtraData *uid = a->CustomData;
  1504. laLayout *l;
  1505. if(!b->Panels.pFirst){return 0;}
  1506. if (laIsInBlockHeader(b, e->x, e->y) || MAIN.CurrentWindow->CurrentLayout->ClickedPanel){
  1507. MAIN.CurrentWindow->CurrentLayout->OperatingBlock = b;
  1508. if (b->CurrentPanel){
  1509. if (e->type == LA_MOUSE_WHEEL_DOWN && b->CurrentPanel->Item.pNext){
  1510. b->CurrentPanel = b->CurrentPanel->Item.pNext; Executed = 1;
  1511. }elif (e->type == LA_MOUSE_WHEEL_UP && b->CurrentPanel->Item.pPrev){
  1512. b->CurrentPanel = b->CurrentPanel->Item.pPrev; Executed = 1;
  1513. }
  1514. }
  1515. if(!b->Folded){
  1516. for (p = b->Panels.pFirst; p; p = p->Item.pNext){ tw += (p->TitleWidth + LA_SEAM_W*2); }
  1517. if (tw > b->W - LA_SEAM_W*2 - LA_RH) ratio = (real)(b->W - LA_SEAM_W*2 - LA_RH) / tw;
  1518. if ((e->type == LA_L_MOUSE_DOWN)){
  1519. uid->LastX = e->x;
  1520. uid->LastY = e->y;
  1521. int LT=0,RT=0;
  1522. for (p = b->Panels.pFirst; p; p = p->Item.pNext){
  1523. RT = LT + p->TitleWidth+LA_SEAM_W*2;
  1524. if (e->x >= b->X + L+LT * ratio && e->x < b->X + L+RT * ratio){
  1525. MAIN.CurrentWindow->CurrentLayout->ClickedPanel = p; b->CurrentPanel = p; Executed = 1;
  1526. }
  1527. LT = RT;
  1528. }
  1529. }elif (e->type == LA_MOUSEMOVE){
  1530. if (abs(e->x - uid->LastX) > LA_RH*3 || abs(e->y - uid->LastY) > LA_RH*3){
  1531. if (MAIN.CurrentWindow->CurrentLayout->ClickedPanel){
  1532. l = MAIN.CurrentWindow->CurrentLayout;
  1533. l->DropToBlock = b;
  1534. l->DropLocation = la_DetectBlockDropLocation(b, e->x, e->y);
  1535. laRefreshWindow();
  1536. }
  1537. }
  1538. }elif (e->type == LA_L_MOUSE_UP){
  1539. l = MAIN.CurrentWindow->CurrentLayout;
  1540. if (l->DropToBlock){
  1541. l->DropToBlock = la_MakeDropBlock(l->DropToBlock,l->DropLocation);
  1542. p = l->ClickedPanel;
  1543. if(p->Block == l->DropToBlock){
  1544. if(laTearOffPanel(p->Block, p)) Executed=1;
  1545. }else{
  1546. p->Block->CurrentPanel = p->Item.pPrev ? p->Item.pPrev : (p->Item.pNext ? p->Item.pNext : 0);
  1547. lstRemoveItem(&p->Block->Panels, p); laBlock* orig_block=p->Block->parent;
  1548. int clear=0; if(!lstHaveItemInList(&p->Block->Panels)){clear=1;}
  1549. lstPushItem(&l->DropToBlock->Panels, p);
  1550. p->Block = l->DropToBlock;
  1551. if(clear){
  1552. laCombineChildBlocks(orig_block);
  1553. if(!lstFindItem(orig_block->CurrentPanel,nutSameAddress,&orig_block->Panels)){
  1554. orig_block->CurrentPanel = orig_block->Panels.pFirst;
  1555. }
  1556. }
  1557. p->Block->CurrentPanel = p;
  1558. Executed = 1;
  1559. la_RecalcBlockRecursive(p->Block, p->Block->X, p->Block->Y, p->Block->W, p->Block->H);
  1560. if(orig_block!=p->Block){
  1561. la_RecalcBlockRecursive(orig_block, orig_block->X, orig_block->Y, orig_block->W, orig_block->H);
  1562. }
  1563. }
  1564. }
  1565. MAIN.CurrentWindow->CurrentLayout->DropToBlock = 0;
  1566. MAIN.CurrentWindow->CurrentLayout->ClickedPanel = 0;
  1567. return 0;
  1568. }
  1569. }else{
  1570. if(!b->OnButton){ b->OnButton=1; laRefreshWindow(); } Ret=0;
  1571. if(laIsInBlockBotton1(b, e->x, e->y)){ if(b->OnButton!=2){b->OnButton=2;laRefreshWindow();} if(e->type==LA_L_MOUSE_DOWN){laUnfoldBlockTitle(b);Executed=1;Ret=1;} }
  1572. elif(laIsInBlockBotton2(b, e->x, e->y)){ if(b->OnButton!=2){b->OnButton=2;laRefreshWindow();} if(e->type==LA_L_MOUSE_DOWN){laMaximizeBlock(b);Executed=1;Ret=1;} }
  1573. }
  1574. if (Executed){
  1575. laRecalcPanel(b->CurrentPanel);
  1576. la_RecalcBlockRecursive(b, b->X, b->Y, b->W, b->H);
  1577. }
  1578. if (!Executed && e->type == LA_L_MOUSE_DOWN && laIsInBlockBotton1(b, e->x, e->y)){
  1579. laui_BlockMenu(a, MAIN.CurrentWindow, MAIN.CurrentWindow->CurrentLayout, b, e);
  1580. }
  1581. return Ret;
  1582. }else{
  1583. if(b->OnButton){b->OnButton=0;laRefreshWindow();}
  1584. }
  1585. return 0;
  1586. }
  1587. int la_ProcessBlockEdgeEvent(laOperator *WindowAct, laLayout *l, laBlock *b, laEvent *e){
  1588. laBlock *ob = l->MovingBlock;
  1589. laWindow *w = WindowAct->Instance;
  1590. if (e->type == LA_MOUSEMOVE && ob && l->MovingBlock && l->IsMoving){
  1591. if (ob->Vertical) ob->SplitRatio = (real)(e->y - ob->Y) / (real)(ob->H);
  1592. else ob->SplitRatio = (real)(e->x - ob->X) / (real)(ob->W);
  1593. la_RecalcBlockRecursive(ob, ob->X, ob->Y, ob->W, ob->H);
  1594. if (ob->B1->CurrentPanel) laRecalcPanel(ob->B1->CurrentPanel);
  1595. if (ob->B2->CurrentPanel) laRecalcPanel(ob->B2->CurrentPanel);
  1596. return 1;
  1597. }
  1598. if (ob = la_OnBlockSeperator(b, e)){
  1599. ob->B1->OnButton=ob->B2->OnButton=0;
  1600. if(l->MovingBlock!=ob){ laRefreshWindow(); }
  1601. l->MovingBlock = ob; laSetWindowCursor(ob->Vertical?LA_UP_AND_DOWN:LA_LEFT_AND_RIGHT);
  1602. if (e->type == LA_L_MOUSE_DOWN){
  1603. l->IsMoving = 1;
  1604. }elif (e->type == LA_L_MOUSE_UP){
  1605. l->IsMoving = 0;
  1606. }elif (e->type == LA_R_MOUSE_DOWN){
  1607. l->OnBlockSeperator = ob;
  1608. laui_BlockEdgeMenu(WindowAct, l, ob, e);
  1609. }
  1610. return 1;
  1611. }
  1612. if(l->MovingBlock){ l->MovingBlock = 0; laRefreshWindow(); laSetWindowCursor(LA_ARROW); }
  1613. return 0;
  1614. }
  1615. real la_ScrollerVerticalPan(int MousePanY, laPanel *p, laUiList *suil, laUiItem *pui){
  1616. int DisplayH, TotalH;
  1617. if (!pui){ DisplayH = p->H-suil->U; }
  1618. else{ DisplayH = pui->Page?(pui->B-pui->Page->U):(pui->B - pui->U); }
  1619. TotalH = suil->B - suil->U;
  1620. return ((real)TotalH * (real)MousePanY / (real)DisplayH);
  1621. }
  1622. real la_ScrollerHorizontalPan(int MousePanX, laPanel *p, laUiList *suil, laUiItem *pui){
  1623. int DisplayW, TotalW;
  1624. DisplayW = pui->Page?(pui->R-pui->Page->L):(pui->R - pui->L);
  1625. TotalW = suil->R - suil->L;
  1626. return ((real)TotalW * (real)MousePanX / (real)DisplayW);
  1627. }
  1628. void laui_LayoutCycle(laUiList *uil, laPropPack *This, laPropPack *OperatorProps, laColumn *UNUSED, int context){
  1629. laColumn *c;
  1630. c = laFirstColumn(uil);
  1631. laShowItemFull(uil, c, 0, "la.windows.layouts", 0, 0, laui_IdentifierOnly, 0);
  1632. laUiItem* b=laBeginRow(uil,c,0,0);
  1633. laShowItem(uil, c, 0, "LA_new_layout")->Expand=1;
  1634. laShowItem(uil, c, 0, "LA_remove_layout")->Flags|=LA_UI_FLAGS_ICON|LA_UI_FLAGS_NO_CONFIRM;
  1635. laEndRow(uil,b);
  1636. }
  1637. int OPINV_SwitchLayout(laOperator *a, laEvent *e){
  1638. laWindow *w = MAIN.CurrentWindow; if (!w) return LA_FINISHED;
  1639. if (strSame(strGetArgumentString(a->ExtraInstructionsP, "show_list"), "true")){
  1640. laPanel* p =laEnableOperatorPanel(a, 0, e->x-LA_RH, e->y-LA_RH, 500, 500, 0,0,0,0,0,0,0,0,e);
  1641. return LA_RUNNING;
  1642. }
  1643. laLayout* newlayout;
  1644. if (strSame(strGetArgumentString(a->ExtraInstructionsP, "reverse"), "true")) newlayout = w->CurrentLayout->Item.pPrev ? w->CurrentLayout->Item.pPrev : w->Layouts.pLast;
  1645. else newlayout = w->CurrentLayout->Item.pNext ? w->CurrentLayout->Item.pNext : w->Layouts.pFirst;
  1646. memAssignRef(w, &w->CurrentLayout, newlayout);
  1647. laRenameWindow(w, w->CurrentLayout->ID->Ptr);
  1648. la_StopAllOperators();
  1649. laRetriggerOperators();
  1650. laRedrawCurrentWindow();
  1651. laNotifyUsers("la.windows.layouts");
  1652. return LA_FINISHED;
  1653. }
  1654. int OPINV_DeleteTheme(laOperator *a, laEvent *e){
  1655. laTheme* t = a->This?a->This->EndInstance:MAIN.CurrentTheme;
  1656. if(!t || MAIN.Themes.pFirst == MAIN.Themes.pLast) return LA_CANCELED;
  1657. laBoxedTheme* NextBt;
  1658. for(laBoxedTheme* bt=t->BoxedThemes.pFirst; bt; bt=NextBt){
  1659. NextBt = bt->Item.pNext; lstRemoveItem(&t->BoxedThemes, bt); memFree(bt);
  1660. }
  1661. lstRemoveItem(&MAIN.Themes, t); memFree(t);
  1662. if(t==MAIN.CurrentTheme){MAIN.CurrentTheme = MAIN.Themes.pFirst;la_RefreshThemeColor(MAIN.CurrentTheme);}
  1663. laNotifyUsers("themes"); laRedrawCurrentWindow();
  1664. return LA_FINISHED;
  1665. }
  1666. int la_GenericTopPanelProcessing(laOperator* a, laEvent* e){
  1667. laPanel* p;
  1668. if (p = laDetectPanel(e->x, e->y)){
  1669. int x = e->x;
  1670. int y = e->y;
  1671. laWindowToLocal(0, p, &x, &y);
  1672. if (laIsInPanel(p, x, y) /*&& p->Show*/){
  1673. laSetOperatorLocalizer(p);
  1674. laInvokeUi(a, "LA_panel_operator", e, p, 0, 1);
  1675. return LA_RUNNING;
  1676. }
  1677. }
  1678. return 0;
  1679. }
  1680. int la_GeneratePasteEvent(laWindow* w){
  1681. #ifdef LA_LINUX
  1682. XConvertSelection(MAIN.dpy, MAIN.bufid, MAIN.fmtid, MAIN.propid, w->win, CurrentTime);
  1683. #endif
  1684. }
  1685. int OPINV_SystemPaste(laOperator *a, laEvent *e){ la_GeneratePasteEvent(MAIN.CurrentWindow); return LA_FINISHED; }
  1686. int OPINV_Window(laOperator *a, laEvent *e){
  1687. laRetriggerOperators();
  1688. return LA_RUNNING;
  1689. }
  1690. int OPMOD_Window(laOperator *a, laEvent *e){
  1691. laPanel *p;
  1692. laBlock *b = 0;
  1693. laWindow *w = a->Instance;
  1694. laGeneralUiExtraData *uid = a->CustomData;
  1695. if (!uid) uid = memAcquireSimple(sizeof(laGeneralUiExtraData));
  1696. a->CustomData = uid;
  1697. if(laKeyMapExecuteEvent(a, &MAIN.KeyMap, e)) return LA_RUNNING_PASS;
  1698. if(w->IsDocking && MAIN.DockingPanel){
  1699. laRestoreToLayout();
  1700. laRestoreCanvasUI();
  1701. laLayout* l=MAIN.CurrentWindow->CurrentLayout;
  1702. laBlock *Recieve = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
  1703. if (Recieve){
  1704. la_ClearDockingTarget(); l->DropToBlock = Recieve;
  1705. l->DropLocation = la_DetectBlockDropLocation(Recieve, e->x, e->y);
  1706. laRefreshWindow();
  1707. }else{
  1708. MAIN.CurrentWindow->CurrentLayout->DropToBlock = 0;
  1709. }
  1710. if(e->type==LA_L_MOUSE_UP && l->DropToBlock){
  1711. l->DropToBlock = la_MakeDropBlock(l->DropToBlock, l->DropLocation);
  1712. laDockPanel(w->DockingFrom, l->DropToBlock, MAIN.DockingPanel);
  1713. la_StopDocking();la_ClearDockingTarget(); return LA_RUNNING;
  1714. }
  1715. if(e->type==LA_R_MOUSE_DOWN || (e->type==LA_KEY_DOWN&&e->key==LA_KEY_ESCAPE)){
  1716. la_StopDocking();la_ClearDockingTarget(); return LA_RUNNING;
  1717. }
  1718. return LA_RUNNING;
  1719. }
  1720. if(w->MaximizedUi && w->MaximizedUiPanel){
  1721. if(((e->y<LA_RH && e->x<LA_RH)||e->y<LA_SEAM_W) && uid->Dragging){ laShowMenuBar(); uid->Dragging=0; }
  1722. if(!la_UiOperatorExists(w->MaximizedUi)){
  1723. laSetOperatorLocalizer(w->MaximizedUiPanel);
  1724. laInvokeUi(a, w->MaximizedUi->Type->OperatorID, e, w->MaximizedUi, 0, 1);
  1725. return LA_RUNNING;
  1726. }
  1727. if(e->y>LA_2RH && e->x>LA_2RH){ if(!uid->Dragging)laRequestDelayEvent(0.5); uid->Dragging=1; }
  1728. if(e->type==LA_TIME_DELAY){ laHideMenuBar(); }
  1729. }else{
  1730. if(MAIN.PendingSplash){
  1731. laSetOperatorLocalizer(MAIN.PendingSplash);
  1732. laInvokeUi(a, "LA_panel_operator", e, MAIN.PendingSplash, 0, 1);
  1733. laRetriggerOperators();
  1734. MAIN.PendingSplash=0; return LA_RUNNING;
  1735. }
  1736. laBlock* RootBlock=w->MaximizedBlock?w->MaximizedBlock:w->CurrentLayout->FirstBlock;
  1737. if (la_ProcessBlockEdgeEvent(a, w->CurrentLayout, RootBlock, e)) return LA_RUNNING;
  1738. b = w->MaximizedBlock?w->MaximizedBlock:laDetectBlockRecursive(w->CurrentLayout->FirstBlock, e->x, e->y);
  1739. laClearBlockButtonRecursive(RootBlock,b);
  1740. if (b && la_ProcessBlockEvent(a, b, e)) return LA_RUNNING;
  1741. for (p = w->Panels.pFirst; p; p = p->Item.pNext){
  1742. int x = e->x; int y = e->y;
  1743. laWindowToLocal(0, p, &x, &y);
  1744. if (laIsInPanel(p, x, y) && p->Show){
  1745. laSetOperatorLocalizer(p);
  1746. if (!p->LaterDestroy) laInvokeUi(a, "LA_panel_operator", e, p, 0, 1);
  1747. return LA_RUNNING;
  1748. }
  1749. }
  1750. }
  1751. if(la_GenericTopPanelProcessing(a,e)) return LA_RUNNING;
  1752. return LA_RUNNING;
  1753. }
  1754. int OPINV_Panel(laOperator *a, laEvent *e){
  1755. if (!((laPanel *)a->Instance)->Show) return LA_FINISHED;
  1756. a->CustomData = memAcquireSimple(sizeof(laGeneralUiExtraData));
  1757. laRetriggerOperators();
  1758. return LA_RUNNING;
  1759. }
  1760. void OPEXT_Panel(laOperator *a, int ExitCode){
  1761. memFree(a->CustomData);
  1762. }
  1763. int la_ScrollPanel(laGeneralUiExtraData*ex, laPanel*p, laEvent* e){
  1764. int ret=0;
  1765. if(ex->TargetIndexVali==4 && e->type==LA_MOUSEMOVE){
  1766. laUiList* uuil=ex->Ptr1; laUiItem* upui=ex->Ptr2;
  1767. if(upui){ laPanUiListFree(uuil, ex->LastX-e->x, ex->LastY-e->y);
  1768. //if(uuil->HeightCoeff){
  1769. if(uuil->B-upui->Page->PanY<upui->TB-(*p->BT)->BM-LA_SCROLL_W){
  1770. upui->Page->PanY = (uuil->B-upui->TB+(*p->BT)->BM+LA_SCROLL_W);
  1771. if(upui->Page->PanY<0){upui->Page->PanY=0;}
  1772. }
  1773. //}
  1774. }
  1775. ex->LastX=e->x; ex->LastY=e->y;
  1776. laRedrawCurrentPanel();
  1777. ret= 1;
  1778. }
  1779. if(ex->TargetIndexVali==5 && e->type==LA_MOUSEMOVE){
  1780. laUiList* uuil=ex->Ptr1; laUiItem* upui=ex->Ptr2;
  1781. if(upui)laScaleUiList(uuil, -(ex->LastY-e->y)*0.005+1, upui->L, upui->R, upui->U, upui->B);
  1782. ex->LastX=e->x; ex->LastY=e->y;
  1783. laRecalcCurrentPanel();
  1784. ret= 1;
  1785. }
  1786. if(e->type==LA_M_MOUSE_UP){ ex->TargetIndexVali=0; }
  1787. if (e->type & LA_KEY_MOUSE_SCROLL || (e->type==LA_M_MOUSE_DOWN) || (e->key&LA_KEY_PANNING)){
  1788. laUiItem *pui = 0; laListHandle levels={0}; int dir=0;
  1789. if(e->key&LA_KEY_PANNING){
  1790. if (e->key&LA_KEY_ARRDOWN) dir=1;
  1791. elif (e->key&LA_KEY_ARRUP) dir=-1;
  1792. }else{
  1793. if (e->type & LA_STATE_DOWN) dir=1;
  1794. elif (e->type & LA_STATE_UP) dir=-1;
  1795. }
  1796. laUiList *duil = la_DetectUiListRecursiveDeep(p->MenuRefer?p->MenuRefer:&p->UI, e->x, e->y, 10000, &pui, 0, 0, 0, 0, &levels);
  1797. laUiListRecord* lip=levels.pLast; laUiList* uuil=lip->uil; laUiItem* upui=lip->Item.pPrev?((laUiListRecord*)lip->Item.pPrev)->pui:0; int ran=0;
  1798. if(e->SpecialKeyBit == LA_KEY_CTRL){
  1799. if(e->type==LA_M_MOUSE_DOWN){
  1800. while (lip && upui && (!uuil->AllowScale)) { lip=lip->Item.pPrev; uuil=lip->uil; upui=lip->Item.pPrev?((laUiListRecord*)lip->Item.pPrev)->pui:0; }
  1801. if(uuil) { ex->TargetIndexVali=5; ex->Ptr1=uuil; ex->Ptr2=upui; ex->LastX=e->x; ex->LastY=e->y; ret= 1;}
  1802. }else{
  1803. }
  1804. }else{
  1805. if(e->type==LA_M_MOUSE_DOWN){
  1806. while (lip && upui && (!uuil->AllowScale)) { lip=lip->Item.pPrev; uuil=lip->uil; upui=lip->Item.pPrev?((laUiListRecord*)lip->Item.pPrev)->pui:0; }
  1807. if(uuil) { ex->TargetIndexVali=4; ex->Ptr1=uuil; ex->Ptr2=upui; ex->LastX=e->x; ex->LastY=e->y; ret= 1;}
  1808. }else{
  1809. while (lip && upui){
  1810. if(uuil->AllowScale){ if((ran=laScaleUiList(uuil, 1.0f-dir*0.1, upui->L, upui->R, upui->U, upui->B))){ laRecalcCurrentPanel(); break;} }
  1811. else{ if((ran=laPanUiListAuto(uuil, 0, dir*MAIN.ScrollingSpeed*LA_RH,
  1812. uuil->L, upui->R-(uuil->ScrollerShownV?(LA_SCROLL_W+(*p->BT)->RM):0),
  1813. uuil->U, upui->B-(*upui->Type->Theme)->BM-(uuil->ScrollerShownH?(LA_SCROLL_W+(*p->BT)->BM):0)))) break; }
  1814. lip=lip->Item.pPrev; uuil=lip->uil; upui=lip->Item.pPrev?((laUiListRecord*)lip->Item.pPrev)->pui:0;
  1815. }
  1816. if(!ran) laPanUiListAuto(p->MenuRefer?p->MenuRefer:&p->UI, 0, dir*MAIN.ScrollingSpeed*LA_RH, 0, p->W, p->TitleBar.B+(*p->BT)->TM, p->H-(*p->BT)->BM);
  1817. laRedrawCurrentPanel();
  1818. ret= 1;
  1819. }
  1820. }
  1821. while(duil=lstPopPointer(&levels));
  1822. }
  1823. return ret;
  1824. }
  1825. int OPMOD_Panel(laOperator *a, laEvent *e){
  1826. int x = e->x;
  1827. int y = e->y;
  1828. laPanel *p = a->Instance, *dp;
  1829. laUiItem *ui = 0;
  1830. laGeneralUiExtraData *uid = a->CustomData;
  1831. laListHandle Locals = {0};
  1832. int RET=LA_RUNNING|(p->IsMenuPanel?0:LA_PASS_ON);
  1833. if(MAIN.DockingPanel){ return LA_FINISHED; }
  1834. if (!p->Show || (!laIsInPanel(p, x, y) && !uid->TargetIndexVali)){
  1835. if(p->CloseWhenMovedOut==2){
  1836. if(e->type&LA_STATE_DOWN){
  1837. la_StopUiOperatorService(p); laDestroySinglePanel(p,0); return LA_FINISHED;
  1838. }
  1839. return LA_RUNNING;
  1840. }
  1841. if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); }
  1842. return LA_FINISHED_PASS;
  1843. }
  1844. if(((e->type==LA_KEY_DOWN && e->key==LA_KEY_ESCAPE)||(e->type==LA_R_MOUSE_DOWN)) && p->CloseWhenMovedOut==2){
  1845. la_StopUiOperatorService(p); laDestroySinglePanel(p,0); return LA_FINISHED;
  1846. }
  1847. int NoPrimaryUI=(p==MAIN.CurrentWindow->MaximizedUiPanel);
  1848. if(p->PanelTemplate && laKeyMapExecuteEvent(a, &p->PanelTemplate->KeyMap, e)) return RET;
  1849. int IsTop=laIsTopPanel(p);
  1850. if (!IsTop && !uid->TargetIndexVali){
  1851. laLocalToWindow(0, p, &x, &y);
  1852. dp = laDetectPanel(x, y);
  1853. if (dp && dp->Mode && dp != p){
  1854. return LA_FINISHED;
  1855. }else if ((e->type & LA_MOUSEDOWN) == LA_MOUSEDOWN){
  1856. laPopPanel(p); IsTop=1;
  1857. }else if(p->Mode) return LA_RUNNING;
  1858. laWindowToLocal(0, p, &x, &y);
  1859. }
  1860. if (e->type == LA_L_MOUSE_DOWN && (!NoPrimaryUI) && e->x + e->y < p->W + p->H - LA_SCROLL_W*2){
  1861. laUiItem *pui = 0; laUiList *suil = 0;laListHandle levels={0};
  1862. laUiList *duil = la_DetectUiListRecursiveDeep(&p->UI, e->x, e->y, 10000, &pui, &suil, 0, 0, 0, &levels);
  1863. while(duil=lstPopPointer(&levels));
  1864. if (suil){
  1865. uid->Ptr1 = suil; uid->Ptr2 = pui;
  1866. uid->TargetIndexVali = 3;
  1867. uid->LastX = e->x; uid->LastY = e->y;
  1868. uid->On=(!pui || e->x>pui->R-LA_SCROLL_W-2*(*p->BT)->RM)?1:0;
  1869. return LA_RUNNING;
  1870. }
  1871. }
  1872. if(la_ScrollPanel(uid,p,e))return LA_RUNNING;
  1873. if (!p->Mode || (IsTop && !uid->TargetIndexVali)){
  1874. if(y<p->TitleBar.B){ ui = la_DetectUiItemRecursive(&p->TitleBar, x, y, 10000, &Locals, 0); }
  1875. elif (!ui && (!NoPrimaryUI)){
  1876. lstClearPointer(&Locals);
  1877. ui = la_DetectUiItemRecursive(&p->UI, x, y, 10000, &Locals, 0);
  1878. }
  1879. }
  1880. if (ui && !a->Child && ui->Type->OperatorType && !la_UiOperatorExists(ui)){
  1881. laSetOperatorLocalizer(p);
  1882. if (laInvokeUiP(a, ui->Type->OperatorType, e, ui, &Locals, 0) >= 0){ laRetriggerOperators(); }
  1883. lstClearPointer(&Locals);
  1884. //return LA_RUNNING;
  1885. }
  1886. lstClearPointer(&Locals);
  1887. if (p->Mode && e->type&LA_MOUSE_EVENT && !uid->TargetIndexVali && !p->IsMenuPanel){
  1888. if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2){
  1889. if((!a->Item.pPrev) && (!p->ShowCorner)){ p->ShowCorner=1; laSetWindowCursor(LA_CORNER); laRefreshWindow(); }
  1890. if(e->type==LA_L_MOUSE_DOWN){ uid->TargetIndexVali = 2; uid->LastX=e->x;uid->LastY=e->y; }
  1891. return LA_RUNNING;
  1892. }else{
  1893. if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); }
  1894. if(e->type==LA_L_MOUSE_DOWN){ uid->TargetIndexVali = 1; uid->LastX=e->x;uid->LastY=e->y; return LA_RUNNING; }
  1895. }
  1896. }
  1897. if (e->type == LA_MOUSEMOVE){
  1898. if (uid->TargetIndexVali == 1){
  1899. if (!p->SL && !p->SR) p->TX = p->X + e->x - uid->LastX;
  1900. if (!p->ST && !p->SB) p->TY = p->Y + e->y - uid->LastY;
  1901. laNotifyUsersPPPath(&p->PP, "position");
  1902. la_EnsurePanelSnapping(p, MAIN.CurrentWindow->CW, MAIN.CurrentWindow->CH);
  1903. laRecalcCurrentPanel();
  1904. return LA_RUNNING;
  1905. }elif (uid->TargetIndexVali == 2){
  1906. p->TW += e->x - uid->LastX; p->TH += e->y - uid->LastY;
  1907. uid->LastX = e->x; uid->LastY = e->y;
  1908. p->BoundUi=0;
  1909. laNotifyUsersPPPath(&p->PP, "size");
  1910. la_EnsurePanelSnapping(p, MAIN.CurrentWindow->CW, MAIN.CurrentWindow->CH);
  1911. laRecalcCurrentPanel();
  1912. return LA_RUNNING;
  1913. }elif (uid->TargetIndexVali == 3){
  1914. laUiList *suil = uid->Ptr1; laUiItem *pui = uid->Ptr2;
  1915. int IsVertical=uid->On;
  1916. uid->TargetIndexValf+=IsVertical?la_ScrollerVerticalPan(e->y - uid->LastY, p, uid->Ptr1, uid->Ptr2):
  1917. (pui?la_ScrollerHorizontalPan(e->x - uid->LastX, p, uid->Ptr1, uid->Ptr2):0);
  1918. uid->Dragging = (int)uid->TargetIndexValf; uid->TargetIndexValf-=uid->Dragging;
  1919. int pV=uid->Dragging*IsVertical, pH=uid->Dragging*(!IsVertical);
  1920. if (!pui) laPanUiList(suil, pH, pV,0, p->W, suil->U, p->H-(*p->BT)->BM);
  1921. else laPanUiList(suil, pH, pV, suil->L, pui->R-(suil->ScrollerShownV?(LA_SCROLL_W+(*p->BT)->RM):0),
  1922. suil->U, pui->B-(*p->BT)->BM-(suil->ScrollerShownH?(LA_SCROLL_W+(*p->BT)->BM):0));
  1923. uid->LastX = e->x; uid->LastY = e->y;
  1924. laRedrawCurrentPanel();
  1925. return LA_RUNNING;
  1926. }
  1927. }
  1928. if (e->type == LA_L_MOUSE_UP){
  1929. uid->TargetIndexVali = 0; laSetWindowCursor(LA_ARROW);
  1930. return LA_RUNNING;
  1931. }
  1932. if(p->Mode&&e->type&LA_MOUSE_EVENT){ return LA_RUNNING; }
  1933. return RET;
  1934. }
  1935. int OPMOD_MenuPanel(laOperator *a, laEvent *e){
  1936. int x = e->x;
  1937. int y = e->y;
  1938. laPanel *p = a->Instance;
  1939. laUiItem *ui;
  1940. laListHandle Locals = {0};
  1941. laGeneralUiExtraData *uid = a->CustomData;
  1942. if(MAIN.DockingPanel){return LA_FINISHED; }
  1943. int IsClose=laIsCloseToPanel(p,x,y);
  1944. int IsIn=laIsInPanel(p, x, y);
  1945. if(p->CloseWhenMovedOut && ((!IsClose) || (!IsIn && e->type==LA_TIME_IDLE) || e->type==LA_L_MOUSE_DOWN||e->type==LA_R_MOUSE_DOWN)){
  1946. la_StopUiOperatorService(p);
  1947. laDestroySinglePanel(p,0);
  1948. return LA_FINISHED_PASS;
  1949. }
  1950. if (e->type == LA_ESCAPE_DOWN || (e->type == LA_L_MOUSE_DOWN && !IsIn)){
  1951. laConfirmInt(a, 1, LA_CONFIRM_DATA);
  1952. la_StopUiOperatorService(p);
  1953. laDestroySinglePanel(p,0);
  1954. return LA_FINISHED_PASS;
  1955. }
  1956. if(p->PanelTemplate && laKeyMapExecuteEvent(a, &p->PanelTemplate->KeyMap, e)) return LA_RUNNING_PASS;
  1957. if (e->type == LA_L_MOUSE_DOWN && e->y < p->H - LA_SCROLL_W){
  1958. laUiItem *pui = 0; laUiList *suil = 0;laListHandle levels={0};
  1959. laUiList *duil = la_DetectUiListRecursiveDeep(p->MenuRefer?p->MenuRefer:&p->UI, e->x, e->y, 10000, &pui, &suil, 0, 0, 0, &levels);
  1960. while(duil=lstPopPointer(&levels));
  1961. if (suil){
  1962. uid->Ptr1 = suil; uid->Ptr2 = pui;
  1963. uid->TargetIndexVali = 3;
  1964. uid->LastX = e->x; uid->LastY = e->y;
  1965. uid->On=(!pui || e->x>pui->R-LA_SCROLL_W-2*(*p->BT)->RM)?1:0;
  1966. return LA_RUNNING;
  1967. }
  1968. }
  1969. if (e->type == LA_L_MOUSE_UP && uid->TargetIndexVali == 3){
  1970. uid->TargetIndexVali = 0;
  1971. return LA_RUNNING;
  1972. }
  1973. if(la_ScrollPanel(uid,p,e))return LA_RUNNING;
  1974. if (e->type == LA_MOUSEMOVE){
  1975. if (uid->TargetIndexVali == 3){
  1976. laUiList *suil = uid->Ptr1; laUiItem *pui = uid->Ptr2;
  1977. int IsVertical=uid->On;
  1978. uid->TargetIndexValf+=IsVertical?la_ScrollerVerticalPan(e->y - uid->LastY, p, uid->Ptr1, uid->Ptr2):
  1979. (pui?la_ScrollerHorizontalPan(e->x - uid->LastX, p, uid->Ptr1, uid->Ptr2):0);
  1980. uid->Dragging = (int)uid->TargetIndexValf; uid->TargetIndexValf-=uid->Dragging;
  1981. int pV=uid->Dragging*IsVertical, pH=uid->Dragging*(!IsVertical);
  1982. if (!pui) laPanUiList(suil, pH, pV,0, p->W, suil->U, p->H-(*p->BT)->BM);
  1983. else laPanUiList(suil, pH, pV, suil->L, pui->R-(suil->ScrollerShownV?(LA_SCROLL_W+(*p->BT)->RM):0),
  1984. suil->U, pui->B-(*p->BT)->BM-(suil->ScrollerShownH?(LA_SCROLL_W+(*p->BT)->BM):0));
  1985. uid->LastX = e->x; uid->LastY = e->y;
  1986. laRedrawCurrentPanel();
  1987. return LA_RUNNING;
  1988. }
  1989. }
  1990. ui = la_DetectUiItemRecursive(&p->UI, x, y, 10000, &Locals, 0);
  1991. if (!ui){
  1992. lstClearPointer(&Locals);
  1993. ui = la_DetectUiItemRecursive(p->MenuRefer, x, y, 10000, &Locals, 0);
  1994. }
  1995. if (ui && !la_UiOperatorExists(ui)){
  1996. laSetOperatorLocalizer(p);
  1997. laInvokeUiP(a, ui->Type->OperatorType, e, ui, &Locals, 0);
  1998. }
  1999. lstClearPointer(&Locals);
  2000. if (a->ConfirmData && (!p->NoConfirm)){
  2001. laConfirmInt(a, a->ConfirmData->IData, a->ConfirmData->Mode);
  2002. la_StopUiOperatorService(p);
  2003. laDestroySinglePanel(p,0);
  2004. return LA_FINISHED_PASS;
  2005. }
  2006. return LA_RUNNING;
  2007. }
  2008. int OPMOD_ModalPanel(laOperator *a, laEvent *e){
  2009. int x = e->x;
  2010. int y = e->y;
  2011. laPanel *p = a->Instance;
  2012. laUiItem *ui = 0;
  2013. laListHandle Locals = {0};
  2014. laGeneralUiExtraData *uid = a->CustomData;
  2015. if(MAIN.DockingPanel){return LA_FINISHED; }
  2016. if (e->type == LA_KEY_DOWN && e->key==LA_KEY_ESCAPE){
  2017. laConfirmInt(a, 0, LA_CONFIRM_CANCEL);
  2018. la_StopUiOperatorService(p);
  2019. laDestroySinglePanel(p,0);
  2020. return LA_FINISHED_PASS;
  2021. }
  2022. if (a->ConfirmData){
  2023. laConfirmSameDataIfAny(a);
  2024. if (a->ConfirmData->Mode == LA_CONFIRM_DATA||a->ConfirmData->Mode==LA_CONFIRM_CUSTOM_STRING){
  2025. return LA_RUNNING_PASS;
  2026. }
  2027. la_StopUiOperatorService(p);
  2028. laDestroySinglePanel(p,0);
  2029. return LA_FINISHED_PASS;
  2030. }
  2031. if (!laIsInPanel(p, e->x, e->y) && !uid->TargetIndexVali){
  2032. if(e->type&LA_STATE_DOWN){
  2033. p->AnimationRatio=0; p->AnimationMode=LA_PANEL_ANIMATION_FLASH; laRedrawCurrentPanel();
  2034. }
  2035. if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); } return LA_RUNNING;
  2036. }
  2037. if(p->PanelTemplate && laKeyMapExecuteEvent(a, &p->PanelTemplate->KeyMap, e)) return LA_RUNNING_PASS;
  2038. if (e->type == LA_L_MOUSE_DOWN && e->y < p->H - LA_SCROLL_W){
  2039. laUiItem *pui = 0; laUiList *suil = 0;laListHandle levels={0};
  2040. laUiList *duil = la_DetectUiListRecursiveDeep(&p->UI, e->x, e->y, 10000, &pui, &suil, 0, 0, 0, &levels);
  2041. while(duil=lstPopPointer(&levels));
  2042. if (suil){
  2043. uid->Ptr1 = suil; uid->Ptr2 = pui;
  2044. uid->TargetIndexVali = 3;
  2045. uid->LastX = e->x; uid->LastY = e->y;
  2046. uid->On=(!pui || e->x>pui->R-LA_SCROLL_W-2*(*p->BT)->RM)?1:0;
  2047. return LA_RUNNING;
  2048. }
  2049. }
  2050. if(la_ScrollPanel(uid,p,e))return LA_RUNNING;
  2051. if (!uid->TargetIndexVali){
  2052. ui = la_DetectUiItemRecursive(&p->TitleBar, x, y, 10000, &Locals, 0);
  2053. if (!ui){
  2054. lstClearPointer(&Locals);
  2055. ui = la_DetectUiItemRecursive(&p->UI, x, y, 10000, &Locals, 0);
  2056. }
  2057. }
  2058. if (ui && !a->Child && ui->Type->OperatorType && !la_UiOperatorExists(ui)){
  2059. laSetOperatorLocalizer(p);
  2060. laInvokeUiP(a, ui->Type->OperatorType, e, ui, &Locals, 0);
  2061. return LA_RUNNING;
  2062. }
  2063. lstClearPointer(&Locals);
  2064. int insize=0; if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2){ insize=1;
  2065. if((!a->Item.pPrev) && (!p->ShowCorner)){ p->ShowCorner=1; laSetWindowCursor(LA_CORNER); laRefreshWindow(); }
  2066. }else{ if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); } }
  2067. if (e->type == LA_L_MOUSE_DOWN){
  2068. uid->LastX = e->x;
  2069. uid->LastY = e->y;
  2070. if(insize){ uid->TargetIndexVali = 2; laSetWindowCursor(LA_CORNER); }
  2071. else uid->TargetIndexVali = 1;
  2072. return LA_RUNNING;
  2073. }
  2074. if (e->type == LA_MOUSEMOVE){
  2075. if (uid->TargetIndexVali == 1){
  2076. if (!p->SL && !p->SR) p->TX = p->X + e->x - uid->LastX;
  2077. if (!p->ST && !p->SB) p->TY = p->Y + e->y - uid->LastY;
  2078. laNotifyUsersPPPath(&p->PP, "position");
  2079. la_EnsurePanelSnapping(p, MAIN.CurrentWindow->CW, MAIN.CurrentWindow->CH);
  2080. laRecalcCurrentPanel();
  2081. return LA_RUNNING;
  2082. }elif (uid->TargetIndexVali == 2){
  2083. p->TW += e->x - uid->LastX; p->TH += e->y - uid->LastY;
  2084. uid->LastX = e->x; uid->LastY = e->y;
  2085. p->BoundUi=0;
  2086. laNotifyUsersPPPath(&p->PP, "size");
  2087. la_EnsurePanelSnapping(p, MAIN.CurrentWindow->CW, MAIN.CurrentWindow->CH);
  2088. laRecalcCurrentPanel();
  2089. return LA_RUNNING;
  2090. }elif (uid->TargetIndexVali == 3){
  2091. laUiList *suil = uid->Ptr1; laUiItem *pui = uid->Ptr2;
  2092. int IsVertical=uid->On;
  2093. uid->TargetIndexValf+=IsVertical?la_ScrollerVerticalPan(e->y - uid->LastY, p, uid->Ptr1, uid->Ptr2):
  2094. (pui?la_ScrollerHorizontalPan(e->x - uid->LastX, p, uid->Ptr1, uid->Ptr2):0);
  2095. uid->Dragging = (int)uid->TargetIndexValf; uid->TargetIndexValf-=uid->Dragging;
  2096. int pV=uid->Dragging*IsVertical, pH=uid->Dragging*(!IsVertical);
  2097. if (!pui) laPanUiList(suil, pH, pV,0, p->W, suil->U, p->H-(*p->BT)->BM);
  2098. else laPanUiList(suil, pH, pV, suil->L, pui->R-(suil->ScrollerShownV?(LA_SCROLL_W+(*p->BT)->RM):0),
  2099. suil->U, pui->B-(*p->BT)->BM-(suil->ScrollerShownH?(LA_SCROLL_W+(*p->BT)->BM):0));
  2100. uid->LastX = e->x; uid->LastY = e->y;
  2101. laRedrawCurrentPanel();
  2102. return LA_RUNNING;
  2103. }
  2104. if(uid->TargetIndexVali==2){laSetWindowCursor(LA_CORNER);}
  2105. }
  2106. if (e->type == LA_L_MOUSE_UP){
  2107. uid->TargetIndexVali = 0; laSetWindowCursor(LA_ARROW);
  2108. return LA_RUNNING;
  2109. }
  2110. return LA_RUNNING;
  2111. }
  2112. int OPCHK_IsPanel(laPropPack *This, laStringSplitor *ss){
  2113. if (This && This->LastPs->p == _LA_PROP_PANEL) return 1;
  2114. else{
  2115. char *PanelInternalID = strGetArgumentString(ss, "panel_id");
  2116. if (!PanelInternalID) return 0;
  2117. else
  2118. return 1;
  2119. }
  2120. return 0;
  2121. }
  2122. int OPCHK_IsPanelNoInstructions(laPropPack *This, laStringSplitor *ss){
  2123. if (This && This->LastPs->p == _LA_PROP_PANEL) return 1;
  2124. return 0;
  2125. }
  2126. int OPINV_HidePanel(laOperator *a, laEvent *e){
  2127. laPanel *p = a->This?a->This->EndInstance:0;
  2128. laHidePanelWithDissoveEffect(p);
  2129. return LA_FINISHED;
  2130. }
  2131. int OPINV_ActivatePanel(laOperator *a, laEvent *e){
  2132. laStringSplitor *ss = a->ExtraInstructionsP;
  2133. char *TemplateID = strGetArgumentString(ss, "panel_id");
  2134. if (!TemplateID) return LA_CANCELED;
  2135. laActivatePanel(TemplateID, e->x, e->y);
  2136. return LA_FINISHED;
  2137. }
  2138. int OPINV_PanPanel(laOperator *a, laEvent *e){
  2139. laPanel *p = a->This?a->This->EndInstance:0;
  2140. //laHidePanel(p);
  2141. return LA_FINISHED;
  2142. }
  2143. int OPCHK_IsHyper(laPropPack *This, laStringSplitor *ss){
  2144. if (This && This->LastPs->p->Container->Hyper) return 1;
  2145. return 0;
  2146. }
  2147. int OPINV_ViewHyperData(laOperator *a, laEvent *e){
  2148. char buf[2048]={0};
  2149. memHyperInfo(a->This, buf);
  2150. printf("%s",buf);
  2151. return LA_FINISHED;
  2152. }
  2153. int OPINV_TranslationDumpMisMatch(laOperator *a, laEvent *e){
  2154. transDumpMissMatchRecord("TranslationDump.txt");
  2155. laEnableMessagePanel(a, 0, "OK", "Untranslated strings exported to TranslationDump.txt", e->x - 250, e->y - 10, 300, e);
  2156. return LA_FINISHED;
  2157. }
  2158. int OPINV_RefreshScreens(laOperator *a, laEvent *e){
  2159. #ifdef LA_LINUX
  2160. la_GetDPI(MAIN.win);
  2161. #endif
  2162. #ifdef _WIN32
  2163. la_GetDPI(MAIN.CurrentWindow);
  2164. #endif
  2165. return LA_FINISHED;
  2166. }
  2167. int OPINV_RemoveScreenConfig(laOperator *a, laEvent *e){
  2168. if(!a->This || !a->This->EndInstance) return LA_FINISHED;
  2169. laEnableYesNoPanel(0, 0, "Confirm?", "Will remove this screen entry", e->x, e->y, 200, e);
  2170. return LA_RUNNING;
  2171. }
  2172. int OPMOD_RemoveScreenConfig(laOperator *a, laEvent *e){
  2173. if(!a->This || !a->This->EndInstance) return LA_FINISHED; laScreen* s=a->This->EndInstance;
  2174. if(a->ConfirmData){
  2175. if(a->ConfirmData->Mode == LA_CONFIRM_OK){
  2176. la_RemoveScreen(s); laNotifyUsers("la.user_preferences.screens");
  2177. }
  2178. return LA_FINISHED;
  2179. }
  2180. return LA_FINISHED;
  2181. }
  2182. int OPINV_OpenInternetLink(laOperator *a, laEvent *e){
  2183. char *link = strGetArgumentString(a->ExtraInstructionsP, "link");
  2184. if (link) laOpenInternetLink(link);
  2185. return LA_FINISHED;
  2186. }
  2187. void laget_PanelTemplateCategory(void* rack_unused, laUiTemplate* uit, char* copy, char** ptr);
  2188. void la_RegisterBuiltinOperators(){
  2189. laPropContainer *pc; laProp *p;
  2190. laOperatorType *at;
  2191. laEnumProp *ep;
  2192. laCreateOperatorType("LA_terminate_program", "Quit", "Terminate Program Immediately",
  2193. OPCHK_TerminateProgram, 0, 0, OPINV_TerminateProgram, 0, U'⏻', LA_ACTUATOR_SYSTEM);
  2194. laCreateOperatorType("LA_undo", "Undo", "Undo from recorded data state", OPCHK_Undo, 0, 0, OPINV_Undo, 0, U'⮌', LA_ACTUATOR_SYSTEM);
  2195. laCreateOperatorType("LA_redo", "Redo", "Redo using recorded data state", OPCHK_Redo, 0, 0, OPINV_Redo, 0, U'⮎', LA_ACTUATOR_SYSTEM);
  2196. laCreateOperatorType("LA_refresh_screens", "Refresh Screens", "Refresh Screens", 0, 0, 0, OPINV_RefreshScreens, 0, U'⭯', LA_ACTUATOR_SYSTEM);
  2197. laCreateOperatorType("LA_remove_screen_config", "Remove Screen", "Remove this screen configuration", 0, 0, 0, OPINV_RemoveScreenConfig, OPMOD_RemoveScreenConfig, U'🞫', LA_ACTUATOR_SYSTEM);
  2198. laCreateOperatorType("LA_translation_dump", "Dump Untranslated Text", "Dump Untranslated Text To File", 0, 0, 0, OPINV_TranslationDumpMisMatch, 0, U'📥', LA_ACTUATOR_SYSTEM);
  2199. laCreateOperatorType("LA_open_internet_link", "Goto", "Open Internet Link", 0, 0, 0, OPINV_OpenInternetLink, 0, U'🌐', LA_ACTUATOR_SYSTEM);
  2200. laCreateOperatorType("LA_system_paste", "SYSWINDOW Paste", "Generate a syetem paste event", 0, 0, 0, OPINV_SystemPaste, 0, U'📋', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2201. laCreateOperatorType("LA_string_copy", "Copy", "Copy string to clip board", 0, 0, 0, OPINV_StringCopy, 0, U'🗍', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2202. laCreateOperatorType("LA_window_operator", "SYSWINDOW Operator", "Handle All Unhandled Events", 0, 0, 0, OPINV_Window, OPMOD_Window, U'🖦', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2203. at = laCreateOperatorType("LA_switch_layout", "Switch Layout", "Cycle All Layouts In Current SYSWINDOW", 0, 0, 0, OPINV_SwitchLayout, OPMOD_FinishOnData, U'↔', LA_ACTUATOR_SYSTEM);
  2204. at->UiDefine=laui_LayoutCycle;
  2205. at = laCreateOperatorType("LA_new_window", "New SYSWINDOW", "Create a new window", 0, 0, 0, OPINV_NewWindow, 0, U'🗗', LA_ACTUATOR_SYSTEM);
  2206. laCreateOperatorType("LA_combine_child_blocks", "Combine Child Block", "If Child Blocks Are Two Panel Blocks, Then Combine Them.",
  2207. OPCHK_CombineChildBlocks, 0, 0, OPINV_CombineChildBlocks, 0, U'□' , LA_ACTUATOR_SYSTEM);
  2208. at = laCreateOperatorType("LA_new_panel", "New Panel", "Create a new panel",
  2209. 0, 0, 0, OPINV_NewPanel, OPMOD_NewPanel, U'🞆', LA_ACTUATOR_SYSTEM);
  2210. pc = laDefineOperatorProps(at, 0);
  2211. p = laAddSubGroup(pc, "template", "Template", "Template selection used to create the new panel", "panel_template", 0, 0, laui_TitleOnly, -1, laget_FirstPanelTemplate, laget_NewPanelGetActiveTemplate, laget_ListNext, 0, 0, laset_NewPanelSetTemplate,0,0);
  2212. laSubGroupExtraFunctions(p,0,0,0,0,laget_PanelTemplateCategory);
  2213. at->UiDefine=laui_PanelTemplateSelect;
  2214. laCreateOperatorType("LA_block_fold_title", "Fold Title", "Fold the tile bar of the block", 0, 0, 0, OPINV_BlockFoldTitle, 0, U'⯅', LA_ACTUATOR_SYSTEM);
  2215. laCreateOperatorType("LA_block_maximize", "Maximize", "Maximize this block", 0, 0, 0, OPINV_BlockMaximize, 0, U'⮼', LA_ACTUATOR_SYSTEM);
  2216. laCreateOperatorType("LA_block_tear_off_panel", "Tear Off", "Tear off current panel in the block",
  2217. OPCHK_BlockHasMorePanels, 0, 0, OPINV_BlockTearOffPanel, 0, U'🗗', LA_ACTUATOR_SYSTEM);
  2218. laCreateOperatorType("LA_block_close_panel", "Close Panel", "Close current panel in the block",
  2219. OPCHK_BlockHasMorePanels, 0, 0, OPINV_BlockClosePanel, OPMOD_BlockClosePanel, U'🞫', LA_ACTUATOR_SYSTEM);
  2220. laCreateOperatorType("LA_canvas_ui_maximize", "Maximize", "Maximize this UI item", 0, 0, 0, OPINV_CanvasUiMaximize, 0, U'⮼', LA_ACTUATOR_SYSTEM);
  2221. laCreateOperatorType("LA_hide_menu_bar", "Hide Menu Bar", "Hide menu bar of the window", 0, 0, 0, OPINV_HideMenuBar, 0, U'⯅', LA_ACTUATOR_SYSTEM);
  2222. laCreateOperatorType("LA_fullscreen", "Fullscreen", "Switch full screen for the window",
  2223. 0, 0, 0, OPINV_Fullscreen, 0, U'🡵', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2224. laCreateOperatorType("LA_new_layout", "New Layout", "Create a new layout in the window",
  2225. 0, 0, 0, OPINV_NewLayout, 0, U'🞦', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2226. laCreateOperatorType("LA_remove_layout", "Remove Layout", "Remove current layout in the window",
  2227. OPCHK_RemoveLayout, 0, 0, OPINV_RemoveLayout, 0, U'🞫', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2228. laCreateOperatorType("LA_panel_operator", "Panel Operator", "Handle Events On The Panel Level",
  2229. 0, 0, OPEXT_Panel, OPINV_Panel, OPMOD_Panel, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2230. laCreateOperatorType("LA_modal_panel_operator", "Modal Panel Operator", "Handle Events On Modal Panels Like Yes-No Boxes",
  2231. 0, 0, OPEXT_Panel, OPINV_Panel, OPMOD_ModalPanel, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2232. laCreateOperatorType("LA_menu_panel_operator", "Menu Panel Operator", "Handle Events On Menu Panel,Recieve And Dispatch Confirm Messages,Then Self-destroy.",
  2233. 0, 0, OPEXT_Panel, OPINV_Panel, OPMOD_MenuPanel, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2234. laCreateOperatorType("LA_panel_activator", "Panel Activator", "Show A Panel When Invoked.Need An Extra Argument[panel_id]",
  2235. OPCHK_IsPanel, 0, 0, OPINV_ActivatePanel, 0, 0, LA_ACTUATOR_SYSTEM)
  2236. ->ParseArgs = la_PanelActiviatorParser;
  2237. laCreateOperatorType("LA_hide_panel", "Hide Panel", "Hide a panel",
  2238. OPCHK_IsPanel, 0, 0, OPINV_HidePanel, 0, 0, LA_ACTUATOR_SYSTEM);
  2239. laCreateOperatorType("LA_dock_panel", "Dock Panel", "Dock a panel",
  2240. OPCHK_IsPanel, 0, 0, OPINV_DockPanel, 0, 0, LA_ACTUATOR_SYSTEM);
  2241. laCreateOperatorType("LA_prop_restore_default", "Restore default value", "Restore property back to its default value", OPCHK_PropSetValue, 0, 0, OPINV_PropSetDefault, 0, U'⭯', LA_ACTUATOR_SYSTEM);
  2242. laCreateOperatorType("LA_prop_set_min", "Set Min Value", "Set property to its minimum value", OPCHK_PropSetValue, 0, 0, OPINV_PropSetMin, 0, 0, LA_ACTUATOR_SYSTEM);
  2243. laCreateOperatorType("LA_prop_set_max", "Set Max Value", "Set property to its maximum value", OPCHK_PropSetValue, 0, 0, OPINV_PropSetMax, 0, 0, LA_ACTUATOR_SYSTEM);
  2244. laCreateOperatorType("LA_string_set_default", "Set Default Value", "Set default string", OPCHK_StringSetValue, 0, 0, OPINV_PropSetDefault, 0, U'⭯', LA_ACTUATOR_SYSTEM);
  2245. laCreateOperatorType("LA_string_get_folder_path", "Get folder Path", "get folder path", OPCHK_StringSetValue, 0, 0, OPINV_StringGetFolderPath, OPMOD_StringGetFolderOrFilePath, U'📁', LA_ACTUATOR_SYSTEM);
  2246. laCreateOperatorType("LA_string_get_file_path", "Get folder Path", "get file path", OPCHK_StringSetValue, 0, 0, OPINV_StringGetFilePath, OPMOD_StringGetFolderOrFilePath, U'🖹', LA_ACTUATOR_SYSTEM);
  2247. laCreateOperatorType("LA_collection_clear_selection", "Clear Selection", "Clear collection selection", OPCHK_CollectionSetValue, 0, 0, OPINV_CollectionClearSelection, 0, U'🧹', LA_ACTUATOR_SYSTEM);
  2248. laCreateOperatorType("LA_prop_insert_key", "Insert Key Frame", "Insert key frame in the active action", OPCHK_PropInsertKey, 0, 0, OPINV_PropInsertKey, 0, U'🔑', LA_ACTUATOR_SYSTEM);
  2249. laCreateOperatorType("LA_view_hyper_data", "View Hyper Data", "Show Properties Of Specific Data Block", OPCHK_IsHyper, 0, 0, OPINV_ViewHyperData, 0, U'🛈', LA_ACTUATOR_SYSTEM);
  2250. at = laCreateOperatorType("LA_file_dialog_new_directory", "New Directory", "New Directory", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserNewDirectory, OPMOD_FileBrowserNewDirectory, U'📁', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2251. at->UiDefine = laui_FileBrowserNewDirectory;
  2252. laCreateOperatorType("LA_file_dialog_refresh", "Refresh", "Refresh List", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserRefresh, 0, U'🗘', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2253. laCreateOperatorType("LA_file_dialog_up", "Up", "Select Upper Folder Level", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserUpLevel, 0, U'🢰', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2254. laCreateOperatorType("LA_file_dialog_confirm", "Confirm", "Confirm selection", OPCHK_FileBrowserCanConfirm, 0, 0, OPINV_FileBrowserConfirm, OPMOD_FileBrowserConfirm, U'✔', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
  2255. at = laCreateOperatorType("LA_file_dialog", "File Dialog", "Do File Operations", 0, 0, OPEXT_FileBrowser, OPINV_FileBrowser, OPMOD_FileBrowser, U'🗐', LA_ACTUATOR_SYSTEM);
  2256. pc = laDefineOperatorProps(at, 1);
  2257. at->UiDefine = laui_FileBrowserFileList;
  2258. _LA_PROP_FILE_BROWSER = pc;
  2259. laAddStringProperty(pc, "path", "Path", "Directort path", 0, 0, 0, "/", 0, offsetof(laFileBrowser, Path), 0, 0, laset_FileBrowserPath, 0, LA_UDF_LOCAL);
  2260. laAddStringProperty(pc, "file_name", "File Name", "File name", 0, 0, 0, 0, 0, offsetof(laFileBrowser, FileName), 0, 0, laset_FileBrowserFileName, 0, LA_UDF_LOCAL);
  2261. laAddStringProperty(pc, "temp_str", "Temp String", "Temp string", 0, 0, 0, "", 0, offsetof(laFileBrowser, TempStr), 0, 0, 0, 0, LA_UDF_LOCAL);
  2262. laAddStringProperty(pc, "filter_name", "Filter Name", "Filter file name", 0, 0, 0, 0, 0, offsetof(laFileBrowser, FilterName), 0, 0, laset_FileBrowserFilterName, 0, LA_UDF_LOCAL);
  2263. laAddSubGroup(pc, "file_list", "File List", "List Of Files And Directories Under A Specific Path", "file_item",0,0,laui_FileBrowserFileItem, -1, 0, laget_FileBrowserActiveFile, 0, 0, 0, laset_FileBrowserSelectFile, offsetof(laFileBrowser, FileList), 0);
  2264. laAddSubGroup(pc, "disk_list", "Disk List", "List Of All Logical Drives (In Windows)", "disk_item",0, 0, 0, -1, 0, 0, 0, 0, 0, laset_FileBrowserActiveDisk, offsetof(laFileBrowser, Disks), 0);
  2265. laAddSubGroup(pc, "bookmarks", "Bookmarks", "Bookmarked directories in GTK3", "bookmarked_folder",0, 0, 0, -1, 0, 0, 0, laset_FileBrowserBookmark, 0, 0, offsetof(laFileBrowser, Bookmarks), 0);
  2266. laAddSubGroup(pc, "available_extensions", "Available Extensions", "List of all available extensions", "la_extension_type",0, 0, 0, -1, laget_FileBrowserAcceptedExtensionsFrist, 0, laget_FileBrowserAcceptedExtensionsNext,laset_FileBrowserExtension,0,0,0,0);
  2267. laAddIntProperty(pc,"use_type","Use Type","Use file type",0,0,0,0,0,0,0,0,offsetof(laFileBrowser,UseType),0,0,0,0,0,0,0,0,0,0,LA_READ_ONLY);
  2268. ep = laAddEnumProperty(pc, "select_what", "Select What", "Select folder or file", 0, 0, 0, 0, 0, offsetof(laFileBrowser, SelectFolder), 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);{
  2269. laAddEnumItemAs(ep, "file", "File", "File", LA_FILE_SELECT_FILE, U'📁');
  2270. laAddEnumItemAs(ep, "folder", "Folder", "Folder", LA_FILE_SELECT_FOLDER, U'🖹');
  2271. }
  2272. laAddOperatorProperty(pc, "new_directory", "New Directory", "Create a new directory", "LA_file_dialog_new_directory", U'📁', 0);
  2273. laAddOperatorProperty(pc, "refresh", "Refresh", "Refresh file list", "LA_file_dialog_refresh", U'🗘', 0);
  2274. laAddOperatorProperty(pc, "folder_up", "Up", "Select Upper Folder Level In File Browsers", "LA_file_dialog_up", U'🢰', 0);
  2275. laAddOperatorProperty(pc, "confirm", "Confirm", "Confirm selection", "LA_file_dialog_confirm", U'✔', 0);
  2276. p = laAddPropertyContainer("disk_item", "Disk Item", "A logical drive (in Windows)", 0, laui_FileBrowserDiskItem, 0, 0, 0, 1);{
  2277. laAddStringProperty(p, "id", "ID", "Disk identifier", 0, 0, 0, 0, 0, 0, 0, laget_FileBrowserDiskID, 0, 0, 0);
  2278. laAddFloatProperty(p, "total_gb", "Total", "Disk total compacity in gigabytes", 0, 0, "GB", 0, 0, 0, 0, 0, offsetof(laDiskItem, Total_GB), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
  2279. laAddFloatProperty(p, "free_gb", "Free", "Disk Free Space Size In Gigabytes", 0, 0, "GB", 0, 0, 0, 0, 0, offsetof(laDiskItem, Free_GB), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
  2280. }
  2281. p = laAddPropertyContainer("file_item", "File Item", "A file item in a list", U'🖹', 0, 0, 0, 0, 0);{
  2282. laAddStringProperty(p, "name", "Name", "The name of the file (with extension)", 0, 0, 0, 0, 0, offsetof(laFileItem, Name), 0, 0, 0, 0, LA_UDF_LOCAL);
  2283. laAddIntProperty(p, "is_folder", "Is Folder", "File is a folder or actual file", 0, 0, 0, 1, 0, 0, 0, 0, offsetof(laFileItem, IsFolder), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
  2284. laAddSubGroup(p, "time_modified", "Time Last Modified", "The Time When The File Was Last Modified", "time_info",0, 0, 0, offsetof(laFileItem, TimeModified), 0, 0, 0, 0, 0, 0, 0, LA_UDF_LOCAL);
  2285. laAddIntProperty(p, "size", "Size", "File Size In Bytes", 0, 0, "Bytes", 0, 0, 0, 0, 0, offsetof(laFileItem, Size), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
  2286. laAddStringProperty(p, "size_string", "Size String", "File size in convenient string", 0, 0, 0, 0, 0, 0, 0, laget_FileBrowserFileSizeString, 0, 0, LA_READ_ONLY);
  2287. ep = laAddEnumProperty(p, "type", "Type", "General type of the file", 0, 0, 0, 0, 0, offsetof(laFileItem, Type), 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);{
  2288. laAddEnumItemAs(ep, "unknown", "Unknown", "Unknown/Uncategorized File Type", LA_FILETYPE_UNKNOWN, U'🖹');
  2289. laAddEnumItemAs(ep, "udf", "UDF", "Uniform Data Format", LA_FILETYPE_UDF, U'📦');
  2290. laAddEnumItemAs(ep, "document", "Document", "Document File", LA_FILETYPE_DOCUMENT, U'🖹');
  2291. laAddEnumItemAs(ep, "image", "Image", "Image File", LA_FILETYPE_IMAGE, U'🖻');
  2292. laAddEnumItemAs(ep, "audio", "Audio", "Audio File", LA_FILETYPE_AUDIO, U'𝄞');
  2293. laAddEnumItemAs(ep, "video", "Video", "Video File", LA_FILETYPE_VIDEO, U'🎞');
  2294. laAddEnumItemAs(ep, "compressed", "Compressed", "Compressed File", LA_FILETYPE_COMPRESSED, U'🗜');
  2295. laAddEnumItemAs(ep, "font", "Font", "Font File", LA_FILETYPE_FONT, U'🗚');
  2296. laAddEnumItemAs(ep, "vector", "Vector", "Vector File", LA_FILETYPE_VECTOR, U'🞎');
  2297. laAddEnumItemAs(ep, "webpage", "Webpage", "Webpage", LA_FILETYPE_WEBPAGE, U'🌐');
  2298. laAddEnumItemAs(ep, "meta", "Meta Data", "Meta Data Package", LA_FILETYPE_META, U'🖹');
  2299. laAddEnumItemAs(ep, "blend", "Blend", "Blend File", LA_FILETYPE_BLEND, U'🖹');
  2300. laAddEnumItemAs(ep, "pdf", "PDF", "PDF File", LA_FILETYPE_PDF, U'🖹');
  2301. laAddEnumItemAs(ep, "exe", "Executable", "SYSWINDOW Executable", LA_FILETYPE_EXEC, U'🖦');
  2302. laAddEnumItemAs(ep, "sys", "System", "System Files", LA_FILETYPE_SYS, U'🖹');
  2303. laAddEnumItemAs(ep, "folder", "Folder", "Folder", LA_FILETYPE_FOLDER, U'📁');
  2304. laAddEnumItemAs(ep, "lasdexchange", "LaSDExchange", "LA Scene Descriptive Exchange File", LA_FILETYPE_LASDEXCHANGE, 0);
  2305. }
  2306. }
  2307. p = laAddPropertyContainer("bookmarked_folder", "Bookmarked_folder", "A bookmarked folder from GTK3", 0, laui_IdentifierOnly, sizeof(laBookmarkedFolder), 0, 0, 0);{
  2308. laAddStringProperty(p, "name", "Name", "Bookmark name", 0, 0, 0, 0, 0, offsetof(laBookmarkedFolder, Name), 0, 0, 0, 0, LA_AS_IDENTIFIER|LA_UDF_LOCAL);
  2309. laAddStringProperty(p, "path", "Path", "Bookmark path", 0, 0, 0, 0, 0, offsetof(laBookmarkedFolder, Path), 0, 0, 0, 0, LA_UDF_LOCAL);
  2310. }
  2311. ep = laAddEnumProperty(pc, "show_backups", "Show Backups", "Show backup files", 0, 0, 0, 0, 0, offsetof(laFileBrowser, ShowBackups), 0, laset_FileBrowserShowBackups, 0, 0, 0, 0, 0, 0, 0,0);{
  2312. laAddEnumItemAs(ep, "NONE", "None", "Don't show backup files", 0, U'~');
  2313. laAddEnumItemAs(ep, "SHOWN", "Shown", "Show backup files", 1, U'~');
  2314. }
  2315. ep = laAddEnumProperty(pc, "show_thumbnail", "Show Thumbnail", "Show thumbnail", 0, 0, 0, 0, 0, offsetof(laFileBrowser, ShowThumbnail), 0, laset_FileBrowserShowThumbnail, 0, 0, 0, 0, 0, 0, 0,0);{
  2316. laAddEnumItemAs(ep, "NONE", "None", "Don't show thumbnail files", 0, U'🖼');
  2317. laAddEnumItemAs(ep, "SHOWN", "Shown", "Show thumbnail files", 1, U'🖼');
  2318. }
  2319. ep = laAddEnumProperty(pc, "sort_name", "Name", "Sort by names",LA_WIDGET_ENUM_CYCLE, 0, 0, 0, 0, 0, laget_FileBrowserSortName,laset_FileBrowserSortName, 0, 0, 0, 0, 0, 0, 0,0);{
  2320. laAddEnumItemAs(ep, "NONE", "None", "Don't sort", 0, 0);
  2321. laAddEnumItemAs(ep, "SORT", "Sort", "Sort accending", 1, U'🔻');
  2322. laAddEnumItemAs(ep, "REV", "Reversed", "Sort Descending", 2, U'🔺');
  2323. }
  2324. ep = laAddEnumProperty(pc, "sort_time", "Time", "Sort by times",LA_WIDGET_ENUM_CYCLE, 0, 0, 0, 0, 0, laget_FileBrowserSortTime,laset_FileBrowserSortTime, 0, 0, 0, 0, 0, 0, 0,0);{
  2325. laAddEnumItemAs(ep, "NONE", "None", "Don't sort", 0, 0);
  2326. laAddEnumItemAs(ep, "SORT", "Sort", "Sort accending", 1, U'🔻');
  2327. laAddEnumItemAs(ep, "REV", "Reversed", "Sort Descending", 2, U'🔺');
  2328. }
  2329. ep = laAddEnumProperty(pc, "sort_size", "Size", "Sort by sizes",LA_WIDGET_ENUM_CYCLE, 0, 0, 0, 0, 0, laget_FileBrowserSortSize,laset_FileBrowserSortSize, 0, 0, 0, 0, 0, 0, 0,0);{
  2330. laAddEnumItemAs(ep, "NONE", "None", "Don't sort", 0, 0);
  2331. laAddEnumItemAs(ep, "SORT", "Sort", "Sort accending", 1, U'🔻');
  2332. laAddEnumItemAs(ep, "REV", "Reversed", "Sort Descending", 2, U'🔺');
  2333. }
  2334. at = laCreateOperatorType("LA_udf_read", "Read", "Read a UDF file", 0, 0, OPEXT_UDFOperation, OPINV_UDFRead, OPMOD_UDFRead, U'📑', LA_ACTUATOR_SYSTEM);
  2335. pc = laDefineOperatorProps(at, 0);
  2336. at->UiDefine = laui_LinkerPanel;
  2337. at = laCreateOperatorType("LA_udf_save_instance", "Save Instance", "Save a instance as a UDF block", 0, 0, OPEXT_UDFOperation, OPINV_UDFSaveInstance, OPMOD_UDFSaveInstance, U'📑', LA_ACTUATOR_SYSTEM);
  2338. at = laCreateOperatorType("LA_managed_save", "Save as", "Save managed data blocks", 0, 0, OPEXT_ManagedSave, OPINV_ManagedSave, OPMOD_ManagedSave, U'🖫', LA_ACTUATOR_SYSTEM);
  2339. pc = laDefineOperatorProps(at, 1);
  2340. ep=laAddEnumProperty(pc, "show_page", "Show Page", "Show whether data blocks or UDF files", 0,0,0,0,0,offsetof(laManagedSaveExtra, ShowPage),0,laset_ManagedSavePage,0,0,0,0,0,0,0,0);
  2341. laAddEnumItemAs(ep, "DATA_BLOCKS", "Data Blocks", "All data blocks", 0, 0);
  2342. laAddEnumItemAs(ep, "FILES", "Files", "All Files", 1, 0);
  2343. at->UiDefine = laui_ManagedSavePanel;
  2344. laCreateOperatorType("LA_udf_propagate", "Propagate", "Propagate this file to all unassigned child nodes", 0, 0, 0, OPINV_UDFPropagate, 0, 0, LA_ACTUATOR_SYSTEM);
  2345. laCreateOperatorType("LA_managed_save_new_file", "New File", "New managed UDF file", 0, 0, OPEXT_ManagedSave, OPINV_ManagedSaveNewFile, OPMOD_ManagedSaveNewFile, U'+', LA_ACTUATOR_SYSTEM);
  2346. laCreateOperatorType("LA_manage_udf", "UDF Manager", "Operations on all managed UDF files", 0, 0, 0, OPINV_UDFManager, 0, U'🔍', LA_ACTUATOR_SYSTEM);
  2347. laCreateOperatorType("LA_add_resource_folder", "Add Resource Folder", "Add a resource folder entry for searching UDF references",
  2348. 0, 0, 0, OPINV_AddResourceFolder, 0, U'🞧', LA_ACTUATOR_SYSTEM);
  2349. laCreateOperatorType("LA_remove_resource_folder", "Remove Resource Folder", "Remove a resource folder entry",
  2350. 0, 0, 0, OPINV_RemoveResourceFolder, 0, U'🞫', LA_ACTUATOR_SYSTEM);
  2351. laCreateOperatorType("LA_new_input_mapping", "New Mapping", "New input mapping", 0, 0, 0, OPINV_NewInputMapping, 0, '+', LA_ACTUATOR_SYSTEM);
  2352. laCreateOperatorType("LA_new_input_mapping_entry", "New Entry", "New input mapping entry", 0, 0, 0, OPINV_NewInputMappingEntry, 0, '+', LA_ACTUATOR_SYSTEM);
  2353. laCreateOperatorType("LA_remove_input_mapping", "Remove Mapping", "Remove input mapping", 0, 0, 0, OPINV_RemoveInputMapping, OPMOD_RemoveInputMapping, U'🞫', LA_ACTUATOR_SYSTEM);
  2354. laCreateOperatorType("LA_remove_input_mapping_entry", "Remove Entry", "Remove input mapping entry", 0, 0, 0, OPINV_RemoveInputMappingEntry, OPMOD_RemoveInputMappingEntry, U'🞫', LA_ACTUATOR_SYSTEM);
  2355. at = laCreateOperatorType("LA_input_mapping_entry_select_signal", "Select Signal", "Select signal for this entry", 0, 0, 0, OPINV_InputMappingEntrySelectSignal, OPMOD_InputMappingEntrySelectSignal, U'⯆', LA_ACTUATOR_SYSTEM);
  2356. at->UiDefine = laui_InputMappingEntrySignalSelector;
  2357. at = laCreateOperatorType("LA_input_mapping_entry_select_operator", "Select Operator", "Select operator for this entry", 0, 0, 0, OPINV_InputMappingEntrySelectOperator, OPMOD_InputMappingEntrySelectOperator, U'⯆', LA_ACTUATOR_SYSTEM);
  2358. at->UiDefine = laui_InputMappingEntryOperatorSelector;
  2359. at = laCreateOperatorType("LA_input_mapping_entry_select_key", "Select Key", "Select key for this entry", 0, 0, OPEXT_InputMappingEntrySelectKey, OPINV_InputMappingEntrySelectKey, OPMOD_InputMappingEntrySelectKey, U'K', LA_ACTUATOR_SYSTEM);
  2360. at->UiDefine = laui_InputMappingEntryKeySelector;
  2361. pc = laDefineOperatorProps(at, 1);
  2362. laAddStringProperty(pc,"pressed_string","Pressed String","String of the pressed key",LA_WIDGET_STRING_PLAIN,0,0,0,1,-1,0,laget_KeyDetectorPressedString,0,0,LA_READ_ONLY);
  2363. laCreateOperatorType("LA_save_user_preferences", "Save Preferences", "Save user preferences", 0, 0, 0, OPINV_SaveUserPreferences, 0, 0, LA_ACTUATOR_SYSTEM);
  2364. laCreateOperatorType("LA_restore_factory", "Restore Factory Settings", "Restore factory settings", 0, 0, 0, OPINV_RestoreFactorySettings, OPMOD_RestoreFactorySettings, 0, LA_ACTUATOR_SYSTEM);
  2365. laCreateOperatorType("LA_confirm", "Confirm", "Confirm The Statement", 0, 0, 0, OPINV_DoNothing, 0, U'✔', LA_ACTUATOR_SYSTEM)
  2366. ->ExtraInstructions = "feedback=CONFIRM;";
  2367. laCreateOperatorType("LA_cancel", "Cancel", "Ignore The Statement", 0, 0, 0, OPINV_DoNothing, 0, U'🞫', LA_ACTUATOR_SYSTEM)
  2368. ->ExtraInstructions = "feedback=CANCEL;";
  2369. laCreateOperatorType("LA_pure_yes_no", "Yes Or No", "Show Yes Or No Box", 0, 0, 0, OPINV_PureYesNo, 0, U'❓', LA_ACTUATOR_SYSTEM);
  2370. laCreateOperatorType("LA_delete_theme", "Delete Theme", "Delete a theme",
  2371. 0, 0, 0, OPINV_DeleteTheme, 0, U'🞫', LA_ACTUATOR_SYSTEM);
  2372. }