*/}}

la_data.h 34 KB

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