*/}}

la_data.h 33 KB

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