|
@@ -470,6 +470,8 @@ int laGetReady(){
|
|
|
}
|
|
|
|
|
|
void laShutoff(){
|
|
|
+ if(MAIN.Cleanup) MAIN.Cleanup();
|
|
|
+
|
|
|
strSafeDestroy(&MAIN.WorkingDirectory);
|
|
|
strSafeDestroy(&MAIN.example_string);
|
|
|
|
|
@@ -743,6 +745,9 @@ void laRetriggerOperators(){
|
|
|
void laSetFrameCallbacks(laPreFrameF PreFrame, laPreDrawF PreDraw, laPostFrameF PostFrame){
|
|
|
MAIN.PreFrame=PreFrame; MAIN.PreDraw=PreDraw; MAIN.PostFrame=PostFrame;
|
|
|
}
|
|
|
+void laSetCleanupCallback(laCleanupF Cleanup){
|
|
|
+ MAIN.Cleanup=Cleanup;
|
|
|
+}
|
|
|
|
|
|
//====================================================================================================
|
|
|
|
|
@@ -3019,7 +3024,7 @@ laUiItem *la_UpdatePropDisplay(laUiItem *ui, laPropPack *Base, const char *Path,
|
|
|
|
|
|
if (!result){
|
|
|
ui->AT = laGetOperatorType(Path);
|
|
|
- if (!ui->AT /* && !OverrideType*/) return la_UpdatePropDisplay(ui, 0, "la.example_int", 0, 0, instructions);
|
|
|
+ if (!ui->AT /* && !OverrideType*/) return la_UpdatePropDisplay(ui, 0, "la.unknown_prop", 0, 0, instructions);
|
|
|
ui->Type = la_GetUiButtonType();
|
|
|
if (OverrideType && (OverrideType->ForType == LA_PROP_OPERATOR)) ui->Type = OverrideType;
|
|
|
}else{
|
|
@@ -4321,7 +4326,7 @@ int la_UpdateUiListRecursive(laUiList *uil, int U, int L, int R, int B, int Fast
|
|
|
int MaxB = ElementB;
|
|
|
int CanGetTheme = laCanGetTheme(ui->PP.LastPs->p);laTheme* OriginalTheme=MAIN.CurrentTheme;
|
|
|
int CanGetGap= laCanGetGap(ui->PP.LastPs->p); int Gap=0;
|
|
|
- int CanGetCategory= laCanGetCategory(ui->PP.LastPs->p); char _cat[256]; char* cat=_cat; int GotCategory=0;
|
|
|
+ int CanGetCategory= laCanGetCategory(ui->PP.LastPs->p); char _cat[256]; char* cat=_cat; int GotCategory=0,FirstIn=1;
|
|
|
|
|
|
if (!ElementLimit) RowPriority = 0;
|
|
|
|
|
@@ -4350,11 +4355,12 @@ int la_UpdateUiListRecursive(laUiList *uil, int U, int L, int R, int B, int Fast
|
|
|
laGetCategory(ui->PP.LastPs->p, ui->PP.LastPs->UseInstance, ui->PP.EndInstance, _cat, &cat); if(cat[0]) GotCategory=1;
|
|
|
}else GotCategory=0;
|
|
|
|
|
|
- if(GotCategory){ Begin+=LA_RH*1.5+bt->TM;
|
|
|
+ if(GotCategory){ Begin+=LA_RH*(FirstIn?1:1.5)+bt->TM;
|
|
|
if (RowPriority){
|
|
|
- Row += 1; Col=0; Begin = ElementB+bt->TM+LA_RH*1.5+bt->TM;
|
|
|
+ Row += 1; Col=0; Begin = ElementB+bt->TM+LA_RH*(FirstIn?1:1.5)+bt->TM;
|
|
|
}
|
|
|
}
|
|
|
+ FirstIn=0;
|
|
|
|
|
|
if (ElementLimit){
|
|
|
EL = tnsInterpolate(ui->TL, ui->TR, (Col)*ElementWidth);
|
|
@@ -4972,7 +4978,10 @@ int la_DrawUiListRecursive(laUiListDraw *uild, laUiList *uil, int L, int R, int
|
|
|
}
|
|
|
|
|
|
if(sub->TabName && sub->TabName->Ptr){
|
|
|
- tnsDrawStringAuto(sub->TabName->Ptr,laThemeColor(bt,LA_BT_DISABLED|LA_BT_TEXT),ui->L+bt->LM+bt->LP,ui->R,sub->U-LA_RH,LA_TEXT_MONO);
|
|
|
+ int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
|
|
|
+ int NoGap=ui->Flags&LA_UI_FLAGS_NO_GAP;
|
|
|
+ tnsDrawStringAuto(sub->TabName->Ptr,laThemeColor(bt,LA_BT_DISABLED|LA_BT_TEXT),
|
|
|
+ ui->L+(NoDecal?0:bt->LM)+(NoGap?0:bt->LP),ui->R,sub->U-LA_RH,LA_TEXT_MONO);
|
|
|
tnsFlush();
|
|
|
}
|
|
|
|
|
@@ -5608,7 +5617,7 @@ void *la_DestroyOperator(laOperator **a, laListHandle *Operators, int OnlyThisOn
|
|
|
MAIN.CurrentPanel = (*a)->OperatorPanel;
|
|
|
laDestroySinglePanel((*a)->OperatorPanel,0);
|
|
|
}
|
|
|
- if ((*a)->CreatedThis) FreeMem((*a)->CreatedThis);
|
|
|
+ if ((*a)->CreatedThis) memFree((*a)->CreatedThis);
|
|
|
|
|
|
if ((*a)->ExtraInstructionsP) strDestroyStringSplitor(&(*a)->ExtraInstructionsP);
|
|
|
|
|
@@ -5667,85 +5676,11 @@ int laOperatorAvailableSafe(char *ID, laPropPack *This, void *Real_FromInstance,
|
|
|
return laOperatorAvailablePSafe(at, This, Real_FromInstance, Instructions);
|
|
|
}
|
|
|
|
|
|
-int laInvokeUi(laOperator *From, char *ID, laEvent *e, void *inst, laListHandle *Locals, int IgnoreLocals){
|
|
|
- laOperatorType *at;
|
|
|
- laOperator *a, *f = From;
|
|
|
-
|
|
|
- int rev;
|
|
|
-
|
|
|
- if (la_UiOperatorExists(inst)) return -1;
|
|
|
-
|
|
|
- at = hsh256FindItemSTR(&MAIN.OperatorTypeHash, la_OperatorTypeByID, ID);
|
|
|
- if (!at) return -1;
|
|
|
-
|
|
|
- a = la_CreateOperator(at);
|
|
|
- a->Instance = inst;
|
|
|
- a->ToPanel = MAIN.ToPanel;
|
|
|
- if (!IgnoreLocals) lstGeneratePointerList(f ? &f->LocalUiLists : 0, Locals, &a->LocalUiLists);
|
|
|
-
|
|
|
- if (From) f->Child = a;
|
|
|
-
|
|
|
- a->Using = 1;
|
|
|
-
|
|
|
- if (at->Init) at->Init(a);
|
|
|
- rev = at->Invoke(a, e);
|
|
|
-
|
|
|
- a->Using = 0;
|
|
|
-
|
|
|
- if (rev & LA_FINISH){
|
|
|
- a->StopNow = 1; if(From)From->Child=0;
|
|
|
- }
|
|
|
- if (rev & LA_BLOCK){
|
|
|
- lstAppendItem(&MAIN.CurrentWindow->PendingOperators, a);
|
|
|
- a->State = rev;
|
|
|
- }else la_DestroyOperator(&a, 0, 0);
|
|
|
-
|
|
|
- return rev;
|
|
|
-}
|
|
|
-int laInvokeUiP(laOperator *From, laOperatorType *at, laEvent *e, void *inst, laListHandle *Locals, int IgnoreLocals){
|
|
|
- laOperator *a, *f = From;
|
|
|
- int rev;
|
|
|
-
|
|
|
- if (!at || (la_UiOperatorExists(inst))){
|
|
|
- return -1;
|
|
|
- }
|
|
|
- a = la_CreateOperator(at);
|
|
|
- a->Instance = inst;
|
|
|
- a->ToPanel = MAIN.ToPanel;
|
|
|
- if (!IgnoreLocals) lstGeneratePointerList(f ? &f->LocalUiLists : 0, Locals, &a->LocalUiLists);
|
|
|
-
|
|
|
- if (From) f->Child = a;
|
|
|
-
|
|
|
- a->Using = 1;
|
|
|
-
|
|
|
- if (at->Init) at->Init(a);
|
|
|
- rev = at->Invoke(a, e);
|
|
|
-
|
|
|
- a->Using = 0;
|
|
|
-
|
|
|
- if (rev & LA_FINISH){
|
|
|
- a->StopNow = 1; if(From)From->Child=0;
|
|
|
- }
|
|
|
- if (rev & LA_BLOCK){
|
|
|
- lstAppendItem(&MAIN.CurrentWindow->PendingOperators, a);
|
|
|
- a->State = rev;
|
|
|
- }else
|
|
|
- la_DestroyOperator(&a, 0, 0);
|
|
|
-
|
|
|
- DEB = a;
|
|
|
-
|
|
|
- return rev;
|
|
|
-}
|
|
|
-
|
|
|
-int laInvoke(laOperator *From, char *ID, laEvent *e, laPropPack *This, char *args, char *args2){
|
|
|
- laOperatorType *at;
|
|
|
+int laInvokeP(laOperator *From, laOperatorType *at, laEvent *e, laPropPack *This, char *args, char *args2){
|
|
|
laOperator *a, *f = From;
|
|
|
int rev;
|
|
|
|
|
|
- at = hsh256FindItemSTR(&MAIN.OperatorTypeHash, la_OperatorTypeByID, ID);
|
|
|
- if (!at) return -1;
|
|
|
-
|
|
|
- if (!f && e && e->Localized) return -1;
|
|
|
+ if (!f && e&&e->Localized) return -1;
|
|
|
|
|
|
a = la_CreateOperator(at);
|
|
|
a->ToPanel = MAIN.ToPanel;
|
|
@@ -5760,14 +5695,21 @@ int laInvoke(laOperator *From, char *ID, laEvent *e, laPropPack *This, char *arg
|
|
|
return LA_CANCELED;
|
|
|
}
|
|
|
|
|
|
- if (e&&(!e->Localized) && (at->ExtraMark & LA_EXTRA_TO_PANEL)){
|
|
|
+ lstGeneratePointerList(f ? &f->LocalUiLists : 0, 0, &a->LocalUiLists);
|
|
|
+
|
|
|
+ if (e&&!e->Localized && at->ExtraMark & LA_EXTRA_TO_PANEL){
|
|
|
laWindowToLocal(0, a->ToPanel, &e->x, &e->y);
|
|
|
e->Localized = 1;
|
|
|
}
|
|
|
|
|
|
- if (e&&e->Localized && (!at->ExtraMark & LA_EXTRA_TO_PANEL)){
|
|
|
- laLocalToWindow(0, a->ToPanel, &e->x, &e->y);
|
|
|
- e->Localized = 0;
|
|
|
+ if (e&&e->Localized){
|
|
|
+ if (!at->ExtraMark & LA_EXTRA_TO_PANEL){
|
|
|
+ laLocalToWindow(f, f->ToPanel, &e->x, &e->y);
|
|
|
+ e->Localized = 0;
|
|
|
+ }else{
|
|
|
+ laLocalToWindow(f, f->ToPanel, &e->x, &e->y);
|
|
|
+ laWindowToLocal(a, a->ToPanel, &e->x, &e->y);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (From) f->Child = a;
|
|
@@ -5780,30 +5722,35 @@ int laInvoke(laOperator *From, char *ID, laEvent *e, laPropPack *This, char *arg
|
|
|
a->Using = 0;
|
|
|
|
|
|
if (rev & LA_FINISH){
|
|
|
- a->StopNow = 1; if(From)From->Child=0;
|
|
|
+ a->StopNow = 1; if(From)From->Child=0;
|
|
|
}
|
|
|
|
|
|
if (!a->StopNow && (rev&LA_BLOCK || rev&LA_PASS_ON)){
|
|
|
lstAppendItem(&MAIN.CurrentWindow->PendingOperators, a);
|
|
|
a->State = rev;
|
|
|
a->PP.EndInstance = a->CustomData;
|
|
|
+ if (a->PP.LastPs) a->PP.LastPs->Type = L'.';
|
|
|
}else
|
|
|
la_DestroyOperator(&a, 0, 0);
|
|
|
|
|
|
return rev;
|
|
|
}
|
|
|
-int laInvokeCreateThis(laOperator *From, char *ID, laEvent *e, laPropPack *OrigionalThis, void *FromInstance, char *args, char *args2){
|
|
|
- laOperatorType *at;
|
|
|
- laOperator *a, *f = From;
|
|
|
- int rev;
|
|
|
- laPropPack *created;
|
|
|
+int laInvoke(laOperator *From, char *ID, laEvent *e, laPropPack *This, char *args, char *args2){
|
|
|
+ laOperatorType *at; laOperator *a, *f = From;
|
|
|
|
|
|
at = hsh256FindItemSTR(&MAIN.OperatorTypeHash, la_OperatorTypeByID, ID);
|
|
|
if (!at) return -1;
|
|
|
|
|
|
- if (!f && (e && e->Localized) || !OrigionalThis || !OrigionalThis->LastPs) return -1;
|
|
|
+ return laInvokeP(From,at,e,This,args,args2);
|
|
|
+}
|
|
|
+int laInvokePCreateThis(laOperator *From, laOperatorType *at, laEvent *e, laPropPack *OrigionalThis, void *FromInstance, char *args, char *args2){
|
|
|
+ laOperator *a, *f = From;
|
|
|
+ int rev;
|
|
|
+ laPropPack *created;
|
|
|
+
|
|
|
+ if (!f && e&&e->Localized || !OrigionalThis || !OrigionalThis->LastPs) return -1;
|
|
|
|
|
|
- created = CreateNew(laPropPack);
|
|
|
+ created = memAcquireSimple(sizeof(laPropPack));
|
|
|
created->LastPs = memAcquireSimple(sizeof(laPropStep));
|
|
|
created->Go = created->LastPs;
|
|
|
created->LastPs->p = OrigionalThis->LastPs->p;
|
|
@@ -5851,41 +5798,15 @@ int laInvokeCreateThis(laOperator *From, char *ID, laEvent *e, laPropPack *Origi
|
|
|
|
|
|
return rev;
|
|
|
}
|
|
|
-int laInvokeP(laOperator *From, laOperatorType *at, laEvent *e, laPropPack *This, char *args, char *args2){
|
|
|
+int laInvokeUiP(laOperator *From, laOperatorType *at, laEvent *e, void *inst, laListHandle *Locals, int IgnoreLocals){
|
|
|
laOperator *a, *f = From;
|
|
|
int rev;
|
|
|
|
|
|
- if (!f && e&&e->Localized) return -1;
|
|
|
-
|
|
|
+ if (!at || (la_UiOperatorExists(inst))){ return -1; }
|
|
|
a = la_CreateOperator(at);
|
|
|
+ a->Instance = inst;
|
|
|
a->ToPanel = MAIN.ToPanel;
|
|
|
- a->This = This;
|
|
|
- a->ExtraInstructions = args;
|
|
|
- strMakeInstructions(&a->ExtraInstructionsP, args);
|
|
|
- strMakeInstructions(&a->ExtraInstructionsP, args2);
|
|
|
- strMakeInstructions(&a->ExtraInstructionsP, at->ExtraInstructions);
|
|
|
-
|
|
|
- if (!laOperatorAvailableP(at, This, a->ExtraInstructionsP)){
|
|
|
- la_DestroyOperator(&a, 0, 0);
|
|
|
- return LA_CANCELED;
|
|
|
- }
|
|
|
-
|
|
|
- lstGeneratePointerList(f ? &f->LocalUiLists : 0, 0, &a->LocalUiLists);
|
|
|
-
|
|
|
- if (e&&!e->Localized && at->ExtraMark & LA_EXTRA_TO_PANEL){
|
|
|
- laWindowToLocal(0, a->ToPanel, &e->x, &e->y);
|
|
|
- e->Localized = 1;
|
|
|
- }
|
|
|
-
|
|
|
- if (e&&e->Localized){
|
|
|
- if (!at->ExtraMark & LA_EXTRA_TO_PANEL){
|
|
|
- laLocalToWindow(f, f->ToPanel, &e->x, &e->y);
|
|
|
- e->Localized = 0;
|
|
|
- }else{
|
|
|
- laLocalToWindow(f, f->ToPanel, &e->x, &e->y);
|
|
|
- laWindowToLocal(a, a->ToPanel, &e->x, &e->y);
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!IgnoreLocals) lstGeneratePointerList(f ? &f->LocalUiLists : 0, Locals, &a->LocalUiLists);
|
|
|
|
|
|
if (From) f->Child = a;
|
|
|
|
|
@@ -5897,74 +5818,27 @@ int laInvokeP(laOperator *From, laOperatorType *at, laEvent *e, laPropPack *This
|
|
|
a->Using = 0;
|
|
|
|
|
|
if (rev & LA_FINISH){
|
|
|
- a->StopNow = 1; if(From)From->Child=0;
|
|
|
+ a->StopNow = 1; if(From)From->Child=0;
|
|
|
}
|
|
|
-
|
|
|
- if (!a->StopNow && (rev&LA_BLOCK || rev&LA_PASS_ON)){
|
|
|
+ if (rev & LA_BLOCK){
|
|
|
lstAppendItem(&MAIN.CurrentWindow->PendingOperators, a);
|
|
|
a->State = rev;
|
|
|
- a->PP.EndInstance = a->CustomData;
|
|
|
- if (a->PP.LastPs) a->PP.LastPs->Type = L'.';
|
|
|
- }else
|
|
|
- la_DestroyOperator(&a, 0, 0);
|
|
|
+ }else la_DestroyOperator(&a, 0, 0);
|
|
|
+
|
|
|
+ DEB = a;
|
|
|
|
|
|
return rev;
|
|
|
}
|
|
|
-int laInvokePCreateThis(laOperator *From, laOperatorType *at, laEvent *e, laPropPack *OrigionalThis, void *FromInstance, char *args, char *args2){
|
|
|
+int laInvokeUi(laOperator *From, char *ID, laEvent *e, void *inst, laListHandle *Locals, int IgnoreLocals){
|
|
|
+ laOperatorType *at;
|
|
|
laOperator *a, *f = From;
|
|
|
- int rev;
|
|
|
- laPropPack *created;
|
|
|
-
|
|
|
- if (!f && e&&e->Localized || !OrigionalThis || !OrigionalThis->LastPs) return -1;
|
|
|
-
|
|
|
- created = CreateNew(laPropPack);
|
|
|
- created->LastPs = memAcquireSimple(sizeof(laPropStep));
|
|
|
- created->Go = created->LastPs;
|
|
|
- created->LastPs->p = OrigionalThis->LastPs->p;
|
|
|
- created->LastPs->UseInstance = FromInstance;
|
|
|
- created->EndInstance = FromInstance;
|
|
|
- created->LastIndex = OrigionalThis->LastIndex;
|
|
|
-
|
|
|
- a = la_CreateOperator(at);
|
|
|
- a->ToPanel = MAIN.ToPanel;
|
|
|
- a->This = created;
|
|
|
- a->CreatedThis = created;
|
|
|
- a->ExtraInstructions = args;
|
|
|
- strMakeInstructions(&a->ExtraInstructionsP, args);
|
|
|
- strMakeInstructions(&a->ExtraInstructionsP, args2);
|
|
|
- strMakeInstructions(&a->ExtraInstructionsP, at->ExtraInstructions);
|
|
|
-
|
|
|
- if (!laOperatorAvailableP(at, created, a->ExtraInstructionsP)){
|
|
|
- la_DestroyOperator(&a, 0, 0);
|
|
|
- return LA_CANCELED;
|
|
|
- }
|
|
|
-
|
|
|
- lstGeneratePointerList(f ? &f->LocalUiLists : 0, 0, &a->LocalUiLists);
|
|
|
-
|
|
|
- if (e&&!e->Localized && at->ExtraMark & LA_EXTRA_TO_PANEL) laWindowToLocal(0, a->ToPanel, &e->x, &e->y);
|
|
|
-
|
|
|
- if (From) f->Child = a;
|
|
|
-
|
|
|
- a->Using = 1;
|
|
|
|
|
|
- if (at->Init) at->Init(a);
|
|
|
- rev = at->Invoke(a, e);
|
|
|
-
|
|
|
- a->Using = 0;
|
|
|
-
|
|
|
- if (rev & LA_FINISH){
|
|
|
- a->StopNow = 1; if(From)From->Child=0;
|
|
|
- }
|
|
|
-
|
|
|
- if (!a->StopNow && (rev&LA_BLOCK || rev&LA_PASS_ON)){
|
|
|
- lstAppendItem(&MAIN.CurrentWindow->PendingOperators, a);
|
|
|
- a->State = rev;
|
|
|
- a->PP.EndInstance = a->CustomData;
|
|
|
- }else
|
|
|
- la_DestroyOperator(&a, 0, 0);
|
|
|
+ if (la_UiOperatorExists(inst)) return -1;
|
|
|
+ at = hsh256FindItemSTR(&MAIN.OperatorTypeHash, la_OperatorTypeByID, ID); if (!at) return -1;
|
|
|
|
|
|
- return rev;
|
|
|
+ return laInvokeUiP(From,at,e,inst,Locals,IgnoreLocals);
|
|
|
}
|
|
|
+
|
|
|
void laRequestDelayEvent(real Seconds){
|
|
|
MAIN.DelayTriggered=0; MAIN.DelayStart=MAIN.TimeAccum; MAIN.DelayTime = Seconds; }
|
|
|
|