*/}}

la_data.h 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. /*
  2. * LaGUI: A graphical application framework.
  3. * Copyright (C) 2022-2023 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #pragma once
  19. #include "la_5.h"
  20. #include "la_tns.h"
  21. /* | given to | given to | array | */
  22. /* | user | user calls | setting| */
  23. /* | callback | and is used | needs | */
  24. /* | callback | to recieve | offset | */
  25. /* | callback | array config| hint | */
  26. /* +----------+-------------+--------+ */
  27. /* | The | | | */
  28. /* | DataBlock| The | The | */
  29. /* return value | Name | Instance | Actual Data | Offset | */
  30. /*\ / \_ \ / _/ */
  31. /* \ / \_ \ / _/ */
  32. /* \ / \_ \ / _/ */
  33. /* \ / \_ \ / _/ */
  34. /* \ / \ \ / _/ */
  35. typedef int (*laArrayGetLenF)(void *);
  36. typedef int (*laIntGetF)(void *);
  37. typedef void (*laIntSetF)(void *, int);
  38. typedef void (*laIntReadF)(void *, int);
  39. typedef void (*laIntArrayGetAllF)(void *, int *);
  40. typedef void (*laIntArraySetF)(void *, int, int); //idx,n
  41. typedef void (*laIntArraySetAllF)(void *, int);
  42. typedef void (*laIntArraySetAllArrayF)(void *, int *);
  43. typedef void (*laIntArrayReadAllF)(void *, int *);
  44. typedef real (*laFloatGetF)(void *);
  45. typedef void (*laFloatSetF)(void *, real);
  46. typedef void (*laFloatReadF)(void *, real);
  47. typedef void (*laFloatArrayGetAllF)(void *, real *);
  48. typedef void (*laFloatArraySetF)(void *, int, real); //idx,n
  49. typedef void (*laFloatArraySetAllF)(void *, real);
  50. typedef void (*laFloatArraySetAllArrayF)(void *, real *);
  51. typedef void (*laFloatArrayReadAllF)(void *, real *);
  52. typedef int (*laEnumGetF)(void *);
  53. typedef int (*laEnumGetLengthF)(void *);
  54. typedef void (*laEnumSetF)(void *, int);
  55. typedef void (*laEnumReadF)(void *, int);
  56. typedef void (*laEnumArraySetF)(void *, int, int); //idx,n
  57. typedef void (*laEnumArraySetAllF)(void *, int *);
  58. typedef void (*laEnumArrayReadAllF)(void *, int *);
  59. typedef void (*laEnumArrayGetAllF)(void *, int *);
  60. typedef void (*laStringSetF)(void *, char *);
  61. typedef void (*laStringGetF)(void *, char *copy_result, char** direct_result);
  62. typedef void (*laStringReadF)(void *, char *);
  63. typedef int (*laStringGetLenF)(void *);
  64. typedef void (*laSubReadF)(void *, void *); //from,set
  65. typedef void *(*laSubGetInstanceF)(void *, void *); //from,iterator
  66. typedef void (*laSubSetInstanceF)(void *, void *);
  67. typedef void *(*laSubGetNextF)(void *, void *); //this,iterator
  68. typedef int (*laSubGetAmountF)(void *);
  69. typedef int (*laSubGetStateF)(void *);
  70. typedef int (*laSubSetStateF)(void *, void *, int);
  71. typedef void *(*laSubTypeDetachedGet)(void *, void *);
  72. typedef void *(*laSubTypeDetachedGetNext)(void *, void *);
  73. typedef void *(*laSubGetTypeF)(void *);// inst, returns type ref.
  74. typedef int (*laSubUIFilterF)(void* parent, void* inst); // 1 show, 0 discard.
  75. typedef int (*laSubSaveFilterF)(void* parent, void* inst); // 1 save, 0 discard.
  76. typedef void *(*laSubUIThemeF)(void* parent, void* inst); // return a theme, MAIN.CurrentTheme can always be referenced to produce invert.
  77. typedef int (*laSubUIGapF)(void* parent, void* inst);
  78. typedef void (*laSubUICategoryF)(void* parent, void* inst, char *copy_result, char** direct_result);
  79. typedef void* (*laRawGetF)(void *, int* r_size, int* return_is_a_copy);
  80. typedef void (*laRawMultiGetF)(void *, int* r_chunks, uint32_t* r_sizes, void** pointers); // max 128 chunks
  81. typedef int (*laRawMultiCanGetF)(void *);
  82. typedef int (*laRawGetSizeF)(void *);
  83. typedef void (*laRawSetF)(void *, void* data, uint32_t copy_size);
  84. typedef void (*laContainerPostReadFunc)(void *);
  85. typedef laPropContainer* (*laGetNodeTypeFunc)(void *);
  86. typedef void (*laContainerBeforeFreeF)(void *);
  87. typedef void (*laContainerResetF)(void *);
  88. typedef void (*laContainerUndoTouchedF)(void *, u64bit hint);
  89. typedef void (*laContainerpUDFPropagateF)(void *, void* udf, int Force);
  90. typedef void (*laPreSaveF)();
  91. typedef void (*laPostSaveF)();
  92. typedef int (*laActionHolderVerifyF)(void* Holder, laPropContainer* HolderType, void* inst, laPropContainer* InstType);
  93. #define LA_PROP_GENERAL_ROOT (1<<7)
  94. #define LA_PROP_SUB (1<<8)
  95. #define LA_PROP_INT (1<<9)
  96. #define LA_PROP_FLOAT (1<<10)
  97. #define LA_PROP_STRING (1<<11)
  98. #define LA_PROP_ENUM (1<<12)
  99. #define LA_PROP_STRING (1<<13)
  100. #define LA_PROP_ARRAY (1<<14)
  101. #define LA_PROP_PANEL (1<<15)
  102. #define LA_PROP_UI (1<<16)
  103. #define LA_PROP_OPERATOR (1<<17)
  104. #define LA_PROP_MENU (1<<18)
  105. #define LA_PROP_SELF_CONDITION (1<<19)
  106. #define LA_PROP_BIN (1<<20)
  107. #define LA_PROP_REF_LIST (1<<21)
  108. #define LA_PROP_GENERIC_BITS (~LA_PROP_ARRAY)
  109. #define LA_PROP_IS_FOLDER (1<<22)
  110. #define LA_PROP_IS_FILE (1<<23)
  111. #define LA_PROP_RAW (1<<24)
  112. #define LA_PROP_IS_LINEAR_SRGB (1<<24)
  113. #define LA_PROP_READ_PROGRESS (1<<25)
  114. #define LA_PROP_OTHER_ALLOC (1<<3)
  115. #define LA_PROP_HYPER_BITS (1|2)
  116. #define LA_RAW_CSTR_MAX_LEN 4096
  117. #define LA_PROP_KEY_INTERPOLATION_ROTATION 1
  118. typedef void (*laUiDefineFunc)(void *uil, void *collection_inst, void *this_inst, void *extra_col, int temlpate_context);
  119. typedef void (*laPanelDetachedPropFunc)(void *panel);
  120. //typedef void(*laUnlinkFunc)(void*, void*);//this instance,target instance
  121. NEED_STRUCTURE(laCanvasTemplate);
  122. NEED_STRUCTURE(laKeyMapper);
  123. STRUCTURE(laSaverDummy){
  124. laListItem Item;
  125. real pad;
  126. };
  127. STRUCTURE(laPropContainer){
  128. laListItem Item;
  129. const char *Identifier;
  130. const char *Name;
  131. const char *Description;
  132. uint32_t IconID;
  133. int NodeSize;
  134. laContainerBeforeFreeF BeforeFree;
  135. laContainerUndoTouchedF UndoTouched;
  136. laContainerResetF Reset;
  137. laContainerpUDFPropagateF UDFPropagate;
  138. laContainerPostReadFunc PostRead;
  139. laContainerPostReadFunc PostReadIm;
  140. int Hyper;
  141. int OtherAlloc;
  142. laActionHolderVerifyF ActionHolderVerify;
  143. laCanvasTemplate *Template2D;
  144. laListHandle Props;
  145. laUiDefineFunc UiDefine;
  146. laUiDefineFunc MenuUiDefine;
  147. laListHandle FailedNodes;
  148. laListHandle TrashBin;
  149. laListHandle LocalUsers;
  150. int validated;
  151. laProp* SaverDummy;
  152. };
  153. NEED_STRUCTURE(laUiType);
  154. NEED_STRUCTURE(laPanel);
  155. NEED_STRUCTURE(laPropStep);
  156. STRUCTURE(laPropPack){
  157. laPropStep *Go;
  158. void *EndInstance;
  159. laPropStep *LastPs;
  160. laPropPack *RawThis;
  161. char LastIndex;
  162. //char ReusedPs;
  163. };
  164. STRUCTURE(laProp){
  165. laListItem Item;
  166. laPropContainer *Container;
  167. int PropertyType;
  168. int ReadOnly;
  169. //laProp* Detached;
  170. laPropPack DetachedPP;
  171. int Len;
  172. char ElementBytes;
  173. uint32_t IconID;
  174. const char *Identifier;
  175. const char *Name;
  176. const char *Description;
  177. const char *Prefix;
  178. const char *Unit;
  179. const char *ExtraInstructions;
  180. laArrayGetLenF GetLen;
  181. laPropContainer *SubExtra; //?
  182. laPropContainer *SubProp;
  183. laUiDefineFunc UiDefine;
  184. laUiType *DefaultUiType;
  185. int DefaultFlags;
  186. int Offset;
  187. char OffsetIsPointer;
  188. char UDFIsRefer;
  189. char UDFNoCreate;
  190. char UDFIgnore;
  191. char UDFOnly;
  192. char UDFIsSingle;
  193. char UDFHideInSave;
  194. char UDFSingleManageable;
  195. char UDFReadProgress;
  196. char IsRadAngle;
  197. char CanTranslate;
  198. char Keyable;
  199. char KeySpecialInterpolation;
  200. //int SignalThrow;
  201. //int SignalCatch;
  202. u64bit Tag;
  203. laListHandle UserPanels;
  204. };
  205. STRUCTURE(laPropUserPanel){
  206. laListItem Item;
  207. laPanel *Panel;
  208. laListHandle UserPacks;
  209. };
  210. STRUCTURE(laPropUser){
  211. laListItem Item;
  212. laPropStep *User;
  213. unsigned int FrameDistinguish;
  214. };
  215. STRUCTURE(laPropStep){
  216. laPropStep *pNext;
  217. laProp *p;
  218. char Type;
  219. void *UseInstance;
  220. };
  221. STRUCTURE(laPropLink){
  222. laListItem Item;
  223. laPropPack Recieve;
  224. laSafeString *Identifier;
  225. laProp *Prop;
  226. laPropStep FakePS;
  227. laPropPack PP;
  228. void *DataStowage;
  229. };
  230. STRUCTURE(laIntProp){
  231. laProp Base;
  232. laIntGetF Get;
  233. laIntSetF Set;
  234. laIntArraySetF SetArr;
  235. laIntArraySetAllF SetAll;
  236. laIntArraySetAllArrayF SetAllArr;
  237. laIntArrayGetAllF GetAll;
  238. laIntReadF Read;
  239. laIntArrayReadAllF ReadAll;
  240. int Step;
  241. int Min, Max;
  242. int DefVal;
  243. const int *DefArr;
  244. int *Detached;
  245. };
  246. STRUCTURE(laFloatProp){
  247. laProp Base;
  248. laFloatGetF Get;
  249. laFloatSetF Set;
  250. laFloatArraySetF SetArr;
  251. laFloatArraySetAllF SetAll;
  252. laFloatArraySetAllArrayF SetAllArr;
  253. laFloatArrayGetAllF GetAll;
  254. laFloatReadF Read;
  255. laFloatArrayReadAllF ReadAll;
  256. real Step;
  257. real Min, Max;
  258. real DefVal;
  259. const real *DefArr;
  260. real *Detached;
  261. };
  262. STRUCTURE(laEnumItem){
  263. laListItem Item;
  264. const char *Identifier;
  265. const char *Name;
  266. const char *Description;
  267. int Index;
  268. uint32_t IconID;
  269. };
  270. STRUCTURE(laEnumProp){
  271. laProp Base;
  272. laEnumGetF Get;
  273. laEnumGetLengthF GetLen;
  274. laEnumSetF Set;
  275. laEnumArraySetF SetArr;
  276. laEnumArraySetAllF SetAll;
  277. laEnumArrayGetAllF GetAll;
  278. laEnumReadF Read;
  279. laEnumArrayReadAllF ReadAll;
  280. laListHandle Items; //id start from 1.
  281. int DefVal;
  282. const int *DefArr;
  283. int *Detached;
  284. };
  285. STRUCTURE(laStringProp){
  286. laProp Base;
  287. laStringGetF Get;
  288. laStringSetF Set;
  289. laStringGetLenF Getstrlen;
  290. laStringReadF Read;
  291. char IsSafeString;
  292. const char *DefStr;
  293. char *Detached;
  294. };
  295. NEED_STRUCTURE(laOperatorType)
  296. STRUCTURE(laOperatorProp){
  297. laProp Base;
  298. const char *OperatorID;
  299. laOperatorType *OperatorType;
  300. };
  301. STRUCTURE(laRawProp){
  302. laProp Base;
  303. laRawGetF RawGet;
  304. laRawMultiGetF RawMultiGet; laRawMultiCanGetF RawMultiCanGet;
  305. laRawSetF RawSet;
  306. laRawGetSizeF RawGetSize;
  307. };
  308. STRUCTURE(laSubProp){
  309. laProp Base;
  310. laSubGetInstanceF Get;
  311. laSubGetInstanceF GetActive;
  312. laSubSetInstanceF Set;
  313. laSubGetNextF GetNext;
  314. laSubGetStateF GetState;
  315. laSubSetStateF SetState;
  316. laSubGetAmountF GetAmount;
  317. laSubUIFilterF UiFilter;
  318. laSubSaveFilterF SaveFilter;
  319. laSubUIThemeF GetTheme;
  320. laSubUIGapF GetGap;
  321. laSubUICategoryF GetCategory;
  322. int ListHandleOffset;
  323. laSubTypeDetachedGet DetachedGet;
  324. laSubTypeDetachedGetNext DetachedGetNext;
  325. const char *TargetID;
  326. laGetNodeTypeFunc GetType;
  327. int IsDetached;
  328. void *Detached;
  329. int IsRefList;
  330. };
  331. STRUCTURE(laPropIterator){
  332. laListItemPointer *Linker;
  333. void *Parent;
  334. void *Handle;
  335. };
  336. STRUCTURE(laResourceFolder){
  337. laListItem Item;
  338. laSafeString* Path;
  339. };
  340. STRUCTURE(laRoot){
  341. laPropContainer *Root;
  342. void *RootInstance;
  343. };
  344. STRUCTURE(laUDFPostRead){
  345. laListItem Item;
  346. void *Instance;
  347. laContainerPostReadFunc Func;
  348. };
  349. STRUCTURE(laPtrSync){
  350. laListItem Item; //hash
  351. void *RefDB;
  352. //void* ReadRef;
  353. void *Parent; //key
  354. laSubProp *Prop; //must be sub
  355. };
  356. STRUCTURE(laPtrSyncCommand){
  357. laListItem Item;
  358. laPtrSync *Target;
  359. void *ReadInstance;
  360. laUID ReadNUID;
  361. };
  362. STRUCTURE(laUDFPropQuickSeek){
  363. laListItem Item;
  364. laSafeString *Path;
  365. off_t QuickSeek;
  366. };
  367. STRUCTURE(laUDFPropSegment){
  368. laListItem Item;
  369. laPropPack *PPP;
  370. laPropPack PP;
  371. laSafeString *Path;
  372. off_t WriteQuickSeek;
  373. };
  374. STRUCTURE(laUDFH2Instance){
  375. laListItem Item;
  376. laPropContainer* pc;
  377. void* Instance;
  378. };
  379. STRUCTURE(laUDF){
  380. int Opened;
  381. int Extensions;
  382. FILE *DiskFile;
  383. laSafeString *FileName;
  384. laListHandle H2Instances;
  385. laUDFH2Instance* CurrentH2Instance;
  386. laListHandle PropsToOperate;
  387. laListHandle QuickSeeks;
  388. //laListHandle PointerSync;
  389. //laListHandle PointerRecording;
  390. short NumSegmets;
  391. short Modified;
  392. short HasInstances;
  393. short Managed;
  394. u8bit *FileContent;
  395. u64bit Seek;
  396. u64bit FileContentSize;
  397. long TotalRefs;
  398. laListHandle HyperRecords; //writing
  399. //laListHandle LinkedFiles; //writing and reading
  400. laListHandle OwnHyperItems; //reading
  401. };
  402. STRUCTURE(laUDFHyperRecordItem){
  403. laListItem Item;
  404. void* HyperUserMem;
  405. laPropContainer* pc;
  406. u64bit Seek;
  407. };
  408. STRUCTURE(laUDFRegistry){
  409. laListItem Item;
  410. laSafeString* Path;
  411. };
  412. STRUCTURE(laUDFOwnHyperItem){
  413. laListItem Item;
  414. laUID NUID;
  415. laUDFRegistry* Registry;
  416. u64bit Seek;
  417. };
  418. STRUCTURE(laTrashRestoreExtra){
  419. void *Instance;
  420. laListHandle Instances;
  421. };
  422. STRUCTURE(laManagedUDF){
  423. laListItem Item;
  424. laUDF* udf;
  425. laSafeString *BaseName; // update together
  426. laListHandle PropSegments;
  427. };
  428. STRUCTURE(laManagedSaveProp){
  429. laListItem Item;
  430. laSafeString* Path;
  431. laListHandle SaveAlongside;
  432. };
  433. typedef void (*laDiffPushEverythingF)();
  434. typedef void (*laDiffCommandUndoF)(void* Data);
  435. typedef void (*laDiffCommandRedoF)(void* Data);
  436. typedef void (*laDiffCommandFreeF)(void* Data, int FromOlder);
  437. STRUCTURE(laDiffCommandCustom){
  438. laListItem Item;
  439. void* Data;
  440. laDiffCommandUndoF Undo;
  441. laDiffCommandRedoF Redo;
  442. laDiffCommandFreeF Free;
  443. };
  444. STRUCTURE(laDiff){
  445. laListItem Item;
  446. laListHandle Commands;
  447. laListHandle CustomCommands;
  448. laListHandle ExtraTouched;
  449. laSafeString* Description;
  450. u64bit Hint;
  451. };
  452. STRUCTURE(laDiffExtraTouched){
  453. laListItem Item;
  454. laDBInst* dbi;//ref, not owner
  455. };;
  456. STRUCTURE(laDiffCommand){
  457. laListItem Item;
  458. laDBInst* Instance;
  459. laProp* p;
  460. void* Data; //for sub, this is dbinst.
  461. };
  462. STRUCTURE(laDiffCommandRaw){
  463. laListItem Item;
  464. laDBInst* Instance;
  465. laProp* p;
  466. void* Data; int DataSize;
  467. };
  468. STRUCTURE(laDiffCommandInst){
  469. laListItem Item;
  470. laDBInst* OriginalPrev;
  471. laDBInst* OriginalNext;
  472. laDBInst* BeforePrev;
  473. laDBInst* BeforeNext;
  474. laDBInst* DBInst;
  475. };
  476. STRUCTURE(laDiffCommandSub){
  477. laDiffCommand Base;
  478. laListHandle AddedInst;
  479. laListHandle RemovedInst;
  480. laListHandle MovedInst;
  481. };
  482. STRUCTURE(laDiffTemp){
  483. laListItem Item;
  484. void* p;
  485. void* tPrev;
  486. void* tNext;
  487. void* nPrev;
  488. void* nNext;
  489. };
  490. STRUCTURE(laDBRecordedProp){
  491. laListItem Item;
  492. laSafeString* OriginalPath;
  493. };
  494. STRUCTURE(laDBInstPendingRelink){
  495. laListItem Item;
  496. laDBInst* dbi; void* from; void* to;
  497. };
  498. STRUCTURE(laDBInst){
  499. laListItem Item;
  500. laListItem Item2;//DBInstLink
  501. void* OriginalInstance;
  502. laPropContainer* pc;
  503. laListHandle Props;
  504. };
  505. STRUCTURE(laDBProp){
  506. laListItem Item;
  507. laProp* p;
  508. void* Data;
  509. //---------------
  510. };
  511. ;
  512. STRUCTURE(laDBRawProp){
  513. laListItem Item;
  514. laProp* p;
  515. void* Data;
  516. //---------------
  517. int DataSize;
  518. };
  519. STRUCTURE(laDBSubProp){
  520. laListItem Item;
  521. laProp* p;
  522. void* Data;
  523. //---------------
  524. laListHandle Instances;
  525. };
  526. STRUCTURE(laDiffPtrSync){
  527. laListItem Item;
  528. void* instance;
  529. laDBProp* dbp;
  530. laDiffCommand* dc;
  531. };
  532. STRUCTURE(laDiffPost){
  533. laListItem Item;
  534. void* instance;
  535. laContainerUndoTouchedF Touched;
  536. };
  537. #define LA_ANIMATION_PLAY_MODE_REPEAT 0
  538. #define LA_ANIMATION_PLAY_MODE_HOLD 1
  539. #define LA_ANIMATION_PLAY_MODE_BOUNCE 2
  540. #define LA_ANIMATION_MIX_REPLACE 0
  541. #define LA_ANIMATION_MIX_ADD 1
  542. NEED_STRUCTURE(laAction);
  543. STRUCTURE(laActionHolder){
  544. laListItem Item;
  545. void* Instance; int ActionOffset,PropOffset;
  546. laPropContainer* Container;
  547. laSafeString* Name;
  548. laSafeString* CategoryTitle;
  549. };
  550. STRUCTURE(laActionHolderPath){
  551. laListItem Item;
  552. laPropPack PP;
  553. char* OriginalPath;
  554. };
  555. STRUCTURE(laAnimation){
  556. real _PAD;
  557. laAction* CurrentAction;
  558. laListHandle ActionHolders;
  559. laListHandle ActionHolderPaths;
  560. real PlayHead;
  561. int PlayStatus;
  562. laTimeRecorder TimeOrigin;
  563. real RunPlayHead;
  564. };
  565. STRUCTURE(laAction){
  566. laListItem Item;
  567. laSafeString* Name;
  568. void* HolderInstance; laPropContainer* HolderContainer; // for verification
  569. laListHandle Channels;
  570. int FrameCount;
  571. real Length;
  572. real PlayHead,Offset;
  573. int PlayMode;
  574. int Solo, Mute;
  575. int PlayByDefault;
  576. int MixMode;
  577. };
  578. STRUCTURE(laActionProp){
  579. laListItem Item;
  580. void* For;
  581. laProp* Prop;
  582. int DataSize; // sizeof
  583. laSafeString* CachedName;
  584. uint64_t Data[16];
  585. int Reset;
  586. };
  587. STRUCTURE(laActionChannel){
  588. laListItem Item;
  589. laActionProp* AP;
  590. laListHandle Keys;
  591. };
  592. STRUCTURE(laActionKey){
  593. laListItem Item;
  594. int At,OriginaAt;
  595. int Selected;
  596. int DataSize;
  597. void* Data;
  598. };
  599. STRUCTURE(laRetargetedAction){
  600. void** Instances;
  601. real PlayHead;
  602. int PlayStatus;
  603. int Direction;
  604. };
  605. STRUCTURE(laActionRetarget){
  606. int DetachedInNode;
  607. int ActionCount;
  608. real PlaySync;
  609. laListHandle* Actions;
  610. laRetargetedAction* Retargeted;
  611. void* HolderInstance;
  612. };
  613. #define LA_ACTION_FRAME(aa,override_playhead) (((((override_playhead)>=0)?(override_playhead):(aa)->PlayHead)+FLT_EPSILON)*(real)((aa)->FrameCount))
  614. /* Only little endian are supported right now */
  615. #define LA_UDF_IDENTIFIER "UDF_LE"
  616. #define LA_UDF_EXTENSION_FLOAT32 (1<<0)
  617. #define LA_UDF_EXTENSION_RAW (1<<1)
  618. #define LA_UDF_EXTENSION_QUICK_SEEK (1<<2)
  619. #define LA_UDF_EXTENSIONS_ENABLED (LA_UDF_EXTENSION_RAW|LA_UDF_EXTENSION_QUICK_SEEK)
  620. #define LA_UDF_ALL_EXTENSIONS 0xffff
  621. #define LA_UDF_MARK_TIMESTAMP 3
  622. #define LA_UDF_MODE_APPEND 0
  623. #define LA_UDF_MODE_OVERWRITE 1
  624. #define LA_UDF_SINGLE (1<<0)
  625. #define LA_UDF_COLLECTION (1<<1)
  626. #define LA_UDF_REFER (1<<2)
  627. #define LA_UDF_ITEM (1<<3) //ItemType
  628. #define LA_UDF_ACTIVE (1<<4)
  629. #define LA_UDF_STATE (1<<5)
  630. #define LA_UDF_REGULAR_MARK_64 (1<<6)
  631. #define LA_UDF_ARRAY_MARK_64 (1<<7)
  632. #define LA_UDF_HYPER_ITEM (1<<8) //ItemType
  633. #define LA_UDF_SHARE_RESOURCE (1<<9)
  634. #define LA_UDF_USE_VERSION (1<<10) //Use History
  635. #define LA_UDF_REGULAR_MARK_32 (1<<10)
  636. #define LA_UDF_ARRAY_MARK_32 (1<<11)
  637. #define LA_UDF_STRING_MARK (1<<12)
  638. #define LA_UDF_HYPER_MARK (1<<13)
  639. #define LA_UDF_ONLY (1<<14)
  640. #define LA_UDF_RAW_MARK (1<<14)
  641. //#define LA_UDF_LINKED_ITEM (1<<15) //ItemType
  642. #define LA_UDF_IGNORE (1<<16)
  643. #define LA_DETACHABLE (1<<17)
  644. #define LA_UDF_VARIABLE_NODE_SIZE (1<<18)
  645. #define LA_UDF_FIXED_NODE_SIZE (1<<19)
  646. #define LA_UDF_LOCAL (1<<20)
  647. #define LA_RAD_ANGLE (1<<21)
  648. #define LA_UDF_PRINT_STATICS (1<<22)
  649. #define LA_UDF_NUID_SEEK (1<<23)
  650. #define LA_UDF_NUID_LINK_FILES (1<<24)
  651. #define LA_AS_IDENTIFIER (1<<25)
  652. #define LA_UDF_USE_LINK_NODE (1<<26)
  653. #define LA_READ_ONLY (1<<27)
  654. #define LA_HIDE_IN_SAVE (1<<28)
  655. #define LA_TRANSLATE (1<<29)
  656. #define LA_PROP_KEYABLE (1<<30)
  657. #define LA_PROP_ROTATION (1<<31)
  658. STRUCTURE(laThreadNotifier){
  659. laListItem Item;
  660. char Path[256];
  661. };
  662. laPropContainer *laDefineRoot();
  663. NEED_STRUCTURE(laOperatorType)
  664. NEED_STRUCTURE(laOperator)
  665. NEED_STRUCTURE(laEvent)
  666. void laset_InstanceUID(void* instance, char* buf);
  667. void *laget_ListNext(laListItem *Item, void *UNUSED);
  668. void *laget_ListPrev(laListItem *Item, void *UNUSED);
  669. void *laget_List2Next(laListItem2 *Item, void *UNUSED);
  670. void *laget_List2Prev(laListItem2 *Item, void *UNUSED);
  671. void la_DEBUG_VerifyThisContainer(laPanel *pa, laPropContainer *pc);
  672. void la_DEBUG_VerifyPanelPropsDestroyed(laPanel *p);
  673. void la_CopyPropPack(laPropPack *From, laPropPack *To);
  674. void laPropPackToLocal(laPropPack* ToPP, laPropPack* pp);
  675. laPropContainer* la_EnsureSubTarget(laSubProp* sp, void* optional_instance);
  676. laPropContainer *la_ContainerLookup(char *ID);
  677. laProp *la_PropLookup(laListHandle *lst, char *ID);
  678. void la_UsePropPack(laPropPack *pp, int ForceRecalc);
  679. void la_StopUsingPropPack(laPropPack *pp);
  680. void la_SetPropMathcerContext(laPanel *p);
  681. void laNotifyUsersPP(laPropPack *pp);
  682. void laNotifyUsersPPPath(laPropPack *pp, char *path);
  683. void laNotifySubPropUsers(laProp *p, void *Instance);
  684. void laNotifyUsers(char *Path);
  685. void laNotifyInstanceUsers(void *Instance);
  686. void laThreadNotifyUsers(char *Path);
  687. void laNotifyDetached(void* OldInstance, void* NewInstance);
  688. void laDetachedTrySet(char* prop_identifier,void* NewInstance);
  689. int laIsPropertyReadOnly(laPropPack *pp);
  690. int laGetPrefixP(laPropPack *p, char buf[8][64]);
  691. int laGetPrefix(laProp *p, char buf[8][64]);
  692. laPropContainer* laGetInstanceType(laPropPack* pp, void* instance);
  693. laUiDefineFunc laGetPropertyUiDefine(laPropPack* pp, void* instance);
  694. int laSetInt(laPropPack *pp, int n);
  695. int laGetInt(laPropPack *pp);
  696. int laSetFloat(laPropPack *pp, real n);
  697. real laGetFloat(laPropPack *pp);
  698. int laGetArrayLength(laPropPack *pp);
  699. int laSetIntArraySingle(laPropPack *pp, int index, int n);
  700. int laSetIntArrayAll(laPropPack *pp, int n);
  701. int laSetIntArrayAllArray(laPropPack *pp, int *arr);
  702. int laGetIntArray(laPropPack *pp, int *result);
  703. int laSetFloatArraySingle(laPropPack *pp, int index, real n);
  704. int laSetFloatArrayAll(laPropPack *pp, real n);
  705. int laSetFloatArrayAllArray(laPropPack *pp, real *arr);
  706. int laGetFloatArray(laPropPack *pp, real *result);
  707. laEnumItem *laGetEnum(laPropPack *pp);
  708. int laGetEnumEntryLen(laPropPack *pp);
  709. laEnumItem *laGetEnumArrayIndexed(laPropPack *pp, int index);
  710. int laGetEnumArray(laPropPack *pp, laEnumItem **result);
  711. laEnumItem *laGetEnumFromIdentifier(laEnumProp *p, char *Identifier);
  712. int laEnumHasIcon(laPropPack *pp);
  713. int laSetEnumExternal(laPropPack *pp, int n);
  714. int laSetEnum(laPropPack *pp, int n);
  715. int laSetEnumArrayIndexedExternal(laPropPack *pp, int index, int n);
  716. int laSetEnumArrayIndexed(laPropPack *pp, int index, int n);
  717. int laSetEnumArrayAllArray(laPropPack* pp, laEnumItem** ei);
  718. int laSetEnumArrayAll(laPropPack* pp, int EnumN);
  719. int laSetString(laPropPack *pp, char *str);
  720. int laGetString(laPropPack *pp, char *result, char** direct_result);
  721. int laActuateProp(laPropPack *This, laPropPack *RunPP, laOperator *OptionalFrom, laEvent *e);
  722. int laGetIntRange(laPropPack *pp, int *min, int *max);
  723. int laGetFloatRange(laPropPack *pp, real *min, real *max);
  724. void* laGetRaw(laPropPack *pp, int* r_size, int* return_is_a_copy);
  725. int laSetRaw(laPropPack *pp, void* data, uint32_t _size);
  726. int laTryGetInstanceIdentifier(void* Instance, laPropContainer* pc, char* identifier, char** here);
  727. void laMarkPropChanged(laPropPack* pp);
  728. void laMarkMemChanged(void* memuser);
  729. void laMarkMemClean(void* memuser);
  730. void *la_FindMatchingInstance(void *From, laProp *Sub, laProp *p, laPropStep *Value);
  731. void la_FreePropStepCache(laPropStep *GoTarget);
  732. void la_StepPropPack(laPropPack *pp);
  733. void la_GetPropPackFullPath(laPropPack *pp, char *result);
  734. void la_GetPropPackPath(laPropPack *pp, char *result);
  735. laItemUserLinker *laUseDataBlock(void* HyperUserMem, laProp *Which, unsigned int FrameDistinguish, void *User, laUserRemoveFunc Remover, int ForceRecalc);
  736. void laStopUsingDataBlock(void* HyperUserMem, laProp *prop, laPanel *p);
  737. void laDataBlockNoLongerExists(void *HyperUserMem, laListHandle* UserList);
  738. void la_PrintUserList(void* HyperUserMem);
  739. void laThrowToTrashBin(void* Data, char *ContainerString);
  740. void la_FreeProperty(laProp* p);
  741. void la_FreePropertyContainer(laPropContainer* pc);
  742. laSaverDummy* laGetSaverDummy(void* instance, laSubProp* p);
  743. void laPurgeSaverDummy(void* instance, laSubProp* p);
  744. laPropContainer *laAddPropertyContainer(const char *Identifier, const char *Name, const char *Description, uint32_t IconID, laUiDefineFunc DefaultUiDefine,
  745. int NodeSize, laContainerPostReadFunc PostRead, laContainerPostReadFunc PostReadIm, int IsHyper);
  746. laProp* laPropContainerManageable(laPropContainer* pc, int offset_of_dummy_list);
  747. void laPropContainerExtraFunctions(laPropContainer* pc, laContainerBeforeFreeF BeforeFree, laContainerResetF Reset, laContainerUndoTouchedF Touched, laContainerpUDFPropagateF UDFPropagate, laUiDefineFunc MenuUi);
  748. void laContainerAnimationFunctions(laPropContainer* pc, laActionHolderVerifyF ActionHolderVerify);
  749. const char *la_GetPropertyTypeString(int Type);
  750. NEED_STRUCTURE(laWidget);
  751. laProp *la_CreateProperty(laPropContainer *Container, int Type, const char *Identifier, const char *Name, const char *Description,
  752. const char *Prefix, const char *Unit, laWidget* DefaultWidget, u64bit Tag);
  753. void la_ClearDetachedProp(laPanel* p);
  754. laProp *la_MakeDetachedProp(laPanel* p, const char *From, const char *Rename);
  755. laProp *laAddIntProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, laWidget* DefaultWidget,
  756. const char *Prefix, const char *Unit, int Max, int Min, int Step, int DefVal, const int *DefArr,
  757. int OffsetSize, laIntGetF Get, laIntSetF Set, int ArrayLength, laArrayGetLenF GetLen,
  758. laIntArraySetF SetArr, laIntArrayGetAllF GetAll, laIntArraySetAllF SetAll, laIntArraySetAllArrayF SetAllArr,
  759. laIntReadF Read, laIntArrayReadAllF ReadAll,
  760. u64bit Tag);
  761. laProp *laAddFloatProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, laWidget* DefaultWidget,
  762. const char *Prefix, const char *Unit, real Max, real Min, real Step, real DefVal, const real *DefArr,
  763. int OffsetSize, laFloatGetF Get, laFloatSetF Set, int ArrayLength, laArrayGetLenF GetLen,
  764. laFloatArraySetF SetArr, laFloatArrayGetAllF GetAll, laFloatArraySetAllF SetAll, laFloatArraySetAllArrayF SetAllArr,
  765. laFloatReadF Read, laFloatArrayReadAllF ReadAll,
  766. u64bit Tag);
  767. laProp *laAddEnumProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, laWidget* DefaultWidget,
  768. const char *Prefix, const char *Unit, int DefVal, const int *DefArr,
  769. int OffsetSize, laEnumGetF Get, laEnumSetF Set, int ArrayLength, laArrayGetLenF GetLen,
  770. laEnumArraySetF SetArr, laEnumArrayGetAllF GetAll, laEnumArraySetAllF SetAll,
  771. laEnumReadF Read, laEnumArrayReadAllF ReadAll,
  772. u64bit Tag);
  773. int laAddEnumItem(laProp *p, const char *Identifier, const char *Name, const char *Description, uint32_t IconID);
  774. int laAddEnumItemAs(laProp *p, const char *Identifier, const char *Name, const char *Description, int Index, uint32_t IconID);
  775. laProp *laAddStringProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, laWidget* DefaultWidget,
  776. const char *Prefix, const char *Unit, const char *DefStr,
  777. int IsSafeString, int OffsetSize, laStringGetLenF GetLen, laStringGetF Get, laStringSetF Set,
  778. laStringReadF Read,
  779. u64bit Tag);
  780. laProp *laAddSubGroup(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description,
  781. const char *TargetId, laGetNodeTypeFunc GetType, laWidget* DefaultWidget, laUiDefineFunc DefaultUiDef,
  782. int OffsetSize, laSubGetInstanceF Get, laSubGetInstanceF GetActive, laSubGetNextF GetNext, laSubSetInstanceF Set,
  783. laSubGetStateF GetState, laSubSetStateF SetState, int ListHandleOffset, u64bit Tag);
  784. void laSubGroupExtraFunctions(laProp* p, laSubUIFilterF* UiFilter, laSubSaveFilterF* SaveFilter, laSubUIThemeF* GetTheme, laSubUIGapF GetGap, laSubUICategoryF GetCategory);
  785. void laSubGroupDetachable(laProp *SubProp, laSubTypeDetachedGet DetachedGet, laSubTypeDetachedGetNext DetachedGetNext);
  786. laProp *laAddOperatorProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description,
  787. const char *OperatorID, uint32_t IconID, laWidget* DefaultWidget);
  788. laProp *laAddRawProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, int OffsetSize, laRawGetSizeF GetSize, laRawGetF RawGet, laRawSetF RawSet, u64bit Tag);
  789. void laRawPropertyExtraFunctions(laProp* p, laRawMultiGetF MultiGet, laRawMultiCanGetF CanMultiGet);
  790. //void laPropertySignal(laProp* p, int Throw, int Catch);
  791. NEED_STRUCTURE(laBoxedTheme);
  792. void *laGetInstance(laProp *sub, void *ThisInstance, laPropIterator *pi);
  793. void *laGetNextInstance(laProp *sub, void *FromInstance, laPropIterator *pi);
  794. void *laGetActiveInstanceStrict(laProp *sub, void *FromInstance);
  795. void *laGetActiveInstance(laProp *sub, void *FromInstance, laPropIterator *pi);
  796. void laSetActiveInstance(laProp *sub, void *FromInstance, void *Instance);
  797. void laAppendInstance(laSubProp *sub, void *FromInstance, void *Instance);
  798. int laGetUiState(laProp *sub, void *Instance);
  799. laBoxedTheme* laGetUiTheme(laProp *sub, void* parent, void *Instance);
  800. int laGetUiGap(laProp *sub, void* parent, void *Instance);
  801. void laGetCategory(laProp *sub, void* parent, void *Instance, char* buf, char** buf_ptr);
  802. int laCanGetState(laProp *sub);
  803. int laCanGetTheme(laProp *sub);
  804. int laCanGetGap(laProp *sub);
  805. int laCanGetCategory(laProp *sub);
  806. int laSetState(laProp *sub, void *FromInstance, void *Instance, int State);
  807. laPropContainer *la_SetGeneralRoot(laPropContainer **GeneralRoot, const char *Identifier, const char *Name, const char *Description);
  808. int la_GetPropFromPath(laPropPack *Self, laPropPack *Base, const char *Path, void **SpecifiedInstance);
  809. laProp *la_GetGeneralPropFromPath(laProp *General, const char *Path);
  810. int laValidateProperties();
  811. void laSetRootInstance(void *root);
  812. void la_RegisterMainUiTypes();
  813. void la_RegisterMainThemes();
  814. void la_RegisterInternalProps();
  815. void la_PrintPropStructure();
  816. laProp *la_GetGeneralProp(laProp *p);
  817. void* laget_InstanceActiveUDF(void* instance);
  818. void laset_InstanceUDF(void* instance, void* set);
  819. void la_UDFAppendSharedTypePointer(char *ID, void *Pointer);
  820. void la_AppendLinkedFile(laUDF *File);
  821. void la_GetWorkingDirectoryInternal();
  822. int laGetRelativeDirectory(char *FullFrom, char *FullTo, char *Result);
  823. void laGetUDFRelativeDirectory(laUDF *From, laUDF *To, char *Result);
  824. void laGetFullPath(char *FullFrom, char *Relative, char *Result);
  825. laUDF *laPrepareUDF(char *FileName);
  826. int laWriteProp(laUDF *udf, char *Path);
  827. int laWritePropP(laUDF *udf, laPropPack *pp);
  828. int laPackUDF(laUDF *udf, int UseInstanceList, int DoBackup);
  829. laManagedSaveProp* laSaveProp(char* path);
  830. void laSaveAlongside(laManagedSaveProp* parent, char* path);
  831. void laSetThumbnailProp(char* path);
  832. void laClearSaveProp();
  833. int laRegisterModifications(int ReturnIfAnyMod, int ReturnIfAnyEmpty, int* rempty, int RegisterToUDF);
  834. laUDF *laOpenUDF(char *FileName, int ReadToMemory, laUDFRegistry* ReadRegistryRef, laManagedUDF** UseManaged);
  835. void laCloseUDF(laUDF *udf);
  836. void laExtractProp(laUDF *udf, char* Path);
  837. int laExtractUDF(laUDF *udf, laManagedUDF* mUDF, int Mode);
  838. int laExtractQuickRaw(FILE* fp, char* path, uint8_t** buf, size_t* size);
  839. int laLoadHyperResources(char* uid_search);
  840. laUDFOwnHyperItem* laFindHyperItem(laPropContainer* pc, char* uid);
  841. laUDFRegistry* laFindUDFRegistry(char* Path);
  842. laUDFRegistry* laCreateUDFRegistry(char* Path);
  843. void laClearUDFRegistries();
  844. void laRefreshUDFRegistries();
  845. laManagedUDF* la_FindManagedUDF(char* FileName);
  846. laManagedUDF* la_EnsureManagedUDF(char* FileName, int PutAtTop);
  847. void la_MakeDummyManagedUDF();
  848. void laStopManageUDF(laManagedUDF* m);
  849. void laClearManagedUDF();
  850. void laSaveManagedUDF(int ModifiedOnly);
  851. void laPropagateUDF(laPropContainer* pc, void* inst, int force);
  852. void laSetSaveCallback(laPreSaveF PreSave, laPostSaveF PostSave);
  853. //================== manifest
  854. void laAddResourceFolder(char* Path);
  855. void laRemoveResourceFolder(laResourceFolder* rf);
  856. void la_ClearUDFRegistryAndFolders();
  857. //================== undo
  858. void laFreeOlderDifferences(int KeepHowMany);
  859. void laFreeNewerDifferences();
  860. void laPrintDBInstInfo();
  861. void la_NoLongerRecordUndo();
  862. void laAddRootDBInst(char* path);
  863. void laPushDifferences(char* Description, u64bit hint);
  864. void laRecordCustomDifferences(void* Data, laDiffCommandUndoF Undo, laDiffCommandRedoF Redo, laDiffCommandFreeF Free);
  865. int laRecordDifferences(laPropPack* base, char* path);
  866. int laRecordInstanceDifferences(void* instance, const char* container);
  867. void laRecordAndPush(laPropPack* base, char* path, char* description, uint64_t hint);
  868. void laRecordAndPushProp(laPropPack* base, char* path);
  869. void laRecordEverythingAndPush();
  870. void laSetDiffCallback(laDiffPushEverythingF PushEverything);
  871. void laUndo();
  872. void laRedo();
  873. //======================= animation
  874. #define LA_ANIMATION_STATUS_PAUSED 0
  875. #define LA_ANIMATION_STATUS_PLAY_FWD 1
  876. #define LA_ANIMATION_STATUS_PLAY_REV 2
  877. int la_GetKeyablePropertyStorageSize(laProp* p);
  878. void la_AnimationEvaluateActions(int ClampOffsets);
  879. laRetargetedAction* la_AnimationGetRetargetedAction(laActionRetarget* ar, laAction* aa);
  880. laAction* laAnimiationNewAction(laActionHolder* ah, char* Name);
  881. laActionChannel* laAnimationEnsureChannel(laAction* aa, void* hyper1, laProp* p);
  882. laActionChannel* laAnimationEnsureFrame(laActionChannel* ac, int frame);
  883. void laAnimationStoreKeyValue(laActionChannel* ac, laActionKey* ak);
  884. laActionKey* laAnimationInsertKeyFrame(laAction* aa, void* hyper1, laProp* p, int* error);
  885. void laAnimationRemoveFrame(laActionChannel* ac, laActionKey* ak);
  886. void laAnimationRemoveChannel(laAction* aa, laActionChannel* ac);
  887. void laAnimationRemoveAction(laAction* aa);
  888. void* laAnimationGetRetargetedPropInstance(laProp* p, void* Instance);
  889. void laAnimationEnsureRetarget(void* HolderInstance, laListHandle* action_list, laActionRetarget** retarget);
  890. laActionRetarget* laAnimationCopyRetargetFrom(laActionRetarget* from_ar);
  891. void laAnimationClearRetarget(laActionRetarget **ar_ptr);
  892. void laAnimationSetPlayStatus(int PlayStatus);
  893. void laAnimationSetPlayHead(real time);
  894. int laAnimationSyncRetarget(laActionRetarget* ar, real PlayHead);
  895. int laAnimationEvaluateRetargetedActions(laActionRetarget* ar);
  896. void la_AnimationPreFrame();
  897. void la_AnimationPostFrame();
  898. int laAnimationRegisterHolderPath(const char* Path);
  899. void laAnimationUpdateHolderList();