*/}}

la_data.h 30 KB

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