From da1718dca44e97e48049b1871fe0cba0d2640091 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 1 Nov 2018 11:31:45 +0000 Subject: [PATCH] app+: move its ini to IMG, ability to run it without /kolibrios/ mounted, translate ui git-svn-id: svn://kolibrios.org@7519 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 2 +- data/common/settings/app_plus.ini | 22 ++--- programs/cmm/app_plus/app_plus.c | 137 ++++++++++++++++++++---------- programs/system/cpu/trunk/cpu.asm | 4 +- 4 files changed, 108 insertions(+), 57 deletions(-) diff --git a/data/Tupfile.lua b/data/Tupfile.lua index c4381379f1..bf12f99afc 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -54,6 +54,7 @@ img_files = { {"NETWORK/TL_SYS_16.PNG", PROGS .. "/network/ftpc/tl_sys_16.png"}, {"NETWORK/TL_NOD_16.PNG", PROGS .. "/network/ftpc/tl_nod_16.png"}, {"SETTINGS/APP.INI", "common/settings/app.ini"}, + {"SETTINGS/APP_PLUS.INI", "common/settings/app_plus.ini"}, {"SETTINGS/ASSOC.INI", "common/settings/assoc.ini"}, {"SETTINGS/AUTORUN.DAT", "common/settings/AUTORUN.DAT"}, {"SETTINGS/DOCKY.INI", "common/settings/docky.ini"}, @@ -239,7 +240,6 @@ extra_files = { {"kolibrios/media/zsea/zsea.ini", PROGS .. "/media/zsea/zSea.ini"}, {"kolibrios/media/zsea/buttons/buttons.png", PROGS .. "/media/zsea/buttons.png"}, {"kolibrios/res/skins/", "../skins/authors.txt"}, - {"kolibrios/settings/app_plus.ini", "common/settings/app_plus.ini"}, {"kolibrios/res/wallpapers/in_the_wind.png", "common/wallpapers/in_the_wind.png"}, {"kolibrios/res/wallpapers/deink.png", "common/wallpapers/deink.png"}, } diff --git a/data/common/settings/app_plus.ini b/data/common/settings/app_plus.ini index ee48424a55..92d35d4c41 100644 --- a/data/common/settings/app_plus.ini +++ b/data/common/settings/app_plus.ini @@ -12,6 +12,17 @@ uPDF=/sys/lod|*pdf* /kolibrios/media/updf,73 IconEdit=/sys/media/iconedit,98 EasyShot=/sys/easyshot,2 +[3D Tools] +Info3DsPro=/kolibrios/3d/info3ds/info3ds,75 +Info3DsUser=/kolibrios/3d/info3ds/info3ds_u,75 +VoxelEditor=/kolibrios/3d/voxel_editor/voxel_editor,30 + +[3D Demos] +3dsHeart=/kolibrios/3D/3dsheart,78 +Cubeline=/kolibrios/3D/cubeline,78 +M2View=/kolibrios/3D/md2view/md2view,78 +Globe=/kolibrios/3D/TEXTURES1,78 + [Misc] DosBox=/kolibrios/emul/dosbox/dosbox,11 Dicty=/kolibrios/utils/DICTY.KEX,79 @@ -27,14 +38,3 @@ VncViewer=/sys/network/vncc,77 Timer=/sys/demos/timer,119 ASCII View=/sys/asciivju,118 -[3D Tools] -Info3DsPro=/kolibrios/3d/info3ds/info3ds,75 -Info3DsUser=/kolibrios/3d/info3ds/info3ds_u,75 -VoxelEditor=/kolibrios/3d/voxel_editor/voxel_editor,30 - -[3D Demos] -3dsHeart=/kolibrios/3D/3dsheart,78 -Cubeline=/kolibrios/3D/cubeline,78 -M2View=/kolibrios/3D/md2view/md2view,78 -Globe=/kolibrios/3D/TEXTURES1,78 - diff --git a/programs/cmm/app_plus/app_plus.c b/programs/cmm/app_plus/app_plus.c index 24e8d78b3a..c952c7179e 100644 --- a/programs/cmm/app_plus/app_plus.c +++ b/programs/cmm/app_plus/app_plus.c @@ -1,7 +1,3 @@ -#ifndef AUTOBUILD -#include "lang.h--" -#endif - #define MEMSIZE 4096*20 #include "..\lib\strings.h" #include "..\lib\mem.h" @@ -12,55 +8,68 @@ #include "..\lib\patterns\restart_process.h" #include "..\lib\added_sysdir.c" +#ifndef AUTOBUILD +#include "lang.h--" +#endif + +//===================================================// +// // +// DATA // +// // +//===================================================// + +proc_info Form; +#define CONX 30 //content X pos char default_dir[] = "/rd/1"; od_filter filter2 = {"",0}; -proc_info Form; - dword scr = FROM "scr.raw_8bit"; dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000, 0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C}; #define BTN_MANUAL_SEARCH 10 +#define BTN_OPEN_ANYWAY 11 -#define APP_PLUS_INI_PATH "/kolibrios/settings/app_plus.ini" +#define APP_PLUS_INI_PATH "/sys/settings/app_plus.ini" -#define APP_PLUS_INI_NOT_EXISTS "'APP+\n/kolibrios/settings/app_plus.ini does not exists.\nProgram terminated.' -tE" +//===================================================// +// // +// TRANSLATIONS // +// // +//===================================================// -#define WINDOW_TITLE_TEXT "Error" -#define CONTENT_HEADER_TEXT "/KOLIBRIOS/ IS NOT MOUNTED" -#define DESCRIPTION_TEXT "Try to find it manually. It should look +#ifdef LANG_RUS +?define WINDOW_TITLE_TEXT "Внимание! Это важно." +?define CONTENT_HEADER_TEXT "ПАПКА /KOLIBRIOS/ НЕ НАЙДЕНА" +?define DESCRIPTION_TEXT "Попробуйте найти ее самостоятельно. +Содержимое икомой папки показано на +картинке справа. В случае неверно +выбранной папки требуется выполнить +перезагрузку ПК и попробовать снова." +?define MANUALLY_BUTTON_TEXT "Найти /kolibrios/..." +?define OPEN_ANYWAY_BUTTON_TEXT "Запустить APP+ (некоторые программы будут недоступны)" +#else +?define WINDOW_TITLE_TEXT "Warning! It's important." +?define CONTENT_HEADER_TEXT "/KOLIBRIOS/ IS NOT MOUNTED" +?define DESCRIPTION_TEXT "Try to find it manually. It should look like image on the right. Note: this action can be done only once per 1 session of the OS running. If you will choose the wrong folder then you need to reboot system to try again." -#define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..." +?define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..." +?define OPEN_ANYWAY_BUTTON_TEXT "Open APP+ anyway (some apps will be unavailable)" +#endif - -void CheckKosMounted() -{ - if (dir_exists("/kolibrios")) - { - if (file_exists(APP_PLUS_INI_PATH)) - RunProgram("syspanel", APP_PLUS_INI_PATH); - else - notify(APP_PLUS_INI_NOT_EXISTS); - ExitProcess(); - } -} - -void WaitAutosearch() -{ - while (CheckProcessExists("SEARCHAP")) pause(2); -} +//===================================================// +// // +// CODE // +// // +//===================================================// void main() { - word id; - - CheckKosMounted(); WaitAutosearch(); CheckKosMounted(); @@ -72,13 +81,17 @@ void main() loop() switch(WaitEvent()) { case evButton: - id=GetButtonID(); - if (id==1) ExitProcess(); - if (id==BTN_MANUAL_SEARCH) EventManualSearch(); + EventButton(GetButtonID()); break; case evKey: GetKeys(); - if (key_scancode == SCAN_CODE_ENTER) EventManualSearch(); + if (key_scancode == SCAN_CODE_ENTER) { + EventButton(active_button_id); + } + else if (key_scancode == SCAN_CODE_TAB) { + active_button_id = active_button_id-10^1 + 10; + DrawButtons(); + } break; case evReDraw: @@ -89,21 +102,47 @@ void main() void draw_window() { incn y; - dword x=30; y.n=0; system.color.get(); - DefineAndDrawWindow(screen.width-570/2, 100, 570, 280+skin_height, 0x34, system.color.work, WINDOW_TITLE_TEXT,0); + DefineAndDrawWindow(screen.width-570/2, 100, 570, 300+skin_height, 0x34, system.color.work, WINDOW_TITLE_TEXT,0); GetProcessInfo(#Form, SelfInfo); - WriteTextB(x+2,y.inc(20)+2,0x81,MixColors(system.color.work, 0xB92234,220),CONTENT_HEADER_TEXT); - WriteTextB(x,y.n,0x81,0xB92234,CONTENT_HEADER_TEXT); - - WriteTextLines(x,y.inc(50),0x90,system.color.work_text,DESCRIPTION_TEXT,20); + WriteTextB(CONX+2,y.inc(20)+2,0x81,MixColors(system.color.work, 0xB92234,220),CONTENT_HEADER_TEXT); + WriteTextB(CONX,y.n,0x81,0xB92234,CONTENT_HEADER_TEXT); PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal); DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph); - DrawStandartCaptButton(x, Form.cheight-66, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT); + + WriteTextLines(CONX,y.inc(50),0x90,system.color.work_text,DESCRIPTION_TEXT,20); + + DrawButtons(); } +void DrawButtons() +{ + DrawStandartCaptButton(CONX, Form.cheight-80, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT); + DrawStandartCaptButton(CONX, Form.cheight-42, BTN_OPEN_ANYWAY, OPEN_ANYWAY_BUTTON_TEXT); +} + +void CheckKosMounted() +{ + if (dir_exists("/kolibrios")) + { + if (file_exists(APP_PLUS_INI_PATH)) EventOpenApp(); + ExitProcess(); + } +} + +void WaitAutosearch() +{ + while (CheckProcessExists("SEARCHAP")) pause(2); +} + +//===================================================// +// // +// EVENTS // +// // +//===================================================// + void EventManualSearch() { OpenDialog_start stdcall (#o_dialog); @@ -112,5 +151,17 @@ void EventManualSearch() CheckKosMounted(); } +void EventOpenApp() +{ + RunProgram("syspanel", APP_PLUS_INI_PATH); +} + +void EventButton(dword id) +{ + if (id==CLOSE_BTN) ExitProcess(); + else if (id==BTN_MANUAL_SEARCH) EventManualSearch(); + else if (id==BTN_OPEN_ANYWAY) { EventOpenApp(); ExitProcess(); } +} + stop: diff --git a/programs/system/cpu/trunk/cpu.asm b/programs/system/cpu/trunk/cpu.asm index d22f9285a2..f04baa4da7 100644 --- a/programs/system/cpu/trunk/cpu.asm +++ b/programs/system/cpu/trunk/cpu.asm @@ -59,7 +59,7 @@ err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i init_checkboxes2 check1,check1_end mcall 48,3,sc,40 edit_boxes_set_sys_color edit1,edit1_end,sc ;set color - check_boxes_set_sys_color2 check1,check1_end,sc ;set color + ;check_boxes_set_sys_color2 check1,check1_end,sc ;set color ;------------------------------------------------------------------------------ align 4 ;main loop when process name isn't edited. @@ -620,7 +620,7 @@ aCheck_box_mouse db 'check_box_mouse2',0 ;aVersion_op db 'version_op',0 ;------------------------------------------------------------------------------ align 4 -check1 check_box2 (10 shl 16)+11,(383 shl 16)+11,6, 0x80AABBCC,0,0,check_text, ch_flag_bottom ;ch_flag_en +check1 check_box2 (10 shl 16)+12,(383 shl 16)+12,6, 0x80D6DEE7,0x4C5258,0,check_text, ch_flag_middle ;ch_flag_en check1_end: edit1 edit_box 350,95,381,0xffffff,0x6f9480,0,0xAABBCC,0,start_application_c,\ start_application,mouse_dd,ed_focus,start_application_e,start_application_e