appearance: WiP of adding screensaver tab

various small changes

git-svn-id: svn://kolibrios.org@9453 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-12-21 17:22:15 +00:00
parent f1469998c7
commit bcdd96a753
13 changed files with 117 additions and 104 deletions

View File

@ -440,9 +440,6 @@ tup.append_table(img_files, {
{"3D/RAY", PROGS .. "/demos/ray/ray"},
{"3D/VIEW3DS", PROGS .. "/demos/view3ds/view3ds"},
{"DEMOS/BCDCLK", PROGS .. "/demos/bcdclk/trunk/bcdclk"},
{"DEMOS/CIRCLE", PROGS .. "/develop/examples/circle/trunk/circle"},
{"DEMOS/COLORREF", PROGS .. "/demos/colorref/trunk/colorref"},
{"DEMOS/CSLIDE", PROGS .. "/demos/cslide/trunk/cslide"},
{"DEMOS/EYES", PROGS .. "/demos/eyes/trunk/eyes"},
{"DEMOS/FIREWORK", PROGS .. "/demos/firework/trunk/firework"},
{"DEMOS/MOVBACK", PROGS .. "/demos/movback/trunk/movback"},
@ -465,7 +462,10 @@ tup.append_table(img_files, {
{"DEVELOP/KEYASCII", PROGS .. "/develop/keyascii/trunk/keyascii"},
{"DEVELOP/MTDBG", PROGS .. "/develop/mtdbg/mtdbg"},
{"DEVELOP/SCANCODE", PROGS .. "/develop/scancode/trunk/scancode"},
{"DEVELOP/EXAMPLES/CIRCLE", PROGS .. "/develop/examples/circle/trunk/circle"},
{"DEVELOP/EXAMPLES/COLORREF", PROGS .. "/demos/colorref/trunk/colorref"},
{"DEVELOP/EXAMPLES/CONGET", PROGS .. "/develop/libraries/console_coff/examples/test_gets"},
{"DEVELOP/EXAMPLES/CSLIDE", PROGS .. "/demos/cslide/trunk/cslide"},
{"DEVELOP/EXAMPLES/THREAD", PROGS .. "/develop/examples/thread/trunk/thread"},
{"DEVELOP/EXAMPLES/USE_MB", PROGS .. "/demos/use_mb/use_mb"},
{"File Managers/KFAR", PROGS .. "/fs/kfar/trunk/kfar"},

View File

@ -17,6 +17,7 @@ PCI=on
[screensaver]
timeout=10 ;in minutes
program=/sys/demos/spiral
available=3d/crownscr;demos/web;demos/zeroline;demos/spiral
[style]
buttons_gradient=1

View File

@ -15,9 +15,7 @@
53 Run |run
04 Shut down |end
#1 **** DEMOS
16 Circle |demos/circle
16 Fractal |demos/tinyfrac
16 Color demo |demos/colorref
16 Eyes |demos/eyes
16 Tube |demos/tube
16 Plasma |demos/plasma
@ -50,6 +48,7 @@
11 Fplay Video * |/kolibrios/media/fplay
#5 **** DEV
54 Flat Assembler |develop/fasm
03 Example.asm |example.asm
49 Debugger |develop/mtdbg
13 Debug Board |develop/board
09 KPack Archiver |kpack

View File

@ -15,9 +15,7 @@
53 ‡ ¯ã᪠¯à®£à ¬¬ë |run
04 ‡ ¢¥à襭¨¥ à ¡®âë |end
#1 **** 2D „¥¬ª¨
16 Šà㦮ª |demos/circle
16 ”ࠪ⠫ Œ ­¤¥«ì¡à®â  |demos/tinyfrac
16 –¢¥â  |demos/colorref
16 ƒ« §  |demos/eyes
16 ’àã¡  |demos/tube
16 Plasma |demos/plasma
@ -50,6 +48,7 @@
11 ‚¨¤¥®¯«¥¥à Fplay * |/kolibrios/media/fplay
#5 **** <20> §à ¡®âª 
54 Flat Assembler |develop/fasm
03 Example.asm |example.asm
09 “¯ ª®¢é¨ª KPack |kpack
49 Žâ« ¤ç¨ª |develop/mtdbg
13 „®áª  ®â« ¤ª¨ |develop/board

View File

@ -1,7 +1,6 @@
#define MEMSIZE 4096*20
#include "..\lib\strings.h"
#include "..\lib\mem.h"
#include "..\lib\io.h"
#include "..\lib\gui.h"
#include "..\lib\obj\proc_lib.h"
#include "..\lib\patterns\simple_open_dialog.h"

View File

@ -14,6 +14,7 @@
#include "../lib/patterns/select_list.h"
#include "../lib/patterns/simple_open_dialog.h"
#include "../lib/patterns/restart_process.h"
#include "ui_elements_preview.h"
@ -25,35 +26,39 @@
#ifdef LANG_RUS
?define WINDOW_HEADER "<EFBFBD> áâனª¨ ®ä®à¬«¥­¨ï"
?define T_SKINS " ‘â¨«ì ®ª®­"
?define T_WALLPAPERS " Ž¡®¨"
?define T_SELECT_FOLDER "‚ë¡à âì ¯ ¯ªã"
?define MENU_LIST "Žâªàëâì ä ©« |Enter\n“¤ «¨âì ä ©« |Del"
?define T_PICTURE_MODE " <20>®«®¦¥­¨¥ ª à⨭ª¨ "
?define T_CHECKBOX_STRETCH "<EFBFBD> áâï­ãâì"
?define T_CHECKBOX_TILED "‡ ¬®áâ¨âì"
?define T_UPDATE_DOCK "Ž¡­®¢«ïâì Dock-¯ ­¥«ì"
char t_skins[] = " ‘â¨«ì ®ª®­";
char t_wallpapers[] = " Ž¡®¨";
char t_screensaver[] = " ‘ªà¨­á¥©¢¥à";
#else
?define WINDOW_HEADER "Appearance"
?define T_SKINS " Skins"
?define T_WALLPAPERS " Wallpapers"
?define T_SELECT_FOLDER "Select folder"
?define MENU_LIST "Open file |Enter\nDelete file |Del"
?define T_PICTURE_MODE " Picture Mode "
?define T_CHECKBOX_STRETCH "Stretch"
?define T_CHECKBOX_TILED "Tiled"
?define T_UPDATE_DOCK "Update Dock"
char t_skins[] = " Skins";
char t_wallpapers[] = " Wallpapers";
char t_screensaver[] = " Screensaver";
#endif
#define PANEL_H 40
#define WIN_W 621
#define PANEL_H 58
#define LP 10 //LIST_PADDING
char skins_folder_path[4096];
char wallp_folder_path[4096];
signed int active_skin=-1, active_wallpaper=-1;
signed int active_skin=-1, active_wallpaper=-1, active_screensaver=-1;
enum {
BASE_TAB_BUTTON_ID=2,
BTN_SELECT_WALLP_FOLDER=10 };
BASE_TAB_BUTTON_ID=3,
BTN_SELECT_WALLP_FOLDER=10,
BTN_TEST_SCREENSAVER };
char folder_path[4096];
char cur_file_path[4096];
@ -61,14 +66,17 @@ char cur_skin_path[4096];
char temp_filename[4096];
int files_mas[400];
_ini ini = { "/sys/settings/system.ini", "style" };
int cur;
proc_info Form;
block skp;
enum {SKINS, WALLPAPERS};
enum {SKINS, WALLPAPERS, SCREENSAVERS};
_tabs tabs = { LP, LP, NULL, BASE_TAB_BUTTON_ID };
_tabs tabs = { -sizeof(t_skins)-sizeof(t_wallpapers)-sizeof(t_screensaver)-3*8+WIN_W
- TAB_PADDING / 2, LP, NULL, BASE_TAB_BUTTON_ID };
checkbox update_docky = { T_UPDATE_DOCK, false };
@ -86,11 +94,11 @@ checkbox optionbox_tiled = { T_CHECKBOX_TILED, false };
void GetRealFolderPathes()
{
char real_skin_path[4096];
char real_kolibrios_path[4096];
SetCurDir("/kolibrios");
GetCurDir(#real_skin_path, sizeof(real_skin_path));
sprintf(#skins_folder_path, "%s/res/skins", #real_skin_path);
sprintf(#wallp_folder_path, "%s/res/wallpapers", #real_skin_path);
GetCurDir(#real_kolibrios_path, sizeof(real_kolibrios_path));
miniprintf(#skins_folder_path, "%s/res/skins", #real_kolibrios_path);
miniprintf(#wallp_folder_path, "%s/res/wallpapers", #real_kolibrios_path);
}
void main()
@ -105,8 +113,9 @@ void main()
o_dialog.type = 2; //select folder
OpenDialog_init stdcall (#o_dialog);
tabs.add(T_SKINS, #EventTabSkinsClick);
tabs.add(T_WALLPAPERS, #EventTabWallpappersClick);
tabs.add(#t_skins, #EventTabSkinsClick);
tabs.add(#t_wallpapers, #EventTabWallpappersClick);
tabs.add(#t_screensaver, #EventTabScreensaverClick);
tabs.draw_active_tab();
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
@ -145,8 +154,14 @@ void main()
GetKeys();
if (select_list.ProcessKey(key_scancode)) EventApply();
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
if (key_scancode==SCAN_CODE_TAB) tabs.click(tabs.active_tab ^ 1);
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
if (key_scancode==SCAN_CODE_TAB) {
id = tabs.active_tab+1;
if(id==3)id=0;
tabs.click(id + tabs.base_id);
draw_window();
break;
}
if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus)
for (id=select_list.cur_y+1; id<select_list.count; id++)
@ -177,7 +192,7 @@ void main()
void draw_window()
{
sc.get();
DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,sc.work,WINDOW_HEADER,0);
DefineAndDrawWindow(screen.width-600/2,80,WIN_W+9,504+skin_height,0x34,sc.work,WINDOW_HEADER,0);
GetProcessInfo(#Form, SelfInfo);
IF (Form.status_window&ROLLED_UP) return;
DrawWindowContent();
@ -186,50 +201,51 @@ void draw_window()
void DrawWindowContent()
{
int id;
int list_w;
sc.get();
if (tabs.active_tab == SKINS) list_w=250; else list_w=350;
tabs.w = Form.cwidth-LP-LP;
//tabs.w = Form.cwidth-LP-LP;
tabs.draw();
draw_icon_16w(tabs.x + TAB_PADDING, 15, 17);
draw_icon_16w(strlen(T_SKINS)*8 + tabs.x + TAB_PADDING + TAB_PADDING, 15, 6);
draw_icon_16w(sizeof(t_skins)-1*8 + TAB_PADDING + TAB_PADDING + tabs.x, 15, 6);
draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_PADDING + TAB_PADDING + TAB_PADDING + tabs.x, 15, 61);
id = select_list.cur_y;
#define LIST_W 280
SelectList_Init(
tabs.x+TAB_PADDING,
tabs.y+TAB_HEIGHT+TAB_PADDING,
list_w,
Form.cheight-LP-LP - TAB_PADDING - TAB_PADDING - TAB_HEIGHT
LP + TAB_PADDING,
PANEL_H,
LIST_W,
Form.cheight-LP-LP - TAB_PADDING - PANEL_H
);
select_list.cur_y = id;
skp.set_size(
select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20,
select_list.y + 30 + 50,
list_w,
LP + TAB_PADDING + LIST_W + TAB_PADDING + 30,
PANEL_H,
WIN_W - 400,
230 //select_list.h - 50 - 50
);
SelectList_Draw();
SelectList_DrawBorder();
//DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, sc.work);
if (tabs.active_tab == SKINS)
{
update_docky.draw(skp.x, select_list.y+15);
DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview ");
DrawUiElementsPreview(skp.x+20, skp.y, skp.h);
DrawFrame(skp.x, PANEL_H+5, skp.w, skp.h, " Components Preview ");
DrawUiElementsPreview(skp.x+20, PANEL_H+5, skp.h);
if (CheckProcessExists("@DOCKY")) update_docky.draw(skp.x, PANEL_H+250);
}
if (tabs.active_tab == WALLPAPERS)
{
skp.x -= TAB_PADDING + 3;
DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER);
DrawFrame(skp.x, select_list.y+50, 180, 80, T_PICTURE_MODE);
optionbox_stretch.draw(skp.x+14, select_list.y+70);
optionbox_tiled.draw(skp.x+14, select_list.y+97);
DrawFrame(skp.x, PANEL_H+5, 180, 80, T_PICTURE_MODE);
optionbox_stretch.draw(skp.x+14, PANEL_H+25);
optionbox_tiled.draw(skp.x+14, PANEL_H+52);
DrawStandartCaptButton(skp.x, PANEL_H+100, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER);
}
if (tabs.active_tab == SCREENSAVERS)
{
DrawStandartCaptButton(skp.x, PANEL_H, BTN_TEST_SCREENSAVER, "Test");
}
}
@ -332,6 +348,12 @@ void EventTabWallpappersClick()
ActivateTab(active_wallpaper);
}
void EventTabScreensaverClick()
{
//strcpy(#folder_path, #wallp_folder_path);
ActivateTab(active_screensaver);
}
void EventDeleteFile()
{
io.del(#cur_file_path);
@ -342,7 +364,8 @@ void EventDeleteFile()
void EventSetNewCurrent()
{
cur = select_list.cur_y;
sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
miniprintf(#cur_file_path,"%s/",#folder_path);
strcat(#cur_file_path, io.dir.position(files_mas[cur]));
}
void EventSelectWallpFolder()
@ -368,7 +391,6 @@ void EventSetWallpMode_Tiled()
EventApply();
}
#include "..\lib\patterns\restart_process.h"
void EventApply()
{
char kivpath[4096+10];
@ -384,9 +406,8 @@ void EventApply()
if (tabs.active_tab==WALLPAPERS)
{
SelectList_Draw();
if (optionbox_stretch.checked) strcpy(#kivpath, "\\S__");
if (optionbox_tiled.checked) strcpy(#kivpath, "\\T__");
strcat(#kivpath, #cur_file_path);
if (optionbox_stretch.checked) miniprintf(#kivpath, "\\S__%s", #cur_file_path);
if (optionbox_tiled.checked) miniprintf(#kivpath, "\\T__%s", #cur_file_path);
RunProgram("/sys/media/kiv", #kivpath);
}
}
@ -406,7 +427,6 @@ void EventOpenFile()
if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path);
}
_ini ini = { "/sys/settings/system.ini", "style" };
void EventExit()
{
if (cur_skin_path) ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path));

View File

@ -11,8 +11,7 @@ edit_box edit_st = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff,
void DrawUiElementsPreview(dword x,y,h)
{
incn y2;
y2.n = y;
spinbox1.draw(x, y2.inc(30));
spinbox1.draw(x, y2.set(y+30));
WriteText(x, y2.inc(30), 0x90, sc.work_text, "C-- Edit");
DrawEditBoxPos(x, y2.inc(20), #edit_cmm);
WriteText(x, y2.inc(35), 0x90, sc.work_text, "Strandard Edit");

View File

@ -1,6 +1,5 @@
#define MEMSIZE 4096*10
#define MEMSIZE 1024*40
#include "../lib/io.h"
#include "../lib/list_box.h"
#include "../lib/gui.h"
#include "../lib/fs.h"

View File

@ -1,6 +1,5 @@
#define MEMSIZE 4096*10
#define MEMSIZE 1024*40
#include "../lib/io.h"
#include "../lib/window.h"
#include "../lib/timers.h"

View File

@ -11,9 +11,9 @@
int base_id;
int active_tab;
char names[640];
int count;
dword events[10];
dword names[10];
int click();
void draw();
@ -33,7 +33,7 @@
}
for (i=0; i<count; i++) {
xx += draw_button(xx + TAB_PADDING, i, i*NAME_SIZE + #names) + TAB_PADDING;
xx += draw_button(xx + TAB_PADDING, i, names[i]) + TAB_PADDING;
}
}
@ -44,7 +44,7 @@
:void _tabs::add(dword text, event)
{
strcpy(count*NAME_SIZE + #names, text);
names[count] = text;
events[count] = event;
count++;
}

View File

@ -1,6 +1,5 @@
#define MEMSIZE 1024*160
#include "../lib/io.h"
#include "../lib/gui.h"
#include "../lib/copyf.h"

View File

@ -8,7 +8,6 @@
#include "../lib/gui.h"
#include "../lib/list_box.h"
#include "../lib/io.h"
#include "../lib/collection.h"
#include "../lib/patterns/restart_process.h"

View File

@ -3,7 +3,7 @@
// autobuild does not create lang.h, but defines LANG_{RUS,ENG} directly
#include "lang.h"
#endif
#include "system/kolibri.h"
#include "system/stdlib.h"
#include "system/string.h"
@ -33,7 +33,7 @@ int main_tecla, hay_tecla;
int SSCS = 0;
int debug=0, scanl=0;
int frame_counter;
int frame_counter;
int target_cycle;
Z80Regs spectrumZ80;
@ -238,32 +238,32 @@ file.p21 = filename;
kol_file_70(&file);
regs->I = buffer[ 0];
regs->HLs.B.l = buffer[ 1];
regs->HLs.B.h = buffer[ 2];
regs->DEs.B.l = buffer[ 3];
regs->DEs.B.h = buffer[ 4];
regs->BCs.B.l = buffer[ 5];
regs->BCs.B.h = buffer[ 6];
regs->AFs.B.l = buffer[ 7];
regs->AFs.B.h = buffer[ 8];
regs->HL.B.l = buffer[ 9];
regs->HL.B.h = buffer[10];
regs->DE.B.l = buffer[11];
regs->DE.B.h = buffer[12];
regs->BC.B.l = buffer[13];
regs->BC.B.h = buffer[14];
regs->IY.B.l = buffer[15];
regs->IY.B.h = buffer[16];
regs->IX.B.l = buffer[17];
regs->IX.B.h = buffer[18];
regs->IFF1 = regs->IFF2 = (buffer[19]&0x04) >>2;
regs->R.W = buffer[20];
regs->AF.B.l = buffer[21];
regs->AF.B.h = buffer[22];
regs->SP.B.l =buffer[23];
regs->SP.B.h =buffer[24];
regs->IM = buffer[25];
regs->I = buffer[ 0];
regs->HLs.B.l = buffer[ 1];
regs->HLs.B.h = buffer[ 2];
regs->DEs.B.l = buffer[ 3];
regs->DEs.B.h = buffer[ 4];
regs->BCs.B.l = buffer[ 5];
regs->BCs.B.h = buffer[ 6];
regs->AFs.B.l = buffer[ 7];
regs->AFs.B.h = buffer[ 8];
regs->HL.B.l = buffer[ 9];
regs->HL.B.h = buffer[10];
regs->DE.B.l = buffer[11];
regs->DE.B.h = buffer[12];
regs->BC.B.l = buffer[13];
regs->BC.B.h = buffer[14];
regs->IY.B.l = buffer[15];
regs->IY.B.h = buffer[16];
regs->IX.B.l = buffer[17];
regs->IX.B.h = buffer[18];
regs->IFF1 = regs->IFF2 = (buffer[19]&0x04) >>2;
regs->R.W = buffer[20];
regs->AF.B.l = buffer[21];
regs->AF.B.h = buffer[22];
regs->SP.B.l =buffer[23];
regs->SP.B.h =buffer[24];
regs->IM = buffer[25];
regs->BorderColor = buffer[26];
file.p00 = 0;
@ -276,9 +276,9 @@ file.p21 = filename;
kol_file_70(&file);
regs->PC.B.l = Z80MemRead(regs->SP.W, regs);
regs->SP.W++;
regs->PC.B.h = Z80MemRead(regs->SP.W, regs);
regs->PC.B.l = Z80MemRead(regs->SP.W, regs);
regs->SP.W++;
regs->PC.B.h = Z80MemRead(regs->SP.W, regs);
regs->SP.W++;
}
@ -316,10 +316,10 @@ buffer[20] = regs->R.W & 0xFF;
buffer[21] = regs->AF.B.l;
buffer[22] = regs->AF.B.h;
sptmpl = Z80MemRead( regs->SP.W-1, regs );
sptmpl = Z80MemRead( regs->SP.W-1, regs );
sptmph = Z80MemRead( regs->SP.W-2, regs );
Z80MemWrite( --(regs->SP.W), regs->PC.B.h, regs);
Z80MemWrite( --(regs->SP.W), regs->PC.B.h, regs);
Z80MemWrite( --(regs->SP.W), regs->PC.B.l, regs);
buffer[23] = regs->SP.B.l;
@ -347,9 +347,9 @@ file.p21 = filename;
kol_file_70(&file);
regs->SP.W += 2;
Z80MemWrite( regs->SP.W-1, sptmpl, regs );
Z80MemWrite( regs->SP.W-2, sptmph, regs );
regs->SP.W += 2;
Z80MemWrite( regs->SP.W-1, sptmpl, regs );
Z80MemWrite( regs->SP.W-2, sptmph, regs );
}
@ -379,7 +379,7 @@ kol_file_70(&file);
void wnd_draw()
{
kol_paint_start();
kol_wnd_define( (screen_w-540)/2, (screen_h-440)/2, 540, 440, 0x34b0b0b0, 0x34b0b0b0, WND_CAPTION);
kol_wnd_define( (screen_w-540)/2, (screen_h-440)/2, 540, 440, 0x74b0b0b0, 0x74b0b0b0, WND_CAPTION);
screen_print(&spectrumZ80);
kol_paint_image((540 - screen_a_w)/2-5,
(440 - screen_a_h-kol_skin_height())/2,
@ -414,9 +414,9 @@ spectrumZ80.RAM = (char*) malloc(64*1024);
memcpy(spectrumZ80.RAM, BIOS48, 16*1024);
Z80Reset( &spectrumZ80, 69888 );
Z80FlagTables();
fila[1][1] = fila[1][2] = fila[2][2] = fila[3][2] = fila[4][2] =
Z80FlagTables();
fila[1][1] = fila[1][2] = fila[2][2] = fila[3][2] = fila[4][2] =
fila[4][1] = fila[3][1] = fila[2][1] = 0xFF;
debug = 0;