*/}}
Browse Source

saver improvements

YimingWu 3 weeks ago
parent
commit
0e39127dbb
7 changed files with 29 additions and 12 deletions
  1. 2 1
      la_data.c
  2. 1 1
      la_data.h
  3. 5 5
      la_kernel.c
  4. 5 1
      resources/la_operators.c
  5. 4 2
      resources/la_templates.c
  6. 2 1
      resources/la_translations.c
  7. 10 1
      resources/la_widgets.c

+ 2 - 1
la_data.c

@@ -3950,11 +3950,12 @@ void laClearManagedUDF(){
     while(m=MAIN.ManagedUDFs.pFirst){ laStopManageUDF(m); }
 }
 
-void laSaveManagedUDF(){
+void laSaveManagedUDF(int ModifiedOnly){
     laRegisterModifications(0,0,0,1);
     if(MAIN.PreSave){ MAIN.PreSave(); }
     for(laManagedUDF* m=MAIN.ManagedUDFs.pFirst;m;m=m->Item.pNext){
         if(!m->udf) continue;
+        if(ModifiedOnly && !m->udf->Modified){ continue; }
         if(m->udf->PropsToOperate.pFirst){ laPackUDF(m->udf, 1, 1); }
         laCloseUDF(m->udf);// just in case
     }

+ 1 - 1
la_data.h

@@ -1009,7 +1009,7 @@ void la_MakeDummyManagedUDF();
 void laStopManageUDF(laManagedUDF* m);
 void laClearManagedUDF();
 
-void laSaveManagedUDF();
+void laSaveManagedUDF(int ModifiedOnly);
 
 void laPropagateUDF(laPropContainer* pc, void* inst, int force);
 

+ 5 - 5
la_kernel.c

@@ -6351,8 +6351,8 @@ laUiList *la_DetectUiListRecursive(laUiList *uil, int x, int y, int LimH,
 
     if (y > LimH) return uil;
 
-    if (/*uil->ScrollerShownV && */ laIsInBound(x, y, uil->R, uil->R+LA_SCROLL_W+4, uil->U, uil->B) ||
-        /*uil->ScrollerShownH && */ laIsInBound(x, y, uil->L, uil->R, uil->B, uil->B+LA_SCROLL_W+4)){
+    if ((uil->ScrollerShownV && laIsInBound(x, y, uil->R, uil->R+LA_SCROLL_W+4, uil->U, uil->B)) ||
+        (uil->ScrollerShownH && laIsInBound(x, y, uil->L, uil->R, uil->B, uil->B+LA_SCROLL_W+4))){
         if (ScrollUil) *ScrollUil = uil; /* if (ParentUi)*ParentUi = uil;*/
         return uil;
     }
@@ -6407,15 +6407,15 @@ laUiList *la_DetectUiListRecursive(laUiList *uil, int x, int y, int LimH,
         }
 
         if ((ui->Type == _LA_UI_FIXED_GROUP || ui->Type == _LA_UI_TAB) && (ui->Subs.pFirst || ui->Page)){
-            if (ui->Page->HeightCoeff) CPB = ui->B+ui->Page->PanY;
-            else CPB = ui->Page->B+ui->Page->PanY;
+            if (ui->Page->HeightCoeff) CPB = ui->B;
+            else CPB = ui->Page->B;
             if (ui->Page->ScrollerShownV && laIsInBound(x, y, ui->R - LA_SCROLL_W - bt->RP*2, ui->R, ui->Page->U, CPB)){
                 if (ScrollUil) *ScrollUil = ui->Page; if (ParentUi) *ParentUi = ui;
             }elif (ui->Page->ScrollerShownH && laIsInBound(x, y, ui->Page->L, ui->Page->R, ui->B - LA_SCROLL_W - bt->BP*2, ui->B)){
                 if (ScrollUil) *ScrollUil = ui->Page; if (ParentUi) *ParentUi = ui;
             }elif (laIsInBound(x, y, ui->Page->L, ui->Page->R, ui->Page->U, CPB)){
                 if (ParentUi) *ParentUi = ui; 
-                if (tuil = la_DetectUiListRecursive(ui->Page, x, y, CPB, ParentUi, ScrollUil, ContainerParent, InToContainerUI, Exception)) return tuil;
+                if (tuil = la_DetectUiListRecursive(ui->Page, x, y, CPB+ui->Page->PanY, ParentUi, ScrollUil, ContainerParent, InToContainerUI, Exception)) return tuil;
             }
         }
 

+ 5 - 1
resources/la_operators.c

@@ -750,7 +750,8 @@ int OPINV_ManagedSave(laOperator *a, laEvent *e){
         if(strSame(strGetArgumentString(a->ExtraInstructionsP, "quiet"),"true")){
             int empty=0; laRegisterModifications(0,1,&empty,0);
             if(strSame(strGetArgumentString(a->ExtraInstructionsP, "ignore_unassigned"),"true")) empty=0;
-            if(!empty){ laSaveManagedUDF(); return LA_FINISHED; }
+            int modified_only=0; if(strSame(strGetArgumentString(a->ExtraInstructionsP, "modified_only"),"true")) modified_only=1;
+            if(!empty){ laSaveManagedUDF(modified_only); return LA_FINISHED; }
         }
         if(strSame(strGetArgumentString(a->ExtraInstructionsP, "on_exit"),"true")){ OnExit=1; }
     }
@@ -1912,6 +1913,9 @@ int OPMOD_Panel(laOperator *a, laEvent *e){
         if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); }
         return LA_FINISHED_PASS;
     }
+    if(((e->type==LA_KEY_DOWN && e->key==LA_KEY_ESCAPE)||(e->type==LA_R_MOUSE_DOWN)) && p->CloseWhenMovedOut==2){
+        la_StopUiOperatorService(p); laDestroySinglePanel(p,0); return LA_FINISHED;
+    }
 
     int NoPrimaryUI=(p==MAIN.CurrentWindow->MaximizedUiPanel);
 

+ 4 - 2
resources/la_templates.c

@@ -1158,7 +1158,8 @@ void laui_ManagedSavePanel(laUiList *uil, laPropPack *Base, laPropPack *Operator
         laShowItemFull(uil,c,0,"LA_cancel",0,"text=Discard And Quit;feedback=DISCARD_AND_QUIT",0,0);
     }
     laShowSeparator(uil,c)->Expand=1;
-    laShowItemFull(uil,c,0,"LA_managed_save",0,"quiet=true;ignore_unassigned=true;text=Save All Modified;feedback=SAVE_MODIFIED",0,0);
+    laShowItemFull(uil,c,0,"LA_managed_save",0,"quiet=true;ignore_unassigned=true;text=Save All;feedback=SAVE_MODIFIED",0,0);
+    laShowItemFull(uil,c,0,"LA_managed_save",0,"quiet=true;ignore_unassigned=true;modified_only=true;text=Save Modified;feedback=SAVE_MODIFIED",0,0);
     laEndRow(uil,r);
 }
 
@@ -1558,7 +1559,8 @@ void laui_IdleDataManager(laUiList *uil, laPropPack *Base, laPropPack *Extra, la
     
     r=laBeginRow(uil,c,0,0);
     laShowSeparator(uil,c)->Expand=1;
-    laShowItemFull(uil,c,0,"LA_managed_save",0,"quiet=true;ignore_unassigned=true;text=Save All Modified",0,0);
+    laShowItemFull(uil,c,0,"LA_managed_save",0,"quiet=true;ignore_unassigned=true;text=Save All",0,0);
+    laShowItemFull(uil,c,0,"LA_managed_save",0,"quiet=true;ignore_unassigned=true;modified_only=true;text=Save Modified",0,0);
     laEndRow(uil,r);
 }
 void lauidetached_IdleDataManager(laPanel* p){

+ 2 - 1
resources/la_translations.c

@@ -213,7 +213,8 @@ static const char *entries[]={
 "Math","数学",
 "Comment","评论",
 "Values","数值",
-"Save All Modified","保存所有已修改",
+"Save Modified","保存已修改",
+"Save All","保存全部",
 "Transform","变换",
 "Switch","切换",
 "Mapper","映射",

+ 10 - 1
resources/la_widgets.c

@@ -3131,7 +3131,7 @@ int OPMOD_Collection(laOperator *a, laEvent *e) {
   }
   uil = la_DetectUiListRecursive(ToUil, lx, ly, 10000, 0, 0, 0, 0, 0);
   if (uil != ((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target) {
-    //printf("%d %d EXIT\n",((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target, uil);
+    //printf("%d %d EXITC\n",((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target, uil);
     return LA_FINISHED;
   }
 
@@ -3222,6 +3222,15 @@ int OPMOD_CollectionSelector(laOperator *a, laEvent *e){
         return LA_FINISHED;
     }
 
+    int lx = e->x, ly = e->y;
+    laUiList *ToUil =
+        a->ToPanel->MenuRefer ? a->ToPanel->MenuRefer : &a->ToPanel->UI;
+    laUiList* uil = la_DetectUiListRecursive(ToUil, lx, ly, 10000, 0, 0, 0, 0, 0);
+    if (uil != ((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target) {
+        //printf("%d %d EXIT\n",((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target, uil);
+        return LA_FINISHED;
+    }
+
     if (e->type == LA_TIME_IDLE && !ui->State && !NoTooltip){
         int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
         laPanel *p = laEnableIdlePanel(a->ToPanel, a, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);