*/}}

la_resource.c 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. #include "la_5.h"
  2. extern LA MAIN;
  3. extern struct _tnsMain *T;
  4. laUiType *_LA_UI_FIXED_GROUP;
  5. laUiType *_LA_UI_TAB;
  6. laUiType _LA_UI_CONDITION; //NO PTR
  7. laUiType _LA_UI_CONDITION_END; //NO PTR
  8. laUiType _LA_UI_CONDITION_ELSE; //NO PTR
  9. laUiType _LA_UI_ROW_BEGIN; //NO PTR
  10. laUiType _LA_UI_ROW_END; //NO PTR
  11. laUiType *_LA_UI_COLLECTION;
  12. laUiType *_LA_UI_COLLECTION_ITEM;
  13. laUiType *_LA_UI_COLLECTION_SELECTOR;
  14. laUiType *_LA_UI_COLLECTION_SINGLE;
  15. laUiType *_LA_UI_BUTTON;
  16. laUiType *_LA_UI_LABEL;
  17. laUiType *_LA_UI_INT;
  18. laUiType *_LA_UI_VALUE_METER;
  19. laUiType *_LA_UI_VALUE_METER_2D;
  20. laUiType *_LA_UI_FLOAT;
  21. laUiType *_LA_UI_FLOAT_COLOR;
  22. laUiType *_LA_UI_FLOAT_COLOR_HCY;
  23. laUiType *_LA_UI_ENUM_SELECTOR;
  24. laUiType *_LA_UI_MENU_ROOT;
  25. laUiType *_LA_UI_CONDITION_TOGGLE;
  26. laUiType *_LA_UI_STRING;
  27. laUiType *_LA_UI_STRING_MULTI;
  28. laUiType *_LA_UI_ALIGN;
  29. laUiType *_LA_UI_CANVAS;
  30. laUiType *_LA_UI_COLUMN_ADJUSTER;
  31. laUiType *_LA_UI_SYMBOL;
  32. laUiType *_LA_UI_COLUMN_VIEWER;
  33. laUiType *_LA_UI_NODE_SOCKET;
  34. laUiType *_LA_UI_HEIGHT_ADJUSTER;
  35. laUiType *_LA_UI_RAW;
  36. laUiDefineFunc _LA_SUBPROP_DONT_CARE;
  37. laBoxedTheme *_LA_THEME_PANEL;
  38. laBoxedTheme *_LA_THEME_VALUATOR;
  39. laBoxedTheme *_LA_THEME_BUTTON;
  40. laBoxedTheme *_LA_THEME_STRING;
  41. laBoxedTheme *_LA_THEME_SELECTOR;
  42. laBoxedTheme *_LA_THEME_COLLECTION_SELECTOR;
  43. laBoxedTheme *_LA_THEME_LABEL;
  44. laBoxedTheme *_LA_THEME_TAB;
  45. laBoxedTheme *_LA_THEME_COLLECTION_GROUP;
  46. laBoxedTheme *_LA_THEME_COLLECTION_ITEM;
  47. laBoxedTheme *_LA_THEME_FLOATING_PANEL;
  48. laBoxedTheme *_LA_THEME_3D_VIEW;
  49. laBoxedTheme *_LA_THEME_2D_VIEW;
  50. laBoxedTheme *_LA_THEME_SOCKET;
  51. laProp *_LA_PROP_PANEL;
  52. laProp *_LA_PROP_BLOCK;
  53. laProp *_LA_PROP_WINDOW;
  54. laProp *_LA_PROP_UI_ITEM;
  55. laProp *_LA_PROP_FAILED_ITEM;
  56. laProp *_LA_PROP_TRASH_ITEM;
  57. laProp *_LA_PROP_NODE_GRAPH;
  58. laPropContainer *_LA_PROP_3D_EXTRA;
  59. laPropContainer *_LA_PROP_2D_EXTRA;
  60. laPropContainer *_LA_PROP_FILE_BROWSER;
  61. laProp _P_LA_USE_INSTANCE_ONLY;
  62. void la_RegisterMainOperators(){
  63. la_RegisterUiOperatorsBasic();
  64. la_RegisterViewerOperators();
  65. la_RegisterBuiltinOperators();
  66. }
  67. void la_RegisterMainUiTypes(){
  68. la_RegisterUiTypesBasic();
  69. la_RegisterUiTypesViewerWidgets();
  70. }
  71. void la_RegisterWindowKeys(){
  72. laKeyMapper* km=&MAIN.KeyMap;
  73. laAssignNewKey(km, 0, "LA_udf_read", 0, LA_KEY_CTRL, LA_KEY_DOWN, 'o', 0);
  74. laAssignNewKey(km, 0, "LA_managed_save", 0, LA_KEY_CTRL, LA_KEY_DOWN, 's', "quiet=true;");
  75. laAssignNewKey(km, 0, "LA_managed_save", 0, LA_KEY_CTRL|LA_KEY_SHIFT, LA_KEY_DOWN, 's', 0);
  76. laAssignNewKey(km, 0, "LA_manage_udf", 0, LA_KEY_SHIFT, LA_KEY_DOWN, 'r', 0);
  77. laAssignNewKey(km, 0, "LA_switch_layout", 0, LA_KEY_CTRL, LA_KEY_DOWN, LA_KEY_ARRLEFT, "reverse=true;");
  78. laAssignNewKey(km, 0, "LA_switch_layout", 0, LA_KEY_CTRL, LA_KEY_DOWN, LA_KEY_ARRRIGHT, 0);
  79. laAssignNewKey(km, 0, "LA_system_paste", 0, LA_KEY_CTRL, LA_KEY_DOWN, 'v', 0);
  80. laAssignNewKey(km, 0, "LA_undo", 0, LA_KEY_CTRL, LA_KEY_DOWN, 'z', 0);
  81. laAssignNewKey(km, 0, "LA_redo", 0, LA_KEY_CTRL|LA_KEY_SHIFT, LA_KEY_DOWN, 'z', 0);
  82. }
  83. void la_RegisterMainThemes(){
  84. laBoxedTheme *bt;
  85. strSafeSet(&MAIN.example_string,
  86. "hello(){\n"
  87. " world!\n"
  88. " This is a LaGUI application 🤔\n"
  89. "}");
  90. la_UDFAppendSharedTypePointer("BT Panel", &_LA_THEME_PANEL);
  91. la_UDFAppendSharedTypePointer("BT Floating Panel", &_LA_THEME_FLOATING_PANEL);
  92. la_UDFAppendSharedTypePointer("BT Valuator", &_LA_THEME_VALUATOR);
  93. la_UDFAppendSharedTypePointer("BT Button", &_LA_THEME_BUTTON);
  94. la_UDFAppendSharedTypePointer("BT String", &_LA_THEME_STRING);
  95. la_UDFAppendSharedTypePointer("BT Selector", &_LA_THEME_SELECTOR);
  96. la_UDFAppendSharedTypePointer("BT Collection Selector", &_LA_THEME_COLLECTION_SELECTOR);
  97. la_UDFAppendSharedTypePointer("BT Label", &_LA_THEME_LABEL);
  98. la_UDFAppendSharedTypePointer("BT Tab", &_LA_THEME_TAB);
  99. la_UDFAppendSharedTypePointer("BT Collection Group", &_LA_THEME_COLLECTION_GROUP);
  100. la_UDFAppendSharedTypePointer("BT Collection Item", &_LA_THEME_COLLECTION_ITEM);
  101. la_UDFAppendSharedTypePointer("BT 3D Viewer", &_LA_THEME_3D_VIEW);
  102. la_UDFAppendSharedTypePointer("BT 2D Viewer", &_LA_THEME_2D_VIEW);
  103. la_UDFAppendSharedTypePointer("BT Socket", &_LA_THEME_SOCKET);
  104. laTheme *t;
  105. t = laDesignTheme("Classic Light", "YimingWu");{
  106. LA_SET3(t->Color, 0.58,0.58,0.55);
  107. LA_SET3(t->AccentColor, 0.1,0.1,0.4);
  108. t->InactiveMix=0.7; t->InactiveSaturation=0.2;
  109. t->CursorAlpha=0.9; t->SelectionAlpha=0.3;
  110. t->WireBrightness=0.5; t->WireSaturation=0.6; t->WireTransparency=0.65;
  111. t->EdgeBrightness=0.65; t->EdgeTransparency=0.8; t->VertexBrightness=0.65, t->VertexTransparency=0.9;
  112. t->SelectedFaceTransparency=0.6,t->SelectedEdgeTransparency=0.9, t->SelectedVertexTransparency=1.0;
  113. laDesignBoxedTheme(t, "Panel",&_LA_THEME_PANEL,
  114. 0.85, 0.5, 0.2, 0.15, 0.1, 0.9, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  115. laDesignBoxedTheme(t, "Floating Panel",&_LA_THEME_FLOATING_PANEL,
  116. 0.95, 0.8, 0.1, 0.15, 0.1, 0.9, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  117. laDesignBoxedTheme(t, "Valuator",&_LA_THEME_VALUATOR,
  118. 0.8, 0.5, 0.3, 0.2, 0.1, 0.9, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  119. laDesignBoxedTheme(t, "Button",&_LA_THEME_BUTTON,
  120. 0.97, 0.2, 0.3, 0.2, 0.9, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  121. laDesignBoxedTheme(t, "String",&_LA_THEME_STRING,
  122. 0.9, 0.95, 0.3, 0.2, 0.1, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  123. laDesignBoxedTheme(t, "Selector",&_LA_THEME_SELECTOR,
  124. 0.85, 0.7, 0.3, 0.2, 0.1, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  125. laDesignBoxedTheme(t, "Collection Selector",&_LA_THEME_COLLECTION_SELECTOR,
  126. 0.85, 0.7, 0.3, 0.2, 0.1, 0.95, -0.11, 1, -0.11, -0.11, 0.11, 0.11, 0.11, 0.11);
  127. laDesignBoxedTheme(t, "Label",&_LA_THEME_LABEL,
  128. 0.7, 0.8, 0.3, 0.1, 0.05, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  129. laDesignBoxedTheme(t, "Tab",&_LA_THEME_TAB,
  130. 0.9, 0.8, 0.2, 0.1, 0.7, 0.9, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  131. laDesignBoxedTheme(t, "Socket",&_LA_THEME_SOCKET,
  132. 0.97, 0.2, 0.3, 0.2, 0.9, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  133. laDesignBoxedTheme(t, "Collection Group",&_LA_THEME_COLLECTION_GROUP,
  134. 0.75, 0.65, 0.2, 0.1, 0.7, 0.3, 0.11, 0.11, 0, 0, 0.11, 0.11, 0.11, 0.11);
  135. laDesignBoxedTheme(t, "Collection Item",&_LA_THEME_COLLECTION_ITEM,
  136. 0.75, 0.65, 0.2, 0.1, 0.7, 0.3, 0.11, 0.11, 0, 0, 0.11, 0.11, 0.11, 0.11);
  137. laDesignBoxedTheme(t, "3D Viewer",&_LA_THEME_3D_VIEW,
  138. 0.75, 0.65, 0.2, 0.1, 0.7, 0.3, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  139. laDesignBoxedTheme(t, "2D Viewer",&_LA_THEME_2D_VIEW,
  140. 0.75, 0.65, 0.2, 0.1, 0.7, 0.3, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  141. la_RefreshThemeColor(t);
  142. }
  143. laTheme* t1=t;
  144. t = laDesignTheme("Classic Dark", "YimingWu");{
  145. LA_SET3(t->Color, 0.5,0.4,0.3);
  146. LA_SET3(t->AccentColor, 0.17,0.74,0.49);
  147. t->InactiveMix=0.7; t->InactiveSaturation=0.2;
  148. t->CursorAlpha=0.9; t->SelectionAlpha=0.3;
  149. t->WireBrightness=0.6; t->WireSaturation=0.7; t->WireTransparency=0.65;
  150. t->EdgeBrightness=0.05; t->EdgeTransparency=0.8; t->VertexBrightness=0.05, t->VertexTransparency=0.9;
  151. t->SelectedFaceTransparency=0.6,t->SelectedEdgeTransparency=0.9, t->SelectedVertexTransparency=1.0;
  152. bt = laDesignBoxedTheme(t, "Panel",&_LA_THEME_PANEL,
  153. 0.2, 0.2, 0.1, 0.8, 0.9, 0.8, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  154. memAssignRef(bt, &bt->Parent, t1);
  155. bt = laDesignBoxedTheme(t, "Floating Panel",&_LA_THEME_FLOATING_PANEL,
  156. 0.05, 0.05, 0.4, 0.8, 0.9, 0.8, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  157. memAssignRef(bt, &bt->Parent, t1);
  158. bt = laDesignBoxedTheme(t, "Valuator",&_LA_THEME_VALUATOR,
  159. 0.3, 0.1, 0.4, 0.8, 0.9, 0.9, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  160. memAssignRef(bt, &bt->Parent, t1);
  161. bt = laDesignBoxedTheme(t, "Button",&_LA_THEME_BUTTON,
  162. 0.1, 0.9, 0.3, 0.8, 0.1, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  163. bt = laDesignBoxedTheme(t, "String",&_LA_THEME_STRING,
  164. 0.1, 0.03, 0.3, 0.8, 0.9, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  165. bt = laDesignBoxedTheme(t, "Selector",&_LA_THEME_SELECTOR,
  166. 0.15, 0.7, 0.3, 0.8, 0.2, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  167. bt = laDesignBoxedTheme(t, "Collection Selector",&_LA_THEME_COLLECTION_SELECTOR,
  168. 0.15, 0.1, 0.3, 0.8, 0.9, 0.95, -0.11, 1, -0.11, -0.11, 0.11, 0.11, 0.11, 0.11);
  169. bt = laDesignBoxedTheme(t, "Label",&_LA_THEME_LABEL,
  170. 0.15, 0.1, 0.3, 0.8, 0.9, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  171. bt = laDesignBoxedTheme(t, "Tab",&_LA_THEME_TAB,
  172. 0.2, 0.3, 0.8, 0.7, 0.1, 0.9, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  173. bt = laDesignBoxedTheme(t, "Socket",&_LA_THEME_SOCKET,
  174. 0.1, 0.65, 0.7, 0.8, 0.1, 0.95, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  175. bt = laDesignBoxedTheme(t, "Collection Group",&_LA_THEME_COLLECTION_GROUP,
  176. 0.25, 0.35, 0.8, 0.7, 0.1, 0.3, 0.11, 0.11, 0, 0, 0.11, 0.11, 0.11, 0.11);
  177. bt = laDesignBoxedTheme(t, "Collection Item",&_LA_THEME_COLLECTION_ITEM,
  178. 0.25, 0.35, 0.8, 0.7, 0.1, 0.3, 0.11, 0.11, 0, 0, 0.11, 0.11, 0.11, 0.11);
  179. bt = laDesignBoxedTheme(t, "3D Viewer",&_LA_THEME_3D_VIEW,
  180. 0.25, 0.35, 0.8, 0.7, 0.1, 0.3, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  181. bt = laDesignBoxedTheme(t, "2D Viewer",&_LA_THEME_2D_VIEW,
  182. 0.25, 0.35, 0.8, 0.7, 0.1, 0.3, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11);
  183. la_RefreshThemeColor(t);
  184. }
  185. }