*/}}

la_operators.c 90 KB

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