*/}}

la_data.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  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 ListHandleOffset;
  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. laListHandle Props;
  565. real PlayHead;
  566. int PlayStatus;
  567. laTimeRecorder TimeOrigin;
  568. };
  569. STRUCTURE(laAction){
  570. laListItem Item;
  571. laSafeString* Name;
  572. void* HolderInstance; laPropContainer* HolderContainer; // only for verification
  573. laListHandle Channels;
  574. int FrameCount;
  575. real Length;
  576. real PlayHead,Offset;
  577. int PlayMode;
  578. int Solo, Mute;
  579. int MixMode;
  580. };
  581. STRUCTURE(laActionProp){
  582. laListItem Item;
  583. void* For;
  584. laProp* Prop;
  585. int DataSize; // sizeof
  586. laSafeString* CachedName;
  587. uint64_t Data[16];
  588. int Reset;
  589. };
  590. STRUCTURE(laActionChannel){
  591. laListItem Item;
  592. laActionProp* AP;
  593. laListHandle Keys;
  594. };
  595. STRUCTURE(laActionKey){
  596. laListItem Item;
  597. int At,OriginaAt;
  598. int Selected;
  599. uint64_t Data; // variable size depending on property;
  600. };
  601. #define LA_ACTION_FRAME(aa)\
  602. (aa->PlayHead*(real)aa->FrameCount)
  603. /* Only little endian are supported right now */
  604. #define LA_UDF_IDENTIFIER "UDF_LE"
  605. #define LA_UDF_EXTENSION_FLOAT32 (1<<0)
  606. #define LA_UDF_EXTENSION_RAW (1<<1)
  607. #define LA_UDF_EXTENSION_BITS (LA_UDF_EXTENSION_RAW)
  608. #define LA_UDF_MARK_TIMESTAMP 3
  609. #define LA_UDF_MODE_APPEND 0
  610. #define LA_UDF_MODE_OVERWRITE 1
  611. #define LA_UDF_SINGLE (1<<0)
  612. #define LA_UDF_COLLECTION (1<<1)
  613. #define LA_UDF_REFER (1<<2)
  614. #define LA_UDF_ITEM (1<<3) //ItemType
  615. #define LA_UDF_ACTIVE (1<<4)
  616. #define LA_UDF_STATE (1<<5)
  617. #define LA_UDF_REGULAR_MARK_64 (1<<6)
  618. #define LA_UDF_ARRAY_MARK_64 (1<<7)
  619. #define LA_UDF_HYPER_ITEM (1<<8) //ItemType
  620. #define LA_UDF_SHARE_RESOURCE (1<<9)
  621. #define LA_UDF_USE_VERSION (1<<10) //Use History
  622. #define LA_UDF_REGULAR_MARK_32 (1<<10)
  623. #define LA_UDF_ARRAY_MARK_32 (1<<11)
  624. #define LA_UDF_STRING_MARK (1<<12)
  625. #define LA_UDF_HYPER_MARK (1<<13)
  626. #define LA_UDF_ONLY (1<<14)
  627. #define LA_UDF_RAW_MARK (1<<14)
  628. //#define LA_UDF_LINKED_ITEM (1<<15) //ItemType
  629. #define LA_UDF_IGNORE (1<<16)
  630. #define LA_DETACHABLE (1<<17)
  631. #define LA_UDF_VARIABLE_NODE_SIZE (1<<18)
  632. #define LA_UDF_FIXED_NODE_SIZE (1<<19)
  633. #define LA_UDF_LOCAL (1<<20)
  634. #define LA_RAD_ANGLE (1<<21)
  635. #define LA_UDF_PRINT_STATICS (1<<22)
  636. #define LA_UDF_NUID_SEEK (1<<23)
  637. #define LA_UDF_NUID_LINK_FILES (1<<24)
  638. #define LA_AS_IDENTIFIER (1<<25)
  639. #define LA_UDF_USE_LINK_NODE (1<<26)
  640. #define LA_READ_ONLY (1<<27)
  641. #define LA_HIDE_IN_SAVE (1<<28)
  642. #define LA_TRANSLATE (1<<29)
  643. #define LA_PROP_KEYABLE (1<<30)
  644. #define LA_PROP_ROTATION (1<<31)
  645. STRUCTURE(laThreadNotifier){
  646. laListItem Item;
  647. char Path[256];
  648. };
  649. laPropContainer *laDefineRoot();
  650. NEED_STRUCTURE(laOperatorType)
  651. NEED_STRUCTURE(laOperator)
  652. NEED_STRUCTURE(laEvent)
  653. void laset_InstanceUID(void* instance, char* buf);
  654. void *laget_ListNext(laListItem *Item, void *UNUSED);
  655. void *laget_ListPrev(laListItem *Item, void *UNUSED);
  656. void *laget_List2Next(laListItem2 *Item, void *UNUSED);
  657. void *laget_List2Prev(laListItem2 *Item, void *UNUSED);
  658. void la_DEBUG_VerifyThisContainer(laPanel *pa, laPropContainer *pc);
  659. void la_DEBUG_VerifyPanelPropsDestroyed(laPanel *p);
  660. void la_CopyPropPack(laPropPack *From, laPropPack *To);
  661. void laPropPackToLocal(laPropPack* ToPP, laPropPack* pp);
  662. laPropContainer* la_EnsureSubTarget(laSubProp* sp, void* optional_instance);
  663. laPropContainer *la_ContainerLookup(char *ID);
  664. laProp *la_PropLookup(laListHandle *lst, char *ID);
  665. void la_UsePropPack(laPropPack *pp, int ForceRecalc);
  666. void la_StopUsingPropPack(laPropPack *pp);
  667. void la_SetPropMathcerContext(laPanel *p);
  668. void laNotifyUsersPP(laPropPack *pp);
  669. void laNotifyUsersPPPath(laPropPack *pp, char *path);
  670. void laNotifySubPropUsers(laProp *p, void *Instance);
  671. void laNotifyUsers(char *Path);
  672. void laNotifyInstanceUsers(void *Instance);
  673. void laThreadNotifyUsers(char *Path);
  674. void laNotifyDetached(void* OldInstance, void* NewInstance);
  675. void laDetachedTrySet(char* prop_identifier,void* NewInstance);
  676. int laIsPropertyReadOnly(laPropPack *pp);
  677. int laGetPrefixP(laPropPack *p, char buf[8][64]);
  678. int laGetPrefix(laProp *p, char buf[8][64]);
  679. laPropContainer* laGetInstanceType(laPropPack* pp, void* instance);
  680. laUiDefineFunc laGetPropertyUiDefine(laPropPack* pp, void* instance);
  681. int laSetInt(laPropPack *pp, int n);
  682. int laGetInt(laPropPack *pp);
  683. int laSetFloat(laPropPack *pp, real n);
  684. real laGetFloat(laPropPack *pp);
  685. int laGetArrayLength(laPropPack *pp);
  686. int laSetIntArraySingle(laPropPack *pp, int index, int n);
  687. int laSetIntArrayAll(laPropPack *pp, int n);
  688. int laSetIntArrayAllArray(laPropPack *pp, int *arr);
  689. int laGetIntArray(laPropPack *pp, int *result);
  690. int laSetFloatArraySingle(laPropPack *pp, int index, real n);
  691. int laSetFloatArrayAll(laPropPack *pp, real n);
  692. int laSetFloatArrayAllArray(laPropPack *pp, real *arr);
  693. int laGetFloatArray(laPropPack *pp, real *result);
  694. laEnumItem *laGetEnum(laPropPack *pp);
  695. int laGetEnumEntryLen(laPropPack *pp);
  696. laEnumItem *laGetEnumArrayIndexed(laPropPack *pp, int index);
  697. int laGetEnumArray(laPropPack *pp, laEnumItem **result);
  698. laEnumItem *laGetEnumFromIdentifier(laEnumProp *p, char *Identifier);
  699. int laEnumHasIcon(laPropPack *pp);
  700. int laSetEnumExternal(laPropPack *pp, int n);
  701. int laSetEnum(laPropPack *pp, int n);
  702. int laSetEnumArrayIndexedExternal(laPropPack *pp, int index, int n);
  703. int laSetEnumArrayIndexed(laPropPack *pp, int index, int n);
  704. int laSetEnumArrayAllArray(laPropPack* pp, laEnumItem** ei);
  705. int laSetEnumArrayAll(laPropPack* pp, int EnumN);
  706. int laSetString(laPropPack *pp, char *str);
  707. int laGetString(laPropPack *pp, char *result, char** direct_result);
  708. int laActuateProp(laPropPack *This, laPropPack *RunPP, laOperator *OptionalFrom, laEvent *e);
  709. int laGetIntRange(laPropPack *pp, int *min, int *max);
  710. int laGetFloatRange(laPropPack *pp, real *min, real *max);
  711. void* laGetRaw(laPropPack *pp, int* r_size, int* return_is_a_copy);
  712. int laSetRaw(laPropPack *pp, void* data, int _size);
  713. int laTryGetInstanceIdentifier(void* Instance, laPropContainer* pc, char* identifier, char** here);
  714. void laMarkPropChanged(laPropPack* pp);
  715. void laMarkMemChanged(void* memuser);
  716. void laMarkMemClean(void* memuser);
  717. void *la_FindMatchingInstance(void *From, laProp *Sub, laProp *p, laPropStep *Value);
  718. void la_FreePropStepCache(laPropStep *GoTarget);
  719. void la_StepPropPack(laPropPack *pp);
  720. void la_GetPropPackFullPath(laPropPack *pp, char *result);
  721. void la_GetPropPackPath(laPropPack *pp, char *result);
  722. laItemUserLinker *laUseDataBlock(void* HyperUserMem, laProp *Which, unsigned int FrameDistinguish, void *User, laUserRemoveFunc Remover, int ForceRecalc);
  723. void laStopUsingDataBlock(void* HyperUserMem, laProp *prop, laPanel *p);
  724. void laDataBlockNoLongerExists(void *HyperUserMem, laListHandle* UserList);
  725. void la_PrintUserList(void* HyperUserMem);
  726. void laThrowToTrashBin(void* Data, char *ContainerString);
  727. void la_FreeProperty(laProp* p);
  728. void la_FreePropertyContainer(laPropContainer* pc);
  729. laSaverDummy* laGetSaverDummy(void* instance, laSubProp* p);
  730. void laPurgeSaverDummy(void* instance, laSubProp* p);
  731. laPropContainer *laAddPropertyContainer(const char *Identifier, const char *Name, const char *Description, uint32_t IconID, laUiDefineFunc DefaultUiDefine,
  732. int NodeSize, laContainerPostReadFunc PostRead, laContainerPostReadFunc PostReadIm, int IsHyper);
  733. laProp* laPropContainerManageable(laPropContainer* pc, int offset_of_dummy_list);
  734. void laPropContainerExtraFunctions(laPropContainer* pc, laContainerBeforeFreeF BeforeFree, laContainerResetF Reset, laContainerUndoTouchedF Touched, laContainerpUDFPropagateF UDFPropagate, laUiDefineFunc MenuUi);
  735. void laContainerAnimationFunctions(laPropContainer* pc, laActionHolderVerifyF ActionHolderVerify);
  736. const char *la_GetPropertyTypeString(int Type);
  737. NEED_STRUCTURE(laWidget);
  738. laProp *la_CreateProperty(laPropContainer *Container, int Type, const char *Identifier, const char *Name, const char *Description,
  739. const char *Prefix, const char *Unit, laWidget* DefaultWidget, u64bit Tag);
  740. void la_ClearDetachedProp(laPanel* p);
  741. laProp *la_MakeDetachedProp(laPanel* p, const char *From, const char *Rename);
  742. laProp *laAddIntProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, laWidget* DefaultWidget,
  743. const char *Prefix, const char *Unit, int Max, int Min, int Step, int DefVal, const int *DefArr,
  744. int OffsetSize, laIntGetF Get, laIntSetF Set, int ArrayLength, laArrayGetLenF GetLen,
  745. laIntArraySetF SetArr, laIntArrayGetAllF GetAll, laIntArraySetAllF SetAll, laIntArraySetAllArrayF SetAllArr,
  746. laIntReadF Read, laIntArrayReadAllF ReadAll,
  747. u64bit Tag);
  748. laProp *laAddFloatProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, laWidget* DefaultWidget,
  749. const char *Prefix, const char *Unit, real Max, real Min, real Step, real DefVal, const real *DefArr,
  750. int OffsetSize, laFloatGetF Get, laFloatSetF Set, int ArrayLength, laArrayGetLenF GetLen,
  751. laFloatArraySetF SetArr, laFloatArrayGetAllF GetAll, laFloatArraySetAllF SetAll, laFloatArraySetAllArrayF SetAllArr,
  752. laFloatReadF Read, laFloatArrayReadAllF ReadAll,
  753. u64bit Tag);
  754. laProp *laAddEnumProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, laWidget* DefaultWidget,
  755. const char *Prefix, const char *Unit, int DefVal, const int *DefArr,
  756. int OffsetSize, laEnumGetF Get, laEnumSetF Set, int ArrayLength, laArrayGetLenF GetLen,
  757. laEnumArraySetF SetArr, laEnumArrayGetAllF GetAll, laEnumArraySetAllF SetAll,
  758. laEnumReadF Read, laEnumArrayReadAllF ReadAll,
  759. u64bit Tag);
  760. int laAddEnumItem(laProp *p, const char *Identifier, const char *Name, const char *Description, uint32_t IconID);
  761. int laAddEnumItemAs(laProp *p, const char *Identifier, const char *Name, const char *Description, int Index, uint32_t IconID);
  762. laProp *laAddStringProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, laWidget* DefaultWidget,
  763. const char *Prefix, const char *Unit, const char *DefStr,
  764. int IsSafeString, int OffsetSize, laStringGetLenF GetLen, laStringGetF Get, laStringSetF Set,
  765. laStringReadF Read,
  766. u64bit Tag);
  767. laProp *laAddSubGroup(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description,
  768. const char *TargetId, laGetNodeTypeFunc GetType, laWidget* DefaultWidget, laUiDefineFunc DefaultUiDef,
  769. int OffsetSize, laSubGetInstanceF Get, laSubGetInstanceF GetActive, laSubGetNextF GetNext, laSubSetInstanceF Set,
  770. laSubGetStateF GetState, laSubSetStateF SetState, int ListHandleOffset, u64bit Tag);
  771. void laSubGroupExtraFunctions(laProp* p, laSubUIFilterF* UiFilter, laSubSaveFilterF* SaveFilter, laSubUIThemeF* GetTheme, laSubUIGapF GetGap, laSubUICategoryF GetCategory);
  772. void laSubGroupDetachable(laProp *SubProp, laSubTypeDetachedGet DetachedGet, laSubTypeDetachedGetNext DetachedGetNext);
  773. laProp *laAddOperatorProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description,
  774. const char *OperatorID, uint32_t IconID, laWidget* DefaultWidget);
  775. laProp *laAddRawProperty(laPropContainer *Container, const char *Identifier, const char *Name, const char *Description, int OffsetSize, laRawGetSizeF GetSize, laRawGetF RawGet, laRawSetF RawSet, u64bit Tag);
  776. //void laPropertySignal(laProp* p, int Throw, int Catch);
  777. NEED_STRUCTURE(laBoxedTheme);
  778. void *laGetInstance(laProp *sub, void *ThisInstance, laPropIterator *pi);
  779. void *laGetNextInstance(laProp *sub, void *FromInstance, laPropIterator *pi);
  780. void *laGetActiveInstanceStrict(laProp *sub, void *FromInstance);
  781. void *laGetActiveInstance(laProp *sub, void *FromInstance, laPropIterator *pi);
  782. void laSetActiveInstance(laProp *sub, void *FromInstance, void *Instance);
  783. void laAppendInstance(laSubProp *sub, void *FromInstance, void *Instance);
  784. int laGetUiState(laProp *sub, void *Instance);
  785. laBoxedTheme* laGetUiTheme(laProp *sub, void* parent, void *Instance);
  786. int laGetUiGap(laProp *sub, void* parent, void *Instance);
  787. void laGetCategory(laProp *sub, void* parent, void *Instance, char* buf, char** buf_ptr);
  788. int laCanGetState(laProp *sub);
  789. int laCanGetTheme(laProp *sub);
  790. int laCanGetGap(laProp *sub);
  791. int laCanGetCategory(laProp *sub);
  792. int laSetState(laProp *sub, void *FromInstance, void *Instance, int State);
  793. laPropContainer *la_SetGeneralRoot(laPropContainer **GeneralRoot, const char *Identifier, const char *Name, const char *Description);
  794. int la_GetPropFromPath(laPropPack *Self, laPropPack *Base, const char *Path, void **SpecifiedInstance);
  795. laProp *la_GetGeneralPropFromPath(laProp *General, const char *Path);
  796. int laValidateProperties();
  797. void laSetRootInstance(void *root);
  798. void la_RegisterMainUiTypes();
  799. void la_RegisterMainThemes();
  800. void la_RegisterInternalProps();
  801. void la_PrintPropStructure();
  802. laProp *la_GetGeneralProp(laProp *p);
  803. void* laget_InstanceActiveUDF(void* instance);
  804. void laset_InstanceUDF(void* instance, void* set);
  805. void la_UDFAppendSharedTypePointer(char *ID, void *Pointer);
  806. void la_AppendLinkedFile(laUDF *File);
  807. void la_GetWorkingDirectoryInternal();
  808. int laGetRelativeDirectory(char *FullFrom, char *FullTo, char *Result);
  809. void laGetUDFRelativeDirectory(laUDF *From, laUDF *To, char *Result);
  810. void laGetFullPath(char *FullFrom, char *Relative, char *Result);
  811. laUDF *laPrepareUDF(char *FileName);
  812. int laWriteProp(laUDF *udf, char *Path);
  813. int laWritePropP(laUDF *udf, laPropPack *pp);
  814. int laPackUDF(laUDF *udf, int UseInstanceList, int DoBackup);
  815. void laSaveProp(char* path);
  816. void laClearSaveProp();
  817. int laRegisterModifications(int ReturnIfAnyMod, int ReturnIfAnyEmpty, int* rempty, int RegisterToUDF);
  818. laUDF *laOpenUDF(char *FileName, int ReadToMemory, laUDFRegistry* ReadRegistryRef, laManagedUDF** UseManaged);
  819. void laCloseUDF(laUDF *udf);
  820. int laExtractUDF(laUDF *udf, laManagedUDF* mUDF, int Mode, laListHandle *Parent);
  821. int laLoadHyperResources(char* uid_search);
  822. laUDFOwnHyperItem* laFindHyperItem(laPropContainer* pc, char* uid);
  823. laUDFRegistry* laFindUDFRegistry(char* Path);
  824. laUDFRegistry* laCreateUDFRegistry(char* Path);
  825. void laClearUDFRegistries();
  826. void laRefreshUDFRegistries();
  827. laManagedUDF* la_FindManagedUDF(char* FileName);
  828. laManagedUDF* la_EnsureManagedUDF(char* FileName, int PutAtTop);
  829. void la_MakeDummyManagedUDF();
  830. void laStopManageUDF(laManagedUDF* m);
  831. void laClearManagedUDF();
  832. void laSaveManagedUDF();
  833. void laPropagateUDF(laPropContainer* pc, void* inst, int force);
  834. //================== manifest
  835. void laAddResourceFolder(char* Path);
  836. void laRemoveResourceFolder(laResourceFolder* rf);
  837. void la_ClearUDFRegistryAndFolders();
  838. //================== undo
  839. void laFreeOlderDifferences(int KeepHowMany);
  840. void laFreeNewerDifferences();
  841. void laPrintDBInstInfo();
  842. void la_NoLongerRecordUndo();
  843. void laAddRootDBInst(char* path);
  844. void laPushDifferences(char* Description, u64bit hint);
  845. void laRecordCustomDifferences(void* Data, laDiffCommandUndoF Undo, laDiffCommandRedoF Redo, laDiffCommandFreeF Free);
  846. int laRecordDifferences(laPropPack* base, char* path);
  847. int laRecordInstanceDifferences(void* instance, const char* container);
  848. void laRecordAndPush(laPropPack* base, char* path, char* description, uint64_t hint);
  849. void laRecordAndPushProp(laPropPack* base, char* path);
  850. void laRecordEverythingAndPush();
  851. void laSetDiffCallback(laDiffPushEverythingF PushEverything);
  852. void laUndo();
  853. void laRedo();
  854. //======================= animation
  855. #define LA_ANIMATION_STATUS_PAUSED 0
  856. #define LA_ANIMATION_STATUS_PLAY_FWD 1
  857. #define LA_ANIMATION_STATUS_PLAY_REV 2
  858. laAction* laAnimiationNewAction(laActionHolder* ah, char* Name);
  859. laActionChannel* laAnimationEnsureChannel(laAction* aa, void* hyper1, laProp* p);
  860. laActionChannel* laAnimationEnsureFrame(laActionChannel* ac, int frame);
  861. void laAnimationStoreKeyValue(laActionChannel* ac, laActionKey* ak);
  862. laActionKey* laAnimationInsertKeyFrame(laAction* aa, void* hyper1, laProp* p, int* error);
  863. void laAnimationSetPlayStatus(int PlayStatus);
  864. void laAnimationSetPlayHead(real time);
  865. void la_AnimationPreFrame();
  866. void la_AnimationPostFrame();
  867. int laAnimationRegisterHolderPath(const char* Path);