*/}}

la_operators.c 85 KB

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