From 38136638995a1cc962a2b57ee95c73b15206e610 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 29 Dec 2021 23:09:18 +0000 Subject: [PATCH] appearance: final version! Now the selected value is restored after program reopen git-svn-id: svn://kolibrios.org@9524 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/appearance/appearance.c | 155 ++++++++++++++------------ programs/cmm/appearance/const.h | 38 ++++++- programs/cmm/eolite/include/sorting.h | 4 +- skins/maxcodehack/blacky/Tupfile.lua | 4 +- skins/maxcodehack/blacky/default.asm | 4 +- skins/maxcodehack/blacky/default.dtp | Bin 40 -> 0 bytes 6 files changed, 126 insertions(+), 79 deletions(-) delete mode 100644 skins/maxcodehack/blacky/default.dtp diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index 95eed77e1a..2e95788e7f 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -1,5 +1,4 @@ //11.03.12 - start! -//TODO: select current value at startap #define MEMSIZE 1024*70 #include "../lib/mem.h" @@ -16,6 +15,8 @@ #include "../lib/patterns/simple_open_dialog.h" #include "../lib/patterns/restart_process.h" +dword fmas; + #include "ui_elements_preview.h" #include "const.h" @@ -25,7 +26,7 @@ // // //===================================================// -int active_skin, active_wallpaper, active_screensaver; +int active_skin=-1, active_wallpaper=-1, active_screensaver=-1; checkbox update_docky = { T_UPDATE_DOCK, false }; @@ -37,6 +38,7 @@ char ss_available[200]; collection list; + //===================================================// // // // CODE // @@ -178,91 +180,95 @@ void draw_timeout() WriteTextWithBg(RIGHTx, PANEL_H, 0xD0, sc.work_text, #param, sc.work); } -bool strreqi(dword _left, _right) +void add_filesnames_into_the_list() { - return strcmp(_left+strrchr(_left,'.'), _right); + int j; + for (j=0; jselect_list.visible) select_list.first=select_list.cur_y; + if (select_list.cur_y>SL_VISIBLE) { + select_list.first = -SL_VISIBLE/2 + select_list.cur_y; + } select_list.CheckDoesValuesOkey(); if (LIST_W) draw_window(); } -void Sort_by_Name(int a, b) // for the first call: a = 0, b = sizeof(mas) - 1 -{ - int j; - int isn = a; - if (a >= b) return; - for (j = a; j <= b; j++) { - if (strcmpi(io.dir.position(files_mas[j]), io.dir.position(files_mas[b]))<=0) { - files_mas[isn] >< files_mas[j]; - isn++; - } - } - Sort_by_Name(a, isn-2); - Sort_by_Name(isn, b); -} - void SelectList_DrawLine(dword i) { int draw_y = i*SELECT_LIST_ITEMH+PANEL_H; int i_abs = select_list.first + i; dword text_color = 0xFFFfff; dword bg_color = 0x000000; - char filename_buf[4096]; + char filename_buf[PATHLEN]; char* filename = #filename_buf; strcpy(filename, list.get(i_abs)); @@ -294,28 +300,20 @@ void SelectList_DrawLine(dword i) WriteText(select_list.x+12,draw_y+select_list.text_y,select_list.font_type,bg_color, filename); } -void SelectList_LineChanged() -{ - EventApply(); -} -dword GetRealKolibriosPath() -{ - char real_kolibrios_path[4096]; - if (!dir_exists("/kolibrios")) return 0; - SetCurDir("/kolibrios"); - GetCurDir(#real_kolibrios_path, sizeof(real_kolibrios_path)); - return #real_kolibrios_path; -} void GetIniSettings() { - ini.section = "screensaver"; - ss_timeout.position = ini.GetInt("timeout", 10) - 1; - ini.GetString("available", #ss_available, sizeof(ss_available), 0); ini.section = "style"; ini.GetString("default_skin", #default_skin, PATHLEN, 0); ini.GetString("default_wallp", #default_wallp, PATHLEN, 0); + ini.GetString("skin", #previous_skin, PATHLEN, 0); + ini.GetString("bg_param", #previous_wallp, PATHLEN, 0); + + ini.section = "screensaver"; + ss_timeout.position = ini.GetInt("timeout", 10) - 1; + ini.GetString("available", #ss_available, sizeof(ss_available), 0); + ini.GetString("program", #previous_ss, PATHLEN, 0); } //===================================================// @@ -326,7 +324,7 @@ void GetIniSettings() void EventTabSkinsClick() { - miniprintf(#folder_path, "%s/res/skins", GetRealKolibriosPath()); + miniprintf(#folder_path, "%s/res/skins", get_real_kolibrios_path()); Open_Dir(); } @@ -335,7 +333,7 @@ void EventTabWallpappersClick() if (opendir_path) { strcpy(#folder_path, #opendir_path); } else { - miniprintf(#folder_path, "%s/res/wallpapers", GetRealKolibriosPath()); + miniprintf(#folder_path, "%s/res/wallpapers", get_real_kolibrios_path()); } Open_Dir(); } @@ -359,6 +357,13 @@ void EventTabScreensaverClick() select_list.count++; } while (j); + if (active_screensaver == -1) && (ESBYTE[#previous_ss]) { + for (j=0; j= b) return; + for (j = a; j <= b; j++) { + if (strcmpi(io.dir.position(ESDWORD[j*4+fmas]), io.dir.position(ESDWORD[b*4+fmas]))<=0) { + ESDWORD[isn*4+fmas] >< ESDWORD[j*4+fmas]; + isn++; + } + } + sort_by_name(a, isn-2); + sort_by_name(isn, b); +} + +dword get_real_kolibrios_path() +{ + char real_kolibrios_path[256]; + if (!dir_exists("/kolibrios")) return 0; + SetCurDir("/kolibrios"); + GetCurDir(#real_kolibrios_path, sizeof(real_kolibrios_path)); + return #real_kolibrios_path; +} + +void SelectList_LineChanged() +{ + EventApply(); +} \ No newline at end of file diff --git a/programs/cmm/eolite/include/sorting.h b/programs/cmm/eolite/include/sorting.h index 4a6c4981f5..12391dac46 100644 --- a/programs/cmm/eolite/include/sorting.h +++ b/programs/cmm/eolite/include/sorting.h @@ -1,6 +1,6 @@ void Sort_by_Size(int a, b) // для первого вызова: a = 0, b = <элементов в массиве> - 1 -{ +{ int j; int iss = a; int size1, size2; @@ -16,7 +16,7 @@ void Sort_by_Size(int a, b) // void Sort_by_Name(int a, b) // для первого вызова: a = 0, b = <элементов в массиве> - 1 -{ +{ int j; int isn = a; dword name2 = items.get(b)*304 + buf+72; diff --git a/skins/maxcodehack/blacky/Tupfile.lua b/skins/maxcodehack/blacky/Tupfile.lua index 2c3dcbdcb6..6a3142c4a6 100755 --- a/skins/maxcodehack/blacky/Tupfile.lua +++ b/skins/maxcodehack/blacky/Tupfile.lua @@ -1,2 +1,4 @@ if tup.getconfig("NO_FASM") ~= "" then return end -tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Blacky.skn") +tup.rule("default.dtp.asm", 'fasm "%f" "%o"', "default.dtp") +tup.rule({"default.asm", extra_inputs = {"default.dtp"}}, 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Blacky.skn") + diff --git a/skins/maxcodehack/blacky/default.asm b/skins/maxcodehack/blacky/default.asm index bd276c5fd8..34a824f958 100755 --- a/skins/maxcodehack/blacky/default.asm +++ b/skins/maxcodehack/blacky/default.asm @@ -5,10 +5,10 @@ SKIN_PARAMS \ margins = [6:5:65:3],\ ; margins [left:top:right:bottom] colors active = [binner=0x626262:\ ; border inner bouter=0x010812:\ ; border outer - bframe=0x626262],\ ; border middle + bframe=0x1E1E1E],\ ; border middle colors inactive = [binner=0x626262:\ ; border inner bouter=0x010812:\ ; border outer - bframe=0x626262],\ ; border middle + bframe=0x1E1E1E],\ ; border middle dtp = 'default.dtp' ; dtp colors SKIN_BUTTONS \ diff --git a/skins/maxcodehack/blacky/default.dtp b/skins/maxcodehack/blacky/default.dtp deleted file mode 100644 index 47c651d55678c8a187e57bfea1e3f826f5411daf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40 tcmZ3rY8Au(|Nj{R0s