2013-10-24 00:05:17 +02:00
|
|
|
|
//11.03.12 - start!
|
2016-02-13 12:00:14 +01:00
|
|
|
|
//ver 2.0
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
?include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-10-24 00:05:17 +02:00
|
|
|
|
#define MEMSIZE 0xFE800
|
|
|
|
|
#include "..\lib\mem.h"
|
|
|
|
|
#include "..\lib\strings.h"
|
2015-08-02 21:37:34 +02:00
|
|
|
|
#include "..\lib\io.h"
|
2013-10-24 00:05:17 +02:00
|
|
|
|
#include "..\lib\list_box.h"
|
2016-02-13 12:00:14 +01:00
|
|
|
|
#include "..\lib\menu.h"
|
2015-03-05 21:55:28 +01:00
|
|
|
|
#include "..\lib\gui.h"
|
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
2016-11-02 13:19:15 +01:00
|
|
|
|
#include "..\lib\patterns\select_list.h"
|
2013-10-24 23:45:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
|
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// DATA //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
|
|
|
|
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#ifdef LANG_RUS
|
2016-02-13 12:00:14 +01:00
|
|
|
|
?define WINDOW_HEADER "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ன<EFBFBD><EFBFBD> <20><><EFBFBD>ଫ<EFBFBD><E0ACAB><EFBFBD><EFBFBD>"
|
2016-02-20 14:06:19 +01:00
|
|
|
|
?define T_SKINS "<EFBFBD>⨫<EFBFBD> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
?define T_WALLPAPERS "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#else
|
|
|
|
|
?define WINDOW_HEADER "Appearance"
|
2016-02-20 14:06:19 +01:00
|
|
|
|
?define T_SKINS "Skins"
|
|
|
|
|
?define T_WALLPAPERS "Wallpappers"
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#endif
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
#define PANEL_H 40
|
2018-04-11 19:46:08 +02:00
|
|
|
|
#define LP 10 //LIST_PADDING
|
2015-08-22 19:38:33 +02:00
|
|
|
|
#define SKINS_STANDART_PATH "/kolibrios/res/skins"
|
2014-04-23 18:30:49 +02:00
|
|
|
|
#define WALP_STANDART_PATH "/kolibrios/res/wallpapers"
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2016-02-20 14:06:19 +01:00
|
|
|
|
signed int active_skin=-1, active_wallpaper=-1;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
enum { SKINS=2, WALLPAPERS };
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
char folder_path[4096];
|
|
|
|
|
char cur_file_path[4096];
|
|
|
|
|
char temp_filename[4096];
|
2016-01-26 00:13:50 +01:00
|
|
|
|
int files_mas[400];
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
int cur;
|
|
|
|
|
|
|
|
|
|
proc_info Form;
|
|
|
|
|
|
2018-04-11 19:46:08 +02:00
|
|
|
|
_tabs tabs = { LP, LP, NULL, NULL, SKINS };
|
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// CODE //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
|
{
|
2015-08-10 09:55:50 +02:00
|
|
|
|
int id, mouse_clicked;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2013-12-26 23:51:43 +01:00
|
|
|
|
SetEventMask(0x27);
|
2015-07-29 22:43:05 +02:00
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
EventTabClick(SKINS);
|
2016-01-26 00:13:50 +01:00
|
|
|
|
loop() switch(WaitEvent())
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
|
|
|
|
case evMouse:
|
2013-10-24 23:45:17 +02:00
|
|
|
|
if (!CheckActiveProcess(Form.ID)) break;
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_ProcessMouse();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
|
|
|
|
|
if (mouse.down)&&(mouse.pkm) {
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.ProcessMouse(mouse.x, mouse.y);
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_Draw();
|
2016-12-04 17:50:34 +01:00
|
|
|
|
menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 185, "Open file Enter\nDelete Del", 10);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evButton:
|
|
|
|
|
id=GetButtonID();
|
|
|
|
|
if (id==1) ExitProcess();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
if (id==SKINS) EventTabClick(SKINS);
|
|
|
|
|
if (id==WALLPAPERS) EventTabClick(WALLPAPERS);
|
2013-10-24 00:05:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evKey:
|
2015-08-10 12:47:21 +02:00
|
|
|
|
GetKeys();
|
2016-11-02 13:19:15 +01:00
|
|
|
|
if (select_list.ProcessKey(key_scancode)) EventApply();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
|
2018-04-11 19:46:08 +02:00
|
|
|
|
if (key_scancode==SCAN_CODE_TAB)
|
|
|
|
|
if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS);
|
|
|
|
|
else EventTabClick(SKINS);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
|
2016-11-02 13:19:15 +01:00
|
|
|
|
for (id=select_list.cur_y+1; id<select_list.count; id++)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2016-02-13 12:00:14 +01:00
|
|
|
|
strcpy(#temp_filename, io.dir.position(files_mas[id]));
|
|
|
|
|
if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32)
|
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.cur_y = id - 1;
|
|
|
|
|
select_list.KeyDown();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
EventApply();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2015-08-04 16:36:07 +02:00
|
|
|
|
system.color.get();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
DefineAndDrawWindow(screen.width-400/2,80,400,404+skin_height,0x73,0xE4DFE1,WINDOW_HEADER,0);
|
2013-10-24 00:05:17 +02:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
IF (Form.status_window>=2) break;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
DrawWindowContent();
|
|
|
|
|
if (menu.list.cur_y) {
|
|
|
|
|
if (menu.list.cur_y == 10) EventOpenFile();
|
|
|
|
|
if (menu.list.cur_y == 11) EventDeleteFile();
|
|
|
|
|
menu.list.cur_y = 0;
|
|
|
|
|
};
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void DrawWindowContent()
|
|
|
|
|
{
|
|
|
|
|
int id;
|
2018-04-11 19:46:08 +02:00
|
|
|
|
|
|
|
|
|
DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, system.color.work);
|
|
|
|
|
|
|
|
|
|
tabs.w = Form.cwidth-LP-LP;
|
|
|
|
|
tabs.h = Form.cheight-LP-LP;
|
|
|
|
|
tabs.draw_wrapper();
|
|
|
|
|
|
2018-04-11 20:32:00 +02:00
|
|
|
|
tabs.draw_button(tabs.x+TAB_PADDING, SKINS, T_SKINS);
|
|
|
|
|
tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS);
|
2018-04-11 19:46:08 +02:00
|
|
|
|
|
2016-11-02 13:19:15 +01:00
|
|
|
|
id = select_list.cur_y;
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_Init(
|
2018-04-11 19:46:08 +02:00
|
|
|
|
tabs.x+TAB_PADDING,
|
|
|
|
|
tabs.y+TAB_HEIGHT+TAB_PADDING,
|
|
|
|
|
tabs.w - TAB_PADDING - TAB_PADDING - scroll1.size_x,
|
|
|
|
|
tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT,
|
2016-11-02 15:30:45 +01:00
|
|
|
|
false
|
|
|
|
|
);
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.cur_y = id;
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_Draw();
|
2016-11-03 13:41:15 +01:00
|
|
|
|
SelectList_DrawBorder();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void Open_Dir()
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2016-02-13 12:00:14 +01:00
|
|
|
|
int j;
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.count = 0;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
if(io.dir.buffer)free(io.dir.buffer);
|
|
|
|
|
io.dir.load(#folder_path,DIR_ONLYREAL);
|
|
|
|
|
for (j=0; j<io.dir.count; j++)
|
2013-12-26 23:51:43 +01:00
|
|
|
|
{
|
2016-02-13 12:00:14 +01:00
|
|
|
|
strcpy(#temp_filename, io.dir.position(j));
|
|
|
|
|
strlwr(#temp_filename);
|
2016-02-20 14:06:19 +01:00
|
|
|
|
if (tabs.active_tab==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
|
|
|
|
|
if (tabs.active_tab==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue;
|
2016-11-02 13:19:15 +01:00
|
|
|
|
cur = select_list.count;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
files_mas[cur]=j;
|
2016-11-02 13:19:15 +01:00
|
|
|
|
if (!strcmpi("default.skn",#temp_filename)) files_mas[0]><files_mas[select_list.count];
|
|
|
|
|
select_list.count++;
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
|
void SelectList_DrawLine(dword i)
|
2016-02-13 12:00:14 +01:00
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
int yyy, list_last;
|
|
|
|
|
|
|
|
|
|
cur = select_list.first + i;
|
|
|
|
|
strcpy(#temp_filename, io.dir.position(files_mas[cur]));
|
|
|
|
|
temp_filename[strlen(#temp_filename)-4] = 0;
|
|
|
|
|
yyy = i*select_list.item_h+select_list.y;
|
|
|
|
|
|
|
|
|
|
if (select_list.cur_y-select_list.first==i)
|
|
|
|
|
{
|
|
|
|
|
DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button);
|
|
|
|
|
WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, #temp_filename);
|
|
|
|
|
}
|
|
|
|
|
else
|
2013-12-26 23:51:43 +01:00
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff);
|
|
|
|
|
WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, #temp_filename);
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-02 15:30:45 +01:00
|
|
|
|
void SelectList_LineChanged()
|
|
|
|
|
{
|
|
|
|
|
EventApply();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// EVENTS //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void EventTabClick(int N)
|
2013-10-24 23:45:17 +02:00
|
|
|
|
{
|
2016-02-20 14:06:19 +01:00
|
|
|
|
tabs.click(N);
|
|
|
|
|
if (tabs.active_tab == SKINS)
|
2016-02-13 12:00:14 +01:00
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
active_wallpaper = select_list.cur_y;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
strcpy(#folder_path, SKINS_STANDART_PATH);
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.ClearList();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
Open_Dir();
|
2016-11-02 13:19:15 +01:00
|
|
|
|
if (!select_list.count) notify("'No skins were found' -E");
|
|
|
|
|
select_list.cur_y = active_skin;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2016-02-20 14:06:19 +01:00
|
|
|
|
if (tabs.active_tab == WALLPAPERS)
|
2016-02-13 12:00:14 +01:00
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
active_skin = select_list.cur_y;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
strcpy(#folder_path, WALP_STANDART_PATH);
|
2016-11-02 13:19:15 +01:00
|
|
|
|
select_list.ClearList();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
Open_Dir();
|
2016-11-02 13:19:15 +01:00
|
|
|
|
if (!select_list.count) notify("'No wallpapers were found' -E");
|
|
|
|
|
select_list.cur_y = active_wallpaper;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2016-11-02 13:19:15 +01:00
|
|
|
|
if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey();
|
|
|
|
|
if (select_list.w) DrawWindowContent();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 23:45:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void EventDeleteFile()
|
|
|
|
|
{
|
|
|
|
|
io.del(#cur_file_path);
|
|
|
|
|
Open_Dir();
|
|
|
|
|
EventApply();
|
|
|
|
|
}
|
2013-10-24 23:45:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void EventApply()
|
|
|
|
|
{
|
2016-02-20 14:06:19 +01:00
|
|
|
|
if (tabs.active_tab==SKINS)
|
2016-02-13 12:00:14 +01:00
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
cur = select_list.cur_y;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
|
|
|
|
SetSystemSkin(#cur_file_path);
|
|
|
|
|
}
|
2016-02-20 14:06:19 +01:00
|
|
|
|
if (tabs.active_tab==WALLPAPERS)
|
2016-02-13 12:00:14 +01:00
|
|
|
|
{
|
2016-11-02 13:19:15 +01:00
|
|
|
|
cur = select_list.cur_y;
|
2016-02-13 12:00:14 +01:00
|
|
|
|
sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
|
|
|
|
RunProgram("/sys/media/kiv", #cur_file_path);
|
2016-11-02 15:30:45 +01:00
|
|
|
|
SelectList_Draw();
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 23:45:17 +02:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2016-02-13 12:00:14 +01:00
|
|
|
|
void EventOpenFile()
|
|
|
|
|
{
|
2016-02-20 14:06:19 +01:00
|
|
|
|
if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path);
|
|
|
|
|
if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path);
|
2016-02-13 12:00:14 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
stop:
|