*/}}
Explorar el Código

Saver/Reader cleanups

YimingWu hace 3 días
padre
commit
eb3ed9a303
Se han modificado 4 ficheros con 35 adiciones y 15 borrados
  1. 11 11
      la_data.c
  2. 3 2
      la_interface.h
  3. 20 1
      la_kernel.c
  4. 1 1
      resources/la_widgets.c

+ 11 - 11
la_data.c

@@ -772,7 +772,7 @@ laProp* laPropContainerManageable(laPropContainer* pc, int offset_of_dummy_list)
         laAddSubGroup(MAIN.SaverDummyContainer, "__file", "File", "The file this block came from/saves to", "managed_udf",
             0,LA_WIDGET_COLLECTION_SELECTOR,laui_ManagedUDFItem,-1,laget_InstanceUDF,laget_InstanceActiveUDF,laget_ListNext,laset_InstanceUDF,0,0,0,LA_UDF_REFER|LA_UDF_IGNORE);
     }
-    pc->SaverDummy=laAddSubGroup(pc,"__single_saver_dummy","Saver","Saver dummy","la_saver_dummy",0,0,0,-1,0,0,0,0,0,0,offset_of_dummy_list,LA_UDF_IGNORE);
+    pc->SaverDummy=laAddSubGroup(pc,"__single_saver_dummy","Saver","Saver dummy","la_saver_dummy",0,0,0,-1,0,0,0,0,0,0,offset_of_dummy_list,0);
     return pc->SaverDummy;
 }
 
@@ -3597,7 +3597,7 @@ int laExtractUDF(laUDF *udf, laManagedUDF* mUDF, int Mode){
     ma_device_stop(&MAIN.Audio->AudioDevice);
     if(MAIN.InitArgs.HasAudio) laSpinLock(&MAIN.Audio->AudioStatusLock);
 
-    MAIN.IsReadingUDF = 1;
+    MAIN.ReadingUDF = udf;
 
     la_ReadBuffer(udf, sizeof(LA_UDF_IDENTIFIER) - 1, Identifier);
 
@@ -3646,7 +3646,7 @@ int laExtractUDF(laUDF *udf, laManagedUDF* mUDF, int Mode){
     
     laHideProgress();
     
-    MAIN.IsReadingUDF = 0;
+    MAIN.ReadingUDF = 0;
 
     laUDFPropSegment* ps; while (ps = lstPopItem(&udf->PropsToOperate)){ strSafeDestroy(&ps->Path); FreeMem(ps); }
 
@@ -4132,14 +4132,14 @@ void la_ClearUDFRegistryAndFolders(){
 
 //==========================================================================[undo]
 
-void laPushDifferenceOnly(char* Description, u64bit hint){ if(MAIN.IsReadingUDF){ return; }
+void laPushDifferenceOnly(char* Description, u64bit hint){ if(MAIN.ReadingUDF){ return; }
     laDiff* d=memAcquire(sizeof(laDiff));
     lstAppendItem(&MAIN.Differences, d);
     if(MAIN.HeadDifference && Description) strSafeSet(&MAIN.HeadDifference->Description,Description);
     d->Hint=hint; MAIN.HeadDifference=d;
     laNotifyUsers("la.differences");
 }
-void laPushDifferences(char* Description, u64bit hint){ if(MAIN.IsReadingUDF){ return; }
+void laPushDifferences(char* Description, u64bit hint){ if(MAIN.ReadingUDF){ return; }
     if(MAIN.HeadDifference && (!MAIN.HeadDifference->Commands.pFirst) && (!MAIN.HeadDifference->CustomCommands.pFirst)) return;
     memFreeRemainingLeftNodes();
     laPushDifferenceOnly(Description,hint);
@@ -4815,12 +4815,12 @@ laDBProp* laFindStartingDBProp(laProp* p, void* Instance, laPropContainer* Insta
     }
     return 0;
 }
-void laRecordCustomDifferences(void* Data, laDiffCommandUndoF Undo, laDiffCommandRedoF Redo, laDiffCommandFreeF Free){ if(MAIN.IsReadingUDF){ return 0; }
+void laRecordCustomDifferences(void* Data, laDiffCommandUndoF Undo, laDiffCommandRedoF Redo, laDiffCommandFreeF Free){ if(MAIN.ReadingUDF){ return 0; }
     laDiffCommandCustom* dcc=memAcquire(sizeof(laDiffCommandCustom));
     dcc->Data=Data; dcc->Undo=Undo; dcc->Redo=Redo; dcc->Free=Free;
     lstAppendItem(&MAIN.HeadDifference->CustomCommands,dcc);
 }
-int laRecordDifferences(laPropPack* base, char* path){ if(MAIN.IsReadingUDF){ return 0; }
+int laRecordDifferences(laPropPack* base, char* path){ if(MAIN.ReadingUDF){ return 0; }
     laPropPack PP={0};
     if(!la_GetPropFromPath(&PP,base,path,0)) return 0;
     la_StepPropPack(&PP);
@@ -4841,7 +4841,7 @@ int laRecordDifferences(laPropPack* base, char* path){ if(MAIN.IsReadingUDF){ re
     la_FreePropStepCache(PP.Go);
     return success;
 }
-int laRecordInstanceDifferences(void* instance, const char* container){ if(MAIN.IsReadingUDF){ return 0; }
+int laRecordInstanceDifferences(void* instance, const char* container){ if(MAIN.ReadingUDF){ return 0; }
     laPropContainer* pc=la_ContainerLookup(container);
     if(!pc){ logPrintNew("Undo warning: No container named \"%s\"\n",container); return 0; }
     laDBInst* FromDBI=0;
@@ -4860,17 +4860,17 @@ int laRecordInstanceDifferences(void* instance, const char* container){ if(MAIN.
 
     return success;
 }
-void laRecordAndPush(laPropPack* base, char* path, char* description, uint64_t hint){ if(MAIN.IsReadingUDF){ return; }
+void laRecordAndPush(laPropPack* base, char* path, char* description, uint64_t hint){ if(MAIN.ReadingUDF){ return; }
     if(laRecordDifferences(base, path)){ laPushDifferences(description, hint); }
 }
-void laRecordAndPushProp(laPropPack* base, char* path){ if(MAIN.IsReadingUDF){ return; }
+void laRecordAndPushProp(laPropPack* base, char* path){ if(MAIN.ReadingUDF){ return; }
     char buf[256]={0};
     if(laRecordDifferences(base, path)){
         la_GetPropPackFullPath(base,&buf[strlen(buf)]);if(path){sprintf(&buf[strlen(buf)],"%s%s",base?".":"",path);}
         laPushDifferences(buf, 0);
     }
 }
-void laRecordEverythingAndPush(){ if(MAIN.IsReadingUDF){ return; }
+void laRecordEverythingAndPush(){ if(MAIN.ReadingUDF){ return; }
     for(laDBRecordedProp* rp=MAIN.DBRecordedProps.pFirst;rp;rp=rp->Item.pNext){
         laRecordAndPushProp(0, rp->OriginalPath->Ptr);
     }

+ 3 - 2
la_interface.h

@@ -501,8 +501,8 @@ STRUCTURE(LA){
     laAudio* Audio;
 
     int InitDone;
-    int IsReadingUDF;
     int SavePreferenceOnExit;
+    laUDF* ReadingUDF;
 
     laKeyMapper KeyMap;
 
@@ -1266,7 +1266,7 @@ STRUCTURE(laWidget){
 #define LA_UI_FLAGS_COLORFUL LA_UI_FLAGS_ICON
 
 #define LA_UI_FLAGS_TERMINAL_INPUT LA_UI_FLAGS_COLOR_SPACE_CLAY
-#define LA_UI_FLAGS_IMMEDIATE_INPUT LA_UI_FLAGS_CYCLE
+#define LA_UI_FLAGS_IMMEDIATE_INPUT LA_UI_FLAGS_MENU_FLOAT16
 
 #define LA_UI_FLAGS_MOMENTARY (LA_UI_FLAGS_CYCLE|LA_UI_FLAGS_NODE_CONTAINER)
 #define LA_UI_FLAGS_KNOB LA_UI_FLAGS_NODE_CONTAINER
@@ -2500,6 +2500,7 @@ laPanel *laDefineAndEnableMenuPanel(laPanel *Attachment, laOperator *a, laPropPa
 laPanel *laEnableOperatorPanel(laOperator *For, laPropPack *This, int X, int Y, int W, int H, int MaxW, int MaxH, int MinW, int MinH, int SnapL, int SnapR, int SnapT, int SnapB, laEvent *e);
 laPanel *laEnableYesNoPanel(laOperator *a, laPanel *Attachment, char *Title, char *Message, int X, int Y, int W, laEvent *e);
 laPanel *laEnableMessagePanel(laOperator *a, laPanel *Attachment, char *Title, char *Message, int X, int Y, int W, laEvent *e);
+laPanel *laEnableEmptyMessagePanel(laOperator *a, laPanel *Attachment, char *Title, int X, int Y, int W, laEvent *e);
 
 void laOperatorModalOver(laOperator* For);
 

+ 20 - 1
la_kernel.c

@@ -666,7 +666,7 @@ void la_DestroyWindow(laWindow *wnd){
 }
 
 void laRenameWindow(laWindow* wnd, char* name){
-    if((!wnd)||MAIN.IsReadingUDF) return;
+    if((!wnd)||MAIN.ReadingUDF) return;
     strSafeSet(&wnd->Title, name);
     if(!wnd->win) return;
 #ifdef LA_LINUX
@@ -4269,6 +4269,25 @@ laPanel *laEnableMessagePanel(laOperator *a, laPanel *Attachment, char *Title, c
     return p;
 }
 
+laPanel *laEnableEmptyMessagePanel(laOperator *a, laPanel *Attachment, char *Title, int X, int Y, int W, laEvent *e){
+    laPanel *p; int b; laUiList *uil; laColumn* col;
+    p = la_NewPanel(0, X, Y, W, 0, 1000, 0, 100, 0, 0, 0, 0, 0);
+    strSafeSet(&p->Title, Title);
+    p->BoundUi = 1;
+    p->Mode = LA_PANEL_FLOATING_TOP;
+    p->BT = &_LA_THEME_FLOATING_PANEL;
+    MAIN.ToPanel = p;
+
+    laui_DefaultOperatorPanelTitleBar(&p->TitleBar, &p->PP, &p->PropLinkPP, 0, 0);
+    uil = laPrepareUi(p); col = laFirstColumn(uil);
+
+    laShowPanelWithExpandEffect(p);
+    lstPushItem(&MAIN.CurrentWindow->Panels, p);
+    laSetOperatorLocalizer(p);
+    laInvokeUi(a, "LA_modal_panel_operator", e, p, 0, 1);
+    return p;
+}
+
 void laOperatorModalOver(laOperator* For){
     For->ModalOver = 1;
 }

+ 1 - 1
resources/la_widgets.c

@@ -486,7 +486,7 @@ int la_GetBoxOffset(laBoxedTheme* bt, int State){
 real* la_UiStateColorState(laBoxedTheme* bt, laUiItem* ui, int State){
     int flags = ui->Flags;
     if(flags&LA_UI_FLAGS_DISABLED){ return laThemeColor(bt, LA_BT_DISABLED); }
-    if(flags&LA_UI_WARNING){ return laAccentColor(LA_BT_WARNING); }
+    if(flags&LA_UI_FLAGS_WARNING){ return laAccentColor(LA_BT_WARNING); }
     if(flags&LA_UI_FLAGS_HIGHLIGHT){ return laAccentColor(LA_BT_ACTIVE); }
     return laThemeColor(bt, State);
 }