*/}}

la_operators.c 102 KB

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