*/}}

la_operators.c 101 KB

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