*/}}
浏览代码

UI cleanups

YimingWu 4 月之前
父节点
当前提交
37fe027435
共有 6 个文件被更改,包括 42 次插入18 次删除
  1. 1 0
      la_interface.h
  2. 10 2
      la_kernel.c
  3. 5 2
      resources/la_operators.c
  4. 22 14
      resources/la_templates.c
  5. 2 0
      resources/la_translations_es-ES.c
  6. 2 0
      resources/la_translations_zh-hans.c

+ 1 - 0
la_interface.h

@@ -460,6 +460,7 @@ STRUCTURE(LA){
     int AppWidth,AppHeight;
     int AppReady,AppEnabled;
     int ContextRebindRequired;
+    int GotFilePermission;
     AAssetManager *AssetManager;
     char *InternalDataPath;
     char *ExternalDataPath;

+ 10 - 2
la_kernel.c

@@ -1310,11 +1310,12 @@ int laGetReadyWith(laInitArguments* ia){
     dpi = la_GetDPI(DefaultRootWindow(MAIN.dpy));
 #endif
 #ifdef LAGUI_ANDROID
-    dpi = 144;
+    dpi = 72;
+    
 #endif
     if((!dpi) || dpi<144){ dpi=144; } if(dpi>300){ dpi=300; }
     int UiSize=(int)(tnsLinearItp(16.0f,24.0f,tnsGetRatiod(96,144,dpi))+0.5);
-    
+
     MAIN.UiRowHeight = MAIN.ScaledUiRowHeight =UiSize;
     MAIN.UiScale=1;
     MAIN.MarginSize = 1;
@@ -1439,6 +1440,13 @@ int laGetReadyWith(laInitArguments* ia){
     logPrintNew("Initialization Completed\n");
     MAIN.InitDone=1;
 
+#ifdef LAGUI_ANDROID
+    MAIN.AutoSwitchColorSpace = 0;
+    MAIN.GotFilePermission = la_check_permission("android.permission.WRITE_EXTERNAL_STORAGE");
+#else
+    MAIN.AutoSwitchColorSpace = 1;
+#endif
+
     return 1;
 }
 int laGetReady(){

+ 5 - 2
resources/la_operators.c

@@ -381,8 +381,11 @@ laFileBrowser *la_FileBrowserInit(laOperator *a){
     bf=memAcquireSimple(sizeof(laBookmarkedFolder));
     strcpy(bf->Path,MAIN.InternalDataPath); strcpy(bf->Name,"Internal"); lstAppendItem(&fb->Bookmarks,bf);
 
-    if(!la_check_permission("android.permission.WRITE_EXTERNAL_STORAGE")){
-        la_request_permission("android.permission.WRITE_EXTERNAL_STORAGE");
+    if(!MAIN.GotFilePermission){
+        MAIN.GotFilePermission = la_check_permission("android.permission.WRITE_EXTERNAL_STORAGE");
+        if(!MAIN.GotFilePermission){
+            la_request_permission("android.permission.WRITE_EXTERNAL_STORAGE");
+        }
     }
 
 #else

+ 22 - 14
resources/la_templates.c

@@ -578,22 +578,25 @@ void laui_DefaultMenuBarActual(laUiList *uil, laPropPack *pp, laPropPack *actins
                 laShowItemFull(uil,c,0,"LA_switch_layout", 0, "icon=🡰;reverse=true;", 0, 0)->Flags|=LA_UI_FLAGS_ICON;
                 laShowItemFull(uil,c,0,"LA_switch_layout", 0, "icon=🡲;", 0,0)->Flags|=LA_UI_FLAGS_ICON;
                 laShowItem(uil, c, 0, "la.windows.layouts.identifier");
+#ifndef LAGUI_ANDROID
                 laShowItem(uil,c,0,"LA_new_window")->Flags|=LA_UI_FLAGS_ICON;
+#endif
             }laEndCondition(uil, ui);
         }laEndCondition(uil,mui);
 
         laUiItem* uc=laOnConditionThat(uil,c,laPropExpression(0,"la.user_preferences.enable_color_management"));{
 #ifdef LAGUI_ANDROID
         laEndRow(uil,mbb); mbb=laBeginRow(uil,c,0,0);
+        laShowItem(uil,c,0,"la.windows.output_color_space");
 #else
                 laShowSeparator(uil,c);
-#endif
                 laShowItemFull(uil,c,0,"la.user_preferences.auto_switch_color_space",0,"icon=A",0,0)->Flags|=LA_UI_FLAGS_ICON|LA_UI_FLAGS_CYCLE|LA_UI_FLAGS_HIGHLIGHT|LA_UI_FLAGS_NO_CONFIRM;
                 laUiItem* uc1=laOnConditionThat(uil,c,laPropExpression(0,"la.user_preferences.auto_switch_color_space"));{
                     laShowItem(uil,c,0,"la.windows.output_color_space")->Flags|=LA_UI_FLAGS_PLAIN;
                 }laElse(uil,uc1);{
                     laShowItem(uil,c,0,"la.windows.output_color_space");
                 }laEndCondition(uil, uc1);
+#endif
                 laShowItemFull(uil,c,0,"la.windows.output_show_overflow",0,"text=🟩;",0,0)->Flags|=LA_UI_FLAGS_NO_CONFIRM;
                 laShowItemFull(uil,c,0,"la.windows.output_proofing",0,0,0,0)->Flags|=LA_UI_FLAGS_CYCLE|LA_UI_FLAGS_ICON|LA_UI_FLAGS_HIGHLIGHT|LA_UI_FLAGS_NO_CONFIRM;
                 laShowItemFull(uil,c,0,"la.windows.use_composing",0,"text=☀",0,0)->Flags|=LA_UI_FLAGS_NO_CONFIRM;
@@ -1307,7 +1310,22 @@ void laui_UserPreference(laUiList *uil, laPropPack *Base, laPropPack *OperatorIn
             mcl = laLeftColumn(mc, 0);
             mcr = laRightColumn(mc, 0);
 
-            if(MAIN.PreferencePageDisplay){ MAIN.PreferencePageDisplay(muil,0,0,0,0); }
+            if(MAIN.PreferencePageDisplay){
+                MAIN.PreferencePageDisplay(muil,0,0,0,0); 
+                laShowSeparator(muil, mc);
+            }
+
+            laShowLabel(muil, mc, "Translation:", 0, 0);
+            laShowLabel(muil, mcl, "Enable Translation:", 0, 0);
+            laShowItemFull(muil, mcr, &UP->PP, "enable_translation",LA_WIDGET_ENUM_CYCLE,0,0,0);
+            b = laOnConditionThat(muil, mcl, laPropExpression(&UP->PP, "enable_translation"));{
+            laShowLabel(muil, mcl, "Language:", 0, 0);
+                laShowItemFull(muil, mcr, &UP->PP, "languages", LA_WIDGET_COLLECTION_SELECTOR, 0, 0, 0);
+                laShowItem(muil, mcl, 0, "LA_translation_dump");
+            }
+            laEndCondition(muil, b);
+
+            laShowSeparator(muil, mc);
 
             laShowLabel(muil, mc, "Interface:", 0, 0);
             laShowLabel(muil, mcl, "Row Height:", 0, 0);
@@ -1327,6 +1345,7 @@ void laui_UserPreference(laUiList *uil, laPropPack *Base, laPropPack *OperatorIn
             laShowItem(muil, mcl, &UP->PP, "color_picker_gamma");
             laShowItem(muil, mcr, &UP->PP, "enable_color_management");
 
+#ifndef LAGUI_ANDROID
             laUiItem* bb=laOnConditionThat(muil,mc,laPropExpression(&UP->PP,"enable_color_management"));{
                 laUiItem*bbr=laBeginRow(muil,mc,0,0);
                 laShowLabel(muil, mcl, "Per screen config:", 0, 0)->Expand=1;
@@ -1335,6 +1354,7 @@ void laui_UserPreference(laUiList *uil, laPropPack *Base, laPropPack *OperatorIn
                 laEndRow(muil,bbr);
                 laShowItemFull(muil, mc, &UP->PP, "screens",0,0,laui_Screen,0);
             }laEndCondition(muil,bb);
+#endif
 
             laShowSeparator(muil, mc);
 
@@ -1354,18 +1374,6 @@ void laui_UserPreference(laUiList *uil, laPropPack *Base, laPropPack *OperatorIn
             laShowLabel(muil, mc, "Floating Panel:", 0, 0);
             laShowItem(muil, mcl, &UP->PP, "floating_alpha");
             laShowItem(muil, mcr, &UP->PP, "solid_shadow_length");
-
-            laShowSeparator(muil, mc);
-
-            laShowLabel(muil, mc, "Translation:", 0, 0);
-            laShowLabel(muil, mcl, "Enable Translation:", 0, 0);
-            laShowItemFull(muil, mcr, &UP->PP, "enable_translation",LA_WIDGET_ENUM_CYCLE,0,0,0);
-            b = laOnConditionThat(muil, mcl, laPropExpression(&UP->PP, "enable_translation"));{
-            laShowLabel(muil, mcl, "Language:", 0, 0);
-                laShowItemFull(muil, mcr, &UP->PP, "languages", LA_WIDGET_COLLECTION_SELECTOR, 0, 0, 0);
-                laShowItem(muil, mcl, 0, "LA_translation_dump");
-            }
-            laEndCondition(muil, b);
         }
         
         muil = laAddTabPage(bracket, "Input");{

+ 2 - 0
resources/la_translations_es-ES.c

@@ -24,6 +24,8 @@
 #include "la_5.h"
 
 static const char *entries[]={
+"Performance Overlay", "Superposición de Rendimiento"
+"Menu","Menú",
 "☰ Menu","☰ Menú",
 "Remove this resource folder entry","Quita esta entrada de carpeta de recursos",
 "Confirm selection","Confirma selección",

+ 2 - 0
resources/la_translations_zh-hans.c

@@ -19,6 +19,8 @@
 #include "la_5.h"
 
 static const char *entries[]={
+"Performance Overlay","性能参数叠加",
+"Menu","菜单",
 "☰ Menu","☰ 菜单",
 "Remove this resource folder entry","删除该资源文件夹条目",
 "Confirm selection","确认选择",