2013-10-24 00:05:17 +02:00
|
|
|
|
//11.03.12 - start!
|
|
|
|
|
|
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"
|
2015-03-05 21:55:28 +01:00
|
|
|
|
#include "..\lib\gui.h"
|
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
2013-10-24 23:45:17 +02:00
|
|
|
|
|
|
|
|
|
#ifdef LANG_RUS
|
|
|
|
|
?define WINDOW_HEADER "<EFBFBD><EFBFBD><EFBFBD>ࠢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⥬<><E2A5AC>"
|
2013-12-27 00:36:17 +01:00
|
|
|
|
?define T_SKINS " <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
?define T_WALLPAPERS " <20><><EFBFBD><EFBFBD> ࠡ<>祣<EFBFBD> <20>⮫<EFBFBD>"
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#else
|
|
|
|
|
?define WINDOW_HEADER "Appearance"
|
2013-12-27 00:36:17 +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
|
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
|
unsigned char icons[]= FROM "icons.raw";
|
2013-12-26 23:51:43 +01:00
|
|
|
|
|
2013-10-24 00:05:17 +02:00
|
|
|
|
#define PANEL_H 30
|
2015-08-03 00:22:52 +02:00
|
|
|
|
#define SKINS_STANDART_PATH "/sys/skins"
|
|
|
|
|
//"/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
|
|
|
|
|
|
|
|
|
llist list[2];
|
|
|
|
|
int active;
|
2013-12-26 23:51:43 +01:00
|
|
|
|
enum { WALLPAPERS, SKINS };
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
char folder_path[4096];
|
|
|
|
|
char cur_file_path[4096];
|
|
|
|
|
char temp_filename[4096];
|
|
|
|
|
int files_mas[100];
|
|
|
|
|
|
|
|
|
|
int cur;
|
|
|
|
|
|
|
|
|
|
proc_info Form;
|
|
|
|
|
|
2013-10-24 23:45:17 +02:00
|
|
|
|
scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
void Open_Dir()
|
|
|
|
|
{
|
2015-08-02 21:37:34 +02:00
|
|
|
|
int j;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
list[active].count = 0;
|
2015-08-03 00:22:52 +02:00
|
|
|
|
if(io.dir.buffer)free(io.dir.buffer);
|
2015-08-02 21:40:54 +02:00
|
|
|
|
io.dir.load(#folder_path,DIR_ONLYREAL);
|
2015-08-02 21:37:34 +02:00
|
|
|
|
for (j=0; j<io.dir.count; j++)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2015-08-02 21:40:54 +02:00
|
|
|
|
strcpy(#temp_filename, io.dir.position(j));
|
2013-12-26 23:51:43 +01:00
|
|
|
|
strlwr(#temp_filename);
|
2014-04-23 18:30:49 +02:00
|
|
|
|
if (active==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
|
|
|
|
|
if (active==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
cur = list[active].count;
|
|
|
|
|
files_mas[cur]=j;
|
2014-04-23 18:30:49 +02:00
|
|
|
|
if (!strcmpi("default.skn",#temp_filename)) files_mas[0]><files_mas[list[active].count];
|
2013-10-24 00:05:17 +02:00
|
|
|
|
list[active].count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Draw_List()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2013-12-26 23:51:43 +01:00
|
|
|
|
int yyy;
|
2015-03-25 12:46:22 +01:00
|
|
|
|
int list_last;
|
2015-08-10 14:06:47 +02:00
|
|
|
|
list[SKINS].SetSizes(0, PANEL_H, Form.cwidth-scroll1.size_x-1, Form.cheight-PANEL_H, 20);
|
|
|
|
|
list[WALLPAPERS].SetSizes(0, PANEL_H, Form.cwidth-scroll1.size_x-1, Form.cheight-PANEL_H, 20);
|
2015-03-25 12:46:22 +01:00
|
|
|
|
if (list[active].count > list[active].visible) list_last = list[active].visible; else list_last = list[active].count;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<list_last; i++;)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
|
|
|
|
cur = list[active].first;
|
2015-08-02 21:40:54 +02:00
|
|
|
|
strcpy(#temp_filename, io.dir.position(files_mas[i+cur]));
|
2013-12-26 23:51:43 +01:00
|
|
|
|
temp_filename[strlen(#temp_filename)-4] = 0;
|
|
|
|
|
yyy = i*list[active].line_h+list[active].y;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
if (list[active].current-list[active].first==i)
|
|
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
|
if (system.color.work_button!=system.color.work)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
|
DrawBar(0, yyy, list[active].w, list[active].line_h, system.color.work_button);
|
|
|
|
|
if (i<list[active].count) WriteText(12,yyy+list[active].text_y,0x80,system.color.work_button_text, #temp_filename);
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
|
DrawBar(0, yyy, list[active].w, list[active].line_h, system.color.grab_button);
|
|
|
|
|
if (i<list[active].count) WriteText(12,yyy+list[active].text_y,0x80,system.color.grab_button_text, #temp_filename);
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-12-26 23:51:43 +01:00
|
|
|
|
DrawBar(0,yyy,list[active].w, list[active].line_h, 0xFFFfff);
|
2013-12-27 00:36:17 +01:00
|
|
|
|
WriteText(12,yyy+list[active].text_y,0x80,0, #temp_filename);
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-25 12:46:22 +01:00
|
|
|
|
DrawBar(0,list_last*list[active].line_h+list[active].y, list[active].w, -list_last*list[active].line_h+ list[active].h, 0xFFFfff);
|
2013-10-24 23:45:17 +02:00
|
|
|
|
DrawScroller();
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-26 23:51:43 +01:00
|
|
|
|
void GetFiles()
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2013-12-26 23:51:43 +01:00
|
|
|
|
if (list[SKINS].active)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
|
|
|
|
strcpy(#folder_path, SKINS_STANDART_PATH);
|
|
|
|
|
Open_Dir();
|
2014-04-23 18:30:49 +02:00
|
|
|
|
if (!list[active].count) notify("'No skins were found' -E");
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
2013-12-26 23:51:43 +01:00
|
|
|
|
if (list[WALLPAPERS].active)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
|
|
|
|
strcpy(#folder_path, WALP_STANDART_PATH);
|
|
|
|
|
Open_Dir();
|
2014-04-23 18:30:49 +02:00
|
|
|
|
if (!list[active].count) notify("'No wallpapers were found' -E");
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Apply()
|
|
|
|
|
{
|
2013-12-26 23:51:43 +01:00
|
|
|
|
if (list[SKINS].active)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2013-12-26 23:51:43 +01:00
|
|
|
|
cur = list[SKINS].current;
|
2015-08-03 00:22:52 +02:00
|
|
|
|
sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
2013-10-24 00:05:17 +02:00
|
|
|
|
SetSystemSkin(#cur_file_path);
|
|
|
|
|
}
|
2013-12-26 23:51:43 +01:00
|
|
|
|
if (list[WALLPAPERS].active)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2013-12-26 23:51:43 +01:00
|
|
|
|
cur = list[WALLPAPERS].current;
|
2015-08-03 00:22:52 +02:00
|
|
|
|
sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur]));
|
2013-10-24 00:05:17 +02:00
|
|
|
|
RunProgram("/sys/media/kiv", #cur_file_path);
|
|
|
|
|
Draw_List();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpenFile()
|
|
|
|
|
{
|
2013-12-26 23:51:43 +01:00
|
|
|
|
if (list[SKINS].active) RunProgram("/sys/desktop", #cur_file_path);
|
|
|
|
|
if (list[WALLPAPERS].active) RunProgram("/sys/media/kiv", #cur_file_path);
|
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);
|
2013-10-24 20:26:04 +02:00
|
|
|
|
list[SKINS].current = list[WALLPAPERS].current = -1;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
list[SKINS].first = list[WALLPAPERS].first = 0;
|
2013-12-26 23:51:43 +01:00
|
|
|
|
TabClick(WALLPAPERS);
|
2015-08-10 14:06:47 +02:00
|
|
|
|
list[WALLPAPERS].SetSizes(0, 230, 350, 400-PANEL_H, 18);
|
|
|
|
|
list[SKINS].SetSizes(0, 230, 350, 400-PANEL_H, 18);
|
2013-10-24 00:05:17 +02:00
|
|
|
|
loop()
|
|
|
|
|
{
|
|
|
|
|
switch(WaitEvent())
|
|
|
|
|
{
|
|
|
|
|
case evMouse:
|
2013-10-24 23:45:17 +02:00
|
|
|
|
if (!CheckActiveProcess(Form.ID)) break;
|
2015-08-03 00:22:52 +02:00
|
|
|
|
mouse.get();
|
2013-10-24 23:45:17 +02:00
|
|
|
|
scrollbar_v_mouse (#scroll1);
|
2015-08-03 00:22:52 +02:00
|
|
|
|
if (list[active].first != scroll1.position)
|
2013-10-24 23:45:17 +02:00
|
|
|
|
{
|
|
|
|
|
list[active].first = scroll1.position;
|
|
|
|
|
Draw_List();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-12-26 23:51:43 +01:00
|
|
|
|
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (mouse.vert)
|
2013-12-26 23:51:43 +01:00
|
|
|
|
{
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (list[SKINS].active) && (list[SKINS].MouseScroll(mouse.vert)) Draw_List();
|
|
|
|
|
if (list[WALLPAPERS].active) && (list[WALLPAPERS].MouseScroll(mouse.vert)) Draw_List();
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-03 00:22:52 +02:00
|
|
|
|
if (mouse.up)&&(mouse_clicked)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
2015-08-03 00:22:52 +02:00
|
|
|
|
if (mouse.lkm) &&(list[SKINS].active) && (list[SKINS].ProcessMouse(mouse.x, mouse.y)) Apply();
|
|
|
|
|
if (mouse.lkm) &&(list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessMouse(mouse.x, mouse.y)) Apply();
|
|
|
|
|
mouse_clicked=false;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
}
|
2015-08-03 00:22:52 +02:00
|
|
|
|
else if (mouse.down)&&(mouse.lkm) && (list[SKINS].MouseOver(mouse.x, mouse.y)) mouse_clicked=true;
|
2013-10-24 00:05:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2013-12-26 23:51:43 +01:00
|
|
|
|
|
2013-10-24 00:05:17 +02:00
|
|
|
|
case evButton:
|
|
|
|
|
id=GetButtonID();
|
|
|
|
|
if (id==1) ExitProcess();
|
2013-12-26 23:51:43 +01:00
|
|
|
|
if (id==2) TabClick(WALLPAPERS);
|
|
|
|
|
if (id==3) TabClick(SKINS);
|
2013-10-24 00:05:17 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evKey:
|
2015-08-10 12:47:21 +02:00
|
|
|
|
GetKeys();
|
2015-08-10 09:55:50 +02:00
|
|
|
|
if (list[SKINS].active) && (list[SKINS].ProcessKey(key_scancode)) Apply();
|
|
|
|
|
if (list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessKey(key_scancode)) Apply();
|
|
|
|
|
IF (key_scancode==SCAN_CODE_ENTER) OpenFile();
|
|
|
|
|
if (key_scancode==SCAN_CODE_TAB) if (list[SKINS].active) TabClick(WALLPAPERS); else TabClick(SKINS);
|
|
|
|
|
IF (key_scancode==SCAN_CODE_TAB) //Del
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
|
|
|
|
DeleteFile(#cur_file_path);
|
|
|
|
|
Open_Dir();
|
|
|
|
|
Apply();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2015-08-04 16:36:07 +02:00
|
|
|
|
system.color.get();
|
2013-12-26 23:51:43 +01:00
|
|
|
|
DefineAndDrawWindow(30,80,list[active].w+9,list[active].h+4+GetSkinHeight(),0x73,0xE4DFE1,WINDOW_HEADER,0);
|
2013-10-24 00:05:17 +02:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
IF (Form.status_window>=2) break;
|
|
|
|
|
DrawTabs();
|
|
|
|
|
Draw_List();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-26 23:51:43 +01:00
|
|
|
|
#define BT_PADDING 16
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
2013-12-26 23:51:43 +01:00
|
|
|
|
void DrawTab(dword x,y, but_id, is_active, text)
|
2013-10-24 00:05:17 +02:00
|
|
|
|
{
|
|
|
|
|
dword col_bg, col_text;
|
2013-12-26 23:51:43 +01:00
|
|
|
|
dword w=strlen(text)*6+BT_PADDING, h=21;
|
|
|
|
|
|
|
|
|
|
if (is_active)
|
|
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
|
col_bg=system.color.work_button;
|
|
|
|
|
col_text=system.color.work_button_text;
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
|
col_bg=system.color.work;
|
|
|
|
|
col_text=system.color.work_text;
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
2015-08-04 16:36:07 +02:00
|
|
|
|
DrawRectangle(x,y, w,h, system.color.work_graph);
|
2013-12-26 23:51:43 +01:00
|
|
|
|
DrawCaptButton(x+1,y+1, w-2,h-1, but_id, col_bg, col_text, text);
|
2013-12-27 00:36:17 +01:00
|
|
|
|
_PutImage(x+6,y+4, 16,15, but_id-2*16*15*3+#icons);
|
2013-12-26 23:51:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawTabs()
|
|
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
|
DrawBar(0,0, Form.cwidth, PANEL_H-1, system.color.work);
|
2013-12-26 23:51:43 +01:00
|
|
|
|
DrawTab(10,7, 2, list[WALLPAPERS].active, T_WALLPAPERS);
|
|
|
|
|
DrawTab(strlen(T_WALLPAPERS)*6+BT_PADDING+21,7, 3, list[SKINS].active, T_SKINS);
|
2015-08-04 16:36:07 +02:00
|
|
|
|
DrawBar(0,PANEL_H-2, Form.cwidth, 1, system.color.work_graph);
|
2013-10-24 00:05:17 +02:00
|
|
|
|
DrawBar(0,PANEL_H-1, Form.cwidth, 1, 0xEEEeee);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TabClick(int N)
|
|
|
|
|
{
|
2013-12-26 23:51:43 +01:00
|
|
|
|
if (N==SKINS)
|
|
|
|
|
{
|
|
|
|
|
list[SKINS].active = 1;
|
|
|
|
|
list[WALLPAPERS].active = 0;
|
|
|
|
|
}
|
|
|
|
|
if (N==WALLPAPERS)
|
|
|
|
|
{
|
|
|
|
|
list[SKINS].active = 0;
|
|
|
|
|
list[WALLPAPERS].active = 1;
|
|
|
|
|
}
|
|
|
|
|
active = N;
|
|
|
|
|
GetFiles();
|
2013-10-24 00:05:17 +02:00
|
|
|
|
DrawTabs();
|
|
|
|
|
Draw_List();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 23:45:17 +02:00
|
|
|
|
void DrawScroller()
|
|
|
|
|
{
|
|
|
|
|
scroll1.bckg_col = 0xBBBbbb;
|
2015-08-04 16:36:07 +02:00
|
|
|
|
scroll1.frnt_col = system.color.work;
|
|
|
|
|
scroll1.line_col = system.color.work_graph;
|
2013-10-24 23:45:17 +02:00
|
|
|
|
|
|
|
|
|
scroll1.max_area = list[active].count;
|
|
|
|
|
scroll1.cur_area = list[active].visible;
|
|
|
|
|
scroll1.position = list[active].first;
|
|
|
|
|
|
|
|
|
|
scroll1.all_redraw=1;
|
|
|
|
|
scroll1.start_x = list[active].x + list[active].w;
|
|
|
|
|
scroll1.start_y = list[active].y-2;
|
|
|
|
|
scroll1.size_y = list[active].h+2;
|
|
|
|
|
|
|
|
|
|
scrollbar_v_draw(#scroll1);
|
|
|
|
|
}
|
2013-10-24 00:05:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stop:
|