*/}}
Browse Source

New refresh, and get rid of warnings

YimingWu 1 year ago
parent
commit
2cdc25ef37
11 changed files with 158 additions and 131 deletions
  1. 24 25
      la_data.c
  2. 2 2
      la_data.h
  3. 6 1
      la_interface.h
  4. 73 61
      la_kernel.c
  5. 2 0
      la_tns_kernel.c
  6. 3 3
      la_util.c
  7. 1 1
      resources/la_modelling.c
  8. 32 25
      resources/la_operators.c
  9. 12 6
      resources/la_properties.c
  10. 0 4
      resources/la_templates.c
  11. 3 3
      resources/la_widgets_viewers.c

+ 24 - 25
la_data.c

@@ -97,8 +97,8 @@ laListHandle* laGetUserList(void* HyperUserMem, laProp* Which, int* IsLocal){
 
 
 laItemUserLinker *laUseDataBlock(void *HyperUserMem, laProp *Which, unsigned int FrameDistinguish, void *User, laUserRemoveFunc Remover, int ForceRecalc){
 laItemUserLinker *laUseDataBlock(void *HyperUserMem, laProp *Which, unsigned int FrameDistinguish, void *User, laUserRemoveFunc Remover, int ForceRecalc){
     laItemUserLinker *iul; laItemUserLinkerLocal *iull; int local;
     laItemUserLinker *iul; laItemUserLinkerLocal *iull; int local;
-    if (!HyperUserMem) return;
-    laListHandle* users = laGetUserList(HyperUserMem, Which, &local); if(!users) return;
+    if (!HyperUserMem) return 0;
+    laListHandle* users = laGetUserList(HyperUserMem, Which, &local); if(!users) return 0;
     for (iul = users->pFirst; iul; iul = iul->Pointer.pNext){
     for (iul = users->pFirst; iul; iul = iul->Pointer.pNext){
         if(local && (iull=iul) && iull->Instance!=HyperUserMem) continue;
         if(local && (iull=iul) && iull->Instance!=HyperUserMem) continue;
         if (iul->Which == Which && iul->Pointer.p == User){
         if (iul->Which == Which && iul->Pointer.p == User){
@@ -480,9 +480,8 @@ void laNotifyUsersPP(laPropPack *pp){
             laPanel *p = iul->Pointer.p;
             laPanel *p = iul->Pointer.p;
             if (iul->Which == pp->LastPs->p && iul->FrameDistinguish == p->FrameDistinguish){
             if (iul->Which == pp->LastPs->p && iul->FrameDistinguish == p->FrameDistinguish){
                 //pthread_spin_lock(&MAIN.csNotifier);
                 //pthread_spin_lock(&MAIN.csNotifier);
-                if (iul->Which->PropertyType & LA_PROP_SUB || iul->ForceRecalc) p->Refresh |= LA_TAG_RECALC;
-                else
-                    p->Refresh |= LA_TAG_REDRAW;
+                if (iul->Which->PropertyType & LA_PROP_SUB || iul->ForceRecalc) laRecalcPanel(p);
+                else laRedrawPanel(p);
                 //pthread_spin_unlock(&MAIN.csNotifier);
                 //pthread_spin_unlock(&MAIN.csNotifier);
             }
             }
         }
         }
@@ -507,7 +506,7 @@ void laNotifySubPropUsers(laProp *prop, void *Instance){
             laPanel *p = iul->Pointer.p;
             laPanel *p = iul->Pointer.p;
             if (iul->Which == prop && iul->FrameDistinguish == p->FrameDistinguish){
             if (iul->Which == prop && iul->FrameDistinguish == p->FrameDistinguish){
                 //pthread_spin_lock(&MAIN.csNotifier);
                 //pthread_spin_lock(&MAIN.csNotifier);
-                p->Refresh |= LA_TAG_RECALC;
+                laRecalcPanel(p);
                 //pthread_spin_unlock(&MAIN.csNotifier);
                 //pthread_spin_unlock(&MAIN.csNotifier);
             }
             }
         }
         }
@@ -522,8 +521,8 @@ void laNotifyInstanceUsers(void *Instance){
         if (iul->Remove == la_PropPanelUserRemover){
         if (iul->Remove == la_PropPanelUserRemover){
             laPanel *p = iul->Pointer.p;
             laPanel *p = iul->Pointer.p;
             if (iul->FrameDistinguish == p->FrameDistinguish){
             if (iul->FrameDistinguish == p->FrameDistinguish){
-                p->Refresh |= LA_TAG_REDRAW;
-                if(iul->Which&&iul->Which->PropertyType==LA_PROP_SUB){ p->Refresh|=LA_TAG_RECALC; }
+                laRedrawPanel(p);
+                if(iul->Which&&iul->Which->PropertyType==LA_PROP_SUB){ laRecalcPanel(p); }
             }
             }
         }
         }
     }
     }
@@ -703,7 +702,7 @@ void laPropContainerExtraFunctions(laPropContainer* pc, laContainerBeforeFreeF B
     }
     }
 }
 }
 laProp* laPropContainerManageable(laPropContainer* pc, int offset_of_dummy_list){
 laProp* laPropContainerManageable(laPropContainer* pc, int offset_of_dummy_list){
-    if(!pc || pc->OtherAlloc || !offset_of_dummy_list) return;
+    if(!pc || pc->OtherAlloc || !offset_of_dummy_list) return 0;
 
 
     if(!MAIN.SaverDummyContainer){
     if(!MAIN.SaverDummyContainer){
         MAIN.SaverDummyContainer = laAddPropertyContainer("la_saver_dummy","Saver Dummy","Saver dummy",0,0,sizeof(laSaverDummy),0,0,2);
         MAIN.SaverDummyContainer = laAddPropertyContainer("la_saver_dummy","Saver Dummy","Saver dummy",0,0,sizeof(laSaverDummy),0,0,2);
@@ -1130,7 +1129,7 @@ laPropContainer* laGetInstanceType(laPropPack* pp, void* instance){
     if(instance && sp->GetType){ return sp->GetType(instance); }
     if(instance && sp->GetType){ return sp->GetType(instance); }
     return pp->LastPs->p->SubProp;
     return pp->LastPs->p->SubProp;
 }
 }
-laUiDefineFunc* laGetPropertyUiDefine(laPropPack* pp, void* instance){
+laUiDefineFunc laGetPropertyUiDefine(laPropPack* pp, void* instance){
     if(pp->LastPs->p->UiDefine) return pp->LastPs->p->UiDefine;
     if(pp->LastPs->p->UiDefine) return pp->LastPs->p->UiDefine;
     laPropContainer* pc=laGetInstanceType(pp, instance);
     laPropContainer* pc=laGetInstanceType(pp, instance);
     if(pc && pc->UiDefine) return pc->UiDefine;
     if(pc && pc->UiDefine) return pc->UiDefine;
@@ -1164,7 +1163,7 @@ int laSetInt(laPropPack *pp, int n){
         if (p->Base.DetachedPP.LastPs){
         if (p->Base.DetachedPP.LastPs){
             p->Detached[0] = n;
             p->Detached[0] = n;
             laNotifyUsersPP(pp);
             laNotifyUsersPP(pp);
-            return;
+            return 1;
         }
         }
         if (p->Set) p->Set(pp->LastPs->UseInstance, n);
         if (p->Set) p->Set(pp->LastPs->UseInstance, n);
         elif (pp->LastPs->p->Offset>=0){
         elif (pp->LastPs->p->Offset>=0){
@@ -1229,7 +1228,7 @@ int laSetFloat(laPropPack *pp, real n){
         if (p->Base.DetachedPP.LastPs){
         if (p->Base.DetachedPP.LastPs){
             p->Detached[0] = n;
             p->Detached[0] = n;
             laNotifyUsersPP(pp);
             laNotifyUsersPP(pp);
-            return;
+            return 1;
         }
         }
         if (p->Set) p->Set(pp->LastPs->UseInstance, n);
         if (p->Set) p->Set(pp->LastPs->UseInstance, n);
         elif (pp->LastPs->p->Offset>=0){
         elif (pp->LastPs->p->Offset>=0){
@@ -1306,7 +1305,7 @@ int laSetIntArrayAll(laPropPack *pp, int n){
             p->Detached[i] = n;
             p->Detached[i] = n;
         }
         }
         laNotifyUsersPP(pp);
         laNotifyUsersPP(pp);
-        return;
+        return 1;
     }
     }
     if (!pp->LastPs->UseInstance) return 0;
     if (!pp->LastPs->UseInstance) return 0;
     if (pp->LastPs->p->PropertyType & LA_PROP_INT){
     if (pp->LastPs->p->PropertyType & LA_PROP_INT){
@@ -1333,7 +1332,7 @@ int laReadIntArrayAllArray(laPropPack *pp, int *arr){
             for (i; i < len; i++){
             for (i; i < len; i++){
                 ((laIntProp *)pp->LastPs->p)->Detached[i] = arr[i];
                 ((laIntProp *)pp->LastPs->p)->Detached[i] = arr[i];
             }
             }
-            return;
+            return 1;
         }
         }
         if (!pp->LastPs->UseInstance) return 0;
         if (!pp->LastPs->UseInstance) return 0;
         if (((laIntProp *)pp->LastPs->p)->SetAllArr) ((laIntProp *)pp->LastPs->p)->SetAllArr(pp->LastPs->UseInstance, arr);
         if (((laIntProp *)pp->LastPs->p)->SetAllArr) ((laIntProp *)pp->LastPs->p)->SetAllArr(pp->LastPs->UseInstance, arr);
@@ -1384,7 +1383,7 @@ int laGetIntArray(laPropPack *pp, int *result){
         if (!pp->LastPs->UseInstance) return 0;
         if (!pp->LastPs->UseInstance) return 0;
         if (!((laIntProp *)pp->LastPs->p)->GetAll){
         if (!((laIntProp *)pp->LastPs->p)->GetAll){
             int len = laGetArrayLength(pp);
             int len = laGetArrayLength(pp);
-            if(len==1){ *result=laGetInt(pp); return; }
+            if(len==1){ *result=laGetInt(pp); return 1; }
             if(pp->LastPs->p->Offset>=0){
             if(pp->LastPs->p->Offset>=0){
                 int *src = (pp->LastPs->p->OffsetIsPointer) ? ((int **)((BYTE *)pp->LastPs->UseInstance + pp->LastPs->p->Offset)) : ((int *)((BYTE *)pp->LastPs->UseInstance + pp->LastPs->p->Offset));
                 int *src = (pp->LastPs->p->OffsetIsPointer) ? ((int **)((BYTE *)pp->LastPs->UseInstance + pp->LastPs->p->Offset)) : ((int *)((BYTE *)pp->LastPs->UseInstance + pp->LastPs->p->Offset));
                 memcpy(result, src, len * sizeof(int));
                 memcpy(result, src, len * sizeof(int));
@@ -1520,12 +1519,12 @@ int laGetFloatArray(laPropPack *pp, real *result){
         if (p->Base.DetachedPP.LastPs){
         if (p->Base.DetachedPP.LastPs){
             int len = laGetArrayLength(pp);
             int len = laGetArrayLength(pp);
             memcpy(result, p->Detached, len * sizeof(real));
             memcpy(result, p->Detached, len * sizeof(real));
-            return;
+            return 1;
         }
         }
         if (!pp->LastPs->UseInstance) return 0;
         if (!pp->LastPs->UseInstance) return 0;
         if (!((laFloatProp *)pp->LastPs->p)->GetAll){
         if (!((laFloatProp *)pp->LastPs->p)->GetAll){
             int len = laGetArrayLength(pp);
             int len = laGetArrayLength(pp);
-            if(len==1){ *result=laGetFloat(pp); return; }
+            if(len==1){ *result=laGetFloat(pp); return 1; }
             if(pp->LastPs->p->Offset>=0){
             if(pp->LastPs->p->Offset>=0){
                 real *src = (pp->LastPs->p->OffsetIsPointer) ? ((real **)((BYTE *)pp->LastPs->UseInstance + pp->LastPs->p->Offset)) : ((real *)((BYTE *)pp->LastPs->UseInstance + pp->LastPs->p->Offset));
                 real *src = (pp->LastPs->p->OffsetIsPointer) ? ((real **)((BYTE *)pp->LastPs->UseInstance + pp->LastPs->p->Offset)) : ((real *)((BYTE *)pp->LastPs->UseInstance + pp->LastPs->p->Offset));
                 memcpy(result, src, len * sizeof(real));
                 memcpy(result, src, len * sizeof(real));
@@ -1765,7 +1764,7 @@ int laEnumHasIcon(laPropPack *pp){
     }
     }
     return 0;
     return 0;
 }
 }
-laEnumItem *laGetEnumEntryLen(laPropPack *pp){
+int laGetEnumEntryLen(laPropPack *pp){
     int i = 0;
     int i = 0;
     laEnumItem *ei;
     laEnumItem *ei;
     if (pp->LastPs->p->PropertyType & LA_PROP_ENUM){
     if (pp->LastPs->p->PropertyType & LA_PROP_ENUM){
@@ -1924,14 +1923,14 @@ void laSetActiveInstance(laProp *sub, void *FromInstance, void *Instance){
             laNotifySubPropUsers(sp, FromInstance);
             laNotifySubPropUsers(sp, FromInstance);
             return;
             return;
         }
         }
-        if (!FromInstance) return 0;
+        if (!FromInstance) return;
         if (sp->SetState){
         if (sp->SetState){
             laNotifySubPropUsers(sp, FromInstance);
             laNotifySubPropUsers(sp, FromInstance);
-            return sp->SetState(FromInstance, Instance, LA_UI_ACTIVE);
+            sp->SetState(FromInstance, Instance, LA_UI_ACTIVE);
         }
         }
         if (sp->Set){
         if (sp->Set){
             laNotifySubPropUsers(sp, FromInstance);
             laNotifySubPropUsers(sp, FromInstance);
-            return sp->Set(FromInstance, Instance);
+            sp->Set(FromInstance, Instance);
         }
         }
         if (sub->OffsetIsPointer && sub->Offset>=0){
         if (sub->OffsetIsPointer && sub->Offset>=0){
             void **a = (void **)((BYTE *)FromInstance + sub->Offset);
             void **a = (void **)((BYTE *)FromInstance + sub->Offset);
@@ -2361,7 +2360,7 @@ void *la_ReadPointer(laUDF *udf){
     u64bit result = 0;
     u64bit result = 0;
     if(!udf->FileContent){ fread(&result, sizeof(u64bit), 1, udf->DiskFile); }
     if(!udf->FileContent){ fread(&result, sizeof(u64bit), 1, udf->DiskFile); }
     else{ memcpy(&result, udf->FileContent + udf->Seek, sizeof(u64bit)); udf->Seek += sizeof(u64bit); }
     else{ memcpy(&result, udf->FileContent + udf->Seek, sizeof(u64bit)); udf->Seek += sizeof(u64bit); }
-    return result;
+    return (void *)result;
 }
 }
 real la_ReadFloat(laUDF *udf){
 real la_ReadFloat(laUDF *udf){
     real result;
     real result;
@@ -3740,7 +3739,7 @@ void laGetSubResourceDirectories(char* rootpath_with_slash, laListHandle* out){
     fclose(f);
     fclose(f);
 }
 }
 void laRefreshUDFResourcesIn(char* rootpath){
 void laRefreshUDFResourcesIn(char* rootpath){
-    char Final[1024];
+    char Final[2048];
     int len=strlen(rootpath);
     int len=strlen(rootpath);
     if (rootpath[len - 1] != '/') strcat(rootpath, "/");
     if (rootpath[len - 1] != '/') strcat(rootpath, "/");
 
 
@@ -3774,7 +3773,7 @@ void laRefreshUDFResourcesIn(char* rootpath){
 }
 }
 void laRefreshUDFRegistries(){
 void laRefreshUDFRegistries(){
     laClearUDFRegistries();
     laClearUDFRegistries();
-    char LookupM[1024];
+    char LookupM[PATH_MAX];
     for(laResourceFolder* rf = MAIN.ResourceFolders.pFirst;rf;rf=rf->Item.pNext){
     for(laResourceFolder* rf = MAIN.ResourceFolders.pFirst;rf;rf=rf->Item.pNext){
         if(!rf->Path) continue;
         if(!rf->Path) continue;
         realpath(rf->Path->Ptr, LookupM);
         realpath(rf->Path->Ptr, LookupM);
@@ -4169,7 +4168,7 @@ int laIterateDB(laDBInst* parent, laPropPack* pp, laDiff* diff, laDBProp* dp){
 
 
     switch (p->PropertyType){
     switch (p->PropertyType){
     case LA_PROP_SUB:
     case LA_PROP_SUB:
-        if (p->UDFIsRefer){ if(!parent) return;
+        if (p->UDFIsRefer){ if(!parent) return 0;
             inst = laGetActiveInstanceStrict(p, pp->LastPs->UseInstance);
             inst = laGetActiveInstanceStrict(p, pp->LastPs->UseInstance);
             if(diff){
             if(diff){
                 if(inst!=dp->Data) la_GiveDiffCommand(diff, parent, p, dp->Data); dp->Data=inst; any++;
                 if(inst!=dp->Data) la_GiveDiffCommand(diff, parent, p, dp->Data); dp->Data=inst; any++;

+ 2 - 2
la_data.h

@@ -746,7 +746,7 @@ int laGetPrefixP(laPropPack *p, char buf[8][64]);
 int laGetPrefix(laProp *p, char buf[8][64]);
 int laGetPrefix(laProp *p, char buf[8][64]);
 
 
 laPropContainer* laGetInstanceType(laPropPack* pp, void* instance);
 laPropContainer* laGetInstanceType(laPropPack* pp, void* instance);
-laUiDefineFunc* laGetPropertyUiDefine(laPropPack* pp, void* instance);
+laUiDefineFunc laGetPropertyUiDefine(laPropPack* pp, void* instance);
 
 
 int laSetInt(laPropPack *pp, int n);
 int laSetInt(laPropPack *pp, int n);
 int laGetInt(laPropPack *pp);
 int laGetInt(laPropPack *pp);
@@ -762,7 +762,7 @@ int laSetFloatArrayAll(laPropPack *pp, real n);
 int laSetFloatArrayAllArray(laPropPack *pp, real *arr);
 int laSetFloatArrayAllArray(laPropPack *pp, real *arr);
 int laGetFloatArray(laPropPack *pp, real *result);
 int laGetFloatArray(laPropPack *pp, real *result);
 laEnumItem *laGetEnum(laPropPack *pp);
 laEnumItem *laGetEnum(laPropPack *pp);
-laEnumItem *laGetEnumEntryLen(laPropPack *pp);
+int laGetEnumEntryLen(laPropPack *pp);
 laEnumItem *laGetEnumArrayIndexed(laPropPack *pp, int index);
 laEnumItem *laGetEnumArrayIndexed(laPropPack *pp, int index);
 int laGetEnumArray(laPropPack *pp, laEnumItem **result);
 int laGetEnumArray(laPropPack *pp, laEnumItem **result);
 laEnumItem *laGetEnumFromIdentifier(laEnumProp *p, char *Identifier);
 laEnumItem *laGetEnumFromIdentifier(laEnumProp *p, char *Identifier);

+ 6 - 1
la_interface.h

@@ -553,6 +553,8 @@ STRUCTURE(laWindow){
     int OutputColorSpace;
     int OutputColorSpace;
     int OutputShowStripes;
     int OutputShowStripes;
     int IsFullScreen;
     int IsFullScreen;
+    int Redraw;
+    int RedrawTouched;
 
 
     laPropPack PP;
     laPropPack PP;
     laPropStep FakePS;
     laPropStep FakePS;
@@ -1827,6 +1829,8 @@ void la_EnsurePanelExtras(laPanel *p);
 
 
 void laRedrawAllWindows();
 void laRedrawAllWindows();
 void laRedrawCurrentWindow();
 void laRedrawCurrentWindow();
+void laRedrawPanel(laPanel* p);
+void laRecalcPanel(laPanel* p);
 void laRedrawCurrentPanel();
 void laRedrawCurrentPanel();
 void laRecalcCurrentPanel();
 void laRecalcCurrentPanel();
 void laRecalcPanelImmediate(laPanel *p);
 void laRecalcPanelImmediate(laPanel *p);
@@ -1849,6 +1853,7 @@ int laIsInBlock(laBlock *b, int X, int Y);
 int laIsInBlockHeader(laBlock *b, int X, int Y);
 int laIsInBlockHeader(laBlock *b, int X, int Y);
 int laIsInBlockBotton1(laBlock *b, int X, int Y);
 int laIsInBlockBotton1(laBlock *b, int X, int Y);
 int laIsInBlockBotton2(laBlock *b, int X, int Y);
 int laIsInBlockBotton2(laBlock *b, int X, int Y);
+laBlock *laClearBlockButtonRecursive(laBlock *b, laBlock *except);
 laBlock *laDetectBlockRecursive(laBlock *b, int X, int Y);
 laBlock *laDetectBlockRecursive(laBlock *b, int X, int Y);
 
 
 laUiList *laPrepareUi(laPanel *p);
 laUiList *laPrepareUi(laPanel *p);
@@ -1938,7 +1943,7 @@ laBoxedTheme *laDesignBoxedTheme(laTheme *t, const char *Name, laBoxedTheme** Ba
                                  real NormalY,real ActiveY,real BorderY,real TextY,real TextActiveY, real Alpha,
                                  real NormalY,real ActiveY,real BorderY,real TextY,real TextActiveY, real Alpha,
                                  real TopMargin,  real LeftMargin,  real RightMargin,  real BottomMargin,
                                  real TopMargin,  real LeftMargin,  real RightMargin,  real BottomMargin,
                                  real TopPadding, real LeftPadding, real RightPadding, real BottomPadding);
                                  real TopPadding, real LeftPadding, real RightPadding, real BottomPadding);
-laBoxedTheme *laGetTheme(const char *ThemeName);
+laTheme *laGetTheme(const char *ThemeName);
 laBoxedTheme *laGetBoxedTheme(const char *ThemeName, const char *BoxName);
 laBoxedTheme *laGetBoxedTheme(const char *ThemeName, const char *BoxName);
 real* laThemeColor(laBoxedTheme* bt, int which);
 real* laThemeColor(laBoxedTheme* bt, int which);
 real* laAccentColor(int which);
 real* laAccentColor(int which);

+ 73 - 61
la_kernel.c

@@ -675,19 +675,19 @@ int la_IsThisSysWindow(laWindow *wnd, Window hwnd){
 };
 };
 void la_EnsurePanelSnapping(laPanel *p, int CW, int CH){
 void la_EnsurePanelSnapping(laPanel *p, int CW, int CH){
     if (p->SL){ int s=p->SL<0?0:p->SL;
     if (p->SL){ int s=p->SL<0?0:p->SL;
-        if (p->TX != s) p->Refresh |= LA_TAG_RECALC;
+        if (p->TX != s) laRecalcPanel(p);
         p->TX = s;
         p->TX = s;
     }
     }
     if (p->SR){ int s=p->SR<0?0:p->SR;
     if (p->SR){ int s=p->SR<0?0:p->SR;
-        if (p->TW != CW - p->TX - s) p->Refresh |= LA_TAG_RECALC;
+        if (p->TW != CW - p->TX - s) laRecalcPanel(p);
         p->TW = CW - p->TX - s;
         p->TW = CW - p->TX - s;
     }
     }
     if (p->ST){ int s=p->ST<0?0:p->ST;
     if (p->ST){ int s=p->ST<0?0:p->ST;
-        if (p->TY != s) p->Refresh |= LA_TAG_RECALC;
+        if (p->TY != s) laRecalcPanel(p);
         p->TY = s;
         p->TY = s;
     }
     }
     if (p->SB){ int s=p->SB<0?0:p->SB;
     if (p->SB){ int s=p->SB<0?0:p->SB;
-        if (p->TH != CH - p->TY - s) p->Refresh |= LA_TAG_RECALC;
+        if (p->TH != CH - p->TY - s) laRecalcPanel(p);
         p->TH = CH - p->TY - s;
         p->TH = CH - p->TY - s;
     }
     }
 }
 }
@@ -721,7 +721,7 @@ void la_RecalcBlockRecursive(laBlock *b, int X, int Y, int W, int H){
         p->X = X + LA_SEAM_W; p->Y = Y + LA_SEAM_W + TitleGap;
         p->X = X + LA_SEAM_W; p->Y = Y + LA_SEAM_W + TitleGap;
         p->TX = X + LA_SEAM_W; p->TY = Y + LA_SEAM_W + TitleGap;
         p->TX = X + LA_SEAM_W; p->TY = Y + LA_SEAM_W + TitleGap;
         p->TW = W - LA_SEAM_W*2; p->TH = H - LA_SEAM_W*2 - TitleGap;
         p->TW = W - LA_SEAM_W*2; p->TH = H - LA_SEAM_W*2 - TitleGap;
-        p->Refresh |= LA_TAG_RECALC;
+        laRecalcPanel(p);
     }
     }
 }
 }
 void la_UpdateUiPlacement(laWindow *w){
 void la_UpdateUiPlacement(laWindow *w){
@@ -733,7 +733,7 @@ void la_UpdateUiPlacement(laWindow *w){
     int MenuHeight=(bt->TM+bt->BM)*2+LA_RH;
     int MenuHeight=(bt->TM+bt->BM)*2+LA_RH;
 
 
     if(w->MaximizedUi && w->MaximizedUiPanel){
     if(w->MaximizedUi && w->MaximizedUiPanel){
-        w->MaximizedUiPanel->Refresh|=LA_TAG_RECALC;
+        laRecalcPanel(w->MaximizedUiPanel);
     }elif(w->MaximizedBlock){
     }elif(w->MaximizedBlock){
         la_RecalcBlockRecursive(w->MaximizedBlock, -LA_SEAM_W, MenuHeight, CW+LA_SEAM_W*2, CH-MenuHeight+LA_SEAM_W);
         la_RecalcBlockRecursive(w->MaximizedBlock, -LA_SEAM_W, MenuHeight, CW+LA_SEAM_W*2, CH-MenuHeight+LA_SEAM_W);
     }else{
     }else{
@@ -746,7 +746,7 @@ void la_UpdateUiPlacement(laWindow *w){
             p->TH=p->H=MenuHeight;
             p->TH=p->H=MenuHeight;
         }
         }
         la_EnsurePanelSnapping(p, CW, CH);
         la_EnsurePanelSnapping(p, CW, CH);
-        p->Refresh |= LA_TAG_RECALC;
+        laRecalcPanel(p);
     }
     }
 }
 }
 void la_CommandResizeWindow(Window hwnd, int x, int y, int w, int h){
 void la_CommandResizeWindow(Window hwnd, int x, int y, int w, int h){
@@ -763,7 +763,7 @@ void la_CommandResizeWindow(Window hwnd, int x, int y, int w, int h){
 int la_OnWindowDestroy(Window wnd){
 int la_OnWindowDestroy(Window wnd){
     laListHandle *hlst = &MAIN.Windows;
     laListHandle *hlst = &MAIN.Windows;
     laWindow *w = lstFindItem(wnd, la_IsThisSysWindow, hlst);
     laWindow *w = lstFindItem(wnd, la_IsThisSysWindow, hlst);
-    if (!w) return;
+    if (!w) return 0;
 
 
     if (MAIN.Windows.pFirst==MAIN.Windows.pLast){
     if (MAIN.Windows.pFirst==MAIN.Windows.pLast){
         int empty=0; int mod=laRegisterModifications(1,1,&empty,0);
         int empty=0; int mod=laRegisterModifications(1,1,&empty,0);
@@ -910,10 +910,9 @@ laBoxedTheme *laDesignBoxedTheme(laTheme *t, const char *Name, laBoxedTheme** Ba
     lstAppendItem(&t->BoxedThemes, bt);
     lstAppendItem(&t->BoxedThemes, bt);
     return bt;
     return bt;
 }
 }
-laBoxedTheme *laGetTheme(const char *ThemeName){
+laTheme *laGetTheme(const char *ThemeName){
     laTheme *t = MAIN.Themes.pFirst;
     laTheme *t = MAIN.Themes.pFirst;
     for (t; t; t = t->Item.pNext){
     for (t; t; t = t->Item.pNext){
-        laBoxedTheme *bt;
         if (strSame(t->Name->Ptr, ThemeName)) return t;
         if (strSame(t->Name->Ptr, ThemeName)) return t;
     }
     }
     return 0;
     return 0;
@@ -1194,7 +1193,7 @@ void laEnsurePanelInBound(laPanel *p, laUiList *uil){
     }
     }
 
 
     if (p->ST) p->TY = p->ST;
     if (p->ST) p->TY = p->ST;
-    if (p->SB && p->TH != ch - p->TY - p->SB) p->Refresh = LA_TAG_RECALC;
+    if (p->SB && p->TH != ch - p->TY - p->SB) laRecalcPanel(p);
     if (p->SB) p->TH = ch - p->TY - p->SB;
     if (p->SB) p->TH = ch - p->TY - p->SB;
 
 
     if(p->CloseWhenMovedOut==2){ p->X=(cw-p->W)/2; p->Y=(ch-p->H)/2; }
     if(p->CloseWhenMovedOut==2){ p->X=(cw-p->W)/2; p->Y=(ch-p->H)/2; }
@@ -1250,7 +1249,7 @@ void la_PanelDrawToWindow(laPanel *p, laWindow *w){
             Color,
             Color,
             0, 0, 1 - p->AnimationRatio, 0);
             0, 0, 1 - p->AnimationRatio, 0);
         p->AnimationRatio += (1 - p->AnimationRatio) * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
         p->AnimationRatio += (1 - p->AnimationRatio) * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
-        if (p->AnimationRatio > 0.99) p->AnimationMode = 0;
+        if (p->AnimationRatio > 0.99) p->AnimationMode = 0; laRefreshWindow();
         break;
         break;
 
 
     case LA_PANEL_ANIMATION_EXPAND:
     case LA_PANEL_ANIMATION_EXPAND:
@@ -1266,7 +1265,7 @@ void la_PanelDrawToWindow(laPanel *p, laWindow *w){
             Color,
             Color,
             0, 0, 0, 0);
             0, 0, 0, 0);
         p->AnimationRatio += (1 - p->AnimationRatio) * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
         p->AnimationRatio += (1 - p->AnimationRatio) * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
-        if (p->AnimationRatio > 0.99) p->AnimationMode = 0;
+        if (p->AnimationRatio > 0.99) p->AnimationMode = 0; laRefreshWindow();
         break;
         break;
 
 
     case LA_PANEL_ANIMATION_DISSOVE:
     case LA_PANEL_ANIMATION_DISSOVE:
@@ -1282,7 +1281,7 @@ void la_PanelDrawToWindow(laPanel *p, laWindow *w){
                 Color,
                 Color,
                 0, 0, 0, 0);
                 0, 0, 0, 0);
         p->AnimationRatio -= (p->AnimationRatio) * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
         p->AnimationRatio -= (p->AnimationRatio) * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
-        if (p->AnimationRatio < 0.01) p->AnimationMode = 0;
+        if (p->AnimationRatio < 0.01) p->AnimationMode = 0; laRefreshWindow();
         break;
         break;
 
 
     case LA_PANEL_ANIMATION_COLLAPSE:
     case LA_PANEL_ANIMATION_COLLAPSE:
@@ -1298,7 +1297,7 @@ void la_PanelDrawToWindow(laPanel *p, laWindow *w){
                 Color,
                 Color,
                 0, 0, 0, 0);
                 0, 0, 0, 0);
         p->AnimationRatio -= p->AnimationRatio * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
         p->AnimationRatio -= p->AnimationRatio * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
-        if (p->AnimationRatio < 0.01) p->AnimationMode = 0;
+        if (p->AnimationRatio < 0.01) p->AnimationMode = 0; laRefreshWindow();
         break;
         break;
 
 
     case LA_PANEL_ANIMATION_MINIMIZE:
     case LA_PANEL_ANIMATION_MINIMIZE:
@@ -1314,7 +1313,7 @@ void la_PanelDrawToWindow(laPanel *p, laWindow *w){
             Color,
             Color,
             0, 0, 0, 0);
             0, 0, 0, 0);
         p->AnimationRatio -= p->AnimationRatio * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
         p->AnimationRatio -= p->AnimationRatio * MAIN.PanelAnimationSpeed * MAIN.LastFrameTime * 60;
-        if (p->AnimationRatio < 0.01) p->AnimationMode = 0;
+        if (p->AnimationRatio < 0.01) p->AnimationMode = 0; laRefreshWindow();
         break;
         break;
     }
     }
 
 
@@ -1384,7 +1383,7 @@ void la_PanelDefDraw(laWindow *w, laPanel *p, laBoxedTheme *bt){
             laRecalcPanelImmediate(p);
             laRecalcPanelImmediate(p);
         }
         }
         if (!p->MenuRefer){
         if (!p->MenuRefer){
-            if(!p->OffScr){la_PanelDrawToOffsceen(p,&p->UI); p->Refresh|=LA_TAG_REDRAW;}
+            if(!p->OffScr){la_PanelDrawToOffsceen(p,&p->UI); p->Refresh|=LA_TAG_REDRAW; laRefreshWindow(); }
             if (p->Refresh || !p->OffScr){
             if (p->Refresh || !p->OffScr){
                 la_PanelDrawToOffsceen(p, &p->UI);
                 la_PanelDrawToOffsceen(p, &p->UI);
                 la_SetupUiListLimitMatrix(&uild, 0, p->W, 0, p->H, p->H);
                 la_SetupUiListLimitMatrix(&uild, 0, p->W, 0, p->H, p->H);
@@ -1406,9 +1405,9 @@ void la_PanelDefDraw(laWindow *w, laPanel *p, laBoxedTheme *bt){
                 if(p->Refresh&LA_TAG_RECALC_SCROLLER) DrawState_++;
                 if(p->Refresh&LA_TAG_RECALC_SCROLLER) DrawState_++;
 
 
                 if (!la_AnimateUiListRecursive(&p->TitleBar)) p->Refresh = 0;
                 if (!la_AnimateUiListRecursive(&p->TitleBar)) p->Refresh = 0;
-                else p->Refresh = LA_TAG_ANIMATION;
-                if (!la_AnimateUiListRecursive(&p->UI)) p->Refresh = p->Refresh;
-                else p->Refresh = LA_TAG_ANIMATION;
+                else { p->Refresh = LA_TAG_ANIMATION; laRefreshWindow(); }
+                if (!la_AnimateUiListRecursive(&p->UI)){ p->Refresh = p->Refresh; if(p->Refresh){ laRefreshWindow(); } }
+                else { p->Refresh = LA_TAG_ANIMATION; laRefreshWindow(); }
                 DrawState_ += la_DrawUiListRecursive(&uild, &p->TitleBar, 0, p->W, 0, p->H, 10000, -1, 0, 0, 0);
                 DrawState_ += la_DrawUiListRecursive(&uild, &p->TitleBar, 0, p->W, 0, p->H, 10000, -1, 0, 0, 0);
                 if(p!=w->MaximizedUiPanel){
                 if(p!=w->MaximizedUiPanel){
                     DrawState_ += la_DrawUiListRecursive(&uild, &p->UI, 0, p->W, 0, p->H, 10000, -1, 0, 0, 0);
                     DrawState_ += la_DrawUiListRecursive(&uild, &p->UI, 0, p->W, 0, p->H, 10000, -1, 0, 0, 0);
@@ -1418,7 +1417,7 @@ void la_PanelDefDraw(laWindow *w, laPanel *p, laBoxedTheme *bt){
                         bt->LM,p->W-bt->RM,(p->H - p->TitleBar.B)/2+LA_RH2,LA_TEXT_ALIGN_CENTER|LA_TEXT_LINE_WRAP);
                         bt->LM,p->W-bt->RM,(p->H - p->TitleBar.B)/2+LA_RH2,LA_TEXT_ALIGN_CENTER|LA_TEXT_LINE_WRAP);
                     tnsFlush();
                     tnsFlush();
                 }
                 }
-                if (DrawState_) p->Refresh = LA_TAG_RECALC;
+                if (DrawState_){ p->Refresh = LA_TAG_RECALC; laRefreshWindow(); }
             }
             }
         }else{
         }else{
             if (p->Refresh || !p->OffScr){
             if (p->Refresh || !p->OffScr){
@@ -1427,7 +1426,7 @@ void la_PanelDefDraw(laWindow *w, laPanel *p, laBoxedTheme *bt){
                 la_PanelBackgroundInit(p, bt);
                 la_PanelBackgroundInit(p, bt);
                 la_DrawUiListScrollerV(p->MenuRefer, p->MenuRefer->PanY,
                 la_DrawUiListScrollerV(p->MenuRefer, p->MenuRefer->PanY,
                     p->MenuRefer->B-p->MenuRefer->U-bt->TM-bt->BM, p->H-bt->TM-bt->BM*2, p->W);
                     p->MenuRefer->B-p->MenuRefer->U-bt->TM-bt->BM, p->H-bt->TM-bt->BM*2, p->W);
-                    tnsFlush();
+                tnsFlush();
 
 
                 if(((p->MenuRefer->TB>p->H-bt->BP) && (!p->MenuRefer->ScrollerShownV))||
                 if(((p->MenuRefer->TB>p->H-bt->BP) && (!p->MenuRefer->ScrollerShownV))||
                     ((p->MenuRefer->TB<=p->H-bt->BP) && p->MenuRefer->ScrollerShownV)){
                     ((p->MenuRefer->TB<=p->H-bt->BP) && p->MenuRefer->ScrollerShownV)){
@@ -1443,9 +1442,9 @@ void la_PanelDefDraw(laWindow *w, laPanel *p, laBoxedTheme *bt){
                 if(p->Refresh&LA_TAG_RECALC_SCROLLER) DrawState_++;
                 if(p->Refresh&LA_TAG_RECALC_SCROLLER) DrawState_++;
 
 
                 if (!la_AnimateUiListRecursive(p->MenuRefer)) p->Refresh = 0;
                 if (!la_AnimateUiListRecursive(p->MenuRefer)) p->Refresh = 0;
-                else p->Refresh = LA_TAG_ANIMATION;
+                else { p->Refresh = LA_TAG_ANIMATION; laRefreshWindow(); }
                 DrawState_ += la_DrawUiListRecursive(&uild, p->MenuRefer, 0, p->W, 0, p->H, 10000, -1, 0, 0, 0);
                 DrawState_ += la_DrawUiListRecursive(&uild, p->MenuRefer, 0, p->W, 0, p->H, 10000, -1, 0, 0, 0);
-                if (DrawState_) p->Refresh = LA_TAG_RECALC;
+                if (DrawState_){ p->Refresh = LA_TAG_RECALC; laRefreshWindow(); }
             }
             }
         }
         }
 
 
@@ -1784,7 +1783,7 @@ void la_WindowDefDraw(laWindow *w, laBoxedTheme *bt){
             }
             }
             ui->Type->Draw(ui, LA_RH); tnsFlush();
             ui->Type->Draw(ui, LA_RH); tnsFlush();
             if (!la_AnimateUiListRecursive(&p->UI)) p->Refresh = 0;
             if (!la_AnimateUiListRecursive(&p->UI)) p->Refresh = 0;
-            else p->Refresh|=LA_TAG_ANIMATION;
+            else { p->Refresh|=LA_TAG_ANIMATION; laRefreshWindow(); }
         }
         }
         tnsDrawToScreen();
         tnsDrawToScreen();
         tnsResetViewMatrix();
         tnsResetViewMatrix();
@@ -1798,7 +1797,7 @@ void la_WindowDefDraw(laWindow *w, laBoxedTheme *bt){
                 DrawState_+=la_DrawUiListRecursive(&uild, sub, ui->L, ui->R, ui->U, ui->B, 10000, 0, 0, 0, 0);
                 DrawState_+=la_DrawUiListRecursive(&uild, sub, ui->L, ui->R, ui->U, ui->B, 10000, 0, 0, 0, 0);
             }
             }
         }
         }
-        if (DrawState_) p->Refresh = LA_TAG_RECALC;
+        if (DrawState_){ p->Refresh = LA_TAG_RECALC; laRefreshWindow(); }
     }else{
     }else{
         laBlock* RootBlock= w->MaximizedBlock?w->MaximizedBlock:l->FirstBlock;
         laBlock* RootBlock= w->MaximizedBlock?w->MaximizedBlock:l->FirstBlock;
         la_BlockDefDrawRecursive(w, bt, RootBlock);
         la_BlockDefDrawRecursive(w, bt, RootBlock);
@@ -1834,7 +1833,7 @@ void la_WindowDefDraw(laWindow *w, laBoxedTheme *bt){
         NextP = p->Item.pPrev;
         NextP = p->Item.pPrev;
         if (!p->AnimationMode){
         if (!p->AnimationMode){
             lstRemoveItem(&w->FadingPanels, p);
             lstRemoveItem(&w->FadingPanels, p);
-            p->AnimationMode = LA_PANEL_ANIMATION_DESTROY;
+            p->AnimationMode = LA_PANEL_ANIMATION_DESTROY; laRefreshWindow();
             laDeferredDestroyPanel(p, 0);
             laDeferredDestroyPanel(p, 0);
         }else
         }else
             la_PanelDrawToWindow(p, w);
             la_PanelDrawToWindow(p, w);
@@ -1866,6 +1865,7 @@ laWindow *laDesignWindow(int X, int Y, int W, int H){
     strSafeSet(&n->Title, "Empty Window");
     strSafeSet(&n->Title, "Empty Window");
     n->X = X; n->Y = Y; n->W = W; n->H = H;
     n->X = X; n->Y = Y; n->W = W; n->H = H;
     n->OutputShowStripes=1;
     n->OutputShowStripes=1;
+    n->Redraw=1;
 
 
     la_CreateSystemWindow(n, MAIN.Windows.pFirst!=0);
     la_CreateSystemWindow(n, MAIN.Windows.pFirst!=0);
 
 
@@ -1913,20 +1913,20 @@ void laMaximizeCanvasUI(laUiItem* ui, laPanel* UiParentPanel){
     laRestoreCanvasUI();
     laRestoreCanvasUI();
     if(!ui->Type||(!(ui->Type->Tag&LA_UI_TAG_IS_OFFSCREEN))||!UiParentPanel) return;
     if(!ui->Type||(!(ui->Type->Tag&LA_UI_TAG_IS_OFFSCREEN))||!UiParentPanel) return;
     la_StopUiOperatorService(UiParentPanel); la_StopUiOperatorService(ui); laRetriggerOperators();
     la_StopUiOperatorService(UiParentPanel); la_StopUiOperatorService(ui); laRetriggerOperators();
-    laWindow* w=MAIN.CurrentWindow; w->MaximizedUi=ui; w->MaximizedUiPanel=UiParentPanel; UiParentPanel->Refresh |= LA_TAG_RECALC;
+    laWindow* w=MAIN.CurrentWindow; w->MaximizedUi=ui; w->MaximizedUiPanel=UiParentPanel; laRecalcPanel(UiParentPanel);
     UiParentPanel->Show=0;
     UiParentPanel->Show=0;
     laNotifyUsers("la.windows.maximized_ui"); laHideMenuBar();
     laNotifyUsers("la.windows.maximized_ui"); laHideMenuBar();
 }
 }
 void laRestoreCanvasUI(){
 void laRestoreCanvasUI(){
     laWindow* w=MAIN.CurrentWindow; if(!w->MaximizedUi || !w->MaximizedUiPanel) return;
     laWindow* w=MAIN.CurrentWindow; if(!w->MaximizedUi || !w->MaximizedUiPanel) return;
     la_StopUiOperatorService(w->MaximizedUi); laRetriggerOperators(); w->MaximizedUiPanel->Show=1;
     la_StopUiOperatorService(w->MaximizedUi); laRetriggerOperators(); w->MaximizedUiPanel->Show=1;
-    w->MaximizedUiPanel->Refresh |= LA_TAG_RECALC; w->MaximizedUi=0; w->MaximizedUiPanel=0; la_UpdateUiPlacement(w);
+    laRecalcPanel(w->MaximizedUiPanel); w->MaximizedUi=0; w->MaximizedUiPanel=0; la_UpdateUiPlacement(w);
     laNotifyUsers("la.windows.maximized_ui"); laShowMenuBar();
     laNotifyUsers("la.windows.maximized_ui"); laShowMenuBar();
 }
 }
 void laHideMenuBar(){ laWindow* w=MAIN.CurrentWindow; if(!w->MaximizedUi || !w->MaximizedUiPanel) return;
 void laHideMenuBar(){ laWindow* w=MAIN.CurrentWindow; if(!w->MaximizedUi || !w->MaximizedUiPanel) return;
-    for(laPanel* p=MAIN.CurrentWindow->Panels.pFirst;p;p=p->Item.pNext){ if(p->IsMenuPanel){ p->Show=0; break; } }
+    for(laPanel* p=MAIN.CurrentWindow->Panels.pFirst;p;p=p->Item.pNext){ if(p->IsMenuPanel){ p->Show=0; laRefreshWindow(); break; } }
 }
 }
-void laShowMenuBar(){ for(laPanel* p=MAIN.CurrentWindow->Panels.pFirst;p;p=p->Item.pNext){ if(p->IsMenuPanel){ p->Show=1; break; } } }
+void laShowMenuBar(){ for(laPanel* p=MAIN.CurrentWindow->Panels.pFirst;p;p=p->Item.pNext){ if(p->IsMenuPanel){ p->Show=1; laRefreshWindow(); break; } } }
 void laSplitBlockHorizon(laBlock *b, real Percentage){
 void laSplitBlockHorizon(laBlock *b, real Percentage){
     laPanel *p;
     laPanel *p;
     b->SplitRatio = Percentage;
     b->SplitRatio = Percentage;
@@ -2044,7 +2044,7 @@ laPanel* laTearOffPanel(laBlock* b, laPanel* p_if_set){
     p->TY-=LA_RH;
     p->TY-=LA_RH;
     p->TH+=LA_RH;
     p->TH+=LA_RH;
 
 
-    p->Refresh=LA_TAG_RECALC;
+    laRecalcPanel(p);
     la_RecalcBlockRecursive(b, b->X,b->Y,b->W,b->H);
     la_RecalcBlockRecursive(b, b->X,b->Y,b->W,b->H);
     p->BT = &_LA_THEME_FLOATING_PANEL;
     p->BT = &_LA_THEME_FLOATING_PANEL;
     p->Block = 0;
     p->Block = 0;
@@ -2065,7 +2065,7 @@ void laDockPanel(laWindow* from, laBlock* b, laPanel* p){
     p->Block=b;
     p->Block=b;
     b->CurrentPanel = p;
     b->CurrentPanel = p;
     lstPushItem(&b->Panels, p);
     lstPushItem(&b->Panels, p);
-    p->Refresh=LA_TAG_RECALC;
+    laRecalcPanel(p);
     p->BT = &_LA_THEME_PANEL;
     p->BT = &_LA_THEME_PANEL;
     la_RecalcBlockRecursive(b, b->X,b->Y,b->W,b->H);
     la_RecalcBlockRecursive(b, b->X,b->Y,b->W,b->H);
     tnsFlush();
     tnsFlush();
@@ -2154,7 +2154,7 @@ laPanel *la_NewPanel(laUiTemplate* uit, int X, int Y, int W, int H, int MaxW, in
 
 
     la_EnsurePanelExtras(p);
     la_EnsurePanelExtras(p);
 
 
-    p->Refresh = LA_TAG_RECALC;
+    laRecalcPanel(p);
     p->FrameDistinguish = 100; //greater than 1 is ok
     p->FrameDistinguish = 100; //greater than 1 is ok
 
 
     if(uit&&uit->PropFunc){ uit->PropFunc(p); }
     if(uit&&uit->PropFunc){ uit->PropFunc(p); }
@@ -2178,8 +2178,8 @@ laPanel *laCreatePanelT(laBlock *b, laUiTemplate* uit){
     p->PP.LastPs->Type = L'.';
     p->PP.LastPs->Type = L'.';
 
 
     la_EnsurePanelExtras(p);
     la_EnsurePanelExtras(p);
-
-    p->Refresh = LA_TAG_RECALC;
+    
+    laRecalcPanel(p);
     p->FrameDistinguish = 100; //greater than 1 is ok
     p->FrameDistinguish = 100; //greater than 1 is ok
 
 
     p->TitleWidth = tnsStringGetWidth(transLate(p->Title->Ptr), 0, 0);
     p->TitleWidth = tnsStringGetWidth(transLate(p->Title->Ptr), 0, 0);
@@ -2222,12 +2222,12 @@ void laShowPanel(laPanel *p){
 }
 }
 void laShowPanelWithDropDownEffect(laPanel *p){
 void laShowPanelWithDropDownEffect(laPanel *p){
     laShowPanel(p);
     laShowPanel(p);
-    p->AnimationMode = LA_PANEL_ANIMATION_DROP_DOWN;
+    p->AnimationMode = LA_PANEL_ANIMATION_DROP_DOWN; laRefreshWindow();
     p->AnimationRatio = 0;
     p->AnimationRatio = 0;
 }
 }
 void laShowPanelWithExpandEffect(laPanel *p){
 void laShowPanelWithExpandEffect(laPanel *p){
     laShowPanel(p);
     laShowPanel(p);
-    p->AnimationMode = LA_PANEL_ANIMATION_EXPAND;
+    p->AnimationMode = LA_PANEL_ANIMATION_EXPAND; laRefreshWindow();
     p->AnimationRatio = 0;
     p->AnimationRatio = 0;
 }
 }
 void laHidePanel(laPanel *p){
 void laHidePanel(laPanel *p){
@@ -2238,19 +2238,19 @@ void laHidePanel(laPanel *p){
 void laHidePanelWithDissoveEffect(laPanel *p){
 void laHidePanelWithDissoveEffect(laPanel *p){
     if (!p->Mode) return;
     if (!p->Mode) return;
     laHidePanel(p);
     laHidePanel(p);
-    p->AnimationMode = LA_PANEL_ANIMATION_DISSOVE;
+    p->AnimationMode = LA_PANEL_ANIMATION_DISSOVE; laRefreshWindow();
     p->AnimationRatio = 1;
     p->AnimationRatio = 1;
 }
 }
 void laHidePanelWithCollapseEffect(laPanel *p){
 void laHidePanelWithCollapseEffect(laPanel *p){
     if (!p->Mode) return;
     if (!p->Mode) return;
     laHidePanel(p);
     laHidePanel(p);
-    p->AnimationMode = LA_PANEL_ANIMATION_COLLAPSE;
+    p->AnimationMode = LA_PANEL_ANIMATION_COLLAPSE; laRefreshWindow();
     p->AnimationRatio = 1;
     p->AnimationRatio = 1;
 }
 }
 void laHidePanelWithMinimizeEffect(laPanel *p){
 void laHidePanelWithMinimizeEffect(laPanel *p){
     if (!p->Mode) return;
     if (!p->Mode) return;
     laHidePanel(p);
     laHidePanel(p);
-    p->AnimationMode = LA_PANEL_ANIMATION_MINIMIZE;
+    p->AnimationMode = LA_PANEL_ANIMATION_MINIMIZE; laRefreshWindow();
     p->AnimationRatio = 1;
     p->AnimationRatio = 1;
 }
 }
 void laActivatePanel(char* TemplateID, int x, int y){
 void laActivatePanel(char* TemplateID, int x, int y){
@@ -2427,7 +2427,7 @@ void laDestroySinglePanel(laPanel *p, int immediate){
     la_DestroyUiList(p->MenuRefer, 0, 1, 1);
     la_DestroyUiList(p->MenuRefer, 0, 1, 1);
 
 
     if (p->Mode){
     if (p->Mode){
-        p->AnimationMode = LA_PANEL_ANIMATION_DISSOVE;
+        p->AnimationMode = LA_PANEL_ANIMATION_DISSOVE; laRefreshWindow();
         p->AnimationRatio = p->CloseWhenMovedOut?0.0:1.0;
         p->AnimationRatio = p->CloseWhenMovedOut?0.0:1.0;
     }
     }
 
 
@@ -2466,7 +2466,7 @@ int laEnclosePanelContent(laPanel *p, laUiList *uil){
     if(p->TW>CW){ p->TW=CW; }
     if(p->TW>CW){ p->TW=CW; }
     la_UpdateUiListRecursive(&p->TitleBar, bt->TM, bt->LM, p->TW - bt->LM-bt->RM, p->TH, 0, p);
     la_UpdateUiListRecursive(&p->TitleBar, bt->TM, bt->LM, p->TW - bt->LM-bt->RM, p->TH, 0, p);
     la_UpdateUiListRecursive(uil, bt->TM+p->TitleBar.B, bt->LM, p->TW - bt->RM - ScrollerW, 0, 0, p);
     la_UpdateUiListRecursive(uil, bt->TM+p->TitleBar.B, bt->LM, p->TW - bt->RM - ScrollerW, 0, 0, p);
-    p->Refresh=LA_TAG_REDRAW;
+    laRedrawPanel(p);
     return 1;
     return 1;
 }
 }
 laPanel *laEnableIdlePanel(laPanel *Attachment, laOperator *a, laPropPack *OperatorProps, laUiDefineFunc ReplaceUiDefine, laPropPack *This,
 laPanel *laEnableIdlePanel(laPanel *Attachment, laOperator *a, laPropPack *OperatorProps, laUiDefineFunc ReplaceUiDefine, laPropPack *This,
@@ -2501,7 +2501,7 @@ laPanel *laEnableSplashPanel(laUiDefineFunc ReplaceUiDefine, int L, int R, int B
     int b;
     int b;
     laUiDefineFunc def = ReplaceUiDefine;
     laUiDefineFunc def = ReplaceUiDefine;
     int MinW;
     int MinW;
-    if (!def) return;
+    if (!def) return 0;
     GX = L; GY = B; GW = (R - L) > MaxW ? MaxW : (R - L);
     GX = L; GY = B; GW = (R - L) > MaxW ? MaxW : (R - L);
     p = laDesignPropPanel("TMP", GX, GY, GW, MaxGH, def, 0, 0);
     p = laDesignPropPanel("TMP", GX, GY, GW, MaxGH, def, 0, 0);
     p->Mode = LA_PANEL_FLOATING_TOP;
     p->Mode = LA_PANEL_FLOATING_TOP;
@@ -2770,14 +2770,17 @@ void laRedrawAllWindows(){ if((!MAIN.CurrentWindow) || (!MAIN.CurrentWindow->win
 void laRedrawCurrentWindow(){ if((!MAIN.CurrentWindow) || (!MAIN.CurrentWindow->win)) return;
 void laRedrawCurrentWindow(){ if((!MAIN.CurrentWindow) || (!MAIN.CurrentWindow->win)) return;
     if (MAIN.CurrentWindow) la_UpdateUiPlacement(MAIN.CurrentWindow);
     if (MAIN.CurrentWindow) la_UpdateUiPlacement(MAIN.CurrentWindow);
 }
 }
+void laRefreshWindow(){ MAIN.CurrentWindow->Redraw=1; }
+void laRedrawPanel(laPanel* p){ p->Refresh |= LA_TAG_REDRAW; MAIN.CurrentWindow->Redraw=1; }
+void laRecalcPanel(laPanel* p){ p->Refresh |= LA_TAG_RECALC; MAIN.CurrentWindow->Redraw=1; }
 void laRedrawCurrentPanel(){
 void laRedrawCurrentPanel(){
-    if (MAIN.CurrentPanel) MAIN.CurrentPanel->Refresh |= LA_TAG_REDRAW;
-    elif (MAIN.CurrentWindow->MaximizedUiPanel) MAIN.CurrentWindow->MaximizedUiPanel->Refresh |= LA_TAG_REDRAW;
+    if (MAIN.CurrentPanel) laRedrawPanel(MAIN.CurrentPanel);
+    elif (MAIN.CurrentWindow->MaximizedUiPanel) laRedrawPanel(MAIN.CurrentWindow->MaximizedUiPanel);
 }
 }
 void laRecalcCurrentPanel(){
 void laRecalcCurrentPanel(){
-    if (MAIN.CurrentPanel) MAIN.CurrentPanel->Refresh |= LA_TAG_RECALC;
-    elif (MAIN.CurrentWindow->MaximizedUiPanel) MAIN.CurrentWindow->MaximizedUiPanel->Refresh |= LA_TAG_RECALC;
-} 
+    if (MAIN.CurrentPanel) laRecalcPanel(MAIN.CurrentPanel);
+    elif (MAIN.CurrentWindow->MaximizedUiPanel) laRecalcPanel(MAIN.CurrentWindow->MaximizedUiPanel);
+}
 void laRecalcPanelImmediate(laPanel* p){
 void laRecalcPanelImmediate(laPanel* p){
     p->FrameDistinguish++;
     p->FrameDistinguish++;
     laBoxedTheme* bt = (*p->BT);
     laBoxedTheme* bt = (*p->BT);
@@ -2962,6 +2965,13 @@ int laIsInBlock(laBlock *b, int X, int Y){
 int laIsInBlockHeader(laBlock *b, int X, int Y){ if (X >= b->X && X <= b->X + b->W && Y >= b->Y && Y <= b->Y + LA_RH) return 1; return 0; }
 int laIsInBlockHeader(laBlock *b, int X, int Y){ if (X >= b->X && X <= b->X + b->W && Y >= b->Y && Y <= b->Y + LA_RH) return 1; return 0; }
 int laIsInBlockBotton1(laBlock *b, int X, int Y){ if (X >= b->X && X <= b->X + LA_RH && Y >= b->Y && Y <= b->Y + LA_RH) return 1; return 0; }
 int laIsInBlockBotton1(laBlock *b, int X, int Y){ if (X >= b->X && X <= b->X + LA_RH && Y >= b->Y && Y <= b->Y + LA_RH) return 1; return 0; }
 int laIsInBlockBotton2(laBlock *b, int X, int Y){ if (X >= b->X+LA_RH && X <= b->X+LA_2RH && Y >= b->Y && Y <= b->Y + LA_RH) return 1; return 0; }
 int laIsInBlockBotton2(laBlock *b, int X, int Y){ if (X >= b->X+LA_RH && X <= b->X+LA_2RH && Y >= b->Y && Y <= b->Y + LA_RH) return 1; return 0; }
+laBlock *laClearBlockButtonRecursive(laBlock *b, laBlock *except){
+    if(b->B1){laClearBlockButtonRecursive(b->B1,except);}
+    if(b->B2){laClearBlockButtonRecursive(b->B2,except);}
+    if (!b->B1 && !b->B2){
+        if(b!=except && b->OnButton){ b->OnButton=0; laRefreshWindow(); }
+    }
+}
 laBlock *laDetectBlockRecursive(laBlock *b, int X, int Y){
 laBlock *laDetectBlockRecursive(laBlock *b, int X, int Y){
     laPanel *p;
     laPanel *p;
     laBlock *sb = 0;
     laBlock *sb = 0;
@@ -3188,7 +3198,7 @@ void la_AssignCanvasPropExtras(laUiItem* ui){
 laUiItem *la_UpdatePropDisplay(laUiItem *ui, laPropPack *Base, const char *Path, laUiDefineFunc Template, laWidget* Widget, char* instructions){
 laUiItem *la_UpdatePropDisplay(laUiItem *ui, laPropPack *Base, const char *Path, laUiDefineFunc Template, laWidget* Widget, char* instructions){
     int result;
     int result;
 
 
-    if (!ui) return;
+    if (!ui) return 0;
 
 
     laUiType* OverrideType=Widget&&Widget->Type?Widget->Type:0;
     laUiType* OverrideType=Widget&&Widget->Type?Widget->Type:0;
 
 
@@ -3585,7 +3595,7 @@ laUiConditionNode *laLessEqual(laUiConditionNode *Expression1, laUiConditionNode
 }
 }
 int la_GetIntConditionValue(laUiConditionNode *Expression){
 int la_GetIntConditionValue(laUiConditionNode *Expression){
     if (Expression->Type != LA_CONDITION_INT) return 0;
     if (Expression->Type != LA_CONDITION_INT) return 0;
-    return Expression->Expression1;
+    return Expression->IntValue;
 }
 }
 real la_GetFloatConditionValue(laUiConditionNode *Expression){
 real la_GetFloatConditionValue(laUiConditionNode *Expression){
     if (Expression->Type != LA_CONDITION_FLOAT) return 0;
     if (Expression->Type != LA_CONDITION_FLOAT) return 0;
@@ -4122,7 +4132,7 @@ void la_CreateUiAfter(laUiList *uil, laUiItem *after, laUiDefineFunc Define, laP
 //	}
 //	}
 //}
 //}
 void la_PropPanelUserRemover(void* this_UNUSED, laItemUserLinker* iul){
 void la_PropPanelUserRemover(void* this_UNUSED, laItemUserLinker* iul){
-    laPanel* p = iul->Pointer.p; if(p->FrameDistinguish == iul->FrameDistinguish){ p->Refresh |= LA_TAG_RECALC; }
+    laPanel* p = iul->Pointer.p; if(p->FrameDistinguish == iul->FrameDistinguish){ laRecalcPanel(p); }
 }
 }
 void la_CalcUiItemInfluence(laListHandle *lst, laUiItem *ui){
 void la_CalcUiItemInfluence(laListHandle *lst, laUiItem *ui){
     laColumn *c = ui->C;
     laColumn *c = ui->C;
@@ -4241,7 +4251,7 @@ int la_InitRowNode(laRowInfo* ri, laUiItem* ui, laBoxedTheme* bt){
     ri->U=ui->TU; ri->L=ui->TL;
     ri->U=ui->TU; ri->L=ui->TL;
     ri->MaxB=ui->TU;
     ri->MaxB=ui->TU;
 }
 }
-int la_AddRowNode(laRowInfo* ri, laUiItem* ui, laBoxedTheme* bt, int H){
+void la_AddRowNode(laRowInfo* ri, laUiItem* ui, laBoxedTheme* bt, int H){
     laRowNode* rn=CreateNew(laRowNode);
     laRowNode* rn=CreateNew(laRowNode);
     rn->LP=bt->LP;rn->RP=bt->RP;
     rn->LP=bt->LP;rn->RP=bt->RP;
     rn->GotW = (ui->Type->GetMinWidth?ui->Type->GetMinWidth(ui):(LA_RH)) +bt->LM+bt->RM;
     rn->GotW = (ui->Type->GetMinWidth?ui->Type->GetMinWidth(ui):(LA_RH)) +bt->LM+bt->RM;
@@ -4278,7 +4288,7 @@ int la_CalculateRowExpand(laRowInfo* ri, laUiItem* ui_end, int WaitAnimation){
         if(!ri->Expand && Available>0){Available=0;}
         if(!ri->Expand && Available>0){Available=0;}
         ShareCount=ri->ExpandAccum?ri->ExpandAccum:ri->CountElements;
         ShareCount=ri->ExpandAccum?ri->ExpandAccum:ri->CountElements;
     }
     }
-    if(!ShareCount) return;
+    if(!ShareCount) return 0;
     int PerNode = Available/ShareCount;
     int PerNode = Available/ShareCount;
     int Remaining = Available-PerNode*ShareCount;
     int Remaining = Available-PerNode*ShareCount;
     int L = ri->L; int i=0; laRowNode* rn;
     int L = ri->L; int i=0; laRowNode* rn;
@@ -4329,7 +4339,7 @@ void la_RecordSocketRuntimePosition(laUiItem* ui){
     }
     }
 }
 }
 laUiList* la_GiveExistingPage(laListHandle* from, void* instance){
 laUiList* la_GiveExistingPage(laListHandle* from, void* instance){
-    for(laUiList* uil=from->pFirst;uil;uil=uil->Item.pNext){ if(uil->Instance == instance){ lstRemoveItem(from,uil); return uil; } }
+    for(laUiList* uil=from->pFirst;uil;uil=uil->Item.pNext){ if(uil->Instance == instance){ lstRemoveItem(from,uil); return uil; } } return 0;
 }
 }
 int la_UpdateUiListRecursive(laUiList *uil, int U, int L, int R, int B, int Fast, laPanel *ParentPanel){
 int la_UpdateUiListRecursive(laUiList *uil, int U, int L, int R, int B, int Fast, laPanel *ParentPanel){
     laUiItem *ui; laListHandle TempPages={0}; laUiList* FoundUil;
     laUiItem *ui; laListHandle TempPages={0}; laUiList* FoundUil;
@@ -4387,7 +4397,7 @@ int la_UpdateUiListRecursive(laUiList *uil, int U, int L, int R, int B, int Fast
         //}
         //}
 
 
         if ((ui->AnimationDistinguish + 1) == ParentPanel->FrameDistinguish){
         if ((ui->AnimationDistinguish + 1) == ParentPanel->FrameDistinguish){
-            ParentPanel->Refresh |= LA_TAG_ANIMATION;
+            ParentPanel->Refresh |= LA_TAG_ANIMATION; laRefreshWindow();
             WaitAnimation = 1;
             WaitAnimation = 1;
         }
         }
         ui->AnimationDistinguish = ParentPanel->FrameDistinguish;
         ui->AnimationDistinguish = ParentPanel->FrameDistinguish;
@@ -4668,7 +4678,7 @@ int la_UpdateUiListRecursive(laUiList *uil, int U, int L, int R, int B, int Fast
                         if((subh<ui->Page->TB-ui->Page->TU && (!ui->Page->ScrollerShownV)) ||
                         if((subh<ui->Page->TB-ui->Page->TU && (!ui->Page->ScrollerShownV)) ||
                             (subh>=ui->Page->TB-ui->Page->TU && ui->Page->ScrollerShownV)){
                             (subh>=ui->Page->TB-ui->Page->TU && ui->Page->ScrollerShownV)){
                             ui->Page->ScrollerShownV=!ui->Page->ScrollerShownV;
                             ui->Page->ScrollerShownV=!ui->Page->ScrollerShownV;
-                            ParentPanel->Refresh|=LA_TAG_RECALC_SCROLLER;
+                            ParentPanel->Refresh|=LA_TAG_RECALC_SCROLLER;  laRefreshWindow();
                         }
                         }
                         if(SubB-ui->Page->PanY<ui->TB-bt->BM-(ui->Page->ScrollerShownH?LA_SCROLL_W+bt->BM:0)){
                         if(SubB-ui->Page->PanY<ui->TB-bt->BM-(ui->Page->ScrollerShownH?LA_SCROLL_W+bt->BM:0)){
                             ui->Page->PanY = (SubB-ui->TB-bt->BM+(ui->Page->ScrollerShownH?LA_SCROLL_W+bt->BM:0));
                             ui->Page->PanY = (SubB-ui->TB-bt->BM+(ui->Page->ScrollerShownH?LA_SCROLL_W+bt->BM:0));
@@ -5053,7 +5063,7 @@ int la_DrawUiListRecursive(laUiListDraw *uild, laUiList *uil, int L, int R, int
     laUiListDrawItem *uildi;
     laUiListDrawItem *uildi;
     int Ret = 0;
     int Ret = 0;
 
 
-    if (!uil) return;
+    if (!uil) return 0;
 
 
     //printf("d %d\n",MAIN.CurrentPanel->FrameDistinguish);
     //printf("d %d\n",MAIN.CurrentPanel->FrameDistinguish);
 
 
@@ -6391,7 +6401,7 @@ int la_AllowInput(uint32_t ch){
 int laCopyToClipboard(unsigned char * text){
 int laCopyToClipboard(unsigned char * text){
 	XEvent event; Window owner, window=MAIN.CurrentWindow->win;
 	XEvent event; Window owner, window=MAIN.CurrentWindow->win;
 	XSetSelectionOwner(MAIN.dpy, MAIN.selection, window, 0);
 	XSetSelectionOwner(MAIN.dpy, MAIN.selection, window, 0);
-	if (XGetSelectionOwner (MAIN.dpy, MAIN.selection) != window) return;
+	if (XGetSelectionOwner (MAIN.dpy, MAIN.selection) != window) return 0;
     strSafeSet(&MAIN.CopyPending, text);
     strSafeSet(&MAIN.CopyPending, text);
 }
 }
 int la_ProcessSysMessage(){
 int la_ProcessSysMessage(){
@@ -6504,7 +6514,7 @@ int la_ProcessSysMessage(){
 			if ((R & 2) == 0) XSendEvent (MAIN.dpy, ev.requestor, 0, 0, (XEvent *)&ev);
 			if ((R & 2) == 0) XSendEvent (MAIN.dpy, ev.requestor, 0, 0, (XEvent *)&ev);
 			break;
 			break;
         case SelectionClear:
         case SelectionClear:
-			return;
+			break;
         default:
         default:
             break;
             break;
         }
         }
@@ -6529,7 +6539,8 @@ void la_PrintOperatorStack(){
     }
     }
 }
 }
 
 
-int la_DrawWindow(laWindow *w){
+void la_DrawWindow(laWindow *w){
+    if(!w->Redraw) return; w->Redraw=0; w->RedrawTouched=1;
     MAIN.CurrentWindow = w;
     MAIN.CurrentWindow = w;
     la_WindowDefDraw(w, 0);
     la_WindowDefDraw(w, 0);
 }
 }
@@ -6578,6 +6589,7 @@ void laMainLoop(){
             la_DrawWindow(w);
             la_DrawWindow(w);
         }
         }
         for(w=MAIN.Windows.pFirst;w;w=w->Item.pNext){
         for(w=MAIN.Windows.pFirst;w;w=w->Item.pNext){
+            if(!w->RedrawTouched) continue; w->RedrawTouched=0;
             glXSwapBuffers(MAIN.dpy, w->win); //XSync(MAIN.dpy,0);
             glXSwapBuffers(MAIN.dpy, w->win); //XSync(MAIN.dpy,0);
         }
         }
 
 

+ 2 - 0
la_tns_kernel.c

@@ -2276,6 +2276,8 @@ void tnsUseImage(tnsImage* im){
         im->Texture=tnsCreate2DTexture(GL_RGBA8,W,H,0);
         im->Texture=tnsCreate2DTexture(GL_RGBA8,W,H,0);
         tnsBindTexture(im->Texture); glTexSubImage2D(GL_TEXTURE_2D,0,0,0,W,H,GL_RGBA,GL_UNSIGNED_BYTE,buf);
         tnsBindTexture(im->Texture); glTexSubImage2D(GL_TEXTURE_2D,0,0,0,W,H,GL_RGBA,GL_UNSIGNED_BYTE,buf);
         tnsUnbindTexture();
         tnsUnbindTexture();
+
+        free(buf);
     }
     }
 cleanup_png_read:
 cleanup_png_read:
     if(png_ptr && info_ptr) png_destroy_read_struct(&png_ptr,&info_ptr,0);
     if(png_ptr && info_ptr) png_destroy_read_struct(&png_ptr,&info_ptr,0);

+ 3 - 3
la_util.c

@@ -335,7 +335,7 @@ void *lstGetTop(laListHandle *Handle){
     return Handle->pFirst;
     return Handle->pFirst;
 };
 };
 int lstRemoveItem(laListHandle* Handle, laListItem* li) {
 int lstRemoveItem(laListHandle* Handle, laListItem* li) {
-	if (!li->pPrev && Handle->pFirst != li) return;
+	if (!li->pPrev && Handle->pFirst != li) return 0;
 
 
 	if (!li->pPrev) Handle->pFirst = li->pNext;
 	if (!li->pPrev) Handle->pFirst = li->pNext;
 	else
 	else
@@ -1094,7 +1094,7 @@ void *memAcquireHyper(int Size){
     return mem;
     return mem;
 }
 }
 void memFree(void *Data){
 void memFree(void *Data){
-    if (!Data) return 0;
+    if (!Data) return;
     int level; void* head = memGetHead(Data, &level);
     int level; void* head = memGetHead(Data, &level);
     laMemoryPoolPart *mp;
     laMemoryPoolPart *mp;
     if(level==2) { mp = ((laMemNodeHyper*)head)->InPool; laDataBlockNoLongerExists(Data,&((laMemNodeHyper*)head)->Users);
     if(level==2) { mp = ((laMemNodeHyper*)head)->InPool; laDataBlockNoLongerExists(Data,&((laMemNodeHyper*)head)->Users);
@@ -1322,7 +1322,7 @@ int strHeadOfStringMatch(char *Str, char *SubStr){
     return 1;
     return 1;
 }
 }
 int strSkipSegmet(char **pivot, char *content){
 int strSkipSegmet(char **pivot, char *content){
-    if (!pivot || !(*pivot) || !(*(*pivot)) || !content) return;
+    if (!pivot || !(*pivot) || !(*(*pivot)) || !content) return 0;
 
 
     if (strHeadOfStringMatch(*pivot, content)){
     if (strHeadOfStringMatch(*pivot, content)){
         (*pivot) += strlen(content);
         (*pivot) += strlen(content);

+ 1 - 1
resources/la_modelling.c

@@ -319,7 +319,7 @@ int OPINV_Select(laOperator *a, laEvent *e){
 int OPMOD_Select(laOperator *a, laEvent *e){
 int OPMOD_Select(laOperator *a, laEvent *e){
     if(!a->This || !a->This->EndInstance){ return 0; }
     if(!a->This || !a->This->EndInstance){ return 0; }
     laCanvasExtra* ex=a->This->EndInstance; tnsCamera*c=ex->ViewingCamera; laUiItem* ui=ex->ParentUi;
     laCanvasExtra* ex=a->This->EndInstance; tnsCamera*c=ex->ViewingCamera; laUiItem* ui=ex->ParentUi;
-    tnsObject*root=ui?ui->PP.EndInstance:0; if(!root) return;
+    tnsObject*root=ui?ui->PP.EndInstance:0; if(!root) return 0;
     tnsMeshObject* mo=root->Active;
     tnsMeshObject* mo=root->Active;
     MSelectExtra* se=a->CustomData;
     MSelectExtra* se=a->CustomData;
 
 

+ 32 - 25
resources/la_operators.c

@@ -312,9 +312,8 @@ void laset_FileBrowserSelectFile(laFileBrowser *fb, laFileItem *fi, int State){
         fb->Active = fi;
         fb->Active = fi;
     }
     }
 }
 }
-void* la_FileBrowserGetFullPath(laFileBrowser *fb,char* buf){
-    buf[0]=0;
-    int plen;
+void la_FileBrowserGetFullPath(laFileBrowser *fb,char* buf){
+    buf[0]=0; int plen;
     if (!fb->SelectFolder && fb->FileName[0] == L'\0') return;
     if (!fb->SelectFolder && fb->FileName[0] == L'\0') return;
     plen = strlen(fb->Path);
     plen = strlen(fb->Path);
     if (fb->Path[plen - 1] != L'/') strcat(fb->Path, "/");
     if (fb->Path[plen - 1] != L'/') strcat(fb->Path, "/");
@@ -969,7 +968,7 @@ laUiTemplate* laget_FirstPanelTemplate(void* unused1, void* unused2){
 void laset_NewPanelSetTemplate(laNewPanelData *np, laUiTemplate *uit, int State){
 void laset_NewPanelSetTemplate(laNewPanelData *np, laUiTemplate *uit, int State){
     np->SelectedTemplate = uit;
     np->SelectedTemplate = uit;
 }
 }
-int laget_NewPanelGetActiveTemplate(laNewPanelData* np, laUiTemplate* uit){
+laUiTemplate* laget_NewPanelGetActiveTemplate(laNewPanelData* np, laUiTemplate* uit){
     return np->SelectedTemplate;
     return np->SelectedTemplate;
 }
 }
 void laui_PanelTemplateSelect(laUiList *uil, laPropPack *This, laPropPack *OperatorProps, laColumn *UNUSED, int context){
 void laui_PanelTemplateSelect(laUiList *uil, laPropPack *This, laPropPack *OperatorProps, laColumn *UNUSED, int context){
@@ -1176,6 +1175,7 @@ int OPINV_NewWindow(laOperator* a, laEvent* e){
     }else{
     }else{
         laDesignLayout(nw, "Empty Layout");
         laDesignLayout(nw, "Empty Layout");
     }
     }
+    laStartWindow(nw);
     laRedrawAllWindows();
     laRedrawAllWindows();
 
 
     return LA_FINISHED;
     return LA_FINISHED;
@@ -1302,11 +1302,12 @@ int la_ProcessBlockEvent(laOperator *a, laBlock *b, laEvent *e){
                     LT = RT;
                     LT = RT;
                 }
                 }
             }elif (e->Type == LA_MOUSEMOVE){
             }elif (e->Type == LA_MOUSEMOVE){
-                if (abs(e->x - uid->LastX) > 30 || abs(e->y - uid->LastY) > 30){
+                if (abs(e->x - uid->LastX) > LA_RH || abs(e->y - uid->LastY) > LA_RH){
                     if (MAIN.CurrentWindow->CurrentLayout->ClickedPanel){
                     if (MAIN.CurrentWindow->CurrentLayout->ClickedPanel){
                         l = MAIN.CurrentWindow->CurrentLayout;
                         l = MAIN.CurrentWindow->CurrentLayout;
                         l->DropToBlock = b;
                         l->DropToBlock = b;
                         l->DropLocation = la_DetectBlockDropLocation(b, e->x, e->y);
                         l->DropLocation = la_DetectBlockDropLocation(b, e->x, e->y);
+                        laRefreshWindow();
                     }
                     }
                 }
                 }
             }elif (e->Type == LA_L_MOUSE_UP){
             }elif (e->Type == LA_L_MOUSE_UP){
@@ -1341,13 +1342,13 @@ int la_ProcessBlockEvent(laOperator *a, laBlock *b, laEvent *e){
                 return 0;
                 return 0;
             }
             }
         }else{
         }else{
-            b->OnButton=1;Ret=0;
-            if(laIsInBlockBotton1(b, e->x, e->y)){ b->OnButton=2; if(e->Type==LA_L_MOUSE_DOWN){laUnfoldBlockTitle(b);Executed=1;Ret=1;} }
-            elif(laIsInBlockBotton2(b, e->x, e->y)){ b->OnButton=2; if(e->Type==LA_L_MOUSE_DOWN){laMaximizeBlock(b);Executed=1;Ret=1;} }
+            if(!b->OnButton){ b->OnButton=1; laRefreshWindow(); } Ret=0;
+            if(laIsInBlockBotton1(b, e->x, e->y)){ if(b->OnButton!=2){b->OnButton=2;laRefreshWindow();} if(e->Type==LA_L_MOUSE_DOWN){laUnfoldBlockTitle(b);Executed=1;Ret=1;} }
+            elif(laIsInBlockBotton2(b, e->x, e->y)){ if(b->OnButton!=2){b->OnButton=2;laRefreshWindow();}  if(e->Type==LA_L_MOUSE_DOWN){laMaximizeBlock(b);Executed=1;Ret=1;} }
         }
         }
 
 
         if (Executed){
         if (Executed){
-            b->CurrentPanel->Refresh |= LA_TAG_RECALC;
+            laRecalcPanel(b->CurrentPanel);
             la_RecalcBlockRecursive(b, b->X, b->Y, b->W, b->H);
             la_RecalcBlockRecursive(b, b->X, b->Y, b->W, b->H);
         }
         }
 
 
@@ -1356,7 +1357,7 @@ int la_ProcessBlockEvent(laOperator *a, laBlock *b, laEvent *e){
         }
         }
         return Ret;
         return Ret;
     }else{
     }else{
-        b->OnButton=0;
+        if(b->OnButton){b->OnButton=0;laRefreshWindow();} 
     }
     }
     return 0;
     return 0;
 }
 }
@@ -1365,15 +1366,15 @@ int la_ProcessBlockEdgeEvent(laOperator *WindowAct, laLayout *l, laBlock *b, laE
     laWindow *w = WindowAct->Instance;
     laWindow *w = WindowAct->Instance;
     if (e->Type == LA_MOUSEMOVE && ob && l->MovingBlock && l->IsMoving){
     if (e->Type == LA_MOUSEMOVE && ob && l->MovingBlock && l->IsMoving){
         if (ob->Vertical) ob->SplitRatio = (real)(e->y - ob->Y) / (real)(ob->H);
         if (ob->Vertical) ob->SplitRatio = (real)(e->y - ob->Y) / (real)(ob->H);
-        else
-            ob->SplitRatio = (real)(e->x - ob->X) / (real)(ob->W);
+        else ob->SplitRatio = (real)(e->x - ob->X) / (real)(ob->W);
         la_RecalcBlockRecursive(ob, ob->X, ob->Y, ob->W, ob->H);
         la_RecalcBlockRecursive(ob, ob->X, ob->Y, ob->W, ob->H);
-        if (ob->B1->CurrentPanel) ob->B1->CurrentPanel->Refresh |= LA_TAG_RECALC;
-        if (ob->B2->CurrentPanel) ob->B2->CurrentPanel->Refresh |= LA_TAG_RECALC;
+        if (ob->B1->CurrentPanel) laRecalcPanel(ob->B1->CurrentPanel);
+        if (ob->B2->CurrentPanel) laRecalcPanel(ob->B2->CurrentPanel);
         return 1;
         return 1;
     }
     }
     if (ob = la_OnBlockSeperator(b, e)){
     if (ob = la_OnBlockSeperator(b, e)){
         ob->B1->OnButton=ob->B2->OnButton=0;
         ob->B1->OnButton=ob->B2->OnButton=0;
+        if(l->MovingBlock!=ob){ laRefreshWindow(); }
         l->MovingBlock = ob; laSetWindowCursor(ob->Vertical?LA_UP_AND_DOWN:LA_LEFT_AND_RIGHT);
         l->MovingBlock = ob; laSetWindowCursor(ob->Vertical?LA_UP_AND_DOWN:LA_LEFT_AND_RIGHT);
         if (e->Type == LA_L_MOUSE_DOWN){
         if (e->Type == LA_L_MOUSE_DOWN){
             l->IsMoving = 1;
             l->IsMoving = 1;
@@ -1385,7 +1386,7 @@ int la_ProcessBlockEdgeEvent(laOperator *WindowAct, laLayout *l, laBlock *b, laE
         }
         }
         return 1;
         return 1;
     }
     }
-    if(l->MovingBlock){ l->MovingBlock = 0; laSetWindowCursor(LA_ARROW); }
+    if(l->MovingBlock){ l->MovingBlock = 0; laRefreshWindow(); laSetWindowCursor(LA_ARROW); }
     return 0;
     return 0;
 }
 }
 
 
@@ -1494,6 +1495,7 @@ int OPMOD_Window(laOperator *a, laEvent *e){
         if (Recieve){
         if (Recieve){
             la_ClearDockingTarget(); l->DropToBlock = Recieve;
             la_ClearDockingTarget(); l->DropToBlock = Recieve;
             l->DropLocation = la_DetectBlockDropLocation(Recieve, e->x, e->y);
             l->DropLocation = la_DetectBlockDropLocation(Recieve, e->x, e->y);
+            laRefreshWindow();
         }else{
         }else{
             MAIN.CurrentWindow->CurrentLayout->DropToBlock = 0;
             MAIN.CurrentWindow->CurrentLayout->DropToBlock = 0;
         }
         }
@@ -1518,8 +1520,7 @@ int OPMOD_Window(laOperator *a, laEvent *e){
             return LA_RUNNING;
             return LA_RUNNING;
         }
         }
         if(e->y>LA_2RH && e->x>LA_2RH){ if(!uid->Dragging)laRequestDelayEvent(0.5); uid->Dragging=1; }
         if(e->y>LA_2RH && e->x>LA_2RH){ if(!uid->Dragging)laRequestDelayEvent(0.5); uid->Dragging=1; }
-        if(e->Type==LA_TIME_DELAY){
-            laHideMenuBar(); }
+        if(e->Type==LA_TIME_DELAY){ laHideMenuBar(); }
     }else{
     }else{
         if(MAIN.PendingSplash){
         if(MAIN.PendingSplash){
             laSetOperatorLocalizer(MAIN.PendingSplash);
             laSetOperatorLocalizer(MAIN.PendingSplash);
@@ -1532,6 +1533,7 @@ int OPMOD_Window(laOperator *a, laEvent *e){
         if (la_ProcessBlockEdgeEvent(a, w->CurrentLayout, RootBlock, e)) return LA_RUNNING;
         if (la_ProcessBlockEdgeEvent(a, w->CurrentLayout, RootBlock, e)) return LA_RUNNING;
 
 
         b = w->MaximizedBlock?w->MaximizedBlock:laDetectBlockRecursive(w->CurrentLayout->FirstBlock, e->x, e->y);
         b = w->MaximizedBlock?w->MaximizedBlock:laDetectBlockRecursive(w->CurrentLayout->FirstBlock, e->x, e->y);
+        laClearBlockButtonRecursive(RootBlock,b);
         if (b && la_ProcessBlockEvent(a, b, e)) return LA_RUNNING;
         if (b && la_ProcessBlockEvent(a, b, e)) return LA_RUNNING;
         
         
         for (p = w->Panels.pFirst; p; p = p->Item.pNext){
         for (p = w->Panels.pFirst; p; p = p->Item.pNext){
@@ -1626,7 +1628,7 @@ int OPMOD_Panel(laOperator *a, laEvent *e){
     laListHandle Locals = {0};
     laListHandle Locals = {0};
     int RET=LA_RUNNING|(p->IsMenuPanel?0:LA_PASS_ON);
     int RET=LA_RUNNING|(p->IsMenuPanel?0:LA_PASS_ON);
 
 
-    if(MAIN.DockingPanel){return LA_FINISHED; }
+    if(MAIN.DockingPanel){ return LA_FINISHED; }
 
 
     if (!p->Show || (!laIsInPanel(p, x, y) && !uid->TargetIndexVali)){
     if (!p->Show || (!laIsInPanel(p, x, y) && !uid->TargetIndexVali)){
         if(p->CloseWhenMovedOut==2){
         if(p->CloseWhenMovedOut==2){
@@ -1635,7 +1637,8 @@ int OPMOD_Panel(laOperator *a, laEvent *e){
             }
             }
             return LA_RUNNING;
             return LA_RUNNING;
         }
         }
-        p->ShowCorner=0; laSetWindowCursor(LA_ARROW); return LA_FINISHED_PASS;
+        if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); }
+        return LA_FINISHED_PASS;
     }
     }
 
 
     int NoPrimaryUI=(p==MAIN.CurrentWindow->MaximizedUiPanel);
     int NoPrimaryUI=(p==MAIN.CurrentWindow->MaximizedUiPanel);
@@ -1684,14 +1687,15 @@ int OPMOD_Panel(laOperator *a, laEvent *e){
     }
     }
     lstClearPointer(&Locals);
     lstClearPointer(&Locals);
     
     
-    if (p->Mode && e->Type&LA_MOUSE_EVENT && !uid->TargetIndexVali && !p->IsMenuPanel){ p->ShowCorner=0;
-        if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2){ if(!a->Item.pPrev){ p->ShowCorner=1; laSetWindowCursor(LA_CORNER); }
+    if (p->Mode && e->Type&LA_MOUSE_EVENT && !uid->TargetIndexVali && !p->IsMenuPanel){
+        if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2){
+            if((!a->Item.pPrev) && (!p->ShowCorner)){ p->ShowCorner=1; laSetWindowCursor(LA_CORNER);  laRefreshWindow(); }
             if(e->Type==LA_L_MOUSE_DOWN){ uid->TargetIndexVali = 2; uid->LastX=e->x;uid->LastY=e->y; }
             if(e->Type==LA_L_MOUSE_DOWN){ uid->TargetIndexVali = 2; uid->LastX=e->x;uid->LastY=e->y; }
             return LA_RUNNING;
             return LA_RUNNING;
         }else{
         }else{
+            if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); }
             if(e->Type==LA_L_MOUSE_DOWN){  uid->TargetIndexVali = 1; uid->LastX=e->x;uid->LastY=e->y; return LA_RUNNING; }
             if(e->Type==LA_L_MOUSE_DOWN){  uid->TargetIndexVali = 1; uid->LastX=e->x;uid->LastY=e->y; return LA_RUNNING; }
         }
         }
-        if(!p->ShowCorner){ laSetWindowCursor(LA_ARROW); }
     }
     }
 
 
     if (e->Type == LA_MOUSEMOVE){
     if (e->Type == LA_MOUSEMOVE){
@@ -1847,7 +1851,9 @@ int OPMOD_ModalPanel(laOperator *a, laEvent *e){
         return LA_FINISHED_PASS;
         return LA_FINISHED_PASS;
     }
     }
 
 
-    if (!laIsInPanel(p, e->x, e->y) && !uid->TargetIndexVali){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); return LA_RUNNING; }
+    if (!laIsInPanel(p, e->x, e->y) && !uid->TargetIndexVali){ 
+        if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); } return LA_RUNNING; 
+    }
 
 
     if(p->PanelTemplate && laKeyMapExecuteEvent(a, &p->PanelTemplate->KeyMap, e)) return LA_RUNNING_PASS;
     if(p->PanelTemplate && laKeyMapExecuteEvent(a, &p->PanelTemplate->KeyMap, e)) return LA_RUNNING_PASS;
 
 
@@ -1881,8 +1887,9 @@ int OPMOD_ModalPanel(laOperator *a, laEvent *e){
     lstClearPointer(&Locals);
     lstClearPointer(&Locals);
 
 
     int insize=0; if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2){ insize=1;
     int insize=0; if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2){ insize=1;
-        if(!a->Item.pPrev) p->ShowCorner=1; }else{p->ShowCorner=0; laSetWindowCursor(LA_ARROW); }
-    if(!a->Item.pPrev) p->ShowCorner=1;    if (e->Type == LA_L_MOUSE_DOWN){
+        if((!a->Item.pPrev) && (!p->ShowCorner)){ p->ShowCorner=1; laSetWindowCursor(LA_CORNER); laRefreshWindow(); }
+             }else{ if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); } }
+    if (e->Type == LA_L_MOUSE_DOWN){
         uid->LastX = e->x;
         uid->LastX = e->x;
         uid->LastY = e->y;
         uid->LastY = e->y;
         if(insize){ uid->TargetIndexVali = 2; laSetWindowCursor(LA_CORNER); }
         if(insize){ uid->TargetIndexVali = 2; laSetWindowCursor(LA_CORNER); }

+ 12 - 6
resources/la_properties.c

@@ -261,7 +261,7 @@ int laget_PropertySubContainerIconID(laProp *p){
     return p->SubProp->IconID;
     return p->SubProp->IconID;
 }
 }
 
 
-int laget_TrashItemInstance(void *a){
+void* laget_TrashItemInstance(void *a){
     return a;
     return a;
 }
 }
 
 
@@ -292,7 +292,6 @@ void *laget_NextHiddenPanel(laPanel* p, void* unused_iter){
 void laset_WindowHiddenPanel(laWindow *window, laPanel* p){
 void laset_WindowHiddenPanel(laWindow *window, laPanel* p){
     laShowPanelWithExpandEffect(p);
     laShowPanelWithExpandEffect(p);
     laPopPanel(p);
     laPopPanel(p);
-    return 0;
 }
 }
 void laget_PanelTitle(laPanel *p, char *result){
 void laget_PanelTitle(laPanel *p, char *result){
     strCopyFull(result, p->Title->Ptr);
     strCopyFull(result, p->Title->Ptr);
@@ -369,6 +368,9 @@ void laset_WindowActiveLayout(laWindow *w, laLayout *l, int UNUSED_State){
     laRenameWindow(w, l->ID->Ptr);
     laRenameWindow(w, l->ID->Ptr);
     laRedrawCurrentWindow();
     laRedrawCurrentWindow();
 }
 }
+void* laget_WindowActiveLayout(laWindow *w, void* unused){
+    return w->CurrentLayout;
+}
 //void laget_PanelSnappingTrueFalse(laPanel* p, int* result) {
 //void laget_PanelSnappingTrueFalse(laPanel* p, int* result) {
 //	result[0] = p->SL > 0 ? 1 : 0;
 //	result[0] = p->SL > 0 ? 1 : 0;
 //	result[1] = p->SR > 0 ? 1 : 0;
 //	result[1] = p->SR > 0 ? 1 : 0;
@@ -647,8 +649,9 @@ void lapost_Panel(laPanel *p){
 
 
     la_EnsurePanelExtras(p);
     la_EnsurePanelExtras(p);
 
 
-    p->Refresh = LA_TAG_RECALC;
+    laRecalcPanel(p);
     p->FrameDistinguish = 100;
     p->FrameDistinguish = 100;
+    if(p->IsMenuPanel || p->Block) p->Show=1;
 
 
     laUiTemplate* uit=p->PanelTemplate;
     laUiTemplate* uit=p->PanelTemplate;
     if(uit&&uit->PropFunc){ uit->PropFunc(p); }
     if(uit&&uit->PropFunc){ uit->PropFunc(p); }
@@ -660,6 +663,9 @@ void lapost_Panel(laPanel *p){
     //if(p->Title) p->TitleWidth = tnsStringGetWidth(transLate(p->Title->Ptr), 0, 0);
     //if(p->Title) p->TitleWidth = tnsStringGetWidth(transLate(p->Title->Ptr), 0, 0);
     XSync(MAIN.dpy,0);
     XSync(MAIN.dpy,0);
 }
 }
+void lapost_Block(laBlock *b){
+    la_AssignBlockPP(b);
+}
 void lapost_UserPreferences(void* unused){
 void lapost_UserPreferences(void* unused){
     //MAIN.ScaledUiRowHeight=MAIN.UiRowHeight;
     //MAIN.ScaledUiRowHeight=MAIN.UiRowHeight;
     //tnsInvalidateFontCache();
     //tnsInvalidateFontCache();
@@ -764,7 +770,7 @@ void tnstouched_Object(tnsObject *o, int hint){
 int tnsget_MeshObjectVertSize(tnsMeshObject* o){ return o->totv*sizeof(tnsVert);/*can't use maxv*/ }
 int tnsget_MeshObjectVertSize(tnsMeshObject* o){ return o->totv*sizeof(tnsVert);/*can't use maxv*/ }
 int tnsget_MeshObjectEdgeSize(tnsMeshObject* o){ return o->tote*sizeof(tnsEdge);/*can't use maxv*/ }
 int tnsget_MeshObjectEdgeSize(tnsMeshObject* o){ return o->tote*sizeof(tnsEdge);/*can't use maxv*/ }
 void* tnsget_MeshObjectFaceRaw(tnsMeshObject* o, int* r_size, int* r_is_copy){
 void* tnsget_MeshObjectFaceRaw(tnsMeshObject* o, int* r_size, int* r_is_copy){
-    if(o->Mode==TNS_MESH_EDIT_MODE) return;
+    if(o->Mode==TNS_MESH_EDIT_MODE) return 0;
     int* arr=0; int next=0,max=0; int i=0;
     int* arr=0; int next=0,max=0; int i=0;
     arrEnsureLength(&arr, i, &max, sizeof(int));
     arrEnsureLength(&arr, i, &max, sizeof(int));
     arr[i]=o->totf; i++;
     arr[i]=o->totf; i++;
@@ -1154,7 +1160,7 @@ void la_RegisterInternalProps(){
 
 
         p = laAddPropertyContainer("ui_window", "Window Node", "Property Container For A System Window", 0,0, sizeof(laWindow), lapost_Window, lapostim_Window,1);{
         p = laAddPropertyContainer("ui_window", "Window Node", "Property Container For A System Window", 0,0, sizeof(laWindow), lapost_Window, lapostim_Window,1);{
             laAddStringProperty(p, "title", "Title", "The Title/Name Of A Panel", 0,0,0,0,1, offsetof(laWindow, Title), 0,0,0,0,LA_AS_IDENTIFIER);
             laAddStringProperty(p, "title", "Title", "The Title/Name Of A Panel", 0,0,0,0,1, offsetof(laWindow, Title), 0,0,0,0,LA_AS_IDENTIFIER);
-            laAddSubGroup(p, "layouts", "Layouts", "Layout List Of The Whole Window", "ui_layout",0,0,0,offsetof(laWindow, CurrentLayout), laget_WindowFirstLayout, 0,laget_ListNext, 0,0,laset_WindowActiveLayout, offsetof(laWindow, Layouts), 0);
+            laAddSubGroup(p, "layouts", "Layouts", "Layout List Of The Whole Window", "ui_layout",0,0,0,offsetof(laWindow, CurrentLayout), laget_WindowFirstLayout, laget_WindowActiveLayout,laget_ListNext, 0,0,laset_WindowActiveLayout, offsetof(laWindow, Layouts), 0);
             _LA_PROP_PANEL = laAddSubGroup(p, "panels", "Panels", "Panel list of this window", "ui_panel",0,0,0,-1,laget_SavePanel,0,lagetnext_SavePanel,0,0,0,offsetof(laWindow, Panels), 0);
             _LA_PROP_PANEL = laAddSubGroup(p, "panels", "Panels", "Panel list of this window", "ui_panel",0,0,0,-1,laget_SavePanel,0,lagetnext_SavePanel,0,0,0,offsetof(laWindow, Panels), 0);
             la_UDFAppendSharedTypePointer("_LA_PROP_PANEL", _LA_PROP_PANEL);
             la_UDFAppendSharedTypePointer("_LA_PROP_PANEL", _LA_PROP_PANEL);
             laAddSubGroup(p, "maximized_block", "Maximized Block", "Maximized block in this window", "ui_block",0,0,0,offsetof(laWindow, MaximizedBlock), 0,0,0,0,0,0,0,LA_UDF_REFER|LA_UDF_IGNORE);
             laAddSubGroup(p, "maximized_block", "Maximized Block", "Maximized block in this window", "ui_block",0,0,0,offsetof(laWindow, MaximizedBlock), 0,0,0,0,0,0,0,LA_UDF_REFER|LA_UDF_IGNORE);
@@ -1177,7 +1183,7 @@ void la_RegisterInternalProps(){
 
 
         // UI LAYOUT ========================================================================================
         // UI LAYOUT ========================================================================================
 
 
-        p = laAddPropertyContainer("ui_block", "Layout Node", "Property Container For Single Layout", 0,laui_LayoutListItem, sizeof(laBlock), 0,0,1);{
+        p = laAddPropertyContainer("ui_block", "Ui Block", "Property container for single ui block", 0,0, sizeof(laBlock), lapost_Block,0,1);{
             laAddIntProperty(p, "location", "Location", "Block Location", 0,"X,Y", "px", 0,0,1, 0,0,offsetof(laBlock, X), 0,0,2, 0,0,0,0,0,0,0,LA_READ_ONLY);
             laAddIntProperty(p, "location", "Location", "Block Location", 0,"X,Y", "px", 0,0,1, 0,0,offsetof(laBlock, X), 0,0,2, 0,0,0,0,0,0,0,LA_READ_ONLY);
             laAddIntProperty(p, "size", "Size", "Block Size", 0,"W,H", "px", 0,0,1, 0,0,offsetof(laBlock, W), 0,0,2, 0,0,0,0,0,0,0,LA_READ_ONLY);
             laAddIntProperty(p, "size", "Size", "Block Size", 0,"W,H", "px", 0,0,1, 0,0,offsetof(laBlock, W), 0,0,2, 0,0,0,0,0,0,0,LA_READ_ONLY);
             laAddFloatProperty(p, "split_ratio", "Split Ratio", "Split Ratio On Two Subs", 0,0,0,1, 0,0.05, 0.5, 0,offsetof(laBlock, SplitRatio), 0,0,0,0,0,0,0,0,0,0,0);
             laAddFloatProperty(p, "split_ratio", "Split Ratio", "Split Ratio On Two Subs", 0,0,0,1, 0,0.05, 0.5, 0,offsetof(laBlock, SplitRatio), 0,0,0,0,0,0,0,0,0,0,0);

+ 0 - 4
resources/la_templates.c

@@ -149,10 +149,6 @@ void laui_IdentifierOnly(laUiList *uil, laPropPack *This, laPropPack *OP_UNUSED,
     laShowItemFull(uil, c, This, "identifier", LA_WIDGET_STRING_PLAIN,0, 0, 0);
     laShowItemFull(uil, c, This, "identifier", LA_WIDGET_STRING_PLAIN,0, 0, 0);
 }
 }
 
 
-void laui_SubShow(laPropPack *pp){
-    if (laGetInt(pp) & LA_PROP_SUB) return 1;
-    return 0;
-}
 void laRebuildPathRecursive(laProp *p, char *buf){
 void laRebuildPathRecursive(laProp *p, char *buf){
     if (p->Container){
     if (p->Container){
         laRebuildPathRecursive(p->Container, buf);
         laRebuildPathRecursive(p->Container, buf);

+ 3 - 3
resources/la_widgets_viewers.c

@@ -681,7 +681,7 @@ int OPMOD_Canvas(laOperator *a, laEvent *e){
     int px = e->x, py = e->y;
     int px = e->x, py = e->y;
 
 
     if (!laIsInUiItem(ui, e->x, e->y) && !ex->Dragging){
     if (!laIsInUiItem(ui, e->x, e->y) && !ex->Dragging){
-        ex->OnX = INT_MAX; ex->OnY = INT_MAX; ui->State=LA_UI_NORMAL;
+        ex->OnX = INT_MAX; ex->OnY = INT_MAX; if(ui->State!=LA_UI_NORMAL){ ui->State=LA_UI_NORMAL; laRedrawCurrentPanel(); }
         return LA_FINISHED_PASS;
         return LA_FINISHED_PASS;
     }
     }
 
 
@@ -711,7 +711,7 @@ int OPMOD_Canvas(laOperator *a, laEvent *e){
             }
             }
         }
         }
         int state=VeryClose?(btn?LA_UI_EDITING:LA_UI_ACTIVE):LA_UI_NORMAL;
         int state=VeryClose?(btn?LA_UI_EDITING:LA_UI_ACTIVE):LA_UI_NORMAL;
-        if(state!=ui->State){ ui->State=state;laRedrawCurrentPanel(); }
+        if(state!=ui->State){ ui->State=state; laRedrawCurrentPanel(); }
     }
     }
     //laLocalToPanel(a, &px, &py);
     //laLocalToPanel(a, &px, &py);
 
 
@@ -938,7 +938,7 @@ void *tnsget_detached_FirstScene(void *UNUSED1, void *UNUSED2);
 
 
 void laset_CanvasSelectMode(laCanvasExtra* ex, int mode){
 void laset_CanvasSelectMode(laCanvasExtra* ex, int mode){
     ex->SelectMode=mode; laUiItem* ui=ex->ParentUi;
     ex->SelectMode=mode; laUiItem* ui=ex->ParentUi;
-    tnsObject*root=ui?ui->PP.EndInstance:0; if(!root) return 0;
+    tnsObject*root=ui?ui->PP.EndInstance:0; if(!root) return;
     if(root->Active){ if(root->Active->Type==TNS_OBJECT_MESH && ((tnsMeshObject*)root->Active)->Mode==TNS_MESH_EDIT_MODE){ tnsMMeshEnsureSelection(root->Active, mode); } }
     if(root->Active){ if(root->Active->Type==TNS_OBJECT_MESH && ((tnsMeshObject*)root->Active)->Mode==TNS_MESH_EDIT_MODE){ tnsMMeshEnsureSelection(root->Active, mode); } }
 }
 }