*/}}

la_operators.c 113 KB

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