*/}}

la_data.h 32 KB

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