*/}}

la_data.h 32 KB

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