*/}}
1
0

la_data.h 32 KB

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