*/}}

la_data.h 34 KB

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